Hi,
I'm still very new to PIC and have some some problem with RF module encode/decode programming. I understand how Manchester coding works thanks to Nigel's tutorial but i can not understand the ASM code, i have only learnt and done everything in C. i can right now get like 1 packet randomly, like 1 in 4. I would like to know what else i have to include in order to get it working at 100%.
Software: MPLAB IDE 8.40/Hi-TECH C compiler
Packet structure:...
Sync = 40bit(0x5555555555) // sync RF to correct frequency?
header = 8bit(0x0F) ==> 16bit Manchester(0xAA55) // start byte?
address = 8bit(0x00) ==> 16bit Manchester(0xAAAA) // address byte?
data = 8bit(0xFF) ==> 16bit Manchester(0x5555) // data byte?
checksum = 8bit(0x20) ==> 16bit Manchester(0xA6AA) // total packet byte?
example:
packet[0] = 0xAA // header
packet[1] = 0x55
packet[2] = 0xAA // address
packet[3] = 0xAA
packet[...]
Concept...
* Transmitter: Set a pin to be software UART, then just send bit by bit with delay in between.
example:
while(...)
{
tmpBit <<= packet; // keep looping and bit shift till end of packet
RA0 = tmpBit; // set/clear a pin for sending data
DelayUs(833); // 1200 baudrate = 833uSec/bit
}
* Receiver: Keep receiving data, store in buffer and keep on checking buffer for header?, if this is the right way how to recover the actual clock cycle in C?
example:
while(...)
{
buffer <<= 1; // left shift buffer
buffer += RA0; // get new data
DelayUs(833); // baudrate delay
if(buffer[0] == 0xAA && buffer[1] == 0xFF)
break;
}
// continue on with decoding rest of packet
I'm still very new to PIC and have some some problem with RF module encode/decode programming. I understand how Manchester coding works thanks to Nigel's tutorial but i can not understand the ASM code, i have only learnt and done everything in C. i can right now get like 1 packet randomly, like 1 in 4. I would like to know what else i have to include in order to get it working at 100%.
Software: MPLAB IDE 8.40/Hi-TECH C compiler
Packet structure:...
Sync = 40bit(0x5555555555) // sync RF to correct frequency?
header = 8bit(0x0F) ==> 16bit Manchester(0xAA55) // start byte?
address = 8bit(0x00) ==> 16bit Manchester(0xAAAA) // address byte?
data = 8bit(0xFF) ==> 16bit Manchester(0x5555) // data byte?
checksum = 8bit(0x20) ==> 16bit Manchester(0xA6AA) // total packet byte?
example:
packet[0] = 0xAA // header
packet[1] = 0x55
packet[2] = 0xAA // address
packet[3] = 0xAA
packet[...]
Concept...
* Transmitter: Set a pin to be software UART, then just send bit by bit with delay in between.
example:
while(...)
{
tmpBit <<= packet; // keep looping and bit shift till end of packet
RA0 = tmpBit; // set/clear a pin for sending data
DelayUs(833); // 1200 baudrate = 833uSec/bit
}
* Receiver: Keep receiving data, store in buffer and keep on checking buffer for header?, if this is the right way how to recover the actual clock cycle in C?
example:
while(...)
{
buffer <<= 1; // left shift buffer
buffer += RA0; // get new data
DelayUs(833); // baudrate delay
if(buffer[0] == 0xAA && buffer[1] == 0xFF)
break;
}
// continue on with decoding rest of packet
Last edited: