On the receiver end change to SERIN2.
Have it wait for the "synch" and use the time out modifier. The time out modifier will take place of the "else".
So the reciever is "waiting" for the synch, if it does not get in in the specified time, the program will jump to where ever.
You do not need to send keydata = %00000000 . Once the receiver does not see the synch it will time out and go on.
I agree with Joe, debounce on the receiver end. Here is a simple but not so efficient way one of my kids debounced with a radio using SERIN.
The code waits for the number 9 and writes the next bit to a variable. 9 is the synch in this case. Then if the variable = 3 enough times then another piece of code executes. You will see the the next piece is called "send". He was doing a relay project. If the 9 was not seen the program went back to looping, if the 9 and 3 was seen the program sends something out to the next receiver.
He debounced the heck out of itI was told there is to much noise in the shop.
Code:LOOP: SERIN PORTC.4,T2400,[9],net IF net = 3 THEN D1 GOTO LOOP D1: PAUSE 50 SERIN PORTC.4,T2400,[9],net IF net = 3 THEN D2 GOTO LOOP D2: PAUSE 50 SERIN PORTC.4,T2400,[9],net IF net = 3 THEN D3 GOTO LOOP D3: PAUSE 50 SERIN PORTC.4,T2400,[9],net IF net = 3 THEN D4 GOTO LOOP D4: PAUSE 50 SERIN PORTC.4,T2400,[9],net IF net = 3 THEN D5 GOTO LOOP D5: PAUSE 50 SERIN PORTC.4,T2400,[9],net IF net = 3 THEN SEND GOTO LOOP D6: PAUSE 50 SERIN PORTC.4,T2400,[9],net IF net = 3 THEN D7 GOTO LOOP D7: PAUSE 50 SERIN PORTC.4,T2400,[9],net IF net = 3 THEN D8 GOTO LOOP D8: PAUSE 50 SERIN PORTC.4,T2400,[9],net IF net = 3 THEN D9 GOTO LOOP D9: PAUSE 50 SERIN PORTC.4,T2400,[9],net IF net = 3 THEN D10 GOTO LOOP D10: PAUSE 50 SERIN PORTC.4,T2400,[9],net IF net = 3 THEN SEND GOTO LOOP D11: SERIN PORTC.4,T2400,[9],net IF net = 3 THEN D12 GOTO LOOP D12: SERIN PORTC.4,T2400,[9],net IF net = 3 THEN D13 GOTO LOOP D13: SERIN PORTC.4,T2400,[9],net IF net = 3 THEN SEND GOTO LOOP
Bookmarks