Hey there,
I have pin2 on my basicATOM chip connected to pin 7 of my BS1 (basic stamp 1) on the prop1 board. The grounds of both boards are tied together, although they use different power supplies.
The basicATOM is always the transmitting chip, and the BS1 prop1 is always receiving. A number from 1 to 9 is the data. Only ever one number at a time, and then a carriage return to show the end the number for the BS1.
This setup does not function. I can debug the BS1 and see that it is ready and waiting for action, and I can debug the ATOM and see that it indeed sends out the correct number from 1 to 9. But the BS1 does not seem to be receiving the information.
I have only tied grounds together and have the one serial wire. No resistors, caps, or anything else.
ATOM code:
Code:
if lvert>200 then '(if left forward)
if rvert>200 then '(if right forward)
serout P2, N2400, [dec 1, CR] '(left and right forward)
elseif rvert<80 '(if right reverse)
serout P2, N2400, [dec 3, CR] '(left forward and right reverse)
else '(if right stopped)
serout P2, N2400, [dec 2, CR] '(just left forward)
endif
elseif lvert<80 '(if left reverse)
if rvert>200 then '(if right forward)
serout P2, N2400, [dec 4, CR] '(left reverse and right forward)
elseif rvert<80 '(if right reverse)
serout P2, N2400, [dec 6, CR] '(left and right reverse)
else '(if right stopped)
serout P2, N2400, [dec 5, CR] '(just left reverse)
endif
else '(if left stopped)
if rvert>200 then '(if right forward)
serout P2, N2400, [dec 7, CR] '(just right forward)
elseif rvert<80 '(if right reverse)
serout P2, N2400, [dec 9, CR] '(just right reverse)
else '(if right stopped)
serout P2, N2400, [dec 8, CR] '(both stopped)
endif
endif
and my basic Stamp 1 code:
Code:
' {$STAMP BS1}
' {$PBASIC 1.0}
'P1 = relay 1, M1 forward (left)
'P2 = relay 2, M1 reverse
'P3 = relay 3, M2 forward (right)
'P4 = relay 4, M2 reverse
SYMBOL direction = B2
Main:
SERIN 7, T2400, #direction
IF direction = 1 THEN bothforward
IF direction = 2 THEN LforwardRstop
IF direction = 3 THEN LforwardRreverse
IF direction = 4 THEN LreverseRforward
IF direction = 5 THEN LreverseRstop
IF direction = 6 THEN bothreverse
IF direction = 7 THEN LstopRforward
IF direction = 8 THEN bothstopped
IF direction = 9 THEN LstopRreverse
GOTO main
bothforward:
LOW 2
LOW 4
HIGH 1
HIGH 3
GOTO main
LforwardRstop:
LOW 2
LOW 3
LOW 4
HIGH 1
GOTO main
LforwardRreverse:
LOW 2
LOW 3
HIGH 1
HIGH 4
GOTO main
LreverseRforward:
LOW 1
LOW 4
HIGH 2
HIGH 3
GOTO main
LreverseRstop:
LOW 1
LOW 3
LOW 4
HIGH 2
GOTO main
bothreverse:
LOW 1
LOW 3
HIGH 2
HIGH 4
GOTO main
LstopRforward:
LOW 1
LOW 2
LOW 4
HIGH 3
GOTO main
bothstopped:
LOW 1
LOW 2
LOW 3
LOW 4
GOTO main
LstopRreverse:
LOW 1
LOW 2
LOW 3
HIGH 4
GOTO main
N2400 for the ATOM is: normal (non-inverted) data, no parity, 8 bits, high and lows driven by stamp, 2400 baud. Is this 1 stop bit also?
T2400 for the BS1 is: true data, no parity, 8 bits, 1 stop bit, 2400 baud.
Aren't these settings the same?
Any ideas on why this setup isn't working would be awesome. Thanks.