How do I make a Bar Graph on a LCD Display that responds to a ADC 0831 OUTPUT V
Has any one done this before Would you Please help me get Started
This what I want to
I want 40·Display Character··that are (*), would = 2 AMP·on the Display that would show how many·MillAmps there are for Two Amps MAX
·This is how·I Have it set up
2 volt· = 2 amps
.0098 volts for each ADC step
For each Display Character·=·5.25·@ ONE ADC Step··Which there are 40 Display Character··in to 210 ADC Steps
This would mean that 4 Character·I would have to add one Character
But I want to a lot·less range that this
This is what I have so far
I could do it way but this not what I am looking for
·IF (result <= 20) THEN
····· GOSUB Display01
ELSEIF (result >= 20 AND result· <= 82) THEN
····· GOSUB· Display02
ELSEIF (result >= 83 AND result <= 87) THEN
····· GOSUB· Display03
ELSEIF(result >= 87 AND result <= 95) THEN
····· GOSUB Display04
ELSEIF(result >=·96 AND result <= 101) THEN
····· GOSUB Display05
·Display01:
·· SEROUT LCD, Baud, [noparse][[/noparse]ClearScreen]
·· SEROUT LCD, Baud, [noparse][[/noparse]LineOne0,LineTwo0,"*"]
·· RETURN
·· Display02:
·· SEROUT LCD, Baud, [noparse][[/noparse]ClearScreen]
·· SEROUT LCD, Baud, [noparse][[/noparse]LineOne0,LineTwo0,"****"]
·· RETURN
·· Display03:
·· SEROUT LCD, Baud, [noparse][[/noparse]ClearScreen]
·· SEROUT LCD, Baud, [noparse][[/noparse]LineOne0,LineTwo0,"********"]
·· RETURN
·· Display04:
· ·SEROUT LCD, Baud, [noparse][[/noparse]ClearScreen]
·· SEROUT LCD, Baud, [noparse][[/noparse]LineOne0,LineTwo0,"************"]
·· RETURN
··· Display05:
·· SEROUT LCD, Baud, [noparse][[/noparse]ClearScreen]
·· SEROUT LCD, Baud, [noparse][[/noparse]LineOne0,LineTwo0,"****************"]
·· RETURN
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·
·that you may have and all of your time finding them
·
·
·
·
Sam
Post Edited (sam_sam_sam) : 8/13/2008 12:42:42 AM GMT
This what I want to
I want 40·Display Character··that are (*), would = 2 AMP·on the Display that would show how many·MillAmps there are for Two Amps MAX
·This is how·I Have it set up
2 volt· = 2 amps
.0098 volts for each ADC step
For each Display Character·=·5.25·@ ONE ADC Step··Which there are 40 Display Character··in to 210 ADC Steps
This would mean that 4 Character·I would have to add one Character
But I want to a lot·less range that this
This is what I have so far
I could do it way but this not what I am looking for
·IF (result <= 20) THEN
····· GOSUB Display01
ELSEIF (result >= 20 AND result· <= 82) THEN
····· GOSUB· Display02
ELSEIF (result >= 83 AND result <= 87) THEN
····· GOSUB· Display03
ELSEIF(result >= 87 AND result <= 95) THEN
····· GOSUB Display04
ELSEIF(result >=·96 AND result <= 101) THEN
····· GOSUB Display05
·Display01:
·· SEROUT LCD, Baud, [noparse][[/noparse]ClearScreen]
·· SEROUT LCD, Baud, [noparse][[/noparse]LineOne0,LineTwo0,"*"]
·· RETURN
·· Display02:
·· SEROUT LCD, Baud, [noparse][[/noparse]ClearScreen]
·· SEROUT LCD, Baud, [noparse][[/noparse]LineOne0,LineTwo0,"****"]
·· RETURN
·· Display03:
·· SEROUT LCD, Baud, [noparse][[/noparse]ClearScreen]
·· SEROUT LCD, Baud, [noparse][[/noparse]LineOne0,LineTwo0,"********"]
·· RETURN
·· Display04:
· ·SEROUT LCD, Baud, [noparse][[/noparse]ClearScreen]
·· SEROUT LCD, Baud, [noparse][[/noparse]LineOne0,LineTwo0,"************"]
·· RETURN
··· Display05:
·· SEROUT LCD, Baud, [noparse][[/noparse]ClearScreen]
·· SEROUT LCD, Baud, [noparse][[/noparse]LineOne0,LineTwo0,"****************"]
·· RETURN
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·
![idea.gif](http://forums.parallax.com/images/smilies/idea.gif)
·
·
·
·
Sam
Post Edited (sam_sam_sam) : 8/13/2008 12:42:42 AM GMT
Comments
Will you ever connect with FOR...NEXT ? ·
I'm using DEBUG, but changing to SEROUT should be no big deal.· You don't want to have a SEROUT for each series of stars or bargraph blocks.· That takes up, unnecessarily, so much program space.
Post Edit -- Looks like you omitted your post for which this was a Reply, OM.
Post Edited (PJ Allen) : 8/13/2008 2:15:28 AM GMT
Besides being simpler, this will save you a huge amount of code space and make your output to the LCD much more flexible.
If you need to adjust the range, then just the val in the for/next loop, i.e., if you are getting values of 20-101, then you might do
FOR i = 0 to ( ADCval MIN 20 - 20 /·5 )
which gives you about 16 "bars" of resolution across that range
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
Post Edited (Zoot) : 8/13/2008 2:26:52 AM GMT
Thank you for your reply
Please tell me if i have this Right
I can not test it now
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·
·
·
·
·
Sam
Post Edited (sam_sam_sam) : 8/13/2008 3:45:52 AM GMT
Thank You for your help
I try your second post code and work GREAT which is the Bargraph Demo below
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·
·
·
·
·
Sam
Post Edited (sam_sam_sam) : 8/13/2008 4:51:54 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
We all make mistakes when we are young………That’s why paste is edible!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
Thank You for that I had not·seen that before
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·
·
·
·
·
Sam
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
We all make mistakes when we are young………That’s why paste is edible!
e.g.
But I'll take back what I said -- I think for code space, clarity and flexibility you are better off using the serout in the sub, with a for next loop. Duplicating serout statements can chew up serious code space.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
Then when the number you want to display is scaled to the range of n={0 to 99}, the following line displays the bar (this happens to position the bar on the second line of a 4x20 display):
That prints a series of character 255 (a solid block), followed by one narrower block drawn from CG ram by the n//5, and then clears the rest of the line by prining the required number of spaces (ascii 32).
There is a demo program here at bargraph.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Thank You for your reply
I like this ·
I know that they are not the same as a Parallax 4 Line display
I do not have·a (Scott Edwards backpack or Display) will this matter can you do·the same thing with a Parallax 4 Line display and how would you do it· I have one of these
Thank you for all of your help
·Zoot
Thank You for your help·with this also·I will give this try as soon as·I finish the Basic Stamp to· Optic Sensor / ADC Board and hook up the LCD Display
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·
·
·
·
·
Sam
Post Edited (sam_sam_sam) : 8/13/2008 6:36:56 PM GMT
In any case, the LCD controller would be the same and any changes required would likely be minor.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
http://forums.parallax.com/showthread.php?p=553226
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
Thank you for the links and Demo which I was able to get the Demo working
The ·standard and high-resolution bar graphs work great
And·I got ADC Demo to work
But Can not·seem the two·of them to·work together I try a lot of different way of doing it·
The ·high-resolution bar graphs is the one that want to use
with 210 is the Max
But I at a lost as what to do next
Thank for any help that you can give me
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·
·
·
·
·
Sam
Post Edited (sam_sam_sam) : 8/15/2008 1:36:37 AM GMT