Writing to Relay Control

To set one or more relays write a “1” to the bit controlling that relay:

Registers

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 “mask” those 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, FFFFh = -1,

 

8000h = -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 +

 

20h). Use the commands:

 

 

 

 

!Selects logical address

 

VXI:E

 

 

!Writes value 2 to register 20h

 

To set relays K001, K003, K014, K013, and K024 (connect CH 001 to

 

COM 02) set bits

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 20h. Use the commands:

 

 

 

 

!Selects logical address

 

Similarly,VXI:REG:WRITto reset20,2245a relay to its power-on/reset state, write a “0” to the

 

respective bit.

 

 

 

Reading from Relay

Use the VXI:REG:READ? command to read the value of a register. The

Control Registers

value returned is the decimal-weighted sum of all the bits in that register that

 

are set to “” (relays in the “set” state). At power-on/reset, the value returned

 

should be . Use the command:

 

SL120

 

 

!Selects logical address

 

 

 

!Reads from register base + 20h

 

RG:WRIT20,2

 

 

Examples: Writing to Relay Control Registers

 

VXI:The followingE

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.

 

 

SL120

 

 

 

Appendix B

SLRG:READ?120

20

Register-Based Programming 47

Page 47
Image 47
Agilent Technologies E1470A user manual Vxie