Shop OBEX P1 Docs P2 Docs Learn Events
displaying numbers on an LCD? integer to string? — Parallax Forums

displaying numbers on an LCD? integer to string?

vampyrevampyre Posts: 146
edited 2008-04-25 17:38 in BASIC Stamp
Hi all, I am hoping someone can help me out.
I'm using a BS2 with a 16x2 LCD. I want to make a timer/clock.. but i'm not sure how to print numbers to the LCD.

Am I going to have to convert the integers to strings? And if so, does anyone know where i can find out how to do that?

I had a feeling it would not work but i tried string = DEC value
didint' work

Thanks a lot for any help

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-04-25 17:25
    Read the Stamp Basic Manual, particularly the appendix on the I/O formatters like DEC. Also read the chapter on the SEROUT statement if you're using a serial LCD. If you're using a BS2 with a parallel LCD, you will have to do the integer to character conversion yourself. Check out the DIG operator. It extracts a specific decimal digit from an integer value and can be used for formatting numbers for display. The expression "x DIG d" has a value from 0 to 9 representing the digit value for digit "d" of the integer value "x". "x DIG 0" is the rightmost digit of "x" and "x DIG 4" is the leftmost digit (of 5 digits). You add the character "0" to that value and send the result to the display in the proper position.
  • vampyrevampyre Posts: 146
    edited 2008-04-25 17:38
    DIG rocks, just what i was looking for. I never would have found this in the manual without your tip , thanks!
    I was afraid i was going to have to write a whole messy routine.
Sign In or Register to comment.