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.

 

Hardware:

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.

 

Resources:

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.

 

Examples:

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
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