How to send data From BS1 to BS2 using Transceiver?
Luis_P
Posts: 246
· When I got the Transceivers Parallax told me is possible but I can' make it work.
· Please anybody can help? I need a simple code, when a button is pressed on BS1, send value x = 1 to Bs2.
The Transceivers are connected on P0 = Data ·and·· P1= TX/RX
· Thanks! Thanks! Thanks!
Luis
· Please anybody can help? I need a simple code, when a button is pressed on BS1, send value x = 1 to Bs2.
The Transceivers are connected on P0 = Data ·and·· P1= TX/RX
· Thanks! Thanks! Thanks!
Luis
Comments
On the BS2 receive side, there's a SERIN statement with x.highbyte and x.lowbyte and y.highbyte and y.lowbyte. You can replace these with just some byte value x.
Please read the documentation on the SEROUT and SERIN statements in the Stamp Manual and read the section of the Manual on memory usage which explains things like .highbyte and .lowbyte.
BS1 code:
' {$STAMP BS1}
' {$PBASIC 1.0}
' {$PORT COM1}
SYMBOL· Button1············ = 3
SYMBOL· btnWrk········· = B4
SYMBOL x = W1
Check1:
· PAUSE 100
· BUTTON Button1, 1, 255, 20, btnWrk, 0, No_Press
· HIGH 1 'T/R line
· PULSOUT 0, 300 'Sync pulse for the Transceivers
· SEROUT 0, N2400, ("!", x)
· PAUSE 100
· x = 1
· PAUSE 150
No_Press:
· GOTO Check1
'
Bs2 Code:
' {$STAMP BS2}
' {$PBASIC 2.5}
x VAR Byte
LOW 1 ' T/R Line
·DO
· LOW 0
· SERIN 0, 16468, [noparse][[/noparse]WAIT("!"), x]
· HIGH 0
· DEBUG ? x
LOOP
Similarly, the BS2 is also designed to work with either a source of regulated 5V connected to Vdd or a source of 6-9V connected to Vin.
With either Stamp model, if you use a 6-9V supply connected to Vin, you can use some of the regulated 5V available on Vdd. The amount of current available is limited to about 50mA which must include the current needed by the Stamp itself and anything connected to the I/O pins. The Stamp Manual has further information on the amount of current needed by the Stamp itself.
The Bs2 and Bs1 works with a 9V battery beacuse I have the Bord of education with the regulators.
Problem solved Mike!!
Gracias Luis