/* read and print the module’s Device Type Register */

errStatus = viIn16(E1459,VI_A16_SPACE,0x02,&dt_reg); if (VI_SUCCESS > errStatus){

printf(“ERROR: viIn16() returned 0x%x\n”,errStatus); return errStatus;}

printf(“Device Type register = 0x%4X\n”, dt_reg);

/* read and print the module’s Status Register */

errStatus = viIn16(E1459,VI_A16_SPACE,0x04,&stat_reg); if (VI_SUCCESS > errStatus){

printf(“ERROR: viIn16() returned 0x%x\n”,errStatus); return errStatus;}

printf(“Status register = 0x%4X\n”, stat_reg);

/* Close the Module Instrument Session */

errStatus = viClose (E1459);

if (VI_SUCCESS > errStatus) {

printf(“ERROR: viClose() returned 0x%x\n”,errStatus); return 0;}

/* Close the Resource Manager Session */

errStatus = viClose (viRM);

if (VI_SUCCESS > errStatus) {

printf(“ERROR: viClose() returned 0x%x\n”,errStatus); return 0;}

return VI_SUCCESS;

}

Output and Edge Detection Examples

Edge Interrupt Example

The following three programming examples demonstrate edge detection, DAV, and mixed programming methods.

This example is coded in HP BASIC for a System 9000 (Series 300) linked to a HP E1406 Command Module via HPIB. The example enables all four channel ports to detect both positive and negative edges on any channel of any port. Any edge will consequently generate an interrupt. When idle, the program will loop and continuously display the WORD DATA REGISTERS for all four channel ports and the EDGE INTERRUPT STATUS REGISTER. (This shows the static state of each channel input.) On interrupt, the program will alternately display the EDGE DETECT REGISTERS of each port, and the EDGE INTERRUPT STATUS REGISTER.

90CLEAR SCREEN

100DIM A$[40]

110Vxi_address=70900

120!

130CLEAR 7

140OUTPUT Vxi_address;"*RST;*CLS" ! reset E1406

92 HP E1459A Register Definitions