pythoncomdrivervisa

Using IVI-COM drivers with python via comtypes


I am trying to get my IVI drivers working using comtypes. So far I have been successful in initializing the instrument thanks to Python instrument drivers more specifically Jorenko's post, as he is using the same instrument as me (I'm hoping he sees this as he seems to work for the company that makes the instrument).

So far I have:

from comtypes import client
dmm = client.CreateObject('VTEXDmm.VTEXDmm')
dmm.Initialize('TCPIP::10.20.30.40::INSTR', True, True)
dmm.Initiate()
dmm.Measurement.Read(1000)
#dmm.Measurement.Fetch(1000)

This works fine for taking readings from the default state, which is DC Volts, but I can't figure out how to set other functions. I've tried

dmm.Function = VTEXDmmFunctionACVolts

and had no joy with it.

It's worth noting that I have very little experience with IVI drivers.

Can someone please point me in the right direction

Thanks


Solution

  • Answered my own question (after much trial and error)

    For anyone interested, I had a bit of success with the following

    import comtypes 
    from comtypes import client
    dmm = client.CreateObject('VTEXDmm.VTEXDmm')
    dmm.Initialize('TCPIP::10.20.30.40::INSTR', True, True)
    dmm.Configure(Function=comtypes.gen.VTEXDmmLib.VTEXDmmFunctionACVolts, Range=1.0, Resolution=0.0001)
    dmm.Initiate()
    dmm.Measurement.Read(1000)