Exemple #1
0
def iDeviceCurve(vi1,vi2,vii,vo1,vo2,voi=0.1,ri=1.0,ro=1.0,wt=0.1):

    # Check if SciPy is loaded
    slab.checkSciPy()

    i_range=np.arange(vi1,vi2,vii)
    o_range=np.arange(vo1,vo2,voi)
    plt.figure(facecolor="white")   # White border
    for vi in i_range:
        avo = []
        aio = []
        slab.setVoltage(2,vi)
        slab.wait(wt)
        a0 = slab.readVoltage(1)
        i_in = (vi - a0) / ri
        for vs in o_range:
            slab.setVoltage(1,vs)
            slab.wait(wt)
            a1 = slab.readVoltage(2)
            a2 = slab.readVoltage(3)
            curr = (a1 - a2) / ro
            avo.append(a2)
            aio.append(curr)
        lbl = "{:.6f}".format(i_in) + ' mA'    
        pl.plot(avo,aio,label=lbl)   
    slab.message(1,"Drawing curves")
    pl.legend(loc='upper right')         
    pl.title("Io(Vo) Device Curves as function of Ii")
    pl.xlabel("Output Voltage(V)")
    pl.ylabel("Output Current(mA)")   
    pl.grid()    
    pl.show()   
    pl.close()    
Exemple #2
0
def curveVVbridge(vp,vn,vi=0.1,vmin=0.0,wt=0.1,returnData=False):

    # Check if SciPy is loaded
    slab.checkSciPy() 

    # Perform the positive DC sweep
    slab.message(1,"Positive curve")
    slab.setVoltage(2,vmin)
    xp,y1p,y2p,y3p,y4p = slab.dcSweep(1,vmin,vp,vi,wt)
    # Perform the negative DC sweep
    slab.message(1,"Negative curve")
    slab.setVoltage(1,vmin)
    xn,y1n,y2n,y3n,y4n = slab.dcSweep(2,vmin,vn,vi,wt)
    
    # Join all measurements
    x=[]
    y=[]
    
    ln = len(xn)
    for i in range(0,ln):
        pos = ln-i-1
        xvalue = y1n[pos]-y2n[pos]
        yvalue = y3n[pos]-y4n[pos]
        x.append(xvalue)
        y.append(yvalue)
        
    lp = len(xp)    
    for i in range(0,lp):
        xvalue = y1p[i]-y2p[i]
        yvalue = y3p[i]-y4p[i]
        x.append(xvalue)
        y.append(yvalue) 
        
    x = np.array(x)
    y = np.array(y)    
    
    # Plot result
    slab.message(1,"Drawing curve")
    slab.plot11(x,y,"V(V) Bridge Plot","Input (V)","Output (V)")
    
    if slab.plotReturnData or returnData:
        return x,y 
Exemple #3
0
def curveVIref(v1,v2,vi=0.1,r=1.0,vr=-1,wt=0.1,returnData=False):

    # Check if SciPy is loaded
    slab.checkSciPy() 

    # Perform a DC sweep
    x,y1,y2,y3,y4 = slab.dcSweep(1,v1,v2,vi,wt)
    # Set DAC 1 to Vdd/2
    slab.setVoltage(1,slab.vdd/2)
    # Plot result
    req =  r / 2
    if vr < 0:
        vr = slab.vdd / 2
    vd = y1 - y2
    id = (y2 - vr)/req
    slab.message(1,"Drawing curve")
    slab.plot11(vd,id,"V-I plot with reference","Voltage (V)","Current (mA)") 
    
    if slab.plotReturnData or returnData:
        return vd,id
