View previous topic :: View next topic |
Author |
Message |
cengav4r
Joined: 31 May 2012 Posts: 10
|
PIC18F4550 RF example (Help) |
Posted: Thu May 31, 2012 7:39 am |
|
|
Hi,
I have a project with PIC18F4550 with using usb port. Almost I finished but I dont know how can i use rf module with PIC18F4550. Firstly I did a simple project led (on-off) and display with pic18f4550(If you want these codes, I can send to you). Secondly, I want to flash on and off to led and some message on display (lm016) with using pic and rf module (+usb). If anybody has knowledge about it , could you help me about ccs transmitter and receiver codes (to how can init() to rf modules)?
note:I will use 434 mhz rf module. I just know I will use putx (for transmitter) and getx (for receiver)
Simple circuit (image)
http://imageshack.us/photo/my-images/3/forccs.png/
thanks
-------------------------------------------------------------------------------------
NOTE 2: If you have a simple codes with other pics 16f628,84,877, you can write (receiver and transmitter codes) or webpage links. |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Fri Jun 01, 2012 7:06 am |
|
|
Depends on your RF modules.
You will need to read the data sheet for your modules very carefully.
Simplest solution:-
Connect RS232 TX to transmitter module data in.
Connect reciever module data out to RS232 RX.
Treat as RS232 link.
Mike |
|
|
cengav4r
Joined: 31 May 2012 Posts: 10
|
|
Posted: Fri Jun 01, 2012 11:59 am |
|
|
Hi Mike,
Firstly, Thanks for replying.
I am using 18f4550 and usb port. At first I tried rf communication with 16f628a with two pics.Then I simulated it with proteus.It is working just one led perfectly but when I use two leds it is not working for 2. led (first led still working good).Finally I tried with these codes 18f4550, but it was not worked for both of them.
I am using
for transmitter;
at first
#use delay(clock=4000000)
#use rs232(baud=1200,parity=N,xmit=PIN_A0,rcv=PIN_A1,bits=8)
at the end
putc(0x55); // for rf module wake up
putc(0x55);
putc(0x55);
putc(0x55);
putc(0x55);
putc(0x00);
putc(0x00);
putc(0x00);
putc(0x00);
putc(0x00);
putc(0xFF);
putc(0xFF);
putc(0xFF);
putc(0xFF);
putc(0xFE);
putc('X');
IF you have sample codes, pls send to me
Best regards
note2: Also I checked transmitter and receiver datasheet , but it has only pin connection diagram.for simple 434mhz rf module webpage link:
http://www.rentron.com/rf_remote_control.htm |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Fri Jun 01, 2012 12:23 pm |
|
|
hint #1 . get RID of Proteus. As a 'simulator' it is full of bugs, errors, faulty DRCs and you will waste DAYS if not WEEKS trying to get real code in a real PIC to work thinking that Proteus is 'ok'....
hint #2. Use the hardware UART inside the PIC AND add 'errors' to the use rs232(...) options.
hint #3. Bypass or omit the RF modules and get the 2 PICs working without the RF modules. That way you KNOW the code is mostly correct !!!
hint #4. create 'functions' to transmit and receive data via the RF modules. These 'drivers' should be able to just drop in your working code and work.
hint #5. You're not the first one to do this, so there should be code from others on the 'web'.You may need to spend a day surfing..better time spent than trying to get Proteus 'working'. |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Fri Jun 01, 2012 3:22 pm |
|
|
I endorse everything that temtronic says regarding PROTEUS, and your way forward.
I've used several different RF modules in the past. They do vary. What works with one, may not work with another.
So, like I said before, read the manuals carefully.
Quote: | IF you have sample codes, pls send to me | It doesn't work like that.
This is not a do it for you forum.
You will learn most by cutting code for yourself.
Others and I will help you when you get stuck, but you must show that you have made an effort.
Mike |
|
|
|