PDA

View Full Version : How to send data From BS1 to BS2 using Transceiver?



Luis_P
02-03-2010, 11:54 PM
· 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!http://forums.parallax.com/images/smilies/shakehead.gif
Luis

Mike Green
02-04-2010, 12:02 AM
The documentation for the transceivers (www.parallax.com/Portals/0/Downloads/docs/prod/rf/27982-433MHzRFTransceiver-v1.1.pdf (http://www.parallax.com/Portals/0/Downloads/docs/prod/rf/27982-433MHzRFTransceiver-v1.1.pdf)) has sample programs for both the BS1 and the BS2. You can use the BS1 transmit example with the BS2 receive example. Start with those. Try them. Figure out how they work (they're very simple), then modify them to do what you want.

Mike Green
02-04-2010, 02:30 AM
The BS1 transmit example shows a SEROUT statement with B3, B2, B5, B4 as the operands after the "!". These are the most significant byte and least significant byte of W1 (read the Stamp Manual for details). Similarly, B5 and B4 are the MSB and LSB of W2. You can replace these with just some byte value x.

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.

Mike Green
02-04-2010, 08:42 AM
The biggest problem is that the BS1 transmit program is using the same memory location for the BUTTON workarea and the variable x. B2 is the least significant byte of W1. Either change B2 to B4 or change W1 to W2 (not both)

Luis_P
02-05-2010, 01:45 AM
Looks like the tranceivers really do not work I will call Parallax. I have TX connected to P1 of BS1, I Have RX connected to P1 of BS2, P0 is the data on both chips I have 3.3 V on Bs1 and 5V on Bs2 connected to VIN and Ground. I Have a button on P3 (Bs1) to send the data, I tested the button and works,·this·are the·codes on both and I just get a bunch of random numbers for x on the debug screen. Frustration for me....http://forums.parallax.com/images/smilies/sad.gif

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, [WAIT("!"), x]
· HIGH 0
· DEBUG ? x
LOOP

Mike Green
02-05-2010, 02:10 AM
The BS1 is designed to work with Vdd = 5V. You cannot run it with a supply voltage of 3.3V. It won't work. There is an on-module voltage regulator that you can use if you connect a voltage from 6-9V to Vin. Read the Stamp Manual for details.

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.

Luis_P
02-05-2010, 04:42 AM
When I mentioned the voltage·I was talking about the transceivers (3.3V to 5V) .Sorry

The Bs2 and Bs1 works with a 9V battery beacuse I have the Bord of education with the regulators.

Luis_P
02-05-2010, 05:15 AM
I know now why doesn't work,. The speed!!!! the Bs2 baud to communicate to Bs1 should be changed to 16780.
Problem solved Mike!!

Gracias Luis