Exemple #4
0
def curveVIbridgeOld(v1max,v2max,vi=0.1,r=1.0,wt=0.1,returnData=False):

    # Check if SciPy is loaded
    slab.checkSciPy() 

    # Perform first DC sweep
    slab.message(1,"Forward curve")
    slab.setVoltage(2,0.0)                            # Set DAC 2 to 0.0
    x,y1,y2,y3,y4 = slab.dcSweep(1,0.0,v1max,vi,wt)   # Sweep DAC 1

    # First plot
    vd = y2 - y3
    id = (y1 - y2)/r
    plt.figure(facecolor="white")   # White border
    pl.plot(vd,id)

    # Perform second DC sweep
    slab.message(1,"Backward curve")
    slab.setVoltage(1,0.0)                            # Set DAC 1 to 0.0
    x,y1,y2,y3,y4 = slab.dcSweep(2,0.0,v2max,vi,wt)   # Sweep DAC 2
    
    # Set DACs to zero
    slab.writeChannel(1,0.0)
    slab.writeChannel(2,0.0)
    
    # Second plot
    slab.message(1,"Drawing curve")
    vd = y2 - y3
    id = (y1 - y2)/r
    pl.plot(vd,id)
    
    pl.xlabel("Voltage (V)")
    pl.ylabel("Current (mA)")
    pl.title("V-I plot in bridge mode")
    pl.grid()
    pl.show() 
    pl.close()
    
    if slab.plotReturnData or returnData:
        return vd,id
Exemple #5
0
def curveVIbridge(v1max,v2max,vi=0.1,vmin=0.0,r=1.0,wt=0.1,returnData=False):

    # Check if SciPy is loaded
    slab.checkSciPy() 

    # Perform first DC sweep
    slab.message(1,"Positive curve")
    slab.setVoltage(2,vmin)                                 # Set DAC 2 to vmin
    xf,y1f,y2f,y3f,y4f = slab.dcSweep(1,vmin,v1max,vi,wt)   # Sweep DAC 1

    # Perform second DC sweep
    slab.message(1,"Negative curve")
    slab.setVoltage(1,vmin)                                 # Set DAC 1 to vmin
    xr,y1r,y2r,y3r,y4r = slab.dcSweep(2,vmin,v2max,vi,wt)   # Sweep DAC 2
    
    # Set DACs to vmin
    slab.setVoltage(1,vmin)
    slab.setVoltage(2,vmin)
    
    # Join the curves
    vd=[]
    id=[]
    lenr=len(xr)
    for i in range(0,lenr):
        pos = lenr - i - 1
        vd.append(y2r[pos]-y3r[pos])
        id.append((y1r[pos]-y2r[pos])/r)
    for i in range(0,len(xf)):
        vd.append(y2f[i]-y3f[i])
        id.append((y1f[i]-y2f[i])/r)
    
    plt.figure(facecolor="white")   # White border
    pl.plot(vd,id)      
    pl.xlabel("Voltage (V)")
    pl.ylabel("Current (mA)")
    pl.title("V-I plot in bridge mode")
    pl.grid()
    pl.show() 
    pl.close()
    
    if slab.plotReturnData or returnData:
        return vd,id        
Exemple #6
0
print('If you had performed the calibration, it should load')
if pause_after_connect:
    slab.pause('(Press return)')
print()

slab.printBoardInfo()
print()
print('You should see information about the board')
print('Now connect DAC1 to ADC1,3,4 and DAC2 to ADC2')
if pause_after_info:
    slab.pause('(Press return)')
print()
   
#DC voltage commands
print('DC voltage commands')
slab.setVoltage(1,1.5)
slab.setVoltage(2,2.0)
v1=slab.readVoltage(1)
v2=slab.readVoltage(2)
v3=slab.readVoltage(3)
v4=slab.readVoltage(4)
if not( compare(v1,1.5) and compare(v2,2.0) and compare(v3,1.5) and compare(v4,1.5)):
    raise slab.SlabEx("setVoltage or readVoltage fail")  
print('  setVoltage and readVoltage pass')
slab.zero()
if not zeroCompare(slab.readVoltage(1),0.05):
    raise slab.SlabEx("zero command fails")
print('  zero pass')
print()

slab.setVoltage(1,1.0)
Exemple #7
0
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"
print "during the transient triggered test"
print "Sometimes you should connect it to GND and Vdd in sequence"
print "After the curve is drawn, reconnect ADC1 to DAC1"
print
Exemple #8
0
def setVoltage(channel, value):
    slab.setVoltage(channel, value)