Dear professor,
I have successfully connected to my Logic Analyzer, 16901A via Python COM remote control. I am able to load the configure file to my LA and let it run or stop. But I meet some issues when I cast to some specific modules or call constants, such as AgtDataLong.
when I call “win32com.client.constants.AgtDataLong”, there will be AttributeError, which means ‘AgtDataLong’ is not defined. Because ‘AgtDataLong’ is their own data constant type, I doubt there should be something installed at first, as well as I get error track information when running the command “LAAnalyzerModule = win32com.client.CastTo(LAModule, "IAnalyzerModule")”, the error information is attached.
######################## My Code #####################################
import win32com.client
LAHostNameOrIP = '135.24.17.88‘
LAConnect = win32com.client.Dispatch("AgtLA.Connect")
LAInst = LAConnect.GetInstrument(LAHostNameOrIP)
LAModule = LAInst.GetModuleByName("My 16950B-1")
print LAModule.Type
LAInst.Open("OOO.ala")
#if LAModule.Type == "Analyzer":
# LAAnalyzerModule = win32com.client.CastTo(LAModule, "IAnalyzerModule")
# LAAnalyzerModule.SimpleTrigger("My Bus 1=hff")
LAInst.Run()
LABusSignals = LAModule.BusSignals
LABusSignalsCount = LABusSignals.Count
LABusSignalNameArray = []
LABusSignalTypeArray = []
for index in range(LABusSignalsCount):
LABusSignalName = LABusSignals.Item(index).Name
LABusSignalType = LABusSignals.Item(index).BusSignalType
LABusSignalNameArray.append(LABusSignalName)
LABusSignalTypeArray.append(LABusSignalType)
print LABusSignalName,LABusSignalType
###Get the module's bus/signal data and store into 'LADataArrays'.
LADataArrays = []
LADataArrays.append(LABusSignalNameArray)
LADataArrays.append(LABusSignalTypeArray)
LAStartRange = -10
LAEndRange = 10
for index in range(LABusSignalsCount):
LAData = LABusSignals.Item(index).BusSignalData
LABusSignalType = LABusSignalTypeArray[index]
LADataType = win32com.client.constants.AgtDataLong
.....
.....
#######################################################
Edited by: dochang on Mar 18, 2014 10:55 PM
Edited by: dochang on Mar 18, 2014 10:56 PM
I have successfully connected to my Logic Analyzer, 16901A via Python COM remote control. I am able to load the configure file to my LA and let it run or stop. But I meet some issues when I cast to some specific modules or call constants, such as AgtDataLong.
when I call “win32com.client.constants.AgtDataLong”, there will be AttributeError, which means ‘AgtDataLong’ is not defined. Because ‘AgtDataLong’ is their own data constant type, I doubt there should be something installed at first, as well as I get error track information when running the command “LAAnalyzerModule = win32com.client.CastTo(LAModule, "IAnalyzerModule")”, the error information is attached.
######################## My Code #####################################
import win32com.client
LAHostNameOrIP = '135.24.17.88‘
LAConnect = win32com.client.Dispatch("AgtLA.Connect")
LAInst = LAConnect.GetInstrument(LAHostNameOrIP)
LAModule = LAInst.GetModuleByName("My 16950B-1")
print LAModule.Type
LAInst.Open("OOO.ala")
#if LAModule.Type == "Analyzer":
# LAAnalyzerModule = win32com.client.CastTo(LAModule, "IAnalyzerModule")
# LAAnalyzerModule.SimpleTrigger("My Bus 1=hff")
LAInst.Run()
LABusSignals = LAModule.BusSignals
LABusSignalsCount = LABusSignals.Count
LABusSignalNameArray = []
LABusSignalTypeArray = []
for index in range(LABusSignalsCount):
LABusSignalName = LABusSignals.Item(index).Name
LABusSignalType = LABusSignals.Item(index).BusSignalType
LABusSignalNameArray.append(LABusSignalName)
LABusSignalTypeArray.append(LABusSignalType)
print LABusSignalName,LABusSignalType
###Get the module's bus/signal data and store into 'LADataArrays'.
LADataArrays = []
LADataArrays.append(LABusSignalNameArray)
LADataArrays.append(LABusSignalTypeArray)
LAStartRange = -10
LAEndRange = 10
for index in range(LABusSignalsCount):
LAData = LABusSignals.Item(index).BusSignalData
LABusSignalType = LABusSignalTypeArray[index]
LADataType = win32com.client.constants.AgtDataLong
.....
.....
#######################################################
Edited by: dochang on Mar 18, 2014 10:55 PM
Edited by: dochang on Mar 18, 2014 10:56 PM
It appears that you copy and pasted some of the example code from the LA help file. Did you follow the instructions from the top of the help page on early binding?
Are you using the same version of Python as recommended ( Python version 2.2.3 and the Python for Windows extensions build 200) ?
What happens if you use the entire example from the help file, without changes?
Al
Disclaimer: For more reliable response, you should consider calling your local Agilent Technical Call Center. The Agilent Forums are monitored on an "as available" basis, and aren't necessarily the fastest way to get technical questions answered.