C program to read value from ADC

Status
Not open for further replies.

rajesh dubey

Newbie level 3
Joined
Mar 13, 2014
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
23
write a program in C language to read the value from the ADC continuously on the EasyPic6 board and display the values on the LCD. For example:
Voltage=2.843 V

Write your own routine for reading the result of ADC. Do not use the one in the C library. Make sure RA0 is not used as RXD. Use channel 0 for ADC and make sure the jumper for ADC is on RA0. You may use FRC for ADC clock source if you want. The result of ADC is a 10-bit binary number which means 1023 represents 5V or 5000 mV. Then you should multiply the result of ADC by 5,000 (or a number a little more than 5000 to compensate for the extra resistor in the path of RA0) and divide it by 1023 to get the value of the voltage in mV. Make sure you use RA0 as analog input (ANSEL bit 0).
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…