need sample code for adc turnon and conversion to shows on lcd for pic 16f877a

Status
Not open for further replies.

peter002

Member level 3
Joined
Mar 18, 2013
Messages
56
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Hindusthaan
Activity points
1,765
helo everyone. i m trying to use the ad feature of the pic to show the conversion result on the lcd, i using microc pro for programming and the software shows 3 commans in ad header file that are adc_init, adc_read and adc_sample_read

but using these commands i m getting nothing on the lcd
below is the code i tried

lcd working ok, and i know i hav a lot of mistakes in that code, indeed i m an assembler, and in assembly i hav done that successfuly, but i wanna try in c now, plz hlp..
thanc in advance
 

Why are you using 8 bit LCD code. mikroC PRO PIC comes with 4 bit LCD library. Where did you get the 8 bit LCD library for mikroC PRO PIC ? LCD 8 bit library comes with mikroC not mikroC PRO.

- - - Updated - - -

Try this mikroC PRO PIC code.

broken link removed
 

Attachments

  • ADC.rar
    83.9 KB · Views: 104
  • adc.png
    36 KB · Views: 139
Last edited by a moderator:
well, i use 8 bit mode because it has a bit faster speed that 4 bit mode, and even in the 8bit mode the lcd is working fine.. thanx for the code, i m chking it...

- - - Updated - - -

your code seems very simple and clean bro, can u plz xplain me the meaning of folowing code lines?? thanx in advance
Code:
FloatToStr(adcVal, str);
                    Ltrim(str);
 

Good Morning,
Your C program seems to have a flaw. You have an uneven number of {} these. That means your program may have compiled but the action is uncertain. The last } looks like an orphan. Where does the program counter go after the last command statement? Try putting a while(1){}; after lcd_out line. Good luck.
 

FloatToStr() converts floating point value to string for LCD printing. Ltrim() removes the leading spaces in the string.
 
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…