View previous topic :: View next topic |
Author |
Message |
hobby_85
Joined: 17 Aug 2009 Posts: 50
|
RF with PIC |
Posted: Thu Aug 20, 2009 6:05 am |
|
|
Hey,
I recently bought this 433kHz transmitter and receiver module. Its the common one, where the transmitter has 3 pins and the receiver has 8. I also bought the encoder and decoder..HT12E and HT12D. I believe having the encoder and decoder saves alot of hassle.
Having done some research, I somewhat know how to connect the lot together, but am having difficulty in writing appropriate code.
Ideally, I want to learn some basics, so i figure just transmitting a simple AA from the TX to the RX which in turns lights up an LED should be fun. Can anyone point me in the right direction?
I don't mind reading manuals/papers/tutorials/pseudo code even.
Thanks heaps.
If it helps, I'm using a 16f690 for the TX and 16f688 for the RX. (only had one of each!) |
|
|
hobby_85
Joined: 17 Aug 2009 Posts: 50
|
|
Posted: Thu Aug 20, 2009 8:13 am |
|
|
hey all,
I found a tutorial on the web and will probably have some code up and running in a bit. I was just wondering if it was possible to have a PIC connected to the wireless RF and a RS232 running to the PC at the same time?
If the pic's rx/tx pins are being used for the RF, what pins are used to transmit via the rs232 cable?
thanks |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Thu Aug 20, 2009 11:44 am |
|
|
Yes, you can, You can use Software RS232 --- but like FedEx, if it absolutely, positively has to "be there on time" (bit-wise), use a PIC with 2 RS232 ports.
a PIC18FxxJ11 would work nice. It has 2 UARTS and would solve that AND comes in low pin-count packages.
They are 3.3V operation though, so read the datasheet carefully.
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
hobby85 Guest
|
|
Posted: Fri Aug 21, 2009 6:39 am |
|
|
ive only got the picket 2 development board, so i dont think i can program a 18f pic. Im out at the moment, so ill check the data sheet when i get home to make sure. What would be the other method/option and how much delay would i encounter? I need the rf to be accurate and the 232 can have a slight delay. Can i use 2 pics instead? I need to capture the time of arriva of the rf signal and send it to the pc. |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Fri Aug 21, 2009 6:56 am |
|
|
If your RF modules are intended for operation with Holtek encoder/decoder chips, they are using a manchester encoded modulation interface rather than providing an UART connection.
They can be connected to a PIC, but you have to understand how to generate and decode manchester coded signals. |
|
|
Guest
|
|
Posted: Fri Aug 21, 2009 7:25 am |
|
|
FvM wrote: | If your RF modules are intended for operation with Holtek encoder/decoder chips, they are using a manchester encoded modulation interface rather than providing an UART connection.
They can be connected to a PIC, but you have to understand how to generate and decode manchester coded signals. | sorry, ive never used rf before so im playin catch up here. The rf kits i bought dont need the encoder or decoder. I just bought it because from what ive read, its easier with them. So your saying that with the encoder/ decoder, i can connect the rf to any IO pin of the pic, as long as i learn manchester coding? Thanks mate. |
|
|
hobby_85
Joined: 17 Aug 2009 Posts: 50
|
|
Posted: Fri Aug 21, 2009 9:03 am |
|
|
Hey, I found this page on the ccs forum, giving a sort c code for the single link transmitter/receiver module. Its the exact thing I bought. However, it doesn't look like he used an encoder/decoder. Can someone explain why its working without him using one? Is it because he's using the USART thing of the PIC. So, if I were to be using the Holtek 12e/d, does that mean I don't have to use the USART? Which essentially means that I can connect my PIC to the PC using the rs232 while my rf can be put into any of the other I/O pins.
Or have I got it all completely wrong?
http://www.ccsinfo.com/forum/viewtopic.php?t=33498&highlight=trasmitter
For my purpose, I need to have 1 transmitter speaking to several receivers.
Thanks heaps |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Fri Aug 21, 2009 10:10 am |
|
|
The cheap 433 MHz RF modules, that are mentioned in the said link, are typically using AM (ASK) and involve no further coding/decoding of the data, see e.g.:
http://www.sparkfun.com/datasheets/Wireless/General/MO-RX3400.pdf The above datasheet specifies a data output duty cycle of 40-60% at 1 kbps data rate. An arbitrary coded UART data stream has 10-90% in contrast and thus can't be reproduced by this receiver module, I think. Usually manchester coding is used to achieve a DC free (50% duty cycle) bit stream, additionally preamble and sync characters are used to allow settling of the receiver AGC.
I've read suggestions to send 4 bits (inverted + non-inverted) per UART frame as a manchester-like coding. This works well on the transmitter side, but the bit synchronisation on receiver side is still a problem, the solution can't keep up with a true manchester decoder.
The Holtek chips have hardware manchester encoder/decoder, but they only provide parallel bits to connect "switches and lamps" and no UART interface. Although you can connect a processor to the Holtek parallel IOs, they are not particular suited for data communication.
Perhaps other forum members can share their experience about simple methods to interface AM RF modules. I only used FM transmitters with true manchester coding at higher data rates. |
|
|
|