• RE: Simultaneous sine waves on SMU 2602 channels A & B

    Hello Andrea,
    many thanks for pointing me out in the right direction.

    As an initial experiment I have modified below (see also file in attachment) the ARB Features for testing Ford EMC just to generate 2 simultaneous in phase 100 Hz sinewaves with 2V amplitude and 0V offset.
    However, the SMU 2602 B outputs
    • a 100 Hz sinewave on chA with 2V Peak to Peak and 0V offset
    • a 100 Hz sinewave on chB with 10V Peak to Peak and offset 1V.
    Could you please advise what I am doing wrong?

    Thank you
    Fabrizio


    local _startV -- Used by script to track the starting voltage
    local _srcRate = 8000 -- Source Update Rate used by the script Sets the source update rate (pts/sec) used by the script. 
                          --Do not set higher than 8,000 if your waveform will have polarity changes 0V crossings)
        
    function SetupAWG(startV, rangeV, limitI, wfrmTbl, remoteSense, trigLineIn)
        -- Do some parameter checks
        --=========================
        if startV == nil then startV = 0 end
        if remoteSense ~= true then remoteSense = false end
        if type(trigLineIn) == "number" then
            trigLineIn = math.floor(trigLineIn)
            if trigLineIn < 0 or trigLineIn > 14 then
                return true, "Error: Selected trigger line is not valid.  trigLineIn must be a number between 0 and 14 or nil."
            end
        elseif trigLineIn ~= nil then
            return true,"Error: Invalid parameter trigLineIn.  trigLineIn must be a number between 0 and 14 or nil."
        end
        _startV = startV
        wfrmTbl = {0.078459,0.156434,0.233445,0.309017,0.382683,0.45399,0.522499,0.587785,0.649448,0.707107,0.760406,0.809017,0.85264,0.891007,0.92388,0.951057,0.97237,0.987688,0.996917,1,0.996917,0.987688,0.97237,0.951057,0.92388,0.891007,0.85264,0.809017,0.760406,0.707107,0.649448,0.587785,0.522499,0.45399,0.382683,0.309017,0.233445,0.156434,0.078459,0,-0.078459,-0.156434,-0.233445,-0.309017,-0.382683,-0.45399,-0.522499,-0.587785,-0.649448,-0.707107,-0.760406,-0.809017,-0.85264,-0.891007,-0.92388,-0.951057,-0.97237,-0.987688,-0.996917,-1,-0.996917,-0.987688,-0.97237,-0.951057,-0.92388,-0.891007,-0.85264,-0.809017,-0.760406,-0.707107,-0.649448,-0.587785,-0.522499,-0.45399,-0.382683,-0.309017,-0.233445,-0.156434,-0.078459,0}      
       
        
        
        -- Setup the SMU for arb waveform output
        --======================================
        reset()
        smua.reset()
        smub.reset()
        smua.source.func                    = smua.OUTPUT_DCVOLTS
        smub.source.func                    = smub.OUTPUT_DCVOLTS
        if remoteSense == true then
            smua.sense                        = smua.SENSE_REMOTE
            smub.sense                        = smub.SENSE_REMOTE
        else
            smua.sense                        = smua.SENSE_LOCAL
            smub.sense                        = smub.SENSE_LOCAL
        end
        smua.source.autorangev            = smua.AUTORANGE_OFF
        smua.source.autorangei            = smua.AUTORANGE_OFF
        smua.source.rangev                = rangeV
        smua.source.levelv                = startV
        smua.source.limiti                = limitI
        smua.source.delay                = 0
        smua.source.settling            = smua.SETTLE_FAST_POLARITY
       
        smub.source.autorangev            = smub.AUTORANGE_OFF
        smub.source.autorangei            = smub.AUTORANGE_OFF
        smub.source.rangev                = rangeV
        smub.source.levelv                = startV
        smub.source.limiti                = limitI
        smub.source.delay                = 0
        smub.source.settling            = smub.SETTLE_FAST_POLARITY

        -- Configure the Trigger Model
        --============================
        -- Timer 1 controls the time per point table phase A
        trigger.timer[1].delay            = 1 / _srcRate
        trigger.timer[1].count            = table.getn(wfrmTbl) > 1 and table.getn(wfrmTbl) - 1 or 1
        if trigLineIn == nil then
            -- Immediate
            trigger.timer[1].stimulus    = smua.trigger.ARMED_EVENT_ID
            trigger.timer[1].stimulus    = smub.trigger.ARMED_EVENT_ID
        elseif trigLineIn == 0 then
            -- Front panel TRIG button
            display.trigger.clear()
            trigger.timer[1].stimulus    = display.trigger.EVENT_ID
        else
            -- Digio Trigger
            digio.trigger[trigLineIn].clear()
            digio.trigger[trigLineIn].mode = digio.TRIG_EITHER
            trigger.timer[1].stimulus    = digio.trigger[trigLineIn].EVENT_ID
        end
        trigger.timer[1].passthrough    = true
        
       -- Timer 2 controls the time per point table phase B
        trigger.timer[2].delay            = 1 / _srcRate
        trigger.timer[2].count            = table.getn(wfrmTbl) > 1 and table.getn(wfrmTbl) - 1 or 1
        if trigLineIn == nil then
            -- Immediate
            trigger.timer[2].stimulus    = smua.trigger.ARMED_EVENT_ID
            trigger.timer[2].stimulus    = smub.trigger.ARMED_EVENT_ID
        elseif trigLineIn == 0 then
            -- Front panel TRIG button
            display.trigger.clear()
            trigger.timer[2].stimulus    = display.trigger.EVENT_ID
        else
            -- Digio Trigger
            digio.trigger[trigLineIn].clear()
            digio.trigger[trigLineIn].mode = digio.TRIG_EITHER
            trigger.timer[2].stimulus    = digio.trigger[trigLineIn].EVENT_ID
        end
        trigger.timer[2].passthrough    = true


        -- Configure SMU Trigger Model for arb waveform output
        smua.trigger.source.listv(wfrmTbl)
        smua.trigger.source.limiti        = limitI
        smua.trigger.measure.action        = smua.DISABLE
        smua.trigger.endpulse.action    = smua.SOURCE_HOLD
        smua.trigger.endsweep.action    = smua.SOURCE_HOLD
        smua.trigger.count                = table.getn(wfrmTbl)
        smua.trigger.arm.count            = 1
        smua.trigger.arm.stimulus        = 0
        smua.trigger.source.stimulus    = trigger.timer[1].EVENT_ID
        smua.trigger.measure.stimulus    = 0
        smua.trigger.endpulse.stimulus    = 0
        smua.trigger.source.action        = smua.ENABLE
        
        smub.trigger.source.listv(wfrmTb1)
        smub.trigger.source.limiti        = limitI
        smub.trigger.measure.action        = smub.DISABLE
        smub.trigger.endpulse.action    = smub.SOURCE_HOLD
        smub.trigger.endsweep.action    = smub.SOURCE_HOLD
        smub.trigger.count                = table.getn(wfrmTbl)
        smub.trigger.arm.count            = 1
        smub.trigger.arm.stimulus        = 0
        smub.trigger.source.stimulus    = trigger.timer[2].EVENT_ID
        smub.trigger.measure.stimulus    = 0
        smub.trigger.endpulse.stimulus    = 0
        smub.trigger.source.action        = smub.ENABLE
        
        --==============================
        -- End Trigger Model Configuration
        
        if errorqueue.count > 0 then
            return true,"Error occured during setup.  Please check that your parameters are valid."
        else
            return false,"No error."
        end
    end

    function RunAWG(numCycles)
        if numCycles == nil or numCycles < 0 then
            numCycles = 1
        end
        
        -- Set the number of cycles to output
        smua.trigger.arm.count = numCycles
        smub.trigger.arm.count = numCycles
        -- Turn output on
        smua.source.output = smua.OUTPUT_ON
        smub.source.output = smub.OUTPUT_ON
        -- Start the trigger model execution
        smua.trigger.initiate()
        smub.trigger.initiate()
        
        if errorqueue.count > 0 then
            return true,"Error occurred.  See error queue for details."
        else
            return false,"No error."
        end
    end
    --[[ Name: StopAWG()

        Usage: err,msg = StopAWG()

        Description:
            This function stops the waveform output and turns the SMU
            output off.
    --]]
    function StopAWG()
        smua.abort()
        smua.source.output = 0
        smua.source.levelv = _startV
        
        smub.abort()
        smub.source.output = 0
        smub.source.levelv = _startV
        
        if errorqueue.count > 0 then
            return true,"Error occured.  See error queue for details."
        else
            return false,"No error."
        end
    end

     
  • Simultaneous sine waves on SMU 2602 channels A & B

    Hello,
    I am very new to the SMU 2602 and I am trying to generate 2 simultaneous 120 degree out of phase sine waves at 100 Hz on the channels A and B of the same SMU 2602 B, could you please advise:
    • if this is possible from the hardware point of view?
    • if this is possible from the software point of view?
    • if there are scripts from where I could find suggestions on how to do it? 
    Should I use:
    •  SetupSineFunction(frequency, amplitude, offset, limitI, remoteSense, trigLineIn)
    • or build the waveforms from a table using SetupAWG(startV, rangeV, limitI, wfrmTbl, remoteSense, trigLineIn) and then adjusting the timing to get the frequency I need?

    Thank you
    Fabrizio