Shop OBEX P1 Docs P2 Docs Learn Events
serout question — Parallax Forums

serout question

basicstampedebasicstampede Posts: 214
edited 2006-10-19 13:18 in BASIC Stamp
How do I do this?

I need to ask user to enter a text character, then I need to send it out using serout.

For example, the user may type "I love basic stamps".· Then I have to send out

Say CON $00
EOM CON $AA
serout tx, baud, [noparse][[/noparse]Say, "I love basic stamps", EOM]

This is for a EMIC board.

I've read the example program.· It shows a constant string stored in EEPROM.

However, I wish to modify the program so that EMIC says what the user types.· The length of the message may vary.

Any insight would be appreciated.·

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2006-10-19 13:00
    Check out the "STR" modifier, and BYTE arrays.
  • Tom WalkerTom Walker Posts: 509
    edited 2006-10-19 13:18
    I am assuming that you are using the "vanilla" BS2 which has NO native string handling capabilities and 26 bytes of variable space. Each character received by SERIN could be assigned to ta different variable, but then you would be limited to VERY short strings. I haven't looked at the timing requirements of the EMIC, but you might get away with something like the following mutated pseudo-code:

    Serin character
    If chracter is not equal to return then Serout Say
    While character is not equal to return
    Serout character
    Serin character
    end while
    serout EOM

    In essence, you would build your string on the fly on the EMIC. As I said, this would heavily depend on the timing requirements of the EMIC.

    The same kind of concept could more easily be handled by one of the BS2s with "Scratchpad" RAM and the STR capabilities.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Truly Understand the Fundamentals and the Path will be so much easier...
Sign In or Register to comment.