RF Transceivers --- HELP!
Archiver
Posts: 46,084
Hello:
I have two 433 MHz Transceivers from parallax. Because they are on
the same frequency I can not get them to talk to eachother at the
same time..
I am tring to make it so that one transmits and one receives at a
time without using the MASTER/SLAVE code with data packets since that
is really too complicated for what I am trying to do.
Right now the program only runs once and does not seems to loop, my
sensor is only read once (it's name is "sendVar" in AdcData)
BELOW IS THE CODE, if anyone can help::::
'
'-- This is module 2
'-- MODULE 1 SENDS THE FIRST SIGNAL
'--
'
'{$STAMP BS2sx}
'{$PORT COM1}
sendVar VAR BYTE ' Variable from sensor
receiveVar VAR BYTE ' The status of the module
statusVar VAR BYTE
CS1 CON 0
CLK1 CON 1
D1 CON 2
PWMout CON 11
RX CON 9
TX CON 8
I9600 CON 16624 '$40F0 'Inverted 9600, no parity,
8bits baudrate code for BSIISX
PWM9600 CON 240 'True 9600, no parity, 8bits baudrate
code for BSIISX
'
'-- INITIALIZE
'
Initialize:
statusVar = "X" ' MODULE 1 Send
'
'-- MAIN ROUTINE
'
Main:
goSub AdcData
goSub statusDATA
GOTO Main
'
'-- ADC DATA
'
AdcData:
high CS1
low CS1
low CLK1
pulsout CLK1,210
shiftin D1,CLK1,msbpost, [noparse][[/noparse]sendVar\8]
DEBUG home, "sendVar: ",DEC3 sendVar,CR
'massage the number/math
'sendVar = sendVar/(+-ABS)
'SEROUT ADC reading(s)
RETURN:
'
'-- CHECK TO EITHER SEND OR RECEIVE
'
statusDATA:
SERIN RX, I9600, [noparse][[/noparse]WAIT (statusVAR)] 'Wait for the
statusVar to see what it is
IF statusVar = "X" THEN ReceiveDATA ' X - module
1 is sending
IF statusVar = "Y" THEN SendDATA ' Y - module
1 is receiving
IF statusVar = "A" THEN ReceiveDATA ' A - module
2 is receiving
IF statusVar = "B" THEN SendDATA ' B - module
2 is sending
RETURN:
'
'-- SEND A MESSAGE - DO NOT RECEIVE
'
SendDATA:
PAUSE 20
SEROUT TX, I9600, [noparse][[/noparse]"statusVar"] ' Send letter
X which tells the other module to recieve
' this data
SEROUT TX, I9600, [noparse][[/noparse]sendVar]
DEBUG home, "Sending: ",DEC3 sendVar,CR
PAUSE 30
RETURN:
'
'-- RECEIVE A MESSAGE - DO NOT SEND
'
ReceiveDATA:
SEROUT TX, I9600, [noparse][[/noparse]"statusVar"] ' Send letter
Y which tells the other module to send
' Tells this
module to receive
SERIN RX, I9600, [noparse][[/noparse]receiveVar]
DEBUG "Receiving: ",DEC3 receiveVar,CR
pause 50
'Serout to PWM CHIP/OUTPUT/PELTIER
'Serout PWMout, PWM9600
'XXXXXXXXXXX
'XXXXXXXXXXX
RETURN:
I have two 433 MHz Transceivers from parallax. Because they are on
the same frequency I can not get them to talk to eachother at the
same time..
I am tring to make it so that one transmits and one receives at a
time without using the MASTER/SLAVE code with data packets since that
is really too complicated for what I am trying to do.
Right now the program only runs once and does not seems to loop, my
sensor is only read once (it's name is "sendVar" in AdcData)
BELOW IS THE CODE, if anyone can help::::
'
'-- This is module 2
'-- MODULE 1 SENDS THE FIRST SIGNAL
'--
'
'{$STAMP BS2sx}
'{$PORT COM1}
sendVar VAR BYTE ' Variable from sensor
receiveVar VAR BYTE ' The status of the module
statusVar VAR BYTE
CS1 CON 0
CLK1 CON 1
D1 CON 2
PWMout CON 11
RX CON 9
TX CON 8
I9600 CON 16624 '$40F0 'Inverted 9600, no parity,
8bits baudrate code for BSIISX
PWM9600 CON 240 'True 9600, no parity, 8bits baudrate
code for BSIISX
'
'-- INITIALIZE
'
Initialize:
statusVar = "X" ' MODULE 1 Send
'
'-- MAIN ROUTINE
'
Main:
goSub AdcData
goSub statusDATA
GOTO Main
'
'-- ADC DATA
'
AdcData:
high CS1
low CS1
low CLK1
pulsout CLK1,210
shiftin D1,CLK1,msbpost, [noparse][[/noparse]sendVar\8]
DEBUG home, "sendVar: ",DEC3 sendVar,CR
'massage the number/math
'sendVar = sendVar/(+-ABS)
'SEROUT ADC reading(s)
RETURN:
'
'-- CHECK TO EITHER SEND OR RECEIVE
'
statusDATA:
SERIN RX, I9600, [noparse][[/noparse]WAIT (statusVAR)] 'Wait for the
statusVar to see what it is
IF statusVar = "X" THEN ReceiveDATA ' X - module
1 is sending
IF statusVar = "Y" THEN SendDATA ' Y - module
1 is receiving
IF statusVar = "A" THEN ReceiveDATA ' A - module
2 is receiving
IF statusVar = "B" THEN SendDATA ' B - module
2 is sending
RETURN:
'
'-- SEND A MESSAGE - DO NOT RECEIVE
'
SendDATA:
PAUSE 20
SEROUT TX, I9600, [noparse][[/noparse]"statusVar"] ' Send letter
X which tells the other module to recieve
' this data
SEROUT TX, I9600, [noparse][[/noparse]sendVar]
DEBUG home, "Sending: ",DEC3 sendVar,CR
PAUSE 30
RETURN:
'
'-- RECEIVE A MESSAGE - DO NOT SEND
'
ReceiveDATA:
SEROUT TX, I9600, [noparse][[/noparse]"statusVar"] ' Send letter
Y which tells the other module to send
' Tells this
module to receive
SERIN RX, I9600, [noparse][[/noparse]receiveVar]
DEBUG "Receiving: ",DEC3 receiveVar,CR
pause 50
'Serout to PWM CHIP/OUTPUT/PELTIER
'Serout PWMout, PWM9600
'XXXXXXXXXXX
'XXXXXXXXXXX
RETURN:
Comments
they both listen. When one is set to transmit it's receive function is
temporarily disabled until the transmit function is complete.
It sounds like you want a full duplex circuit. Then both channels are
active. For this purpose you need a separate transmitter and receiver at
both circuit ends operating at two different carrier frequencies.
Is there a way to have the transceivers switch between receive and
send based on input information?
- Alison
--- In basicstamps@yahoogroups.com, "Stephen H Chapman"
<chapman@t...> wrote:
> A transceiver acts as a half duplex circuit. In the idle or
receive mode
> they both listen. When one is set to transmit it's receive
function is
> temporarily disabled until the transmit function is complete.
> It sounds like you want a full duplex circuit. Then both channels
are
> active. For this purpose you need a separate transmitter and
receiver at
> both circuit ends operating at two different carrier frequencies.