Agilent Technologies E1470A Switch User Manual


 
Register-Based Programming 47
Appendix B
Writing to Relay Control
Registers
To set one or more relays write a 1to the bit controlling that relay:
1. Determine the register and bit locations for the relays you want to set.
2. Add the decimal values for each bit you want to set in a register.
3. Use the VXI:REG:WRITe command to write that decimal value to that
register.
Examples: Writing to Relay Control Registers
In these examples, since you are writing 1s to specific bits, the process
actually writes 0s to all other bits in that register thus resetting those relays.
To maintain previously established signal paths, you should read the
register state and maskthose bits when writing to the register.
NOTE If Bit 15 is a 1, BASIC language programming uses a 2s compliment
number so the decimal value is negative. For example, FFFF
h
=-1,
8000
h
= -32768.
If all relays are in their power-on/reset state, to set relay K002 (connect
channel CH002 to COM 00), set bit 1 (decimal value 2) in register (base +
20
h
). Use the commands:
!Selects logical address
!Writes value 2 to register 20h
To set relays K001, K003, K014, K013, and K024 (connect CH 001 to
COM 02) set bits 0, 2, 7, 6, and 11 (decimal values 1, 4, 128, 64, 2048
respectively), send the decimal value 2245 (1 + 4 + 128 + 64 + 2048 = 2245)
to register 20
h
. Use the commands:
!Selects logical address
Similarly, to reset a relay to its power-on/reset state, write a 0to the
respective bit.
Reading from Relay
Control Registers
Use the VXI:REG:READ? command to read the value of a register. The
value returned is the decimal-weighted sum of all the bits in that register that
are set to 1(relays in the setstate). At power-on/reset, the value returned
should be 0. Use the command:
!Selects logical address
!Reads from register base + 20
h
Examples: Writing to Relay Control Registers
The following table shows examples of the decimal values needed to write
to a register(s) to connect signal paths. Hundreds more combinations are
possible. These tables only show representative samples. Negative values
are 2s compliment.