if sl.ndacs<3: pl.plot(xrange,a3,label="ADC3(DAC1)") else: pl.plot(xrange,a3,label="ADC3(DAC3)") pl.plot(xrange,a4,label="ADC4(DAC1)") pl.legend(loc='lower right') pl.title("ADC(DAC) Test Curves") pl.xlabel("DAC Ratiometric value") pl.ylabel("ADC Ratiometric value") pl.grid() pl.show() sl.setSampleTime(0.002) print "Sample time set to 2ms" sl.setTransientStorage(200,1) print "Transient storage set to 200 points" sl.setVoltage(1,1.0) print print "[ ] Commands R, S and Y checked in next curve if:" print " Voltage is about 1V" print " Maximum time is 0.4s" print " Resolution is 2ms" print sl.tranAsyncPlot() print "For the next test you need to take and put ADC1 cable"
w=v[3]/v[0] if not isVectorConstant(w,1.0): raise slab.SlabEx("dcSweep fails at DAC1 or ADC3") w=v[4]/v[0] if not isVectorConstant(w,1.0): raise slab.SlabEx("dcSweep fails at DAC1 or ADC4") if not isVectorConstant(v[2],1.0): raise slab.SlabEx("dcSweep fails at DAC2 or ADC2") print('pass') print() #Transient async test print('Transient async check') slab.setVoltage(1,1.0) slab.setVoltage(2,2.0) slab.setSampleTime(0.001) slab.tranStore(100,4) v=slab.transientAsync() if not isVectorConstant(v[1],1.0): raise slab.SlabEx("transientAsync fails at ADC1") if not isVectorConstant(v[2],2.0): raise slab.SlabEx("transientAsync fails at ADC2") if not isVectorConstant(v[3],1.0): raise slab.SlabEx("transientAsync fails at ADC3") if not isVectorConstant(v[4],1.0): raise slab.SlabEx("transientAsync fails at ADC4") print(' transientAsync pass') print() #Step response test print('Step response check')
''' SLab Example Example_16.py Step response of a RC low pass filter ''' # Locate slab in the parent folder import sys sys.path.append('..') sys.path.append('.') import slab # Set prefix to locate calibrations slab.setFilePrefix("../") # Open serial communication slab.connect() # Set sample time to 50us slab.setSampleTime(0.00005) # Set storage requirements slab.setTransientStorage(1000, 2) # Perform async transient read result = slab.stepPlot(1.0, 2.0) # Close serial communication slab.disconnect()