Shop OBEX P1 Docs P2 Docs Learn Events
Display variable at LCD dispaly — Parallax Forums

Display variable at LCD dispaly

hclamhclam Posts: 5
edited 2005-08-11 01:55 in BASIC Stamp
Hi all,

Im using the command line below to display the constant at the LCD display:

SEROUT TxPin, Baudrate19200, [noparse][[/noparse]"123"]


Can somebody tell me how to display the variable value at the LCD display? Tq

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-08-09 10:50
    hclam -

    You do it the same way that you displayed the constant:

    Variable var byte
    Variable = 123

    SEROUT TxPin, Baudrate19200, [noparse][[/noparse]"123"]

    SEROUT TxPin, Baudrate19200, [noparse][[/noparse]Variable]

    Both the PBASIC Stamp Manual, and the PBASIC Stamp Help file are wonderful resources that you might consider using.

    Regards,

    Bruce Bates
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-08-09 11:24
    Use the DEC modifier to convert a numeric value (variable) to text for display on the LCD:

    · SEROUT Lcd, Baud, [noparse][[/noparse]DEC myVar]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Tom-Matrix OrbitalTom-Matrix Orbital Posts: 38
    edited 2005-08-09 19:14
    Just curious, but what display are you using?
  • hclamhclam Posts: 5
    edited 2005-08-10 01:32
    I use·'Parallax Serial LCD'. Thank for helping...

    I do try out with the solution from all of you, it is work now but it seem like not able to display the floating digits, eg 12.35. What command need to include for displaying floating digit?

    Tq
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-08-10 02:20
    The BASIC Stamp can't store floats, but it can represent them as fixed -- you have to decide the resolution of your "floating point" number.· Let's say you're using hundredths, so the value 1235 actually represents 12.35.· Here's how you can display that value:

    · SEROUT Lcd, Baud, [noparse][[/noparse]DEC (myValue / 100), ".", DEC2 myValue)

    Here's a hint: a serial LCD can use any of the serial modifiers supported by SEROUT and DEBUG -- so you can use DEBUG to do quick tests before putting code into the program that uses the LCD.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • hclamhclam Posts: 5
    edited 2005-08-11 01:55
    Thank a lots!
Sign In or Register to comment.