User manual

Using the Relay Multiplexer 51Chapter 2
Miscellaneous Multiplexer Functions
This section describes some miscellaneous multiplexer functions, including:
Using the Scan Complete Bit
Using the Analog Bus
Saving and Recalling States
Detecting Error Conditions
Synchronizing the Multiplexer
Using the Scan
Complete Bit
The scan complete bit (bit 8) can be used in the Operation Status Register
of a switchbox to determine when a scanning cycle completes (no other bits
in the register apply to the switchbox). Bit 8 has a decimal value of 256 and
you can read it directly with the STAT:OPER? command.
When enabled by the STAT:OPER:ENAB 256 command, the scan complete
bit will be reported as bit 7 of the Status Byte Register. Use the GPIB Serial
Poll or the IEEE 488.2 Common Command *STB? to read the Status Byte
Register. When bit 7 of the Status Byte Register is enabled by the *SRE 128
common command to assert a GPIB Service Request, you can interrupt the
computer when the scan complete bit is set, after the scanning cycle
completes. This allows the controller to do other operations while the
scanning cycle is in progress.
Example: Using the Scan
Complete Bit
This example monitors bit 7 in the Status Byte Register to determine when
the scanning cycle completes. The example uses GPIB select code 7,
primary address 09, and secondary address 14 for the multiplexer.
10 OUTPUT 70914;"*CLS"
!Clear all switchbox status structure
20 OUTPUT 70914;"STAT:OPER:ENAB 256"
!Enable scan complete bit to set bit 7 in
Status Byte Register
30 OUTPUT 70914;"*SRE 128"
!Enable bit 7 of Status Byte Register to
assert RQS
40 OUTPUT 70914;"TRIG:SOUR EXT"
!Set to external trigger mode
50 OUTPUT 70914;"SCAN (@100:102)"
!Defines channel list to scan bank 0 channels
0 through 2
60 OUTPUT 70914;"INIT"
!Start scanning cycle
70 WHILE NOT BIT(SPOLL(70914),7)
!Waiting for scan complete
80 PRINT "DO OTHER OPERATION HERE"
!Enter program lines for computer to do other
operations
90 END WHILE
100 PRINT "INTERRUPT GENERATED"
!Program goes to this line after interrupt is
generated by a completed scanning cycle
110 END
!Terminate program