|
|
View previous topic :: View next topic |
Author |
Message |
karthi27
Joined: 18 Nov 2009 Posts: 10
|
Help needed- Interfacing RX433 & TX433 radio pair with P |
Posted: Sun Jan 17, 2010 7:02 pm |
|
|
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
|
|
Posted: Sun Jan 17, 2010 10:02 pm |
|
|
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
|
|
|
|
|
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
|