The RCRX peripheral reads and decodes the output of an analog RC receiver such as that in the "VEX 75 MHz Control System".
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 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.
rcdata : decoded RC signal. The rcdec resource has the decoded RC signal as string of space 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.
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.
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
A sample output from rcdata might be:
4923 9303 5065 12165 4869 10471 4838 10871 4744 10447 4761 13445 1 5074 9282 4873 12306 4873 10513 5085 10586 4784 10362 4874 13378 1 4856 9390 4946 12121 5024 10465 4831 10823 4828 10407 4744 13472 1 4967 9327 4926 12295 4896 10415 5039 10667 4790 10387 4761 13515 1 4926 9334 4924 12117 5025 10457 4752 10942 4808 10285 4846 13488 1