|Demand Peripherals Robotics and Automation Made Easy|
IN4: Quad Input
The IN4 peripheral lets you receive input from four FPGA pins. The pins can be individually configured to send an update when the input value changes.
Use either the quad switch card or a GPIO card with
the IN4 peripheral.
The IN4 peripheral lets you read or monitor the status of four FPGA pins. Use the SW4 card and IN4 as part of your user interface, or use IN4 and one of the GPIO4 cards to watch for bumper switch closure on your robot. The lowest number pin corresponds to the LSB of the data and interrupt resources.
Resources for the in4 peripheral include a read-only data register and a read-write configuration register to determine which pins are monitored for changes.
inputs : the value on the four input FPGA pins. A dpget on this resource returns the current values of all 4 pins. A dpget requires a round trip over the USB-serial link and may take a few milliseconds. Pin values are given as a hexadecimal number with the value of the lowest numbered pin in the LSB.
When used with dpcat this resource reports the new value of the pins after one of the monitored pins changes value. Use this resource to wait for changes on the monitored pins.
interrupt : which pins to monitor. A change on a monitored pin causes a packet to be sent to the host. The packet contains the new values of all 4 pins and is made available as a line of dpcat output on the 'inputs' resource.
To monitor all four pins for changes use the following:
dpset in4 interrupt f dpcat in4 inputs