CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Help needed- Interfacing RX433 & TX433 radio pair with P

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
karthi27



Joined: 18 Nov 2009
Posts: 10

View user's profile Send private message Send e-mail

Help needed- Interfacing RX433 & TX433 radio pair with P
PostPosted: Sun Jan 17, 2010 7:02 pm     Reply with quote

INTERFACING TX433 & RX433 WITH PIC 16F877
Hi :-)

Am a newbie to RF wireless communication.
Am interfacing the TX433 & RX433 radio pair with my PIC micro-controller.

I've written simple codes that transmits and receives 4 bit data through UART at 2400 baud. (My code transmits the value of an integer variable and receives this value on an another PIC)...

Please check it out and recommend modifications.

TRANSMITTER CODE
Code:

#INCLUDE<16f877.h>             //IC HEADER FILE
#USE delay(clock=4000000)     //SETTING CLOCK FREQUENCY
#FUSES XT,NOWDT,BROWNOUT,NOPROTECT,PUT  //SETTING FUSES

#use rs232(baud=2400,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=4)

void main()
{
int i=0;
   while(1)
   {
      putc(i);
      i++;
   }
}


RECEIVER CODE
Code:

#INCLUDE<16f877.h>             //IC HEADER FILE
#USE delay(clock=4000000)     //SETTING CLOCK FREQUENCY
#FUSES XT,NOWDT,BROWNOUT,NOPROTECT,PUT  //SETTING FUSES

#use rs232(baud=2400,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=4)

void main()
{
int i=0;
char ch;
   while(1)
   {
      ch=getc(i);
   }

}

This is just a simple code to transmit and receive the value of i... The received value is stored in ch. Depending on the value of ch, some action has to be done... will write codes for this later on.

Please go through this code... suggest me suitable modifications and code/algorithm to implement RF communication...
_________________
Regards
Karthi
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jan 17, 2010 10:02 pm     Reply with quote

Quote:

#use rs232(baud=2400,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=4)

Read the CCS manual:
Quote:

#use rs232

BITS =X Where x is 5-9 (5-7 may not be used with the SCI [UART]).

The only 'bits' settings that can be used with the hardware UART are
8 and 9.


Quote:
while(1)
{
ch=getc(i);
}

Read the manual:
Quote:

getc()

Syntax: value = getc()

The getc() function does not accept a parameter.
The compiler gives this error message:
Quote:
*** Error 130 "pcm_test.c" Line 13(15,16): Stream must be a constant in the valid range ::

fgetc() accepts a stream parameter, but you're not using streams.
Rohit de Sa



Joined: 09 Nov 2007
Posts: 282
Location: India

View user's profile Send private message Visit poster's website

PostPosted: Mon Jan 18, 2010 12:33 am     Reply with quote

Also, the RX433/TX433 pair are not very reliable straight out of the box. As with all RF devices they are prone to interference, so at the very least you may want to send a checksum along with the transmitted data.

Sending 'raw' UART data may not always work for several reasons, one of them being that raw UART data is not 'balanced'. This basically means that over a period of time you need to transmit an equal number of 1s and 0s, else your receiver will get saturated. Manchester coding is used to 'balance' data.

Read these links:
http://www.ccsinfo.com/forum/viewtopic.php?t=23953
http://www.ccsinfo.com/forum/viewtopic.php?t=27263&highlight=manchester
http://www.ccsinfo.com/forum/viewtopic.php?t=19141&highlight=manchester

Also do a forum search on:
"433"
"RF manchester"
There are several interesting links.

Rohit
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group