Adc using pic18F4520

Status
Not open for further replies.

srjth.m1

Full Member level 3
Joined
Aug 6, 2012
Messages
157
Helped
6
Reputation
12
Reaction score
6
Trophy points
1,298
Location
India
Visit site
Activity points
2,126
Am using AN0 pin to read a voltage from external source but in LCD it is showing always 4.99v which is my vdd voltage and when am connecting AN0 to ground it shows 0v,itz not showing external supply voltage what to do to read the external voltage?
 

Sorry, I havent used Flowcode, but I can help if you post a screenshot of your flowcode flowchart.
 

Is there FloatToString() function in flowcode. Can I use flowcode demo version to test your project. Will it compile?
 

Yes there is an option to convert float to string,and i don't have problem with all these problem is that in figure you can see the voltage that voltage is reading from my VDD given to MCU,inthe AN0 pin we are variying voltage to low using ground then it shows 0v. when i want to read a external voltage its not reading through AN0 pin
 

OK. I am still downloading flowcode. Will reply after 1 hour.

I think you have not made the adc pins analog. I feel that it is set as digital, so, it is reading only 0 and 5 v.

I installed Flowcode V5 PIC and tried to open your file, but it says PIX18F4520 is not supported in Flowcode Free version.
Only if I get a serial number for Flowcode, I will be able to check your file.
 
Last edited:

ok..!but can you try how to configure pin's as analog?so you can download the flow chart as bmp
 

I don't know how it is done in flowcode.

see the flow chart image. Before the while(1) loop add a C Code flowchart object and add the code ADCON1 = 0x0D;

If possible also add settings for ADCON2 register.
 

Attachments

  • c code1.jpg
    101.3 KB · Views: 84
Last edited:

OK. You have to vary the ADC(1) knob as shown in the video attached.
 

Attachments

  • fc adc sim.rar
    182.6 KB · Views: 74

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…