Problem in my PIC16F877A Program displaying correct dc input voltage on the LCD!!!!

Status
Not open for further replies.

BRL6

New Member
Hi,everybody.I wrote a program with mikroC for PIC PRO/2009/V2.50 ,to measure
a DC voltage input using 16F877A.But it shows the input dc voltage wrongly and uncorrectly;[ it shows 0.014v instead of correct form; 14v ].
I attached my program and its proteus.would you please tell me what is wrong with my program to correct it?

Thanks,
 

Attachments

  • XHE1X16.c
    2.9 KB · Views: 191

hi,
You appear to be dividing the adc value by 1000.? before you decimalise it.
ch0 = adcval0/1000 ; //prepare value for display in V . xxxxxxxxxxxx
 
Hello,ericgibbs.Thanks for your help;would you please tell me how I should decimalise the adc value?

Thanks,
 
I would do it this way
ADC_value x 1400/1024

tc = tc/100;
LCD_Out(1,1,tc);which should give a nice 0 to 14 volt reading

like this
It's set 15 volts
 
Last edited by a moderator:
My input dc voltage range; 0-100V

Hello,be80be .Thanks a lot for your solution.If my input is 0-100v ; any changing
at your instructions will occurs?

Thanks,
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…