National Instruments 320682C Musical Toy Instrument User Manual


 
Chapter 10 Easy I/O for DAQ Library
© National Instruments Corporation 10-55 LabWindows/CVI Standard Libraries
The portWidth for the 8255-based digital I/O ports (including all digital ports on Lab
boards, SCXI-1200, DAQPad-1200, DAQCard-1200, DIO-24, DIO-32F, DIO-96, and
AT-MIO-16DE-10/AT-MIO-16D ports 2, 3 and 4) should be at least 8.
configure specifies whether to configure the digital port before writing.
When this function is called in a loop, it can be optimized by only configuring the digital port
on the first iteration.
When you configure a digital I/O port that is part of an 8255 PPI (including all digital ports
on Lab boards, SCXI-1200, DAQPad-1200, DAQCard-1200, DIO-24, DIO-32F, DIO-96,
and AT-MIO-16DE-10/AT-MIO-16D ports 2, 3 and 4), the 8255 PPI goes through a
configuration phase, where all the ports within the same PPI chip get reset to logic low,
regardless of the data direction. The data directions on other ports, however, are maintained.
WriteToDigitalPort
short error = WriteToDigitalPort (short device, char portNumber[], short portWidth,
long configure, unsigned long pattern);
Purpose
Outputs a decimal pattern to a digital port.
Parameters
Input
device
short integer Assigned by configuration utility.
portNumber
string Specifies the digital port this function configures.
portWidth
short integer The total width in bits of the port. For example,
you can combine two 4-bit ports into an 8-bit port
on an MIO (non E-Series) board by setting
portWidth to 8.
configure
long integer 1: Configure the digital port before writing;
0: Don’t configure the digital port before writing.
When this function is called in a loop, it can be
optimized by only configuring the digital port on
the first iteration.
pattern
unsigned
long integer
Specifies the new state of the lines in the port.