LCD + bar graph


Closed Thread
Results 1 to 14 of 14

Thread: LCD + bar graph

  1. #1
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382

    Default LCD + bar graph

    Anyone done a bargraph on a character LCD? I want to represent a value in text and bargraph and was looking for the best method to accomplish it.

  2. #2
    Join Date
    May 2004
    Location
    Sweden
    Posts
    9


    Did you find this post helpful? Yes | No

    Default Take a look here

    I saw this a couple of years ago...
    http://www.parallax.com/dl/docs/cols...l1/col/nv8.pdf

    Brgds Roy

  3. #3
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382


    Did you find this post helpful? Yes | No

    Default

    Not quite what I was thinking of. I'm hoping for something along the lines of a progress bar.

  4. #4
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382


    Did you find this post helpful? Yes | No

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hi Ben,

    Probably too late for you, but in case what you found didn't work out ...

    LCD BARgraphs
    http://www.picbasic.co.uk/forum/showthread.php?p=12475
    <br>
    DT

  6. #6
    Martin_Nissen's Avatar
    Martin_Nissen Guest


    Did you find this post helpful? Yes | No

    Question

    Quote Originally Posted by Darrel Taylor
    Hi Ben,

    Probably too late for you, but in case what you found didn't work out ...

    LCD BARgraphs
    http://www.picbasic.co.uk/forum/showthread.php?p=12475
    <br>
    I can't get my program compiled when using your file.. It says that my VALUE (in this case, WRD1) is an illegal opcode - With and without _ in front of the word

  7. #7
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hi Martin,

    Make sure there's a space after the @ symbol, and the CASE matches EXACTLY.

    Other than that, I would need to see your code.
    <br>
    DT

  8. #8


    Did you find this post helpful? Yes | No

    Smile

    I have it working fine. Just use the example and modifiy it to your application.

    Nice job Darrel.

  9. #9
    Martin_Nissen's Avatar
    Martin_Nissen Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor
    Hi Martin,

    Make sure there's a space after the @ symbol, and the CASE matches EXACTLY.

    Other than that, I would need to see your code.
    <br>
    Must be because it doesn't work in the compiler i'm using then..

  10. #10
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Must be because it doesn't work in the compiler i'm using then..
    If the compiler is not PicBasic Pro, or the PBP version is prior to 2.40, then that would be the case.

    Sorry about that.
    <br>
    DT

  11. #11
    Join Date
    Oct 2005
    Location
    Loveland CO USA
    Posts
    83


    Did you find this post helpful? Yes | No

    Default Bargraph 128 levels using 16 char LCD

    This bargraph is not near as slick as the one by Darrel.
    My graph displays 128 levels using 16 character LCD
    This bargraph uses 8 user defined characters that are downloaded first.
    There are 16 characters each subdivided into 1/8. 16X8=128
    I needed to display an 8 bit value but I could not so I divided the value by 2 and displayed a 7 bit number.
    Here are the working parts:
    Attached is the entire project but below is the working parts for the graph.
    rons.
    *******************************
    'hardware
    'microChip used 16F873
    ' 4k ROM
    '192 RAM
    '128 EEPROM


    DEFINE LCD_DREG PORTB 'LCD data port
    DEFINE LCD_BITS 8 '8 bit mode

    DEFINE LCD_RSREG PORTC 'RS port
    DEFINE LCD_RSBIT 2 'RS bit

    DEFINE LCD_EREG PORTC 'E port
    DEFINE LCD_EBIT 0 'E bit

    DEFINE LCD_RWREG PORTC 'R/W port
    DEFINE LCD_RWBIT 1 'R/W bit

    DEFINE LCD_LINES 2 'lines

    LCD_rs var portc.1

    'EEPROM tables graphic downloaded to LCD

    DATA @ 0 , %00000000
    DATA @ 1 , %00000000
    DATA @ 2 , %00000000
    DATA @ 3 , %00000000
    DATA @ 4 , %00000000
    DATA @ 5 , %00000000
    DATA @ 6 , %00000000
    DATA @ 7 , %00000000

    DATA @ 8 , %00000000
    DATA @ 9 , %00000000
    DATA @10 , %00000000
    DATA @11 , %00010000
    DATA @12 , %00010000
    DATA @13 , %00010000
    DATA @14 , %00010000
    DATA @15 , %00010000

    DATA @16 , %00010000
    DATA @17 , %00010000
    DATA @18 , %00010000
    DATA @19 , %00010000
    DATA @20 , %00010000
    DATA @21 , %00010000
    DATA @22 , %00010000
    DATA @23 , %00010000

    DATA @24 , %00010000
    DATA @25 , %00011000
    DATA @26 , %00011000
    DATA @27 , %00011000
    DATA @28 , %00011000
    DATA @29 , %00011000
    DATA @30 , %00011000
    DATA @31 , %00011000

    DATA @32 , %00011000
    DATA @33 , %00011000
    DATA @34 , %00011000
    DATA @35 , %00011000
    DATA @36 , %00011100
    DATA @37 , %00011100
    DATA @38 , %00011100
    DATA @39 , %00011100

    DATA @40 , %00011100
    DATA @41 , %00011100
    DATA @42 , %00011100
    DATA @43 , %00011100
    DATA @44 , %00011100
    DATA @45 , %00011100
    DATA @46 , %00011100
    DATA @47 , %00011110

    DATA @48 , %00011100
    DATA @49 , %00011100
    DATA @50 , %00011110
    DATA @51 , %00011110
    DATA @52 , %00011110
    DATA @53 , %00011110
    DATA @54 , %00011110
    DATA @55 , %00011110

    DATA @56 , %00011110
    DATA @57 , %00011110
    DATA @58 , %00011110
    DATA @59 , %00011110
    DATA @60 , %00011110
    DATA @61 , %00011111
    DATA @62 , %00011111
    DATA @63 , %00011111

    LCD_rs=0
    ADCON1 = 7 'PIC16F87X PORTa ANALOG OFF DIGITAL ON

    start: pause 500 'wait for LCD to startup

    lcdout $fe, $40 'set CG address to 0
    for i = 0 to 63 'down load CGtable
    read i,j
    lcdout j
    next i

    lcdout $fe,1 'clear LCD screen
    pause 100

    error1:
    lcdout $fe,$10,$fe,$10,hex DATA_ 'hex data
    'LCD has only 8 user defignable char. so: 1/2
    lcdout $fe,2 'home LCD
    DATA_ = Data_ / 2 ' 1/2 make 8 bit value 7 bit value
    j = DATA_ & $07 'ger 3 bits
    for i = 8 to 128 step 8
    if DATA_ >= i then 'bargraph
    lcdout $ff 'Write black characters to make bar
    else
    lcdout j 'output one of 8 downloaded characters
    j = " " 'next pass output blank characters
    endif
    next i
    GOTO loop
    *******************************
    Quote Originally Posted by DynamoBen
    Anyone done a bargraph on a character LCD? I want to represent a value in text and bargraph and was looking for the best method to accomplish it.
    Attached Files Attached Files

  12. #12
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382


    Did you find this post helpful? Yes | No

    Default

    I ended up using a basic stamp example as my template.

    In response to your graph I just don't have the space in EEProm to do what you did. Its already full with the seven extra large digits I have created for the project.

  13. #13
    TK5EP's Avatar
    TK5EP Guest


    Did you find this post helpful? Yes | No

    Default Here a simple clever code i use

    Hi !

    I had the same request last week.
    I got this attached code from another user here, and also found it somewhere else on the web. It works very nicely with only a few lines of clever coding.
    You can even reduce the code if you don't want to have different type of bars.

    I'm now working on a addon to this code, a "holding" bar which will show the peak measure during a little time. I'm almost done with it.

    Hope this helps !

    Patrick

    Quote Originally Posted by DynamoBen
    Anyone done a bargraph on a character LCD? I want to represent a value in text and bargraph and was looking for the best method to accomplish it.
    Attached Files Attached Files

  14. #14
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382


    Did you find this post helpful? Yes | No

    Default

    Once you have the holding bar complete please post the results.

    My application doesn't need a holding bar but is does need a max limit indicator.

Similar Threads

  1. Is this code not initialising the LCD properly?
    By Platypus in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 30th January 2010, 20:14
  2. 16f688 LCD what have I done wrong
    By spitfiredriver in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th August 2009, 20:54
  3. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 17:56
  4. Need help with LCD number display.
    By Steve Matson in forum mel PIC BASIC
    Replies: 8
    Last Post: - 27th June 2007, 00:07
  5. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 03:30

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts