Help on RS422
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
' {$STAMP BS2sx} ' {$PBASIC 2.5} 'Master send RS422 TX PIN 12 RX PIN 13 Main: HIGH TX DO LOOP UNTIL RX = 1 LOW TX PAUSE 10 'changed from 1 to 10 SEROUT TX,18447,[noparse][[/noparse]"X"] DEBUG "Sent" GOTO Main END' {$STAMP BS2sx} ' {$PBASIC 2.5} 'Slave RS422 TX PIN 12 RX PIN 13 msgIn VAR Byte Main: DO LOOP UNTIL RX = 1 HIGH TX PAUSE 15 SERIN RX,18447,500,TimeOut,[noparse][[/noparse]msgIn] 'Wait for 1/2 sec for serial to start if it doesn't goto TimeOut LOW TX DEBUG ? msgIn END TimeOut: DEBUG "Serial Timed Out",CR, "Restarting",CR GOTO Main ENDIn neither of your listed programs have you any commands to execute·between the DO and the following LOOP,
' {$STAMP BS2sx} ' {$PBASIC 2.5} 'Master send RS422 TX PIN 12 RX PIN 13 HIGH TX [color=red]DO LOOP UNTIL RX = 1[/color] PAUSE 1 SEROUT TX,18447,[noparse][[/noparse]"X"] ENDso 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:
' {$STAMP BS2sx} ' {$PBASIC 2.5} 'Master send RS422 TX PIN 12 RX PIN 13 HIGH TX DO SEROUT TX,18447,[noparse][[/noparse]"X"] PAUSE 10 LOOP UNTIL RX = 1 ENDThere'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.