Vizier87
Active Member
Hi guys, I'm doing a simple Manchester communications. Basically my Tx sends 0xfa and the if the Rx reads 0xfa, an LED lights up.
I've achieved this using the following code for the receiver:
This worked nicely for a wire-to-wire transmission. I could connect and re-connect the wire, reset the PIC and it would work nicely.
However, using cheap 315MHz RF modules, I'd have to have a wire-to-wire transmission first before it'll be synchronized.
Does this mean I have to use a timer to refresh the initialization?
I've achieved this using the following code for the receiver:
C:
while (1) {
data_ = Man_Receive(&error); // Attempt byte receive
if (error) { // If error occured
ErrorCount++; // Update error counter
if (ErrorCount > 20) { // In case of multiple errors
//data_ = Man_Synchro(); // Try to synchronize again
Man_Receive_Init(); // Alternative, try to Initialize Receiver again
ErrorCount = 0; // Reset error counter
}
}
else {
if (data_ != 0xfa)
Indicator = 0;
if (data_ == 0xfa)
Indicator = 1;
}
This worked nicely for a wire-to-wire transmission. I could connect and re-connect the wire, reset the PIC and it would work nicely.
However, using cheap 315MHz RF modules, I'd have to have a wire-to-wire transmission first before it'll be synchronized.
Does this mean I have to use a timer to refresh the initialization?