|
|
View previous topic :: View next topic |
Author |
Message |
Guest
|
RF Module Help |
Posted: Sun Nov 29, 2009 8:21 am |
|
|
I am using the following code for RX
Code: | //Eg1
#include<16F877A.h>
#use delay(clock=20000000)
#fuses HS, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=20M)
#define WireTX PIN_C6 // <--------- C 6
#define WireRX PIN_C7
#include<LCD420.C >
#use rs232(baud=1200, xmit=PIN_C6, rcv=PIN_C7)
void main()
{
char data;
lcd_init();
delay_ms(100);
output_high(pin_b3);
while(1) {
if ( kbhit() )
{
data = getc();
printf(lcd_putc,"\f%c",data,data);
}
}
} |
and for TX
Code: | #include <18F2550.h>
//#define __USB_PIC_PERIF__ 1
#fuses HSPLL,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL5,CPUDIV1,VREGEN
#use delay(clock=20000000)
//#include <usb_cdc.h>
#define WireTX PIN_C6 // <--------- C 6
#define WireRX PIN_C7
#use rs232(baud=1200, xmit=PIN_C6, rcv=PIN_C7)
void main()
{
int a;
// usb_init();
while (true)
{
// if (usb_enumerated())
// {
putc('A');
delay_ms(100);
putc('B');
delay_ms(100);
putc('C');
delay_ms(100);
// }
}
} |
The receiver lcd show some other values....
Please help me....
Thanks |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Sun Nov 29, 2009 9:38 am |
|
|
There may be a problem with the RF module, but as far as I understand, it's impossible by design to have a clock
frequency of 20 MHz in HSPLL operation mode. In this case, the TX UART frequency is also different from intended
1200 baud. Available frequencies are 16, 24, 32 and 48 MHz.
To get any help with RF module issues, you should at least mention the module type...
P.S.: CPUDIV1 means 48 MHz Clock (96 MHz/2) |
|
|
anandpv2009
Joined: 26 Jul 2009 Posts: 31
|
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Sun Nov 29, 2009 12:21 pm |
|
|
Quote: | But pickit2's frequency is 20mhz... |
You may want to learn the difference between crystal and CPU clock frequency. |
|
|
Guest
|
|
Posted: Tue Dec 01, 2009 4:24 pm |
|
|
Hi,
From what I can see from the Vega-site, these are very basic RF modules without any built-in protocol. Such radio links can not be treated as a "wire" between the PIC's.
A good tip is sending packets, starting with 1-3 bytes as preamble so the receiver can "sync" to the transmitters bitrate. Also include a checksum so you can discard packets with errors.
If that´s too much work - try more advanced transceivers that come with this kind of protocol already in their own uP.
Good luck
/BdeB |
|
|
|
|
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
|