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.
Well I figured I didn't have any thing better to This works find if you set the hardware right. Nice 20 ma reading and the 4 mA is a little off
char *value = "00.00 %";
unsigned int ADC_Value;
unsigned int adc_val ;
void main() {
ADCON0 = 0b11000000;
ADCON1 = 0b10001111;
TRISA = 0xFF; // PORTA is input
TRISB = 0; // PORTB is output
Lcd_Init(&PORTB); // Initialize LCD
do {
adc_val = ADC_Read(0);
adc_value = adc_val - 204 ; // To shift the 0 1V
value[0] = adc_value/82 + 48; // (1024 - 204)/10 = 82
value[1] = (adc_value/8)%10 + 48; // (1024 - 204)/100 = 8.2
value[2] = '.';
value[3] = (adc_value/1)%10 + 48; // (1024 - 204)/1000 = 0.82
value[4] = adc_value%10 + 48;
Lcd_Out(1,5,value);
Delay_ms(2000);
} while(1);
}