Transceiver communication failure still not solved!
Luis_P
Posts: 246
· This is cracking my head! a simple RF transciver remote control with only one button and is not working!! the problem is that external noises activate the receiver and get into "my code". I know there is some examples about checksum (error check) but is to complicate for a simple code like mine. Too bad Parallax doesn't provide and example to send one value and check for errors. My remote control use BS1 with Transceiver (transmitter) and Bs2 as a receiver. I use Bs1 because is small and cheap.
This is what I have so far. Please help!!!
·{$STAMP BS1}
··
SYMBOL x1 = B2 ' variable to send value
Check1:
· PAUSE 100
· IF· PIN2 = 1 THEN press1· 'bs1 button if is high then go and send value
GOTO Check1
··· press1:
··· x1 =·$A5
···· HIGH 5····'Vdd line on - Receiver on
··· PAUSE 200
··· HIGH 1· 'T/R line
··· PULSOUT 0, 300 'Sync pulse for the Transceivers
··· SEROUT 0, N2400, ("!", x1)· ' send value of x1 ($A5)
··· PAUSE 150
··· LOW 5····· '+ line off - receiver off
··· PAUSE 200
'====================================================
The Bs2 is connected to another transceiver the loop is waiting for a signal, when I press button on BS1 (pin2) is out of the loop and goes to my code. This is the code for Bs2:
' {$STAMP BS2}··
LOW 1 ' T/R Line
DO
· LOW 0
· SERIN 0, 16780, [noparse][[/noparse]WAIT("!"), x1]
· HIGH 0
· IF x1 = $A5 THEN GOTO Main_Code
·
LOOP
Main_Code:
··· 'My code goes here
Notes:
·Will be nice to know what [noparse][[/noparse]WAIT("!"), x1] means and how to add a simple error check that only my remote control can get out of the loop on the BS2.
Gracias!!
Post Edited (Luis_P) : 5/26/2010 3:37:10 PM GMT
This is what I have so far. Please help!!!
·{$STAMP BS1}
··
SYMBOL x1 = B2 ' variable to send value
Check1:
· PAUSE 100
· IF· PIN2 = 1 THEN press1· 'bs1 button if is high then go and send value
GOTO Check1
··· press1:
··· x1 =·$A5
···· HIGH 5····'Vdd line on - Receiver on
··· PAUSE 200
··· HIGH 1· 'T/R line
··· PULSOUT 0, 300 'Sync pulse for the Transceivers
··· SEROUT 0, N2400, ("!", x1)· ' send value of x1 ($A5)
··· PAUSE 150
··· LOW 5····· '+ line off - receiver off
··· PAUSE 200
'====================================================
The Bs2 is connected to another transceiver the loop is waiting for a signal, when I press button on BS1 (pin2) is out of the loop and goes to my code. This is the code for Bs2:
' {$STAMP BS2}··
LOW 1 ' T/R Line
DO
· LOW 0
· SERIN 0, 16780, [noparse][[/noparse]WAIT("!"), x1]
· HIGH 0
· IF x1 = $A5 THEN GOTO Main_Code
·
LOOP
Main_Code:
··· 'My code goes here
Notes:
·Will be nice to know what [noparse][[/noparse]WAIT("!"), x1] means and how to add a simple error check that only my remote control can get out of the loop on the BS2.
Gracias!!
Post Edited (Luis_P) : 5/26/2010 3:37:10 PM GMT
Comments
DEBUG x1
(Stick that in after the "SERIN 0, 16780, [noparse][[/noparse]WAIT("!"), x1]" line.
Then you will be able to "see" what is being received·at the receiver end.
The value of x1 will be displayed on the debug screen.
If you are getting a lot of garbage due to external noise, you can place the transmitter close to the receiver, then place aluminum foil on the sides and top of the two making a "tunnel" between the two.
The aluminum foil would block external signals and the receiver should then be quiet except for the signals you send.
Then you should be able to see if your basic setup on both ends is working or not.
The aluminum foil "surround" is called a "Faraday Cage". More·on that here...
http://en.wikipedia.org/wiki/Faraday_cage
Once you see that your basic setup will work, then identify the problem(s), then you can go about finding a solution.
http://www.satelliteguys.us/free-air-fta-discussion/96677-modified-extended-remote-works-fta-receiver.html
so if you send a HEX value $A5 wich is equal to 10100101 and $5A = 10110110 the result of comparing $5A and $FF (11111111)·is·equal to $A5·so using this as an error check will do the trick:
' 10100101 =·01011010 ^ 11111111
······ '$A5············'$5A············ '$FF
'On the transmitter BS1
SEROUT 0, N2400, ("!", $A5, $5A) ' send hex values
"On the receiver BS2
SERIN 0, 16780, [noparse][[/noparse]WAIT("!"), x1, x2]
if x1 = (x2 ^ $FF) then ' See the manual for ^ (Xnor) and what does.
if x1 = $A5 then
Goto My_Code
else
'do nothing "ERROR" external noise getting into your code
endif
endif
I WILL TRY THIS LATER TO SEE IF REALLY WORKS!! PARALLAX SUPPORT PLEASE CHECK THIS OUT!!!
YOU NEED AND EXAMPLE LIKE THIS FOR THE TRANSCEIVERS!!!!
GRACIAS!
Post Edited (Luis_P) : 5/26/2010 10:11:45 PM GMT
' 10100101 = 10100101 ^ 11111111
'$A5 '$5A '$FF
should be
' 10100101 = (01011010 ^ 11111111)
'$A5 '$5A '$FF
Note that you don't have to use $A5. I picked this because it has the same number of ones and zeroes and because there are very few adjacent bits that are the same. Both things increase the likelihood that errors from noise pulses will be detected.
Luis
I'm sorprised that Parallax do not provide Mike's solution since many buyers will get this product to create remote control applications.
Gracias! sorry for my broken English