View previous topic :: View next topic |
Author |
Message |
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Sat Mar 25, 2017 3:10 pm |
|
|
Think about it:
Code: |
#int_RDA
void RDA_isr(void)
{
vetor[n] = getc();
if (n == 1)
{
data = 1;
n = 0; //n is now 0
}
n++; //n is now 1.....
}
|
You are never going to write to vetor[0].... |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Mar 25, 2017 5:12 pm |
|
|
Quote: | but the output pin on the transmitter is not set yet, as I'm going to
do so that when the transmitter sends the high value to the receiver it is
set in the transmitter with a high value in the transmitter. EX PIN_B0,
because I have the answer on the receiver but on the TX pin of the receiver |
I don't know what this means. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Sun Mar 26, 2017 5:42 am |
|
|
Please post the information about the RF modules.
Make, model and a link to the datasheet |
|
|
sergio3214
Joined: 15 Mar 2017 Posts: 25 Location: brasil
|
|
|
sergio3214
Joined: 15 Mar 2017 Posts: 25 Location: brasil
|
|
Posted: Mon Mar 27, 2017 10:28 am |
|
|
PCM programmer wrote: | Quote: | but the output pin on the transmitter is not set yet, as I'm going to
do so that when the transmitter sends the high value to the receiver it is
set in the transmitter with a high value in the transmitter. EX PIN_B0,
because I have the answer on the receiver but on the TX pin of the receiver |
I don't know what this means. |
PCM programmer
And that now through this code I want to control the speed of a DC motor thus making an acceleration ramp. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Mon Mar 27, 2017 11:34 am |
|
|
These are amongst the worst modules you could get.
They are not actually designed to send serial data. They are designed for simple on/off remote control type applications. They will receive an enormous amount of invalid data (just about anything transmitting on the 433MHz band can trigger them....). The receive output also idles low.
You are making things hard for yourself, by using cheap modules. It can be done, but honestly to be even remotely reliable is going to require custom serial code and error correction code on the data. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Mon Mar 27, 2017 1:18 pm |
|
|
As Mr. T says...not a good choice to use. If possible, buy the HC-12 serial RF modems. I paid $6 CDN for them, direct from China, took 3 weeks to get. They WORK. Someone in Brasil must import them. If not, order direct from China (free shipping). When dealing with RF, you need reliable communications.
Jay |
|
|
sergio3214
Joined: 15 Mar 2017 Posts: 25 Location: brasil
|
|
Posted: Mon Mar 27, 2017 1:23 pm |
|
|
Ttelmah wrote: | These are amongst the worst modules you could get.
They are not actually designed to send serial data. They are designed for simple on/off remote control type applications. They will receive an enormous amount of invalid data (just about anything transmitting on the 433MHz band can trigger them....). The receive output also idles low.
You are making things hard for yourself, by using cheap modules. It can be done, but honestly to be even remotely reliable is going to require custom serial code and error correction code on the data. |
As I have not purchased I can make the purchase of other modules as for ex
http://www.rficy.com/wp-content/uploads/2013/12/CY03.pdf
http://teslabem.com/modulo-rf-serial-433mhz-bidireccional-hc-11.html
But my desire now is to be able to control a motorcycle through radio frequency because I already get two pic to communicate. Now I want to control the speed of a motor via rf. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Mon Mar 27, 2017 1:37 pm |
|
|
The HC-11 is a far better choice, but if possible get the HC-12 version.
Jay |
|
|
sergio3214
Joined: 15 Mar 2017 Posts: 25 Location: brasil
|
|
Posted: Mon Mar 27, 2017 1:43 pm |
|
|
temtronic wrote: | The HC-11 is a far better choice, but if possible get the HC-12 version.
Jay |
Do you have any idea how I can be deprecating the code to control the speed of a motor by rf if it was help me |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Mon Mar 27, 2017 2:41 pm |
|
|
OK, the best way to approach this project , is to NOT use the RF modules, yet.
Get your 2 PICs, the 'controller' and the 'bike' to communicate simply by using RS-232. Yes, it's a 'wired' interface but you should be able to get 99% of the software running without the RF modules. Once you get good RF modules, you should be able to wire them in and do final testing.
That's why I suggested the HC-12 units. They are 'transparent' as far as communication goes, same as real wire...
By breaking up the project into two stages, you eliminate the problem of deciding is it transmitter code, receiver code or a wireless module problem.
There are several example programs detailing PIC to PIC communcation via serial (aka RS-232), start there. |
|
|
sergio3214
Joined: 15 Mar 2017 Posts: 25 Location: brasil
|
|
Posted: Mon Mar 27, 2017 3:03 pm |
|
|
temtronic wrote: | OK, the best way to approach this project , is to NOT use the RF modules, yet.
Get your 2 PICs, the 'controller' and the 'bike' to communicate simply by using RS-232. Yes, it's a 'wired' interface but you should be able to get 99% of the software running without the RF modules. Once you get good RF modules, you should be able to wire them in and do final testing.
That's why I suggested the HC-12 units. They are 'transparent' as far as communication goes, same as real wire...
By breaking up the project into two stages, you eliminate the problem of deciding is it transmitter code, receiver code or a wireless module problem.
There are several example programs detailing PIC to PIC communcation via serial (aka RS-232), start there. |
I have searched the forum for many days and could not find the solution.
Could you be a little more clear, because I could not get it. |
|
|
sergio3214
Joined: 15 Mar 2017 Posts: 25 Location: brasil
|
|
Posted: Thu Mar 30, 2017 5:35 pm |
|
|
Is there someone who can help me ???
I need a lot to control an engine with this code via radio frequency.
Please help me. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Fri Mar 31, 2017 5:59 am |
|
|
As I said earlier, forget about the 'RF modules' for now. Concentrate on getting your 2 PICS to work on the same breadboard. TX1>RX2, RX1<TX2.
I don't know how much 'control' you're supposed to have over the motorcycle but that will NOT be easy. It's details like balance, turning, interfacing to throttle, brakes, shifter, etc. that can easily take a year or two.
Decades ago I designed an RC motorcycle....regular RC servos. Took 4 months just to get it to go straight down the road.
Start small with 2 PICS and the breadboard..one small step at a time.
Jay |
|
|
sergio3214
Joined: 15 Mar 2017 Posts: 25 Location: brasil
|
|
Posted: Fri Mar 31, 2017 10:52 am |
|
|
So I already did the communication works on the same network baud, I already did communication between the TX and RX turn the led on and off, and also the ADC conversion, what is happening and that I get the conversion value on the tx pin of the receiver and now I want this value to be in a pin such as Code: |
void main()
{
enable_interrupts(INT_RDA);
enable_interrupts(global);
while(TRUE)
{
if (data == 1)
{
resultado = (((int16)vetor[0]<<8) | vetor[1]);
fprintf (Wireless, "\n\r%lu", resultado);
data++;
printf_ valor alto( PIN_B0) // High value on receiver PIN_B0
}
}
} |
|
|
|
|