Serial Communication from BasicATOM to BS1 (prop1 board actually)
Blake
Posts: 74
Hey there,
I know that you guys might not know the ins and outs of the ATOM chip, but I at least want to confirm my BS1 code side of things. I have a pin on my basicATOM chip connected to pin 7 of my BS1 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 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:
and my basic Stamp 1 code:
N2400 for the ATOM is: normal (non-inverted) data, no parity, 8 bits, high and lows driven by stamp, 2400 baud.
T2400 for the BS1 is: true data, no parity, 8 bits, 1 stop bit, 2400 baud.
Are these the same?
Any ideas on why this setup isn't working would be awesome. Thanks.
I know that you guys might not know the ins and outs of the ATOM chip, but I at least want to confirm my BS1 code side of things. I have a pin on my basicATOM chip connected to pin 7 of my BS1 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 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:
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:
' {$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.
T2400 for the BS1 is: true data, no parity, 8 bits, 1 stop bit, 2400 baud.
Are these the same?
Any ideas on why this setup isn't working would be awesome. Thanks.
Comments
Regardless of the use of the words "normal", "true", "non-inverting" or "inverting", the different manufacturers may use different (conflicting) names for the same thing.
I'd try changing one of your chips to the opposite format (inverted vs non-inverted) and trying that. I'd also go for straight ttl levels. I assume the ATOM serial is coming off a regular i/o pin.
In your description for the ATOM you say "high and lows driven by stamp" which usually relates to one device "stealing" negative signal levels from the other. That will work when a chip is connected to a PC, but not with two chips. Thats why ttl levels of 0V and 5V will give better results.
Today I will try it with a BS2p40 which I have on hand to see if it will receive the serial information...
What you're trying to do is not complicated, so there should be a simple explanation. See the Help files under SERIN/SEROUT for some examples.