Sampling of AN0 and displaying on LCD

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
User avatar
CRAIG CHAMBERLAIN
Flowcode V4 User
Posts: 24
Joined: Mon Jun 27, 2011 6:05 am
Location: Madison Wisconsin
Has thanked: 6 times
Contact:

Sampling of AN0 and displaying on LCD

Post by CRAIG CHAMBERLAIN »

Hello, I am trying to just sample a 16f877A AN0, and display it on a 2 x 16 LCD.
I have done that, but now I am trying to show the digits behind the decimal point.

I cannot seem to use float to string to accomplish this, Can someone show me a sample of this?
There is something basic I am missing. I cant even get the code written without errors.
Always wrong type of variable errors,

code as is attached
Thanks in advance
Attachments
ATO D DIRST READ PROGRAM..fcf
unfinished cause I can't
(6.5 KiB) Downloaded 258 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Sampling of AN0 and displaying on LCD

Post by medelec35 »

Hi Craig,
I have moved LCD from port A to port B since AN0 uses port A0 so both LCD and pot will be sharing same pin.
I have also modified your flowchart to work with the least amount of icons to display a voltage from 0.00 to 5.00 volts using the Float variable.

Hope it helps

Martin
Attachments
ATO D DIRST READ PROGRAM V2.fcf
(6.5 KiB) Downloaded 294 times
Martin

User avatar
CRAIG CHAMBERLAIN
Flowcode V4 User
Posts: 24
Joined: Mon Jun 27, 2011 6:05 am
Location: Madison Wisconsin
Has thanked: 6 times
Contact:

Re: Sampling of AN0 and displaying on LCD

Post by CRAIG CHAMBERLAIN »

Martin,
Thank you,
That was a sticking point to a much larger program.
Is it not recommended, or just not possible to use the same port for
the A/D and display?
-Craig

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Sampling of AN0 and displaying on LCD

Post by Enamul »

Hi,
As adc uses analog whereas Lcd uses digital it's not possible for normal uses to switch between that in an same bit of code. Also not advisable.
Enamul
University of Nottingham
enamul4mm@gmail.com

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Sampling of AN0 and displaying on LCD

Post by medelec35 »

Hi
as I has suggested and Enamul said its not recommended.

If you really want to do that, then I have tried it and it does work.

One good reason it's not recommend is if a data output that's connected to the pot input goes high, and the pot is set for a low value e.g. 1V then the PIC WILL get destroyed!
(or the other way round. Pot is set to high and data o/p is low)

To prevent this you must have a resistor (E.g 10K) connected in series with the wiper of the that pot and the port pin. (DO NOT TRY THIS UNTIL RESISTOR OF CORRECT VALUE IS IN PLACE, OTHERWISE A NEW MICROCONTROLLER WILL BE REQUIRED!).
LCD is connected directly to port pin.
If your measuring high impedance then LCD will affect this since I believe it has pull up resistors connected to the data lines?

You do this at your own risk since we have recommend not to do it.
Just because it works for me, if you do something wrong it may not work for you.
Martin

Post Reply