Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
unsigned int temp_res;
void main() {
ADCON1 = 0b00001110; // Configure AN0 pin as analog
ADCON0 = 0d00000001; // Configure other AN pins as digital I/O
TRISA = 0xFF; // PORTA is input
TRISC = 0; // PORTC is output
TRISD = 0; // PORTD is output
do {
temp_res = ADC_Read(0); // Get 10-bit results of AD conversion
PORTD = temp_res; // Send lower 8 bits to PORTD
PORTC = temp_res >> 8; // Send 2 most significant bits to RC1, RC0
} while(1);
}
// this code should light up 10 leds 8 of them on portd and the last 2 portc 0,1