Before using any of these examples, ensure that the GPIB address is set to 7, the interface
command set is SC, the ULI.EXE driver is loaded, and the switch is connected to the computer
using a GPIB cable.
Sending Commands
This example sets the SCG unit to channel 6 and turns on all the external relay drivers.
' set up the interface card and drivers
OPEN "GPIB0" FOR OUTPUT AS #1
OPEN "GPIB0" FOR INPUT AS #2
PRINT #1, "ABORT"
' set terminating character to CR LF sequence
PRINT #1, "GPIBEOS OUT CR LF"
PRINT #1, "GPIBEOS IN CR LF"
' sample commands "SWITCH 1 1 1; STB?"
PRINT #1, "OUTPUT 07;SWITCH 1 1 1;STB?"
PRINT #1, "ENTER 07"
' sample queries
PRINT #1, "OUTPUT 07;SWNUM?"
PRINT #1, "ENTER 07"
INPUT #2, a
PRINT "switch ",a
PRINT #1, "OUTPUT 07;ERR?"
PRINT #1, "ENTER 07"
INPUT #2, a
PRINT "error number= ",a
END
Serial Polling the Status Register
This example changes the channel setting and reads the status register continuously until the
output is settled.
PRINT #1, "OUTPUT 07;csb"
PRINT #1, "OUTPUT 07;SWITCH 1 1 1"
sr = 0
WHILE ((sr AND 4 ) =0)
PRINT #1, "SPOLL 07"
INPUT #2, sr
WEND
PRINT sr
END
' clearing the status byte clears the settling bit
' change channel
' initialize sr variable to enter the while loop
' loop until settled bit is true
' serial poll SCG
' print final value of sr
Programming Guide – 32