Help Requested For Serial Data Problem
Keith
Posts: 5
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.
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
·· 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 Williams
Applications Engineer, Parallax
Dallas, TX· USA
·· 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