thanks for the comments . Still am not corrected my problem. but learn the working of volatile and used it .
My requirement
i have
main.c ,
adc.c and
interrupt.c source files with corressponding header file where the declared the necessary variables and functions .
in main.c file call a function named
read_adc();
C:
void main()
{
ADC_FDB= ADC_read();
LINE1;
sprintf(buffer,"%d",ADC_FDB);
string(buffer);
__delay_ms(100);
}
Here the ADC_FDB value updating as per changing the adc value working as expected .
C:
int ADC_read(void)
{
//.... some of code to read adc and some calculaton
;;
..
return adc_value; //here is the adc_value need to be require in interrupt .c file or all over the project it is a volatie varable
}
here i tried the variable
adc_value decalared as
extern volatile int adc_value ,as global variable in main.c source file but not updating the value in
interrupt.c file
here i tried the variable
adc_value decalared as
extern volatile int adc_value ,as in header file variable in
interrupt.h but not updating the value in
interrupt.c file
what wrong i did .
How does the datas in one source file takes to other files
ie the adc_value (adc read by interrupt method) which is given to to the interrupt routine to update the CCPR value .
used variable as global , extern ,tried in decalartion in main.c and other header files nothing benifited .
i am using MPLAB XC 8 compailer