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
Sampling of AN0 and displaying on LCD
Moderator: Benj
- CRAIG CHAMBERLAIN
- Flowcode V4 User
- Posts: 24
- Joined: Mon Jun 27, 2011 6:05 am
- Location: Madison Wisconsin
- Has thanked: 6 times
Sampling of AN0 and displaying on LCD
- Attachments
-
- ATO D DIRST READ PROGRAM..fcf
- unfinished cause I can't
- (6.5 KiB) Downloaded 279 times
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Sampling of AN0 and displaying on LCD
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
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 313 times
Martin
- CRAIG CHAMBERLAIN
- Flowcode V4 User
- Posts: 24
- Joined: Mon Jun 27, 2011 6:05 am
- Location: Madison Wisconsin
- Has thanked: 6 times
Re: Sampling of AN0 and displaying on LCD
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
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
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: Sampling of AN0 and displaying on LCD
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.
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.
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Sampling of AN0 and displaying on LCD
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.
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