mugheesnawaz
Member level 1
- Joined
- May 1, 2013
- Messages
- 39
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 1,288
- Activity points
- 1,605
i am using pic 16f877A and using its adc AN0 for my input voltage.
i am using divide by 10 voltage divider (i.e if input is 24V, 2.3V will be fed to pic microcontroller).
now i want to display this 24V at the led output in binary but i am getting 23V output display.kindly help me i am getting rounded values of adc.
attached is the proteus design picture
i am using divide by 10 voltage divider (i.e if input is 24V, 2.3V will be fed to pic microcontroller).
now i want to display this 24V at the led output in binary but i am getting 23V output display.kindly help me i am getting rounded values of adc.
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 void main() { PORTA = 0x00; PORTB = 0x00; while (1) // endless loop { float a1,solarV1; TRISA = 0xFF; // Set PORTA as input TRISB = 0x00; // Set PORTB as output ADCON1 = 0xC0; //All pins as Analog Input a1=ADC_Read(0); solarV1= (10*(5*a1)/1024); PORTB = solarV1; //Lower 8 bits to PORTB } }