Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Adc using pic18F4520

Not open for further replies.


Full Member level 3
Aug 6, 2012
Reaction score
Trophy points
Activity points
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?

You should upload your circuit diagram and your code. What reading do you get when you apply voltages like 2V, 2.5V, 3V, etc?

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

Untitled.pngam attaching my work


  • Desktop.rar
    12.1 KB · Views: 43

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

I am downloading flowcode 5 free version. post your flowcode file. I will check.

here is the flow code


  • current.rar
    2.4 KB · Views: 33

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.


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

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


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

Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to