I am trying to send 1 byte data packets from one 18f458 to another
using 433.93MHz FSK TX/RX devices. I am also using a manchester
encoder/decoder on both ends (DPC-9600) at 9.6kbps.
I am using WriteUSART() and ReadUSART() functions in asynch mode at
9.6kbps to send and receive the data.
The DPC-9600 simply interfaces the USART pins and the TX/RX devices.
In TX mode, the data sheet says to just send the output of the TX
USART pin to the 'Data In' pin of the DPC-9600 when you wish to
In RX, when the DPC-9600 has received a byte of data, a 'Data Ready'
pin goes active low, and signals an input to the pic that there is
data in its buffer. The host (pic) responds by sending a logic 1 to
the 'Send Data' pin of the DPC-9600 and the buffer is emptied into
the RX reg of the USART.
Problem: Whatever value I send from the TX pic, I receive zero at
the RX pic, i.e 0x00.
At first I though that I might have been declaring the data to be
sent as 'int' (2 bytes) resulting in 0x00 in the RX reg for any value
below 256, since it holds only 1 byte. But not the case. My values
are less than 256 and they are 'unsigned chars'.
I appologise for the extent of my question, but I figure you better
know some background.
USART configuration at both ends:
OpenUSART(USART_TX_INT_OFF & USART_RX_INT_OFF & USART_ASYNCH_MODE &
USART_EIGHT_BIT & USART_CONT_RX & USART_BRGH_HIGH, 64);
Sample code for RX:
if(DataReady == 0) //Input flag from DPC
SendData = 1; //output from pic to DPC
Delay1KTCYx(20); //allow time for DPC to empty buffer at 9.6kbps
x = ReadUSART();
SendData = 0;
Print(x); //a simple function to display x.
Sample code for TX:
unsigned char x = 1;
unsigned char y = 2;
Delay10KTCYx(100); //allow 10ms in between transmissions
Some help would be much appreciated
Thanks in advance