Using the QuickUSB Library
General-Purpose I/O
There are five (5) 8-bit general-purpose I/O ports on the QuickUSB module
named A-E. Of those, some may be used for other purposes. Port E is used for
the FPGA configuration and SPI functions, so if either of these functions is used
in your design, some of the pins on port E will be consumed.
Other than that, the general-purpose I/O ports are just like I/O ports you would
find on a microcontroller. The functions provided by the QuickUSB Library give
you the capability to set the direction of each pin, read and write to the ports on
a byte wide basis.
QuickUsbReadPortDir
Purpose
Read the data direction of each data port bit for the specified port.
Parameters
hDevice: A HANDLE that was returned from a call to QuickUsbOpen.
address: A BYTE containing the port address. Ports are addressed 0 to 4
corresponding to port A-E.
data:
A PBYTE to a BYTE in which to place the data direction bit
values. Each bit in data corresponds to data bits of the
specified port. A data direction bit value of 0=input and
1=output (i.e. 0x03 means that bits 0 and 1 are outputs and
bits 2-7 are inputs).
Returns
A LONG that is non-zero on success, zero (0) on failure.
Notes
None
QuickUsbWritePortDir
Purpose
Set the data direction of each data port bit for the specified port.
Parameters
hDevice: A HANDLE that was returned from a call to QuickUsbOpen.
address: The port address. Ports are addressed 0 to 4 corresponding to
port A-E.
data:
A byte that contains the data direction bit values. Each bit in
data corresponds to data bits of the specified port. A data
direction bit value of 0=input and 1=output.
Returns
A LONG that is non-zero on success, zero (0) on failure.
Notes
None
62
General-Purpose I/O