serial RF pause problems!
Archiver
Posts: 46,084
I can send serial data reliably as long as there is no pause between
the serial output to the transmitter. If I put a pause of greater
than 100 at the end of my output loop, the data from the second loop
iteration is received as junk. If I have the loop running with no
pauses whatsoever, each loop iterations data is receieved correctly.
Does anyone know what would cause this and how I could fix it? I have
to put code which actualyl does something in between my RF data
transmission, so I need to be able to pause for longer than 100ms
between transmissions! Is there a command which would do the same as
alt-r from the code downloader program (alt-r gets the transmissions
back into synch).
the serial output to the transmitter. If I put a pause of greater
than 100 at the end of my output loop, the data from the second loop
iteration is received as junk. If I have the loop running with no
pauses whatsoever, each loop iterations data is receieved correctly.
Does anyone know what would cause this and how I could fix it? I have
to put code which actualyl does something in between my RF data
transmission, so I need to be able to pause for longer than 100ms
between transmissions! Is there a command which would do the same as
alt-r from the code downloader program (alt-r gets the transmissions
back into synch).
Comments
>the serial output to the transmitter. If I put a pause of greater
>than 100 at the end of my output loop, the data from the second loop
>iteration is received as junk. If I have the loop running with no
>pauses whatsoever, each loop iterations data is receieved correctly.
>Does anyone know what would cause this and how I could fix it? I have
>to put code which actualyl does something in between my RF data
>transmission, so I need to be able to pause for longer than 100ms
>between transmissions! Is there a command which would do the same as
>alt-r from the code downloader program (alt-r gets the transmissions
>back into synch).
>
In the pause between transmissions, most simple AM or OOK (on-off
keying) receivers will turn up their gain (AGC) and will start
receiving random RF noise that shows up as junk at the output. When
the transmission starts again, it takes a few milliseconds for the
receiver get back to the gain level that will "slice" the data
correctly and to detect the first start bit correctly. If the
transmitter simply starts transmitting the real data, the receiver
will usually start off badly and mess up the entire message. For
that reason, the transmitter should start off with a dummy byte or
two, usually a $55 $55, because that is an alternating pattern of
high and low bits. That gets the receiver AGC set and forces a
period of silence in the receiver. Then a little pause (about 8
milliseconds at 1200 baud) to be sure that the receiver will be
expecting a start bit. Then send your data, maybe prefaced with an
invariant pattern that the receiver can key to with a WAIT. The
whole thing is a packet.
If you have access to an oscilloscope, it is very informative to
observe the output of the receiver. You can get better results once
you see what is going on. You can see the effect of the dummy bytes
in forcing a period of silence, and then the noise that come back 40
or 50 milliseconds after the end of the transmitted packet.
-- Tracy