Demand Peripherals             Robotics and Automation Made Easy

  

RCRX: Radio Control Decoder

The RCRX peripheral reads and decodes the output of an analog RC receiver such as that in the "VEX 75 MHz Control System".

 

Hardware:

The output of the RC receiver should be connected to the lowest numbered input on a GPIO card. The next GPIO pin is driven high to indicate reception of valid RC data. This pin normally is tied to an LED through a 180 Ohm resistor.

The remaining two pins on the connector are general purpose I/O pins.

The RCRX peripheral is often paired with either the GPIO4 card or the GPIO4-ST card. More information about the GPIO cards can be found here cards/gpio4.html and here cards/gpio4-st.html.

 

Resources:

The device interfaces for the RC Decoder include the number or RC channels to expect, the output of the RC decoder as well as the direction and current value of the GPIO pins.

nchan : number of RC channels to expect in input.
This resource tells the peripherals how many channels to expect in the input signal. Setting this accurately helps lower the latency of the channel reading. This resource take a single ASCII digit in the range of two to eight and terminated by a newline.

rcdec : decoded RC signal.
The rcdec resource has the decoded RC signal as string of comma separated channel times given in nanoseconds and terminated by a newline. Normally a new reading is available every 20 milliseconds. Output is suppressed if the input signal does not contain a valid RC frame. This resource only works with dpcat.

rcraw : raw RC decoder output.
This read-only resource is the raw output of the RC decoder. It may or may not contain a valid RC receive frame. A frame can start any time after a 3 millisecond period without any transitions. A new frame can start with either a transition from low to high or from high to low. The raw frame is printed as the initial value, that is a 1 or a 0, followed by a comma separated list of times for each of the high and low pulses in the frame. Times are in hundreds of nanoseconds. That is a value of 10455 represents an interval of 1045500 nanoseconds or 1.04 milliseconds. This resource only works with dpcat.

gpiodir : GPIO direction flags.
The gpiodir resource has the direction of the two GPIO pins as a single numeric digit followed by a newline. A value of 0 make both lines an input and a value of 3 makes both lines an output. A value of 2 make the lower numbered GPIO pin an output and a value of 1 makes the higher numbered pin an output.

gpioval : the value on the GPIO pins.
Use dpset to write to this resource to set an output and use dpget to read from it to get the current value on the pins. A read requires a round trip over the USB-serial link and may take a few milliseconds. This resource works with dpget and dpset but not with dpcat.

update_rate :

 

Examples:

The Vex RC transmitter and receiver have eight channels. Set up RCRX to receive RC data from the Vex transmitter.

    dpset rcrx nchan 8
    dpget rcrx rcdec