Shop OBEX P1 Docs P2 Docs Learn Events
Help Requested For Serial Data Problem — Parallax Forums

Help Requested For Serial Data Problem

KeithKeith Posts: 5
edited 2005-05-05 22:48 in BASIC Stamp
I'm working with·a network using one BS2 Slave communicating
via RS485 to a second BS2 Master·which is also serially connected
through the programming port to a PC with a Visual Basic front end.
The network operates fine, but when using SEROUT and SERIN
commands to pass a three digit number (example: 555) from the
Slave to the Master (and then on to the VB front end), the number
seen by the Master (and displayed in a DEBUG Screen)·contains a
"+" character (example: 555+). I cannot determine what is causing
this to occur and it's driving me to drink (which ain't really all
that bad). Pertinent parts of my code is below. Any suggestions
would certainly be very much appreciated.

(Slave A Code)
Value·· VAR·· WORD
SEROUT 1,16468,[noparse][[/noparse]("A"),DEC Value,"A"]··· 'Value = 555

(Master Code)
Value·· VAR·· WORD
>SERIN 1,16468, [noparse][[/noparse]WAIT ('A"),DEC Value]····· 'Input from Slave
DEBUG Value
>SEROUT 16,16468,[noparse][[/noparse]Value]········· 'To VB via pin 16

Thanks in advance for any help received.

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-05-05 21:13
    Hello,

    ·· Perhaps you should attach the original code, since there is at least one typo in the pasted code that would prevent it from running as it is.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-05-05 22:27
    You may need to format your output since DEBUG assumes a character, and SEROUT (as in your command to the PC) works with bytes. 555 is bigger than a normal character and would require two bytes to send to the PC.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-05-05 22:48
    Hello,

    ·· You could also just put a DEC in front of the· Value in the DEBUG and the SEROUT in the Master Code section as you have in the Slave Code.· That will allow you to send the digits from the Word variable as you are doing in the first piece of code anyway.· Also, the other Tech mentions to be aware of the echo going back to your VB code for everything you send to the Stamp Module.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
Sign In or Register to comment.