Chapter 4
Programming
4-6
©
National Instruments Corporation
The support files for the PC include
lowio.h
,
pci.h
,
eserrlp.h
,
lowio.c
,
pci.c, pc_rw.c
, and
pc_ini.c.
lowio.c
has the low
level routines for memory read and write.
essrrlp.h
declares the
external function prototypes and the register addresses;
pc_ini.c
includes
the
Setup_Mite
function, which searches for the PCI board and reassigns
the board address.
pc_rw.c
contains the functions which read and
write from Windows and board discrete registers:
DAQ_STC_Windowed_Mode_Write
,
DAQ_STC_Windowed_Mode_Read
,
Board_Write
,
Board_Write_8bit
, and
Board_Read
.
The support files for the Macintosh include
eserrlp.h
,
mac_rw.c
and
mac_ini.c
. NI-DAQ Library has the routines for memory read and write.
essrrlp.h
declares the external function prototypes and the register
addresses;
mac_ini.c
includes the
Setup_Mite
function which searches
for the PCI-MIO board and saves the board address.
mac_rw.c
contains
the functions which read and write from Windows and board discrete
registers:
DAQ_STC_Windowed_Mode_Write
,
DAQ_STC_Windowed_Mode_Read
,
Board_Write
,
Board_Write_8bit
and
Board_Read
. In addition, Macintosh users should include the NI-DAQ
library since the NI-DAQ library has the low-level routines for reading
the configuration.
Before beginning register-level programming of the analog input and
analog output sections, you should test the Windowed addressing scheme.
To test the Windowed addressing scheme, use a simple example to operate
on the DIO lines. When this example works, try to write code for the other
sections.
As mentioned in Chapter 2 of the DAQ-STC Technical Reference Manual,
several write-only registers on the DAQ-STC contain bitfields that control
a number of functionally independent parts of the chip. To update bitfields,
you must set or clear bits without changing the status of the remaining bits
in the register. Since you cannot read these registers to determine which bits
are set, you should maintain a software copy of the write-only registers.
Note
For simplicity these examples do not include software copies of the registers. If
you wish to write your own examples, or modify these examples, we strongly
recommend adding software copies of the write-only registers. Please refer to
Chapter 2, Register and Bitfield Programming Considerations, in the DAQ-STC
Technical Reference Manual for further information.