Shop OBEX P1 Docs P2 Docs Learn Events
displaying nos. on LCD — Parallax Forums

displaying nos. on LCD

ArchiverArchiver Posts: 46,084
edited 2003-03-27 19:43 in General Discussion
I have the StampWorks kit with the BS2. I am having trouble sending
numbers to the LCD. I keep getting this symbol ||. I have figured out
a way to do it, but I have a feeling it's a boneheaded way. Say I want
to display the number 823. I send the number 8, contained within a
variable, through a loop that compares it to values 0 to 9, when it
gets a match, it sends the msg_pntr to the corresponding EEPROM address.

For example.

Msg08 DATA "8", 0


Is there a better way to do it? I have had no success at the Parallax
website.

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-03-27 19:43
    You are doing things the hard way. Remember that you need to send ASCII
    characters to the LCD -- not their decimal value. Luckily, you can do this
    by adding the decimal value to "0" (decimal 48). Here's a general-purpose
    subroutine that will print a number on your LCD.

    Print_Number:
    LOOKDOWN myNumber, <=[noparse][[/noparse]9, 99, 999, 9999, 65535], highDig
    FOR idx = highDig to 0
    char = myNumber DIG idx + "0"
    GOSUB LCD_Write
    NEXT
    RETURN

    I will leave it to you to crack open the manual (in the back of your
    StampWorks book) to review anything in my snippet of code that doesn't make
    sense.

    -- Jon Williams
    -- Parallax
    -- Author of "StampWorks"


    In a message dated 3/27/2003 12:47:46 PM Central Standard Time,
    jbechtel@e... writes:

    > I have the StampWorks kit with the BS2. I am having trouble sending
    > numbers to the LCD. I keep getting this symbol ||. I have figured out
    > a way to do it, but I have a feeling it's a boneheaded way. Say I want
    > to display the number 823. I send the number 8, contained within a
    > variable, through a loop that compares it to values 0 to 9, when it
    > gets a match, it sends the msg_pntr to the corresponding EEPROM address.
    >
    > For example.
    >
    > Msg08 DATA "8", 0



    [noparse][[/noparse]Non-text portions of this message have been removed]
Sign In or Register to comment.