Hi guys,
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
transmit.
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_
USART_EIGHT_
Sample code for RX:
---
while(1)
{
if(DataReady == 0) //Input flag from DPC
{
SendData = 1; //output from pic to DPC
Delay1KTCYx(
x = ReadUSART();
SendData = 0;
Print(x); //a simple function to display x.
}
}
---
Sample code for TX:
---
unsigned char x = 1;
unsigned char y = 2;
while(1)
{
WriteUSART(x)
Delay10KTCYx(
WriteUSART(y)
Delay10KTCYx(
}
---
Some help would be much appreciated
Thanks in advance
Nick (d.fektv)
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch format to Traditional
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
__,_._,___
No comments:
Post a Comment