Demand Peripherals     Robotics and Automation Made Easy

QUAD2: Dual Quadrature Decoder

The dual quadrature decoder provides two independent channels of quadrature decoding at a maximum frequency of one MHz. The time required to accumulated the pulse counts is also reported so you can get an accurate estimate of the frequency of the input even at low frequency.

 

Hardware:

The QUAD2 peripheral is often paired with either the GPIO4 card or the GPIO4-ST card.

The quadrature inputs are on pins 1 and 2 and on pins 3 and 4. A positive step indicates that the lower numbered input pin (1 or 3) went high before the higher numbered pin (2 or 4). That is, the lowered numbered pin leads the quadrature cycle. The maximum input frequency for the decoder is 1 Megahertz.

 

Resources:

The dual quadrature decoder offers a configurable update rate and a select()'able interface to the latest readings.

counts : The quadrature step counts and the number of seconds it took to accumulate those counts. The first number is a signed integer that is the step count and (by the sign) the direction of the first quadrature input. The second number is a float that is the number of seconds it took to accumulate the step count. The third and fourth numbers are the count and accumulation time for the second input channel.

This resource is read-only. You can use the dpcat command and select() to get continuous updates into your program.

update_rate : Update period for the counts resource in milliseconds. The dpcat command and select() on counts will will give a readable file descriptor every update_rate milliseconds. Setting this to zero turns off all output from the quadrature decoder. The update period must be between 0 and 60 milliseconds in steps of 10 milliseconds. That is, valid values are 0, 10, 20, 30, 40, 50, or 60 milliseconds.

This is a read-write resource and works with dpset and dpget but not dpcat.

 

Examples:

Imagine that the sample rate is 10 milliseconds and that the channel 0 input step rate is about 160 hertz. A sample output from 'counts' might be:

    1   0.007472   0   0.000000
    0   0.000000   0   0.000000
    1   0.007476   0   0.000000
    1   0.007474   0   0.000000
    0   0.000000   0   0.000000

You can not get an accurate frequency from the count alone but by including the accumulation time you can see that the input frequency is about 133.8 Hertz. The accumulation time is measured to the microsecond which usually gives about four digits of accuracy to a frequency estimate.

 

FPGA Defined Peripherals
User Interface
FPGA Configuration
FPGA Buttons & LEDs
Text LCD and Keypad
Quad WS2812 Interface
Quad Slide Pot
Tone Generator
IR Recv/Xmit
6 Digit LCD
RC Decoder
Keyfob RF Decoder
Rotary Encoder Interface
Quad Touch Interface
Motion Control
Dual DC Motor Controller
Dual Quadrature Decoder
Quad 13 Bit Servo
Bipolar Stepper Controller
Unipolar Stepper Controller
Simple Input / Output
Quad Binary Output
Quad Binary Input
Quad GPIO
Octal Input/Output
32 Channel Binary Output
32 Channel Binary Input
Sensors
Octal 12-bit ADC
Quad Ping))) Interface
Octal SRF04 Interface
Quad Event Counter
Instrumentation
Generic I2C
Generic SPI
Octal 8-Bit DAC
Quad Digital Potentiometer
Quad PWM Output
Quad PWM Input
4 Bit Pattern Generator
Real Time Clock
Dual Watchdog Timers
  

Interface Cards
User Interface
Audio Amplifier
IR Recv/xmit
Six Digit LCD Display
Keyfob RF Receiver
Rotary Encoder
Quad Switch Card
Text LCD / keypad
Quad Slide Pot
Quad Touch Interface
Motion Control
Dual 7-amp H-bridge
Quad Open Drain Driver
Quad 10 Amp Relay Card
Input / Output
Octal 8-Bit DAC
Quad Digital Potentiometer
Octal 12-bit ADC
9DOF IMU
Octal SRF04
Quad GPIO
Generic I2C
Generic SPI
USB 2.0 Hub
Real Time Clock
Slot Expander
Octal Input/Output
32 Channel Input
32 Channel Output
Accessories
Power Distribution Card
15 Amp Power Distribution
5 Volt Switching Regulator
ATX Power Break-Out Card
Disk Drive Power Break-Out
MP43 Aluminum Mounting Plate
WW2 Prototyping Card
WW1 Small Prototyping Card