Hey, so I'm pretty new to MikroC, but I can't for the life of me figure out why this isn't working. All it's displaying is 0xFF, regardless of my analog input. The code compiles just fine, but the output isn't changing. Thoughts? Thanks.
unsigned int ADC_Result;
void main() {
CMCON = 0x03;
ADCON1 = 0x30; // set all to digital, this to replace ANSEL/ANSELH
TRISA = 0x00;
TRISC = 0;
TRISB = 0;
do {
ADC_Result = ADC_Read(2); // Get 10-bit results of AD conversion
PORTB = ADC_Result; // Send lower 8 bits to PORTB
PORTC = ADC_Result >> 8; // Send 2 most significant bits to RC1, RC0
} while(1);
}
unsigned int ADC_Result;
void main() {
CMCON = 0x03;
ADCON1 = 0x30; // set all to digital, this to replace ANSEL/ANSELH
TRISA = 0x00;
TRISC = 0;
TRISB = 0;
do {
ADC_Result = ADC_Read(2); // Get 10-bit results of AD conversion
PORTB = ADC_Result; // Send lower 8 bits to PORTB
PORTC = ADC_Result >> 8; // Send 2 most significant bits to RC1, RC0
} while(1);
}