![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
shipool
Joined: 22 Aug 2015 Posts: 15
|
PIC to PIC RF 434Mhz Communication |
Posted: Mon Aug 24, 2015 3:56 pm |
|
|
Hello, i'm speak english very bad.... so, sorry for mistakes.
Emitter Code:
main.h:
Code: |
#include <16F628A.h>
#FUSES NOWDT, XT, PUT, NOPROTECT, NOBROWNOUT, NOMCLR, NOLVP, NOCPD
#use delay (clock = 4000000)
#use rs232(baud=300, xmit=PIN_B2, rcv=PIN_B1, STREAM=Wireless) |
main.c:
Code: |
#include "C:\Projetos\teste\RF_434_Envia\main.h"
//Código de exemplo para transmissão de IDs por RF
//Feito por MatheusLPS - matheuslps@yahoo.com.br
#include <STRING.H>
#include <STDIO.H>
#include <STDLIB.H>
#define WireTX PIN_B2
#define WireRX PIN_B1
void main()
{
while(TRUE)
{
if(input(PIN_A1)) //Só enviar quando o botão for precionado.
{
output_high (WireTX); //Ligo o transmissor (IMPORTANTE)
delay_ms (50);
fprintf(Wireless, "%c", 0xBA); // LAM - algo para que o RX's USART "lock onto", algo do tipo, olhe receptor, estoua qui
fprintf(Wireless, "%c", 0xBE); // LAM - algo para que o RX's USART "lock onto", algo do tipo, olhe receptor, estoua qui
fprintf(Wireless, "%c", 0xFA); // LAM - algo para que o RX's USART "lock onto", algo do tipo, olhe receptor, estoua qui
fprintf(Wireless, "%c", 0xCE); // LAM - algo para que o RX's USART "lock onto", algo do tipo, olhe receptor, estoua qui
fprintf(Wireless,"D"); // Vou enviar isso ao recptor e ele vai procurar por Dave como sendo a senha, se for correta, ele interpreta a variável temp_1
output_low (WireTX); //Desligo o tnsmissor (MAIS IMPORTANTE AINDA)
output_high (PIN_B0); //Ligo um LED para ver que voi enviado os dados
delay_ms(1000);
output_low (PIN_B0); //desligo o led
delay_ms(1000);
}
}
}
|
Receive Code:
main.h:
Code: |
#include <16F628A.h>
#FUSES NOWDT, XT, PUT, NOPROTECT, NOBROWNOUT, NOMCLR, NOLVP, NOCPD
#use delay(clock = 4000000)
#use rs232(baud=300, xmit=PIN_B2, rcv=PIN_B1, STREAM=Wireless) |
main.c:
Code: |
#include "C:\Projetos\teste\RF_434_Recebe\main.h"
#define WireTX PIN_B2
#define WireRX PIN_B1
#define RX_BUFFER_SIZE 80
#define TX_BUFFER_SIZE 80
int8 rxd, valid_data_count;
int1 data_avail = FALSE;
#int_RDA
void RDA_isr(void)
{
rxd = getc();
// now look for unique ID: "D"
if (rxd == 'D') {
data_avail = TRUE;
valid_data_count = 0xff; // get ready to count the number of data bytes - we know we have to expect 5 (Rocks)
// also going to reset the buffer write index back to 0, so that I know where my valid data will be
}
}
void main()
{
enable_interrupts(INT_RDA);
enable_interrupts(global);
while (TRUE) {
restart_wdt();
if (data_avail)
{
data_avail = FALSE;
output_high (PIN_A1);
delay_ms (1000);
output_low (PIN_A1);
}
}
}
|
My problem:
In Proteus, with RF module, works.
Using cable, works, if use the same power supply, else, not.
I try very bauds, but i found the same results.
I'm using 1 protoboard for to 2 projects, less 10cm between one of other.
When i'm sending data of PIC emitter for PIC received, in pin rx(with constant +-4v) of receive, your Volts go to down to zero, and up again to +-4v. (with RF434 Module on).
Sorry for my vocabulary, help me please, i'm stay locked in this 2 months.
and Thanks for all replies. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19369
|
|
Posted: Tue Aug 25, 2015 3:57 am |
|
|
Quote: |
My problem:
In Proteus, with RF module, works.
Using cable, works, if use the same power supply, else, not.
I try very bauds, but i found the same results.
I'm using 1 protoboard for to 2 projects, less 10cm between one of other.
When i'm sending data of PIC emitter for PIC received, in pin rx(with constant +-4v) of receive, your Volts go to down to zero, and up again to +-4v. (with RF434 Module on).
|
Proteus assumes things like grounds are connected together. Also does not even remotely simulate the behaviour of real RF modules, that take _time_ to sync to one another, and can easily be overloaded.
'Using cable', - of course it won't work with separate supplies. The _ground_ needs to connect between the units.
Generally, most RF modules will not work if they are too close together. My garage door remote will not work if I stand directly below the receiver. Move a few feet away, and it all works fine. The receiver can't cope when the signal is too strong...
Then you just say 'RF434'. This is like saying 'petrol car', it tells us nothing about the module. There are _thousands_ of 434Mhz RF modules. The better ones have error checking built in, and will handle syncing themselves. The cheap ones do not, and require you to send a stream of data _before_ you start sending your message, and handle your own error checking on the message. Proteus assumes modules are perfect. They are not.... We need the part number/data sheet for the modules you are using.
All modules have limits on the baud rates they can handle. This may include _minimum_ rates as well as maximum.
[/quote] |
|
![](templates/subSilver/images/spacer.gif) |
shipool
Joined: 22 Aug 2015 Posts: 15
|
|
Posted: Tue Aug 25, 2015 8:27 am |
|
|
Man.... thank you very much, i will try move a few feet away and post the answer when i do.
thank you again!! |
|
![](templates/subSilver/images/spacer.gif) |
shipool
Joined: 22 Aug 2015 Posts: 15
|
|
![](templates/subSilver/images/spacer.gif) |
Rapsodia
Joined: 25 Aug 2015 Posts: 1
|
|
Posted: Tue Aug 25, 2015 11:17 pm |
|
|
shipool, as far as I know, if you are using cheap RF ASK 433MHz modules, you can't use a simple serial communication due to the AGC (automatic gain control) on the receiver, this produce too much noise, instead you need to do a pulse protocol.
This could explain why that works only with cable. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19369
|
|
Posted: Tue Aug 25, 2015 11:25 pm |
|
|
As I said, we need to know the modules involved. The most basic ones will need something more than simple serial. |
|
![](templates/subSilver/images/spacer.gif) |
shipool
Joined: 22 Aug 2015 Posts: 15
|
|
Posted: Wed Aug 26, 2015 7:55 am |
|
|
and how i do a pulse protocol, do you have an example to me?
thank you for the answers |
|
![](templates/subSilver/images/spacer.gif) |
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Wed Aug 26, 2015 12:21 pm |
|
|
Hi,
This thread should be locked as it's going no where! The OP has been asked numerous times to tell us which RF modules he is using - that information is critically important to helping him - but, he refuses to answer that question. Rather, he simply keeps repeating his request for 'examples'. My conclusion is that the OP doesn't really want any help, he just wants someone on the forum to do his project for him! _________________ John
If it's worth doing, it's worth doing in real hardware! |
|
![](templates/subSilver/images/spacer.gif) |
shipool
Joined: 22 Aug 2015 Posts: 15
|
|
Posted: Wed Aug 26, 2015 2:14 pm |
|
|
No, this is not true.
I was search that RF modules name because i did not know, and i was trying the suggestions of your friends, i stay very desperate, and i really do not know do a pulse protocol.
i'm stay more than 2 months in this, i want just one help, your friend show me very well many things, and now, i know much more that i knew when i create my account in this blog. for now, thank you again. |
|
![](templates/subSilver/images/spacer.gif) |
shipool
Joined: 22 Aug 2015 Posts: 15
|
|
Posted: Wed Aug 26, 2015 2:30 pm |
|
|
I read many posts about pulse protocol, but I could not find any practical example. |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9174 Location: Greensville,Ontario
|
|
Posted: Wed Aug 26, 2015 2:42 pm |
|
|
Please post a link or information about which 'RF434' module you are using. It is very possible that a 'driver' exists BUT we NEED to know which modules you are using.
Saying 'RF434' is the same as saying I drive a 'Ford' and needing tire for it. You could have 14" rims, 17 " rims, 20" rims, etc.Not all RF434 s are the same, just as not all Fords are the same !!
Bottom line, the more details about those modules the faster and better the responses you'll get.
Jay |
|
![](templates/subSilver/images/spacer.gif) |
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Wed Aug 26, 2015 2:58 pm |
|
|
shipool wrote: |
I was search that RF modules name because i did not know |
Hi,
Seriously, if you can't tell us the module name then it's really totally pointless to try to continue! 1st rule of embedded development is 'do not work with cheap, no-name hardware for which documentation is not available'.....
BTW, if you spent two months trying to solve this problem, then how much did you really save by buying those no-name RF modules?
Honestly, I'm not trying to be harsh, but you have seriously stacked the deck *against* ever completing your project by your initial hardware selection... _________________ John
If it's worth doing, it's worth doing in real hardware! |
|
![](templates/subSilver/images/spacer.gif) |
shipool
Joined: 22 Aug 2015 Posts: 15
|
|
![](templates/subSilver/images/spacer.gif) |
shipool
Joined: 22 Aug 2015 Posts: 15
|
|
Posted: Wed Aug 26, 2015 5:39 pm |
|
|
Well, like you see, i am really bad about it, and i am studying this because i like, not for a school, or work. I do not have one theory, and the more i search, more things in english i found, and like you see, i speak very bad english, but i am trying and trying and trying.
You guys are the only people i'm getting to talk about it, so keep going help me please. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19369
|
|
Posted: Thu Aug 27, 2015 3:32 am |
|
|
Nobody can help you till you tell us the actual modules you are using.... |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|