Shop OBEX P1 Docs P2 Docs Learn Events
Display of VAR on LCD — Parallax Forums

Display of VAR on LCD

bsparkybsparky Posts: 52
edited 2006-06-01 18:15 in BASIC Stamp
How can I take a VAR apart and display it on an LCD. Short excerpt of my program.

'
Count

Counter:

SEROUT Lcd,Baud,[noparse][[/noparse]5,1,5,2,1,1,"Parts <---> Pieces"]
SEROUT Lcd,Baud,[noparse][[/noparse]3,3,(Parts+48),3,17,(Piece+48)]

Counter1:

DO WHILE Cnt = 0 'Cnt is PIN 3 when PIN 3 goes high count
LOOP
PAUSE 100
Piece = Piece + 1
SEROUT Lcd,Baud,[noparse][[/noparse]3,3,(Parts+48),3,17,(Piece+48)]
IF Piece = PieceCnt THEN PartCom

GOTO Counter1

This works until I reach greater then 10, because there is know ascii for that. I know I have take VAR Parts apart and diplay
it in two differant consecutive places on the LCD. Tried MSB and LSB and HIGHBIT and LOWBIT but could not get it to work.
Any thoughts ............ Thanks

Comments

  • FORDFORD Posts: 221
    edited 2006-06-01 12:59
    you need to show what your variables are, nibbles, byte, words etc, or it is difficult to help.

    This may help...

    instead of· displaying··· parts+48

    try················· DEC2 parts···· and remove the +48.

    Read up on the DEC modifier in the help manual and I think you'll be onto it.

    Cheers
    Chris
  • bsparkybsparky Posts: 52
    edited 2006-06-01 15:05
    Tried using DEC2 but I get an error. Example shown below. I am attaching my program as well.

    '
    Count

    Counter:


    SEROUT Lcd,Baud,[noparse][[/noparse]5,1,5,2,1,1,"Parts <---> Pieces"]
    SEROUT Lcd,Baud,[noparse][[/noparse]3,3,(DEC2 Parts),3,17,(DEC2 Piece)]

    Counter1:

    DO WHILE Cnt = 0
    LOOP
    PAUSE 100
    Piece = Piece + 1
    SEROUT Lcd,Baud,[noparse][[/noparse]3,3,(DEC2 Parts),3,17,(DEC2 Piece)]
    IF Piece = PieceCnt THEN PartCom


    GOTO Counter1

    Thanks for the reply.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-06-01 15:28
    bsparky -

    Remove the parenthesis outside of the DEC expression like the following:

    SEROUT Lcd, Baud, [noparse][[/noparse]3,3,DEC2 Parts,3,17,DEC2 Piece]

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • bsparkybsparky Posts: 52
    edited 2006-06-01 18:15
    Thank you that worked. Its these little things that get you every time..........
Sign In or Register to comment.