AnsweredAssumed Answered

python scripting with U2701A

Question asked by piter on Jun 19, 2014
Hi forum.
I am trying to control a U2701A via python and IVI.

Fter some googling I have written this script. Some parts come from scripts I modified and not needed. I tried to remove them but I might miss some.
------------------------------------------------------------------------------
import matplotlib
matplotlib.use('TkAgg')
import unittest
from comtypes.test import ResourceDenied
from comtypes.client import CreateObject, GetModule
from comtypes import GUID
from comtypes.safearray import _midlSAFEARRAY
from ctypes import c_double, POINTER
from pylab import *
from time import gmtime, strftime

try:
    GUID.from_progid("AgilentU2701A.AgilentU2701A")
except WindowsError:
    pass
else:
    pass
#############
GetModule("IviDriverTypeLib.dll")
GetModule("IviScopeTypeLib.dll")#     no_namespace // IVI inherent functionality
GetModule("AgU2701A.dll")  
#############

from comtypes.gen import AgilentU2701ALib
from comtypes.gen import IviScopeLib
from comtypes.gen import IviDriverLib

ivi_scope = CreateObject("AgilentU2701A.AgilentU2701A")
ivi_scope.Initialize('USB0::0x0957::0x2918::MY52301014::0::INSTR', True, True, '')

from  pylab import *
ivi_scope.Channels.Count
ch1 = ivi_scope.Channels.Item("Channel1")
ch1.Range = 0.4
ch1.Offset = 0.2
ch2 = ivi_scope.Channels.Item("Channel2")
ch2.Enabled = True
ch2.Range = 0.8
ch2.Offset = 0.4

ivi_scope.Acquisition.SampleRate
ivi_scope.Acquisition.TimePerRecord = 500e-9
ivi_scope.Acquisition.StartTime = 0
ivi_scope.Trigger.Level = 0.035
ivi_scope.Trigger.Source = u'CHANNEL1'




wave = ivi_scope.Measurements.Item("Channel1").ReadWaveform(MaxTimeMilliseconds=100)
waveform = array(wave[0])
plot(wave[0])
________________________________________________________________________________________

Here comes my problem:

I measure  nanoseconds  pulses of 10 Hz frequency. Some times I have correctly triggerd signal, and sometimes I have a ¨flat¨ waveform measured. It looks like I have to change TriggerModifier but I cannot figure out how to do it.

Any hints?

Edited by: Piter on Jun 19, 2014 3:12 AM  

Outcomes