Shop OBEX P1 Docs P2 Docs Learn Events
Sending serial messages to LCD — Parallax Forums

Sending serial messages to LCD

ArchiverArchiver Posts: 46,084
edited 2000-10-31 11:22 in General Discussion
Hi everybody,

This is my first time using the group so be gentle with me!

I need to send messages to a serial display from scott edwards - no
problem I hear you say! In total there are about 20 different
messages that need to be called depending on the status of the I/O
pins. At the moment I have to re-write the SEROUT command for every
message, which is messy and time consuming. Is it possible to store
the messages, e.g. 'cover open' in a string and have a GOSUB to the
sending routine. In theory this would save on program space and my
fingers, it would also make it easier to select different languages
from a menu.

Any suggestions?

Thanks

Jon

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2000-10-31 11:22
    In a message dated 10/31/00 3:09:51 AM Central Standard Time,
    jon_millard@p... writes:

    > I need to send messages to a serial display from scott edwards - no
    > problem I hear you say! In total there are about 20 different
    > messages that need to be called depending on the status of the I/O
    > pins. At the moment I have to re-write the SEROUT command for every
    > message, which is messy and time consuming. Is it possible to store
    > the messages, e.g. 'cover open' in a string and have a GOSUB to the
    > sending routine. In theory this would save on program space and my
    > fingers, it would also make it easier to select different languages
    > from a menu.
    >
    > Any suggestions?

    You can store your strings in DATA statements, terminating each with a zero.
    Then, create a subroutine that takes the address of the string (its label)
    and reads each character from the EE until a zero is found. I use this
    technique all the time.

    addr VAR Word
    char VAR Byte

    Msg1 DATA "Cover open", 0
    Msg2 DATA "The BASIC Stamp rules!", 0

    Start:
    addr = Msg2
    GOSUB PrintIt
    END

    PrintIt:
    READ addr, char
    IF char = 0 THEN PrintItDone
    SEROUT Spin, Sbaud, [noparse][[/noparse]char]
    addr = addr + 1
    GOTO PrintIt
    PrintItDone:
    RETURN
Sign In or Register to comment.