parallaxinc / Simple-Libraries

Contents of the SimpleIDE workspace folder and its Parallax Learn Simple Libraries subfolder.
http://learn.parallax.com/propeller-c-set-simpleide/update-your-learn-folder
21 stars 20 forks source link

simpletext writeStr does not appear to send terminating char #39

Closed MatzElectronics closed 8 years ago

MatzElectronics commented 8 years ago

When I used writeStr() and readStr() together, I had to send a send a 0 (null) character after the string. Otherwise readStr() filled it's limit with the send string in a sort of loop.

AndyLindsay commented 8 years ago

A terminating character should be appended to the string that gets sent, typically \r or \n. This keeps writeStr compatible with more receiving devices. By automatically adding a 0 to the string that gets sent, it would make it difficult to communicate with devices for which \0x0 has a different meaning. That is why the onus is on the sender to append the correct terminating character for the intended receiving device.

AndyLindsay commented 8 years ago

P.S. Off the top of my head, examples of receiving devices where 0x00 has another meaning include the Parallax Serial LCD, XBee, and Parallax software terminals.

MatzElectronics commented 8 years ago

Good to know. It's easy to just append the zero.

On Sep 4, 2016 10:09 AM, "Andy Lindsay" notifications@github.com wrote:

P.S. Off the top of my head, examples of receiving devices where 0x00 has another meaning include the Parallax Serial LCD, XBee, and Parallax software terminals.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/parallaxinc/Simple-Libraries/issues/39#issuecomment-244615138, or mute the thread https://github.com/notifications/unsubscribe-auth/AS0quKvhw2IobUKTR-YzAHG5k2uIo5cfks5qmvtOgaJpZM4J0fgy .

MatzElectronics commented 8 years ago

Go ahead and close the issue... I know now how I want to handle this. Thanks!

On Sep 4, 2016 10:35 AM, "Matt Matz" mmatz@parallax.com wrote:

Good to know. It's easy to just append the zero.

On Sep 4, 2016 10:09 AM, "Andy Lindsay" notifications@github.com wrote:

P.S. Off the top of my head, examples of receiving devices where 0x00 has another meaning include the Parallax Serial LCD, XBee, and Parallax software terminals.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/parallaxinc/Simple-Libraries/issues/39#issuecomment-244615138, or mute the thread https://github.com/notifications/unsubscribe-auth/AS0quKvhw2IobUKTR-YzAHG5k2uIo5cfks5qmvtOgaJpZM4J0fgy .

AndyLindsay commented 8 years ago

Okay, thanks Matt.