RS232 between two BS2
Hanfi
Posts: 2
Hello
So if i want to talk between 2 BasicStamp
with Serin and serout
so i could do it like this
Example:
BS2 number 1:
RXD con 1
Baud con 16624
recchar var byte
TXD con 2
Baud con 16624
pace var 200
loop:
serin RXD, baud, 500, timeout, [noparse][[/noparse]recchar] 'Timeouit=500ms'
goto loop
BS2
TXD con 2
Baud con 16624
pace var 200
RXD con 1
Baud con 16624
recchar var byte
loop:
serout TXD, baud, 500, pace, [noparse][[/noparse]"HELLO",cr]
serin RXD, baud, 500, timeout, [noparse][[/noparse]recchar] 'Timeouit=500ms'
goto loop
pin
1 - 2
2 - 1
vss - vss
okay ?
So if i want to talk between 2 BasicStamp
with Serin and serout
so i could do it like this
Example:
BS2 number 1:
RXD con 1
Baud con 16624
recchar var byte
TXD con 2
Baud con 16624
pace var 200
loop:
serin RXD, baud, 500, timeout, [noparse][[/noparse]recchar] 'Timeouit=500ms'
goto loop
BS2
TXD con 2
Baud con 16624
pace var 200
RXD con 1
Baud con 16624
recchar var byte
loop:
serout TXD, baud, 500, pace, [noparse][[/noparse]"HELLO",cr]
serin RXD, baud, 500, timeout, [noparse][[/noparse]recchar] 'Timeouit=500ms'
goto loop
pin
1 - 2
2 - 1
vss - vss
okay ?
Comments
I would recommend putting a 220 ohm resistor in each lead (pin 1 BS2 #1 to 1K to pin2 BS2 #2 and pin1 BS2 #2 to 1K to pin2 BS2 #1) to protect from accidental damage to the I/O pin if you make a mistake in programming and try to do a SEROUT on both connected pins at the same time.