-
Hello Andrea, <br>
<br>
I just tried your suggestion, and it seems that if I load my TSP script into the 3706A up front, using a separate python script and the command <code>write('loadscript filename')</code>, it does not work.<br>
<br>
If I instead write the TSP script to the instrument line by line in the same python script that also trigger the measurement, like your example, it seemed to work for awhile. Now, suddenly, it is not possible to reset the status registers by use of <code>status.reset()</code><br>
<br>
Is there any ways of completely reset the instrument to factory defaults (the <code>reset()</code> does not seem to fix anything either)?<br>
<br>
<br>
Kind regards, <br>
Lars
-
Hello Andrea.<br>
<br>
thanks for the explanation and suggestions.<br>
I will try this as soon as I am in the lab on monday, and report back to you.<br>
<br>
Your help is much appreachiated!<br>
<br>
Have a great weekend!<br>
Kind regards, <br>
Lars
-
Hello Andrea, <br>
thanks for you quick reply.<br>
<br>
This is not working for me.<br>
Also, I would like to understand this a bit better, as I find the manual a bit confusing. There is no SRQ annunciator on the front panel when running this on my instrument.<br>
<br>
Kind regards, <br>
Lars
-
<blockquote>
<p>Hi Paul, </p>
<p>thanks for doing that.</p>
<p></p>
<p>Just so you technicians have some more input I have added my code below.</p>
<p>TSP script on the 3706A (sweep.tsp):</p>
<pre class="linenums prettyprint">-- Reads the sensor output from 3720 in slot2 (channel 1-10) and temperature reading from 3720 in slot1 (channel 1)
reset()                                            -- Reset instrument
errorqueue.clear()                                -- Clear error queue
status.reset()                                    -- Clearing the status registers and output queue
status.request_enable = 0                        -- Clearing the status enable
status.measurement.enable = 0                    -- Clearing the SRQ on measurement complete enable
tempOutput_buffer = dmm.makebuffer(5)                -- Create buffer
sensorOutput_buffer = dmm.makebuffer(50)            -- Create buffer
tempOutput_buffer.clear()                            -- Clearing the tempOutput_buffer
sensorOutput_buffer.clear()                            -- Clearing the sensorOutput_buffer
-- Status registers
status.standard.enable = 1169
status.request_enable = 129
status.measurement.enable = status.measurement.BAV   -- Enable SRQ on measurement complete
function getTemperature()
    dmm.func = dmm.TEMPERATURE                -- Set function to Temperature
    dmm.transducer = dmm.TEMP_FOURRTD        -- Set sensor to 4 wire RTD
    dmm.fourrtd = dmm.RTD_PT100                -- Set RTD to PT100
    dmm.units = dmm.UNITS_CELSIUS            -- Set units to C
    dmm.nplc = 2                            -- Set NPLC
    dmm.configure.set("temp")            -- Save DMM setting to RTDtemp
    dmm.setconfig("1001", "temp")        -- Assign RTDtemp setting to channel 1 on MUX in slot 1
    scan.create("1001")                        -- Create scan list
    scan.measurecount = 5                    -- Set number of repeated measurements in the scan
    scan.execute(tempOutput_buffer)            -- Execute scan and save readings to buffer
    --scan.background(tempOutput_buffer)            -- Execute backgound scan and save readings to buffer
    waitcomplete()
end
function getSensorOutput()
    dmm.func = dmm.DC_VOLTS                        -- Set dmm function to Volts
    dmm.nplc = 2                                -- Set NPLC
    dmm.range = 10                                -- Set Range
    dmm.configure.set("sensor")            -- Save DMM setting to SensorOutput
    dmm.setconfig("2001:2010", "sensor")    -- Assign sensorOutput setting to channel 1 on MUX in slot 2
    scan.create("2001:2010")                    -- Create scan list
    scan.measurecount = 5                        -- Set number of repeated measurements on each channel
    scan.execute(sensorOutput_buffer)            -- Execute scan and save readings to buffer
    --scan.background(sensorOutput_buffer)        -- Execute background scan and save readings to buffer
    waitcomplete()
end
getTemperature()
getSensorOutput()
opc()
</pre>
</blockquote>
<pre class="linenums prettyprint"></pre>
<blockquote>
<pre class="linenums prettyprint"></pre>
<p><br>
Python script to start measurement and read the results:</p>
<pre>import pyvisa as visa
import time
rm = visa.ResourceManager()
inst = rm.open_resource('TCPIP0::192.168.10.3::inst0::INSTR')
inst.read_termination = '\n'
inst.write_termination = '\n'
# running sweep.tsp stored on instrument
inst.write('sweep.run()')
script_running = True
status_byte = 0
debug = 1
while script_running:
    status_byte = inst.read_stb()
    if debug: print(str(status_byte) + ' - ' + str(bin(status_byte))) # for debugging
    if debug: print(status_byte) # for debugging
    if (status_byte and 64) == 64:
        script_running = False
    time.sleep(0.25)
print(inst.query('printbuffer(1, tempOutput_buffer.n, tempOutput_buffer)'))
print(inst.query('printbuffer(1, sensorOutput_buffer.n, sensorOutput_buffer)'))</pre>
<p></p>
<p>Kind regards, </p>
<p>Lars</p>
</blockquote>
-
Hi,<br>
<br>
I am currently trying to set up a python script to get the results of measurement sweeps using a 3700A, but I cannot seem to get a correct understanding on how to use the registers to do this.<br>
<br>
I want to use the OPC() command to check if the measurements are complete, before reading the measurement buffer.<br>
<br>
<br>
Could anyone help me understand how to do this?<br>
<br>
Kind regards, <br>
Lars