User`s manual
Agilent E1330B Digital I/O Module Register Information 127
Appendix B
Writing a
16-Bit Word
Similar to the last program example, this program outputs a 16-bit word to your
peripheral device. To write a 16-bit word, two consecutive ports are required (i.e.
ports 0 and 1, 1 and 2, 2 and 3, or 3 and 4). Both ports must be configured exactly
the same. Configure consecutive port registers by addressing the lower port's
register and sending a 16-bit word. Handshaking is accomplished using the lower
port's handshake lines.
BASIC Version 10 Base_addr = DVAL("1FE400",16)
20 !Logical Address 144.
30 WRITEIO -9826,Base_Addr+DVAL("18",16);DVAL("3232",16)
40 !Sets Ports 0 & 1 Handshake Register to leading edge handshake
50 !and flag driven transfer.
60 WRITEIO -9826,Base_Addr+DVAL("1C",16);DVAL("0000",16
70 !Sets Ports 0 & 1 Delay Register to 0.
80 WRITEIO -9826,Base_Addr+DVAL("20",16);DVAL("0000",16)
90 !Sets Ports 0 & 1 Normalization Register (polarity) to positive-true
100 !(High = true).
110 WRITEIO -9826,Base_Addr+DVAL("10",16);DVAL("0000",16)
120 !Sets Ports 0 & 1 Status Control bit 6 to enable output.
130 WRITEIO -9826,Base_Addr+DVAL("0C",16);DVAL("0202",16)
140 !Sets Ports 0 & 1 Transfer Control Register bit 1 to Enable Handshake.
150 WRITEIO -9826,Base_Addr+DVAL("14",16);512
160 !Sets Ports 0 & 1 Data Register to the value to output.
170 REPEAT
180 UNTIL BIT(READIO ( 9826,Base_addr+DVAL("0C",16)),1)
190 !If more data to send, repeat lines 150 - 180.
200 WRITEIO 9826,Base_Addr+DVAL("0C",16);DVAL("0000",16)
210 !Clears Ports 0 & 1 Transfer Control Register bit 1 to Disable Handshake.
220 END
C Version The C program is similar to that shown for writing an 8-bit byte except the data sent
to the registers must be 16 bits.