I know this topic has been covered to death, however i have a question in regards to something mentioned in other posts. I have two pics that communicate fine over a cable tx to rx using usart. When i hook the RF pair i see nothing.
My question is, in several of the previous posts i see it mentioned that i should try and invert one of the baudrates. How do i do that? I am using c18 with two pic 18f4520s using the internal oscillator. I have calculated the proper spbrg values for my setup and have verified it works via cable. Do i change my spbrg to invert the baudrate? Or is there a bit i have to flag in one of the eusart registers. I can’t find anything about this.
My question is, in several of the previous posts i see it mentioned that i should try and invert one of the baudrates.
I don't know what is meant by "inverting a baud rate".
I’ve had good luck with a UART-to-UART RF link (I never tried a direct cable, actually…).
One hint:
Be aware that when the rcvr is not hearing a decent signal, it will be spewing out a steady stream of random pulses. It will quickly fill up a terminal-emulator screen with random characters. If I let it continue, a crummy emulator such as Hyperterm tends to get locked up.
Perhaps your UART (and the associated code) is spending all of its time dealing with a “buffer overflow”.
Another hint:
In your UART-to-UART connection, and in the connection to/from the TX/RX modules, you are NOT doing RS232 level conversion, right? The TX/RX modules want TTL-style signals only.
What method are you using to find out if your RX UART is receiving anything?
I wasn’t sure what was meant by invert baud rate either so i figured id ask. No i am not doing any 232 shifting, i am just running at ttl. To verify that i am receiving data i am using the debug features of the icd2. Such that i run my program and as the program runs it loads characters it receives sequentially into an array i have setup. THen i pause the program and observe the values stored in the array. When i have it connected via hardware this method works fine.
I don’t know what “inverting the baud rate” means. The author might have been referring to inverting the logic (mark/space) levels. As Pete said, you don’t need level converters, you can connect the output of the PIC directly to the TX pin and the output of the receiver to the PIC input pin.
Noise is a problem as noted, but can be mitigated by looking for a specific character sequence and ignoring everything up to that sequence. I also recommend using a comparator to get rid of the noise on the output, but not every application requires one.
Be aware that when the rcvr is not hearing a decent signal, it will be spewing out a steady stream of random pulses. It will quickly fill up a terminal-emulator screen with random characters. If I let it continue, a crummy emulator such as Hyperterm tends to get locked up.
Perhaps your UART (and the associated code) is spending all of its time dealing with a “buffer overflow”.
…
Any hints for dealing with the noise? I had a system up and running a month ago, but had to take it apart. I reassembled it and now I get a bunch of random data coming in over the terminal (I’m using RealTerm). I have a 30 cm antenna attached to both receiver and transmitter as stated in the documentation.
Building a comparator like the one used in Luhan’s Cricket receiver would be worthwhile. It consists of a dual op-amp, 3 resistors, and a diode. I use a circuit almost identical to his to reliably send data over 100’ using these transmitters and receivers. Linx takes a similar approach in their squelch circuit. These circuits will prevent the data line from firing by random noise.
I've so far done it only in software, and used a "preamble" (a known, fixed sequence of bytes) to let the rcvr know the difference between noise and data.
But I’ve never tried it at more than a few feet away. So, in my next project (in the works now), I’ll add something like in the Cricket design (it is a “comparator with hysteresis”, similar to a Schmitt Trigger circuit).
Come to think of it, I wonder if a Schmitt trigger logic gate (like the old 7413) would work just as well??
such that it stores an array of 20 characters that it has received and a 5 character list of recent received. When i directly connect the tx pin to the rx pin of the other pic in my ddd array in my watch window i see beersbeersbeers as i should. When i connect the tx pin of the transmitting pic to the data pin of the txer and the rx pin of the other pic to the data pin of the rxer, my watch window indicates that i am getting values . . . . . . . . .
which equate to decimal values on the order of
0
234
0
232
0
209
0
234
0
the numbers are fairly consistent and go value zero value zero.
So i tracked down what seems to be an issue. When i start my program i have two continuous rotation servo motors that are in stop. So i start the program and the data streams in fine, however, when i activate the servos and the motors begin to turn i lose the data stream. Even when i stop the motors the stream will not re commence.
I then have to restart the program with the motors idle to get data again.
Any ideas why the servos are killing my transmission?
I’m just guessing since you didn’t explain how your code handles the servos, but one possibility is that the servos draw a bit too much current on start-up, and you’re having a “brown out” that resets the PIC. In the amateur robotics area it’s a real common problem.
The solution is 2 things:
A beefier power supply (or better yet, run the servos from a separate supply),
Better wiring practices between the power source and the electronics.
Another possibility is that you have an error in your servo-handling code (such as a bad pointer) that causes your UART code to get trashed.
Yes, the rf link works now and quite well i might add. Atleast at the close range they are at anyway.
yes you are correct that it crashes when i run the servos. I have a hunch it may be a power issue so im going to isolate the servos tomorrow when i get some batteries.
I can’t see it as being a code issue since the code is very simple and ive looked for conflicts everywhere.
I guess originally i should have isolated the rf link from the rest of my components that i had running to try to set it up, but i really didn’t feel like disconnecting all the other hardware i have connected.
The unreliability of this unit has me bewildered. It works fine at times, and then later on it stops working completely. Nothing on my end has changed. Anyone have any thoughts?
There is the occasional couple of letters popping up that looks correct but for the most part its the pattern shown above. Could outside signals be interferring?
Ive been trying to get mine to work for about a month now. I have it all hooked up correctly but dont seem to get anything. Works fine hardwired but when replaced with the wireless modules I get nothing. I have mine setup to constantly transmit a single character over and over. I tried hooking the output of the rx up for pin 3 instead of pin 2 and when it is reset I will see 1 character and then it stops. It doesnt work at all when connected to pin 2. Any ideas on this?