S sahanaashwin New Member Aug 14, 2008 #1 HI i am new in c programming,i have one doubt in the below coding.in this coding already set AD1CON2bits.BUFS=0(AD1CON2 = 0x041Fthen why we write code if (AD1CON2bits.BUFS==1),else if(AD1CON2bits.BUFS==0) pls explain me # void ADCInit() { AD1CON1 = 0x80E4; AD1CON2 = 0x041F; AD1CON3 = 0x1102; . . } void _ISR _ADC1Interrupt(void) { unsigned int Temp; if (AD1CON2bits.BUFS==1) { Temp = ADC1BUF1; Temp += ADC1BUF3; Temp += ADC1BUF5; Temp += ADC1BUF7; Temp = Temp/4; Adc_Vo += Temp; Adc_Vo = Adc_Vo/2; } else if(AD1CON2bits.BUFS==0) { Temp = ADC1BUF9; Temp += ADC1BUFB; Temp += ADC1BUFD; Temp += ADC1BUFF; Temp = Temp/4; Adc_Vo += Temp; Adc_Vo = Adc_Vo/2; }
HI i am new in c programming,i have one doubt in the below coding.in this coding already set AD1CON2bits.BUFS=0(AD1CON2 = 0x041Fthen why we write code if (AD1CON2bits.BUFS==1),else if(AD1CON2bits.BUFS==0) pls explain me # void ADCInit() { AD1CON1 = 0x80E4; AD1CON2 = 0x041F; AD1CON3 = 0x1102; . . } void _ISR _ADC1Interrupt(void) { unsigned int Temp; if (AD1CON2bits.BUFS==1) { Temp = ADC1BUF1; Temp += ADC1BUF3; Temp += ADC1BUF5; Temp += ADC1BUF7; Temp = Temp/4; Adc_Vo += Temp; Adc_Vo = Adc_Vo/2; } else if(AD1CON2bits.BUFS==0) { Temp = ADC1BUF9; Temp += ADC1BUFB; Temp += ADC1BUFD; Temp += ADC1BUFF; Temp = Temp/4; Adc_Vo += Temp; Adc_Vo = Adc_Vo/2; }
bananasiong New Member Aug 14, 2008 #2 Hi, Which PIC are you using? Why are you posting it here, it should be in microcontroller section..
S sahanaashwin New Member Aug 14, 2008 #3 sorry, i posted in microcontroller section also, i am using p24fj64ga004
B BeeBop Active Member Aug 15, 2008 #4 sahanaashwin said: sorry, i posted in microcontroller section also, i am using p24fj64ga004 Click to expand... Yes, I answered it there, and if I knew about this thread (double post) I wouldn't have bothered. STOP double posting! It is rude, and selfish.
sahanaashwin said: sorry, i posted in microcontroller section also, i am using p24fj64ga004 Click to expand... Yes, I answered it there, and if I knew about this thread (double post) I wouldn't have bothered. STOP double posting! It is rude, and selfish.