Chapter 7 Digital I/ODAQ-STC Technical Reference Manual7-8 ©National Instruments Corporationmain(){int port_val;/* configure DIO<0..7> pins as outputs */DAQ_STC_Windowed_Mode_Write(DAQ_STC_DIO_Control_Register,DAQ_STC_DIO_All_Outputs);for (port_val = 0; port_val< = 255; port_val++){DAQ_STC_Windowed_Mode_Write (DAQ_STC_DIO_Output_Register, port_val);} /*for port_val*/} /*main *//* functions to write and read from the DAQ-STC in the windowed mode *//* outp performs a 16-bit write and inp performs a 16-bit read */DAQ_STC_Windowed_Mode_Write(unsigned int addr, int data){outp (DAQ_STC_Window_Address_Reg, addr);outp (DAQ_STC_Window_Data_Write_Reg, data);}DAQ_STC_Windowed_Mode_Read (unsigned int addr, int *dataptr){outp (DAQ_STC_Window_Address_Reg, addr);inp (DAQ_STC_Window_Data_Read_Reg, &dataptr);}Caution When using windowed-mode accesses from an interruptible process, yourapplication may not function properly if an interrupt occurs between the time thatthe address is loaded into the Window_Address_Register and the time that anaccess is made from the Window_Data_Register. Make sure that the interrupt doesnot disturb the Window_Address_Register during this sensitive period. To do this,disable interrupts during windowed-mode accesses or write the interrupt routinesso that they do not disturb the contents of the Window_Address_Register.7.6.2 Programming the Digital InterfaceThe DAQ-STC has eight DIO lines corresponding to pins DIO<0..7> and a digital output line,EXTSTROBE/SDCLK. The eight DIO lines can be configured for input or output on anindividual basis. DIO4 can be used for 8-bit serial digital input, and line DIO0 can be used for8-bit serial digital output.To program the eight DIO pins for input or output, use the following function:!