Hi guys , i m working on adc using pic18f2580, i have gone through adc using pic18f452 earlier using mikroc pro, but this time there issome problems , guys u know 18f2580 contain comparators but when i m turning it off it is giving identifier error for CMCON.
u guys please check this program and verify what wrong with it and why it is giving error also tell if any thing missing in program
#include <built_in.h>
unsigned int adc_rd;
void main() {
CMCON = 0x07; // turn off comparators//IT IS GIVING IDENTIFIER ERROR
ADCON1 |= 0x00; // Set AN2 channel pin as analog
TRISA = 0xFF; // input
TRISC = 0x00; // Set PORTC as output
TRISB = 0x00; // Set PORTD as output
while (1) {
adc_rd = ADC_Read(0); // get ADC value from channel 0
PORTC = adc_rd; // display adc_rd[7..0]
PORTB = Hi(adc_rd); // display adc_rd[9..8]
}
}
PLEASE TELL WHAT I DO, ALSO VERIFY PROGRAM , TELL ME ANY THING MISSING SO , HOW CAN I TURN OFF COMPARATORS , WHAT WILL BE THE RIGHT WAY.
u guys please check this program and verify what wrong with it and why it is giving error also tell if any thing missing in program
#include <built_in.h>
unsigned int adc_rd;
void main() {
CMCON = 0x07; // turn off comparators//IT IS GIVING IDENTIFIER ERROR
ADCON1 |= 0x00; // Set AN2 channel pin as analog
TRISA = 0xFF; // input
TRISC = 0x00; // Set PORTC as output
TRISB = 0x00; // Set PORTD as output
while (1) {
adc_rd = ADC_Read(0); // get ADC value from channel 0
PORTC = adc_rd; // display adc_rd[7..0]
PORTB = Hi(adc_rd); // display adc_rd[9..8]
}
}
PLEASE TELL WHAT I DO, ALSO VERIFY PROGRAM , TELL ME ANY THING MISSING SO , HOW CAN I TURN OFF COMPARATORS , WHAT WILL BE THE RIGHT WAY.
Last edited: