View previous topic :: View next topic |
Author |
Message |
hemnath
Joined: 03 Oct 2012 Posts: 242 Location: chennai
|
RF Transmitter and Receiver 315Mhz |
Posted: Wed May 21, 2014 2:26 am |
|
|
Hi, I have bought a RF Transmitter and Receiver 315Mhz and two pic18F2520 controller.
CCS Version: v4.114.
Before I use RF transmitter and receiver module, I want to check the communication between two uC using UART.
Hardware Connections:
One uC as master (Transmitter pin PIN C6) is connected to Another uC pin C7.
do i have to connect,
Master PINC7 to Slave PIN C6???
As an example, I want to send a string "Hellow" and to display in the slave uC .
Transmitter code:
Code: | #include "18F2520.h"
#fuses INTRC_IO
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6,rcv=PIN_C7)
void main(void)
{
while(1)
{
puts("HELLOW");
delay_ms(1000);
}
}
|
How to receive this text on the receiver section? |
|
|
jeremiah
Joined: 20 Jul 2010 Posts: 1349
|
|
Posted: Wed May 21, 2014 5:59 am |
|
|
You only have to connect the other pins if you want full communication both ways. Normally it is a good idea, so I would suggest starting out with both sets of pins connected
In terms of receiving, you should check out the ex_sisr.c file in your examples directory of the PICC install. It shows how to receive using a serial interrupt and circular buffer. |
|
|
rikotech8
Joined: 10 Dec 2011 Posts: 376 Location: Sofiq,Bulgariq
|
|
Posted: Wed May 21, 2014 6:02 am |
|
|
In general printf() is more useful than puts().
http://www.commfront.com/USB-Serial-Adapters-Converters/USB-TTL-Converter-Adapter.htm
I dont reccomend to test UART using two uCs. Much easier approach is to print/get some characters or string to a PC. Then you can see what is being sent from the uC. Reciever might be inspected by testing the received character. Let say: Code: |
if(received_character == expected_charackter)
led_on();
else
led_off();
|
_________________ A person who never made a mistake never tried anything new. |
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Wed May 21, 2014 6:34 am |
|
|
Hi,
One other thing. Your success or failure on this project is probably going to be very dependent on *which* Tx/Rx modules you purchased. These can vary all over the map from totally horrible/useless to quite good/robust. Post a link to what you have!
John |
|
|
gpsmikey
Joined: 16 Nov 2010 Posts: 588 Location: Kirkland, WA
|
|
Posted: Wed May 21, 2014 12:55 pm |
|
|
Don't forget that if you are using a PC for the other end for testing, you need to do the RS-232 level conversion for it to talk to the PC correctly (although I do agree with talking to the PC as a good test).
mikey _________________ mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3 |
|
|
|