----- Original Message -----From: d.fektvSent: Saturday, November 17, 2007 9:01 AMSubject: [piclist] Wireless USARTHi 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_TX_INT_OFF & USART_RX_INT_ OFF & USART_ASYNCH_ MODE &
USART_EIGHT_BIT & USART_CONT_RX & USART_BRGH_HIGH, 64);
Sample code for RX:
---
while(1)
{
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;
while(1)
{
WriteUSART(x);
Delay10KTCYx(100); //allow 10ms in between transmissions
WriteUSART(y);
Delay10KTCYx(100);
}
---
Some help would be much appreciated
Thanks in advance
Nick (d.fektv)
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.16.9/1155 - Release Date: 27/11/2007 20:30
Earn your degree in as few as 2 years - Advance your career with an AS, BS, MS degree - College-Finder.net.
Fed Lowers Rates Again - $270,000 Mortgage for $1,498/Mo. No Credit Check Needed No Credit Check Needed - Estimate New Payment.
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