3.5 Performing Digital IO Operations
Description
The driver supports four types of direct digital I/O operations: input bit, input byte, output bit, output byte. Digital I/O is fairly straightforward - to perform digital input, you provide a pointer to the storage variable and indicate the port number and bit number if relevant. To perform digital output, you provide the output value and the output port and bit number, if relevant.
The four Universal Driver functions described here are dscDIOInputByte, dscDIOInputBit, dscDIOOutputByte, dscDIOOutputBit.
Step-By-Step Instructions
If you are performing digital input, create and initialize a pointer to hold the returned value of type byte reference.
Some boards have digital I/O ports with fixed directions, while others have ports with programmable directions. Make sure the port is set to the required direction, input or output. Use function dscDIOSetConfig to set the direction if necessary.
Call the selected digital I/O function. Pass it a byte port value, and either a pointer to or a constant byte digital value. If you are performing bit operations, then you will also need to pass in a byte value telling the driver which particular bit (0-7) of the DIO port you wish to operate on.
Example of Usage for Digital I/O Operations
Last updated