# HG changeset patch # User Daniel O'Connor # Date 1312955306 -34200 # Node ID 9bb8a9f3df6bb49812cbaea495a67ce201c88dda # Parent 20df02be818a130b8f23b06a6f64e580a3371dca Update examples to match new code. diff -r 20df02be818a -r 9bb8a9f3df6b rs_fsp7_example.py --- a/rs_fsp7_example.py Wed Aug 10 15:17:57 2011 +0930 +++ b/rs_fsp7_example.py Wed Aug 10 15:18:26 2011 +0930 @@ -55,14 +55,16 @@ # Wait up to 10 seconds for it to be done r.write("*OPC?") - print "OPC - " + r.read(10) + opc = scpi.getdata(r.read(10), int) + print "OPC - %d" % (opc) # Set peak excursion r.write("CALC:MARK:PEXC 6DB") # Find 3rd order intercept & get result r.write("CALC:MARK:FUNC:TOI ON") r.write("CALC:MARK:FUNC:TOI:RES?") - print "Result " + r.read(10) + toi = scpi.getdata(r.read(1)) + print "Result = %.2f" % (toi) # Set data format r.write("FORM REAL,32") diff -r 20df02be818a -r 9bb8a9f3df6b tek2024b_example.py --- a/tek2024b_example.py Wed Aug 10 15:17:57 2011 +0930 +++ b/tek2024b_example.py Wed Aug 10 15:18:26 2011 +0930 @@ -52,13 +52,13 @@ # Fetch horizontal scale u.write("HOR:MAIN:SCALE?") - hscale = float(u.read(1).split()[1]) - print "Horizontal scale is %f sec/div" % (hscale) + hscale = scpi.getdata(u.read()) + print "Horizontal scale is %f nsec/div" % (hscale * 1e9) # Make sure the previous commands have been executed u.write("*WAI") - # Fetch curve data (wait up to 1 second) + # Fetch curve data (wait up to 1 second) since the read takes a little while u.write("CURVE?") then = time.time() result = u.read(1.0) @@ -66,7 +66,7 @@ print "CURVE read took %f milliseconds" % ((now - then) * 1000.0) # Parse data - ary = scpi.bindecode(result, header = ':CURVE ', dtype = numpy.dtype('>h')) + ary = scpi.bindecode(result, dtype = numpy.dtype('>h')) # Convert to volts ary = ary / 32768.0 * vscale