The ROTEN peripheral lets you monitor a rotary encoder for rotation or center button transitions. ROTEN is most often paired with the ROTEN card but can also be used with the GPIO cards if you want to wire your own rotary encoder.
The roten peripheral is an interface to a rotary encoder with push button. The encoder switches are on the low two pins of the daughter card, the button is on the third pin, and the LED output is on the highest numbered bin. See the schematic for the ROTEN card for details if you wish to wire your own rotary encoder. More information on the ROTEN cand can be found here cards/roten.html.
encoder : step count and button status. A read-only resource (pcget/pccat) with the number of counts up or down since the last output and the current state of the button. The count is always within the range of 63 to -64. The count and button status are given on the same line with a space separating the values. For example five counts counterclockwise and no button press would be reported as:
led : state of the LED/ Use pcset with a value of '0' to turn the LED off and a value of '1' to turn it on. A pcget returns the current state of the LED.
On occasion you may see an output from encoder something like this:
-1 0 0 0 0 0 -1 0The '0 0' values can be ignored. This occurs because the hardware detected a change but the encoder went back to its previous state before the FPGA could report the new value. You can think of it as switch bounce which will have no impact on the actual position of the rotary encoder.
Monitor the rotary encoder for button presses or encoder rotation.
pccat roten encoder