Transmission and Reception Problem BS2 :(
A Krish
Posts: 27
Hey Guys ...
I am running in to communication problem, plzzz give me·your suggestions its really urgent...
System Description:
I have·4 BS2 boards loaded with transmitters and receivers (27980 & 27981), Once the BS2 "A" initiates a code, this·should be recieved by BS2 "B", BS2 "C" and BS2 "D". Once BS2"B" and BS2"C" receive this activation code·they start sensing·and if a trigger comes to the sensor, it must transmit code's to BS2 "D".
Problem Statement:
Once BS2 "B" and BS2 "C" have received the activation code from BS2 "A", and have also sensed, they must transmit to BS2"D". Now my problem lies in the communciation.
I am unable to transmit data from BS2 "B" or BS2 "C"·to BS2 "D" after I have received the activation code from BS2 "A".
If i dont use the activation code .. and directly send the data from BS2 "B" and BS2 "C" then I am·able to receive the communication at BS2 "D".
Things I have already performed:
All transmitter and receiver are correctly attached to the BS2 boards. They have been tested with simple transmission and reception programs ..
Code:
BS2 "A"
' {$STAMP BS2}
' {$PBASIC 2.5}
Init:
x VAR Word
y VAR Word
a VAR Word··········· 'Prerssure Sensor
b VAR Word··········· 'PIR sensor
counter VAR Word
sensorpin CON 15
Sensor:
· DO
··· HIGH 15
··· PAUSE 10
··· RCTIME sensorpin,1,a
····· IF ((IN1 = 1) & (a > 100)) THEN········· 'IN1 is the input pin of PIR sensor
······· DEBUG "In Transmit Mode",LF,CR
······· PAUSE 3000
······· GOSUB Transmit
····· ELSE
······· DEBUG " In Sensor Mode",LF,CR
······· PAUSE 100
······· GOSUB Sensor
····· ENDIF
· LOOP
END
Transmit:····· ' Control passes to this section only when both the sensors sense a movement.
· x = 1011····· ' Data to be transmitted
··· PULSOUT 6, 1200
··· SEROUT 6,16780,[noparse][[/noparse]"!",DEC x,CR]
··· DEBUG ? x,LF,CR
··· GOSUB Sensor
BS2 "B"
' {$STAMP BS2}
' {$PBASIC 2.5}
Init:
x VAR Word
y VAR Word
a VAR Word··········· 'Prerssure Sensor
b VAR Word··········· 'PIR sensor
t VAR Word
counter VAR Word
sensorpin CON 15
Receive:
· DO
··· HIGH 0
··· SERIN 12,16780,300,Receive,[noparse][[/noparse]WAIT("!"),DEC4 y]
··· DEBUG ? y,LF,CR
··· LOW 0
····· IF ( y = 1011 ) THEN················· ' y = 1011 signifies that the sensor needs to be in full power mode
··········································· ' that is all the sensors would be in action to sense movement.
······· DEBUG "Get Awake",LF,CR
······· GOTO Sensor
····· ENDIF
· LOOP
GOTO Sensor
Sensor:
· DO
··· HIGH 15
··· PAUSE 10
··· RCTIME sensorpin,1,a
····· IF ((IN1 = 1) & (a > 100)) THEN
······· DEBUG "In Transmit Mode",LF,CR
······· GOSUB Transmit
····· ELSE
······· DEBUG " In Sensor Mode",LF,CR
······· PAUSE 1000
······· GOSUB Sensor
····· ENDIF
· LOOP
RETURN
Transmit:····· ' Control passes to this section only when both the sensors sense a movement.
··· x = 1010····· ' Data to be transmitted
··· PULSOUT 6, 1200
··· SEROUT 6,16780,[noparse][[/noparse]"!",DEC x,CR]
··· DEBUG ? x,LF,CR
··· GOTO Sensor
RETURN
BS2 "C"
' {$STAMP BS2}
' {$PBASIC 2.5}
Init:
x VAR Word
y VAR Word
a VAR Word··········· 'Prerssure Sensor
b VAR Word··········· 'PIR sensor
counter VAR Word
sensorpin CON 15
Receive:
· DO
··· HIGH 0
··· SERIN 12,16780,300,Receive,[noparse][[/noparse]WAIT("!"),DEC4 y]
··· DEBUG ? y,LF,CR
··· LOW 0
····· IF ( y = 1011 ) THEN················· ' y = 1100 signifies that the sensor needs to be in full power mode
··················································· ' that is all the sensors would be in action to sense movement.
······· DEBUG "Get Awake",LF,CR
······· GOTO Sensor
····· ENDIF
· LOOP
GOTO Sensor
Sensor:
· DO
··· HIGH 15
··· PAUSE 10
··· RCTIME sensorpin,1,a
····· IF ((IN1 = 1) & (a > 100)) THEN
······· DEBUG "In Transmit Mode",LF,CR
······· GOSUB Transmit
····· ELSE
······· DEBUG " In Sensor Mode",LF,CR
······· PAUSE 1000
······· GOSUB Sensor
····· ENDIF
· LOOP
RETURN
Transmit:····· ' Control passes to this section only when both the sensors sense a movement.
· x = 1001····· ' Data to be transmitted
··· PULSOUT 6, 1200
··· SEROUT 6,16780,[noparse][[/noparse]"!",DEC x,CR]
··· PAUSE 1000
··· GOTO Sensor
RETURN
BS2 "D"
' {$STAMP BS2}
' {$PBASIC 2.5}
Init:
x VAR Word
y VAR Word
Receive:
· DO
··· HIGH 0
··· SERIN 12,16780,100,Receive,[noparse][[/noparse]WAIT("!"),DEC4 x]
··· LOW 0
··· IF (x = 1010) THEN······························· ' Left Sub System
······· GOSUB Leftapproach
····· ELSEIF (x = 1001) THEN························· ' Right Sub System
······· GOSUB Rightapproach
····· ELSEIF (x = 1011) THEN························· ' Sleep Sub System
······· GOSUB Sleepsystem
··· ENDIF
· LOOP
Leftapproach:
· DEBUG " Vehicle approaching from the Left Side ",LF,CR
· 'DEBUG ? x
· GOTO Receive
Rightapproach:
· DEBUG " Vehicle approaching from the Right Side ",LF,CR
· 'DEBUG ? x
· GOTO Receive
Sleepsystem:
· DEBUG " Vehicle trying to merge with the highway ",LF,CR
· 'DEBUG ? x
· GOTO Transmit
Transmit:
· y = 1011
· PULSOUT 6,1200
· SEROUT 6,16780,[noparse][[/noparse]"!",DEC y,LF,CR]
· DEBUG " Wake up sub system 2 and Sub system 3 ",LF,CR
· GOTO Receive
· RETURN
Thanks in advance for your help ......
I am running in to communication problem, plzzz give me·your suggestions its really urgent...
System Description:
I have·4 BS2 boards loaded with transmitters and receivers (27980 & 27981), Once the BS2 "A" initiates a code, this·should be recieved by BS2 "B", BS2 "C" and BS2 "D". Once BS2"B" and BS2"C" receive this activation code·they start sensing·and if a trigger comes to the sensor, it must transmit code's to BS2 "D".
Problem Statement:
Once BS2 "B" and BS2 "C" have received the activation code from BS2 "A", and have also sensed, they must transmit to BS2"D". Now my problem lies in the communciation.
I am unable to transmit data from BS2 "B" or BS2 "C"·to BS2 "D" after I have received the activation code from BS2 "A".
If i dont use the activation code .. and directly send the data from BS2 "B" and BS2 "C" then I am·able to receive the communication at BS2 "D".
Things I have already performed:
All transmitter and receiver are correctly attached to the BS2 boards. They have been tested with simple transmission and reception programs ..
Code:
BS2 "A"
' {$STAMP BS2}
' {$PBASIC 2.5}
Init:
x VAR Word
y VAR Word
a VAR Word··········· 'Prerssure Sensor
b VAR Word··········· 'PIR sensor
counter VAR Word
sensorpin CON 15
Sensor:
· DO
··· HIGH 15
··· PAUSE 10
··· RCTIME sensorpin,1,a
····· IF ((IN1 = 1) & (a > 100)) THEN········· 'IN1 is the input pin of PIR sensor
······· DEBUG "In Transmit Mode",LF,CR
······· PAUSE 3000
······· GOSUB Transmit
····· ELSE
······· DEBUG " In Sensor Mode",LF,CR
······· PAUSE 100
······· GOSUB Sensor
····· ENDIF
· LOOP
END
Transmit:····· ' Control passes to this section only when both the sensors sense a movement.
· x = 1011····· ' Data to be transmitted
··· PULSOUT 6, 1200
··· SEROUT 6,16780,[noparse][[/noparse]"!",DEC x,CR]
··· DEBUG ? x,LF,CR
··· GOSUB Sensor
BS2 "B"
' {$STAMP BS2}
' {$PBASIC 2.5}
Init:
x VAR Word
y VAR Word
a VAR Word··········· 'Prerssure Sensor
b VAR Word··········· 'PIR sensor
t VAR Word
counter VAR Word
sensorpin CON 15
Receive:
· DO
··· HIGH 0
··· SERIN 12,16780,300,Receive,[noparse][[/noparse]WAIT("!"),DEC4 y]
··· DEBUG ? y,LF,CR
··· LOW 0
····· IF ( y = 1011 ) THEN················· ' y = 1011 signifies that the sensor needs to be in full power mode
··········································· ' that is all the sensors would be in action to sense movement.
······· DEBUG "Get Awake",LF,CR
······· GOTO Sensor
····· ENDIF
· LOOP
GOTO Sensor
Sensor:
· DO
··· HIGH 15
··· PAUSE 10
··· RCTIME sensorpin,1,a
····· IF ((IN1 = 1) & (a > 100)) THEN
······· DEBUG "In Transmit Mode",LF,CR
······· GOSUB Transmit
····· ELSE
······· DEBUG " In Sensor Mode",LF,CR
······· PAUSE 1000
······· GOSUB Sensor
····· ENDIF
· LOOP
RETURN
Transmit:····· ' Control passes to this section only when both the sensors sense a movement.
··· x = 1010····· ' Data to be transmitted
··· PULSOUT 6, 1200
··· SEROUT 6,16780,[noparse][[/noparse]"!",DEC x,CR]
··· DEBUG ? x,LF,CR
··· GOTO Sensor
RETURN
BS2 "C"
' {$STAMP BS2}
' {$PBASIC 2.5}
Init:
x VAR Word
y VAR Word
a VAR Word··········· 'Prerssure Sensor
b VAR Word··········· 'PIR sensor
counter VAR Word
sensorpin CON 15
Receive:
· DO
··· HIGH 0
··· SERIN 12,16780,300,Receive,[noparse][[/noparse]WAIT("!"),DEC4 y]
··· DEBUG ? y,LF,CR
··· LOW 0
····· IF ( y = 1011 ) THEN················· ' y = 1100 signifies that the sensor needs to be in full power mode
··················································· ' that is all the sensors would be in action to sense movement.
······· DEBUG "Get Awake",LF,CR
······· GOTO Sensor
····· ENDIF
· LOOP
GOTO Sensor
Sensor:
· DO
··· HIGH 15
··· PAUSE 10
··· RCTIME sensorpin,1,a
····· IF ((IN1 = 1) & (a > 100)) THEN
······· DEBUG "In Transmit Mode",LF,CR
······· GOSUB Transmit
····· ELSE
······· DEBUG " In Sensor Mode",LF,CR
······· PAUSE 1000
······· GOSUB Sensor
····· ENDIF
· LOOP
RETURN
Transmit:····· ' Control passes to this section only when both the sensors sense a movement.
· x = 1001····· ' Data to be transmitted
··· PULSOUT 6, 1200
··· SEROUT 6,16780,[noparse][[/noparse]"!",DEC x,CR]
··· PAUSE 1000
··· GOTO Sensor
RETURN
BS2 "D"
' {$STAMP BS2}
' {$PBASIC 2.5}
Init:
x VAR Word
y VAR Word
Receive:
· DO
··· HIGH 0
··· SERIN 12,16780,100,Receive,[noparse][[/noparse]WAIT("!"),DEC4 x]
··· LOW 0
··· IF (x = 1010) THEN······························· ' Left Sub System
······· GOSUB Leftapproach
····· ELSEIF (x = 1001) THEN························· ' Right Sub System
······· GOSUB Rightapproach
····· ELSEIF (x = 1011) THEN························· ' Sleep Sub System
······· GOSUB Sleepsystem
··· ENDIF
· LOOP
Leftapproach:
· DEBUG " Vehicle approaching from the Left Side ",LF,CR
· 'DEBUG ? x
· GOTO Receive
Rightapproach:
· DEBUG " Vehicle approaching from the Right Side ",LF,CR
· 'DEBUG ? x
· GOTO Receive
Sleepsystem:
· DEBUG " Vehicle trying to merge with the highway ",LF,CR
· 'DEBUG ? x
· GOTO Transmit
Transmit:
· y = 1011
· PULSOUT 6,1200
· SEROUT 6,16780,[noparse][[/noparse]"!",DEC y,LF,CR]
· DEBUG " Wake up sub system 2 and Sub system 3 ",LF,CR
· GOTO Receive
· RETURN
Thanks in advance for your help ......
Comments
You could also use the PDN (Power Down) pin on the transmitter to turn it off (with LOW x).
Post Edited (Mike Green) : 4/3/2008 11:22:30 PM GMT
The point is ... if I make the BS2 "B", BS2 "C" work without the data accepted from BS2 "A" then data is being successfully transmitted and received by BS2 "D".
What I am not sure of is... when I receive the data from BS2 "A" in "BS2"B" and Bs2"C" .... do i have to adds some code to it .. coz i am only recieving in BS2"D" data from Bs2 "A" .. not continuos but when ever there is a trigger at the sensor ...
I believe that, after "A" has sent its data, the transmitter remains on and interferes with "B" and "C" sending a response to sensor input. Note that "B" and "C" can not transmit at the same time.
It would work better if only one unit is a "master", like "A". "A" can send a signal to "B" or to "C", maybe by including the letter of the unit in the message. One message tells "B" to turn on its sensor and take a reading. Another message might tell "C" to do the same. A third message tells "B" to transmit its result back to "A" after a short delay for "A" to turn off its transmitter. A fourth message tells "C" to do the same.
I know at a time only one thing would take place either transmission or reception ..... and in this code i beleive i am following that ...
What I understand the problem is in the SEROUT and SERIN command... I mean once BS2"B" and BS2 "C"·receives and gets active .. BS2"D" does not receive data from BS2 "B" and BS2 "C"....
Please read the query carefully .. I think you are misunderstanding me .. I really appricate for your efforts .. plzzz have a look at the problem statement ..
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
I am unable to do this part .. If you feel there is a problem with the Returns can you plzzz let me know a few ... coz I am new to this ...really appreciate your efforts ...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
Post Edit -- Could "A" be used to key the transmissions from "B" and "C"?
Post Edited (PJ Allen) : 4/5/2008 12:49:51 AM GMT
However when I make BS2 "A" activate BS2 "B" or BS2 "C" ... I do receive the activation code on these BS2's and the sensors start sensing but .. then the transmission from BS2 "B" and BS2 "C" is not received by BS2 "D" ...
I am sure this is a piculiar problem .. what I understand is .. thers is some issue with the Serout and Serin code ... that I have given ... and I am failing to undertstand that ...
See how that works.
Post Edit -- This is how I figure your current situation:
Post Edited (PJ Allen) : 4/5/2008 3:35:59 PM GMT
You have pictured the process correctly .... .. but the whole purpose gets defeated if BS2"A" only asks BS2 "B" and BS2 "C" to send data to BS2 "D" .. coz ... I need independently BS2 "B" and BS2 "C" to send data to BS2"D" i.e. only when it senses a pulse from the sensors ...
First, try with only·A, B, and D (no C, it's Off.)· "Works"?· Y/N
Then try with only A, C, and D (no B, it's Off.)· "Works"?· Y/N
case 1:
BS2 "A", BS2 "B" and BS2"D" only ON... i.e. no BS2"C" ... Once BS2 "B" is activated by BS2"A" it should send msg .... but i dont see any msg on BS2 "D" ..
case 2:
BS2 "A", BS2 "C" and BS2"D" only ON... i.e. no BS2"B" ... Once BS2 "C" is activated by BS2"A" it should send msg .... but i dont see any msg on BS2 "D" ..
case 3:
If I change the program in such a way that BS2 "B", BS2 "C" and BS2 "A" all transmit data to BS2"D" then I am receiving data in BS2 "D" ....
I think there is some problem in receiveing and then transmitting .. coz .. right now I am first receiving data from BS2"A" and then transmitting to BS2 "D" from BS2 "B" and BS2 "C" and meanwhile BS2 "D" has also received data from BS2 "A" .....
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
DO
HIGH 0
SERIN 12,16780,100,Receive,[noparse][[/noparse]WAIT("!"),DEC4 x]
LOW 0
IF (x = 1010) THEN ' Left Sub System
GOSUB Leftapproach
ELSEIF (x = 1001) THEN ' Right Sub System
GOSUB Rightapproach
ELSEIF (x = 1011) THEN ' Sleep Sub System <
HERE
GOSUB Sleepsystem
ENDIF
LOOP
Won't this put D into the sleepsystem as soon as A transmits 1011? It doesn't look like this would keep it from working, but makes it look like the flow would be A triggers B and C sensors and also puts D in sleepsystem, preventing it from receiving leftapproach or rightapproach on the first pass. The sleepsystem transmits 1011 and wakes up B and C, which would THEN trigger D on the 2nd pass. You've proabably tried 4,000 consecutive passes by now but I thought I'd point it out.
In "D," I think you could take out:
ELSEIF (x = 1011) THEN ' Sleep Sub System
GOSUB Sleepsystem
And also:
Sleepsystem:
DEBUG " Vehicle trying to merge with the highway ",LF,CR
'DEBUG ? x
GOTO Transmit
Transmit:
y = 1011
PULSOUT 6,1200
SEROUT 6,16780,[noparse][[/noparse]"!",DEC y,LF,CR]
DEBUG " Wake up sub system 2 and Sub system 3 ",LF,CR
GOTO Receive
RETURN
If you want the "Vehicle trying to merge with the highway" debug then put it in "A" and display it the same time you transmit 1011 to B and C.
Post Edit -- If "D" is knocking out a !1011 because it got a !1011 (at the same time as "B" and "C"), it could be at the end of this message when "B" and/or "C" knock out their sensor response/s;·the conflict I'd alluded to.
Post Edited (PJ Allen) : 4/6/2008 3:43:31 PM GMT