There are many, but I typically use the status byte and opc() for operation complete.
Here I setup for 10 scans of 4 thermocouple channels:
my_instr.write("status.clear()")
my_instr.write("status.request_enable = 32")
my_instr.write("status.standard.enable = 1")
my_instr.write("myScanList = \"101,110, 115, 120\"")
my_instr.write("channel.setdmm(myScanList, dmm.ATTR_MEAS_FUNCTION, dmm.FUNC_TEMPERATURE)")
my_instr.write("channel.setdmm(myScanList, dmm.ATTR_MEAS_THERMOCOUPLE, dmm.THERMOCOUPLE_K)")
my_instr.write("channel.setdmm(myScanList, dmm.ATTR_MEAS_REF_JUNCTION, dmm.REFJUNCT_INTERNAL)")
my_instr.write("channel.setdmm(myScanList, dmm.ATTR_MEAS_OPEN_DETECTOR, dmm.ON)")
my_instr.write("channel.setdmm(myScanList, dmm.ATTR_MEAS_NPLC, 1)")
my_instr.write("display.watchchannels = myScanList")
my_instr.write("scan.scancount = 10")
my_instr.write("scan.scaninterval = 1")
my_instr.write("scan.create(\"101,110, 115, 120\")")
Then when ready to run the scan:
#status poll for opc()
my_instr.write("status.clear()")
#attach our session to read_stb channel
print("First status byte value: " + str(my_instr.read_stb()))
#my_instr.read_stb()
my_instr.write("trigger.model.initiate()")
my_instr.write("opc()") #this signals operation complete
#repeat until the SRQ bit is set
still_running = True
status_byte = 0
debug = 1
while still_running:
status_byte = int(my_instr.read_stb())
#if debug: print(status_byte)
if debug: print(str(status_byte) + ' - ' + str(bin(status_byte)) + ' - ' + str(hex(status_byte)))
if (status_byte and 64) == 64:
still_running = False
time.sleep(0.5) #500msec pause before asking again
print("Last status byte value: " + str(status_byte))
print("Scan is done - go get the data")
Typical output from the Python code:
First status byte value: 0 0 - 0b0 - 0x0
0 - 0b0 - 0x0
0 - 0b0 - 0x0
0 - 0b0 - 0x0
0 - 0b0 - 0x0
0 - 0b0 - 0x0
0 - 0b0 - 0x0
0 - 0b0 - 0x0
0 - 0b0 - 0x0
0 - 0b0 - 0x0
0 - 0b0 - 0x0
0 - 0b0 - 0x0
0 - 0b0 - 0x0
0 - 0b0 - 0x0
0 - 0b0 - 0x0
0 - 0b0 - 0x0
0 - 0b0 - 0x0
0 - 0b0 - 0x0
96 - 0b1100000 - 0x60
Last status byte value: 96
Scan is done - go get the data
The attached PDF has a second example for when using TSP functions.