Demand Peripherals     Robotics and Automation Made Easy

GPIO4: Quad General Purpose Input/Output

The GPIO4 peripheral gives you direct control of four FPGA pins. The pins can be individually configured as inputs or output, and inputs can be configured to send an update when the input value changes.



The gpio4 cards give direct access to each of the four pins in a Baseboard slot. Each GPIO pin can be an input or an output, and changes at an input pin can trigger the sending of the pin status up to the host. The highest numbered pin on the connector is controlled by the LSB in the control and data registers. More information about the GPIO4 cards is available here cards/gpio4.html.



pins : the value on the GPIO pins.
A write to this resource sets an output pin, and a read from it returns the current value on the pins. A read requires a round trip over the USB-serial link and may take a few milliseconds. Data is given as a hexadecimal number. You can monitor the pins using a dpcat command. Using dpcat only makes sense if one or more of the pins are configured as input and as a source of interrupts.

direction : the direction of the four pins as a hexadecimal digit.
A set bit makes the pin an output and a cleared bit makes it an input. The power up default is for all pins to be inputs. This resource works with dpget and dpset.

interrupt : an 'interrupt' enable mask.
When a pin is an input and the interrupt bit is set for that pin, then when the logic level of the pin changes, the FPGA builds and sends a packet with the new value of the pins. This ability is called 'interrupt' since it is asynchronous and not polled. The interrupt resource works with dpget and dpset.



Set pins 3 and 4 to outputs and pins 1 and 2 to input with interrupt-on-change enabled for both. Use dpcat to watch for changes at the inputs.

    dpset gpio4 direction c
    dpset gpio4 interrupt 3
    dpcat gpio4 pins


FPGA Defined Peripherals
User Interface
FPGA Configuration
FPGA Buttons & LEDs
Host Tx/Rx Interface
AVR Interface
Stereo Audio Amplifier
Text LCD and Keypad
Quad WS2812 Interface
Quad Slide Pot
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
Octal Input/Output
32 Channel Binary Output
32 Channel Binary Input
Quad Serial Output
Octal Serial Output
Octal 12-bit ADC
Quad Ping))) Interface
Pololu QTR Interface
Octal SRF04 Interface
Generic I2C
Generic SPI
Octal 8-Bit DAC
Quad Digital Potentiometer
Quad PWM Output
Quad PWM Input
Quad Event Counter
Real Time Clock
Dual Pulse Generator

Interface Cards
Control Cards
User Interface
Stereo 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
Octal SRF04
I2C Prototyping
SPI Prototyping
USB 2.0 Hub
Real Time Clock
Octal Input/Output
32 Channel Input
32 Channel Output
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
WW4 Large Prototyping Card
WW2 Prototyping Card
WW1 Small Prototyping Card
SMP SMD Prototyping Card