PXI

cancel
Showing results for 
Search instead for 
Did you mean: 

PXI-4022 - problem with drivers

Solved!
Go to solution

Hi,

I have a PXI-1033 with PXI-4071, PXI-4130 and PXI-4022 cards. I installed ni-pxiplatformservices_20.5.0, ni-dcpower_20.6.0, ni-dmm_20.0.0, ni-serial_20.0.0, ni-visa_20.0.0 on Windows 7 Pro.

I control devices using Python. Two cards 4130 and 4071 work without problems. However, the PXI-4022 card is detected in NI MAX (screenshot), but I cannot use it. As if there was no full driver.

 

In Python I get the message from 4022: DriverError: -1074118656: Device was not recognized. The device is not supported with this driver or version.

 

Can you help me get PXI-4022 working properly in Python?

Andrew

 

CODE:

import nidcpower
import nidmm
import time

with nidcpower.Session(resource_name="Dev2", channels = 0, reset= False, options={'simulate': False, 'driver_setup': {'Model': '4130', 'BoardType': 'PXIe'}}, independent_channels=False, grpc_options=None) as sessionDEV1Ch0:
sessionDEV1Ch0.voltage_level = 0.0
sessionDEV1Ch0.commit()
measurement_type = (nidcpower.MeasurementTypes.VOLTAGE)
sessionDEV1Ch0.initiate()
time.sleep(1)
t = sessionDEV1Ch0.measure(measurement_type)
print ('Meas SMU ch0: ', t)

with nidcpower.Session(resource_name="Dev2", channels = 1, reset= False, options={'simulate': False, 'driver_setup': {'Model': '4130', 'BoardType': 'PXIe'}}, independent_channels=False, grpc_options=None) as sessionDEV1Ch1:
sessionDEV1Ch1.voltage_level = 0.0
sessionDEV1Ch1.commit()
measurement_type = (nidcpower.MeasurementTypes.VOLTAGE)
sessionDEV1Ch1.initiate()
time.sleep(1)
t = sessionDEV1Ch1.measure(measurement_type)
print ('Meas SMU ch1: ', t)
#

with nidmm.Session("Dev2") as sessionDEV2:
sessionDEV2.configure_measurement_digits(nidmm.Function.DC_VOLTS, 10.0, 7.5)
print("Meas 4071: " + str(sessionDEV2.read()))

with nidmm.Session("Dev3") as sessionDEV3:
sessionDEV3.configure_measurement_digits(nidmm.Function.DC_VOLTS, 10.0, 7.5)
print("Meas 4022: " + str(sessionDEV3.read()))

0 Kudos
Message 1 of 7
(214 Views)

Based on the user manual of 4022 - https://download.ni.com/support/manuals/374305c.pdf

 

There is some active circuit with limited control options that uses NI DMM driver (precisely only one).

As per your image, Dev3 is the 4022, and in your code, you init and try to read from Dev3, whereas Dev3 does not have DMM functionality.

 

What you must be doing is, connect the 4022 with your DUT, and DMM (4071). In your code, configure 4022 in the mode of choice and read the measurement using your 4071.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 7
(162 Views)

Thank you Santhosh for your help. It's works. I connected it to the 4071 card and I receive a voltage signal at its input.

However, I have a problem with configuring the ranges. Can you give me an example of 4022 card configuration in a given range, e.g. 100nA? I can't write this in Python code.

0 Kudos
Message 3 of 7
(145 Views)

The PXI-4022 is not supported by the nidmm Python module.

 

In order to control it via Python you will need to call the raw C function niDMM_4022Control(). Python offers multiple mechanisms for this, e.g. ctypes. The library is nidmm_64.dll (assuming 64-bit Windows process), libnidmm.so (Linux), nidmm_32.dll (Windows 32-bit).

 

Now, why is it not supported in the nidmm Python module? The PXI-4022 uses only this single function and does not adhere to the session mechanisms that all other devices supported by the NI-DMM driver do. It's not an IVI-compliant instrument, and it does not need to be. For reasons lost to time it was added to the NI-DMM driver, when it should more properly have had its own separate driver.

Tobias
Principal Software Engineer
Driver Software
National Instruments
Message 4 of 7
(133 Views)

Now, why is it not supported in the nidmm Python module? The PXI-4022 uses only this single function and does not adhere to the session mechanisms that all other devices supported by the NI-DMM driver do. It's not an IVI-compliant instrument, and it does not need to be. For reasons lost to time it was added to the NI-DMM driver, when it should more properly have had its own separate driver.


The reason the nidmm Python module does not support PXI-4022 is because it was an obsolete product at the time the Python API was developed, as stated in nimi-python API design guidelines in the project's wiki:

 

> Don't include obsolete functions / properties

 

Using ctypes to directly call niDMM_4022Control() on the driver library is also my recommendation.

Marcos Kirsch
Chief Software Engineer
NI Driver Software
0 Kudos
Message 5 of 7
(129 Views)
Solution
Accepted by topic author Andrew13K

Thank you all for your help. Thanks to you, I was able to communicate with PXI-4022 enabling amplification configuration. I am providing the code below, maybe it will be useful to someone.

 

Code:

 

import nidmm
from ctypes import *

dll = cdll.LoadLibrary("nidmm_64.dll")
def c_string(s):
return c_char_p(str(s).encode('utf-8'))
vi = c_int(3)        #  The number determining the configuration, information below in the comment

ViStatus = dll.niDMM_4022Control(c_string('Dev3'), vi)
print(ViStatus)

 

#GUARD: 0 - Enables the internal amplifier to be a unity gain buffer for performing 6-wire guarded measurements.
#Current Amp 100 nA: 2 - Enables the low current amplifier and applies a gain of 1E8 V/A.
#Current Amp 10uA: 3 - Enables the low current amplifier and applies a gain of 1E6 V/A.
#Current Amp 1mA: 7 - Enables the low current amplifier and applies a gain of 1E4 V/A.
#Disconnect +IN from AGND: 8 - When one of the current amplification ranges is selected, the +INPUT of the amplifier is tied to analog ground. This is the default case. This default configuration can be overridden by selecting this option to disconnect the +INPUT, and allow the user to provide an external reference. Calling one of the current amplification ranges after calling this node will reconnect the +INPUT to analog ground.

Message 6 of 7
(97 Views)

Andrew13K,

 

Thank you for posting that to help the next person with this question! Kudos!

Tobias
Principal Software Engineer
Driver Software
National Instruments
0 Kudos
Message 7 of 7
(78 Views)