Help on RS422
RichardF
Posts: 168
I am·trying to learn·RS422 comms using two BS2SX-IC's connected by two LTC 490's. The following·are my super simple master and slave programs, which won't work!! Can anyone see why not?
' {$STAMP BS2sx}
' {$PBASIC 2.5}
'Master send RS422
TX PIN 12
RX PIN 13
HIGH TX
DO
· LOOP UNTIL RX = 1
PAUSE 1
SEROUT TX,18447,[noparse][[/noparse]"X"]
END
' {$STAMP BS2sx}
' {$PBASIC 2.5}
'Slave RS422
TX PIN 12
RX PIN 13
msgIn VAR Byte
DO
· LOOP UNTIL RX = 1
HIGH TX
SERIN RX,18447,[noparse][[/noparse]msgIn]
LOW TX
DEBUG msgIn
END
Thanks for the help,Richard
' {$STAMP BS2sx}
' {$PBASIC 2.5}
'Master send RS422
TX PIN 12
RX PIN 13
HIGH TX
DO
· LOOP UNTIL RX = 1
PAUSE 1
SEROUT TX,18447,[noparse][[/noparse]"X"]
END
' {$STAMP BS2sx}
' {$PBASIC 2.5}
'Slave RS422
TX PIN 12
RX PIN 13
msgIn VAR Byte
DO
· LOOP UNTIL RX = 1
HIGH TX
SERIN RX,18447,[noparse][[/noparse]msgIn]
LOW TX
DEBUG msgIn
END
Thanks for the help,Richard
Comments
Try this
In neither of your listed programs have you any commands to execute·between the DO and the following LOOP,
so it'll just dither that way until RX=1, where it'll serout once and END.· Marzec did it, too.· So, what gives?
The first should be:
There's unfinished business, still.· You have RX Pin 13, but is it an input or an output?· [noparse][[/noparse]SEROUT takes care of TX, forcing it to be·an output.]
The reson I repeated that part of his program is because I believed he was using it as a program hold, and didn't want to completely rewrite his program. Basicaly wait for the other stamp to be ready then progress when it is.