Wednesday, November 28, 2007

Re: [piclist] Wireless USART

You probably need to send a few lead-in charcters to get the two in sync.  e.g. 0ffx
 
dB.
 
----- Original Message -----
From: d.fektv
Sent: Saturday, November 17, 2007 9:01 AM
Subject: [piclist] Wireless USART

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_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

__._,_.___
to unsubscribe, go to http://www.yahoogroups.com and follow the instructions
Recent Activity
Visit Your Group
Yahoo! News

Fashion News

What's the word on

fashion and style?

Yahoo! Finance

It's Now Personal

Guides, news,

advice & more.

Moderator Central

Get answers to

your questions about

running Y! Groups.

.

__,_._,___

No comments: