Shop OBEX P1 Docs P2 Docs Learn Events
"Serout" Command help — Parallax Forums

"Serout" Command help

jdoleckijdolecki Posts: 726
edited 2009-01-23 23:02 in BASIC Stamp
My current program uses this line.

SEROUT 15,n9600, [noparse][[/noparse] "Pistol:" ] To display on my LCD.

I want to display a message stored in eeprom, with the "Data" command.


Like this.

msg1· DATA· "Pistol",0
msg2· DATA· "Assault",0
Msg3· DATA· "Sniper",0

So the SEROUT command would look to the eeprom to get the current message.

SEROUT· 15,n9600, [noparse][[/noparse] msg1]

I hope I explained it clearly.
Thanks

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-01-23 21:30
    There is no way to directly display text from the EEPROM. You would need to read a byte from the EEPROM using a READ statement, then output it with a SEROUT and do this in a loop like this:
    address var word
    outByte var byte
    
    address = msg1  ' This sets the variable to the EEPROM address of the first message
    gosub displayIt
    
    ; some where else in the program is:
    
    displayIt:
       read address,outByte  ' Get the byte from the string
       address = address + 1  ' Increment the address
       if outByte = 0 then return  ' Exit at the zero byte
       serout 15,n9600,[noparse][[/noparse]outByte]  ' Output the byte
       goto displayIt  ' Go back for another byte
    
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-01-23 23:02
    Dr Evil,

    This is duplicate thread as you already had one asking about displaying data on your LCD. You should follow up in your original thread in the future rather than starting a new one on the same topic.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
Sign In or Register to comment.