Bargraph and 2x40 LCD problem


Closed Thread
Results 1 to 9 of 9
  1. #1

    Default Bargraph and 2x40 LCD problem

    Hi all

    I have the following problem using a seiko 2x40 LCD (4042)

    http://www.shopeio.com/inventory/pdf/SeikoChar.pdf

    I use a 16F876 and read AD0 and AD1 which I want to display on line 1 and 2

    followed by a bargraph

    All works ok if the COL position is not bigger than 15
    If I use 16 it erase the the text and the bargraph starts on 1st line 1st character

    anyidea ?


    lcd_main:
    Lcdout $fe, 1
    LCDOUT "Forw: ",dec4 fwd_pwr," Watt"
    pause 10
    ; syntax- BARgraph Value, Row, Col, Width, Range, Style
    @ BARgraph _fwd_pwr, 1, 15, 25, 1024, boxed ' OK
    ; @ BARgraph _fwd_pwr, 1, 16, 25, 1024, boxed ' not OK
    return

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


    Did you find this post helpful? Yes | No

    Default

    Try using a variable for the starting column and BAR width.
    Code:
    COL  VAR BYTE
    Width VAR BYTE
    
    lcd_main:
    Lcdout $fe, 1 
    LCDOUT "Forw: ",dec4 fwd_pwr," Watt"
    pause 10
    COL = 16 : Width = 25
    ; syntax- BARgraph   Value,    Row,  Col,  Width, Range, Style
     @         BARgraph  _fwd_pwr,   1, _COL,_Width,   1024,  boxed  ' OK
    ; @         BARgraph  _fwd_pwr,   1,   16,    25,   1024,  boxed ' not OK  
    return
    The routines use a "trick" method to determine if the parameters being passed are constants or variables.

    Anything less than 16 is assumed to be a constant, and anything over that is taken to be the address of a variable.
    If it went up to 40, it could mistake a variable as a constant.

    On anything wider than 16 chars, you should use a variable for Col and Width.

    hth,
    DT

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Thanks Mel

    This works great

  4. #4


    Did you find this post helpful? Yes | No

    Default

    Oeps Darrel !!!

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


    Did you find this post helpful? Yes | No

    Default

    Understandable.

    We do look alot alike.

    DT

  6. #6
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default Rofl!!!

    Ohh, man... Don't do that to me!!!

    I had to go out to the shop and grab my spare keyboard. It'll take me forever to get all the beer spray out of the other one!
    Jeez, most of it came up through my nose... (mmmm, hoppy.)

    I always suspected that you and Melanie might be twins.


    steve

  7. #7
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Understandable.

    We do look alot alike.

    LOL - Darrel, Mel's gonna give you one hell of a slap for that !!

    That's brightened up one dull Saturday morning !

  8. #8
    Join Date
    Jan 2011
    Location
    Skopje,Macedonia
    Posts
    71


    Did you find this post helpful? Yes | No

    Default

    Can anybode make a code for this example?
    Please I need it.

  9. #9
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Do a search on bargraph and you will be amazed.

Members who have read this thread : 0

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