From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

PXI

cancel
Showing results for 
Search instead for 
Did you mean: 

PXIe-6739 and PXIe-4138 integration using MATLAB

Hi,
My goal is supplying a DC voltage (using PXIe-4138) to my setup and measure the current (drained from the source) vs time while I am sending analog control bits (using PXIe-6739) to an analog mux in my hardware. 

 

I am using MATLAB 2017b (Data Acquisition Toolbox) and ok with sending desired outputs using PXIe-6739. However, I couldn't find a resource for controlling PXIe-4138 while sending data with PXIe-6739.

using MATLAB. When I use daq.getDevices, I don't see PXIe-4138 ( I guess this is expected since it's not a DAQ). 

 

Looking for suggestions and code examples for controlling 4138 and 6739 together. 

 

My hardware: PXIe-1078 chasis with  two PXIe-6738s, PXIe-6739 and PXIe-4138. 

Thanks a lot,

Levent

 

0 Kudos
Message 1 of 6
(2,882 Views)

I don't think there is the specific example. Combining following example is good way.

 

Acquire Data Using NI Devices

Source DC voltage through NI-DCPOWER MATLAB Instrument Driver in Simulation Mode

 

Do you have a concern about Synchronization? See this article.

http://zone.ni.com/reference/en-XX/help/370736R-01/ni_dc_power_supplies_help/mi_synchronization/

Certified LabVIEW Developer
There are only two ways to tell somebody thanks: Kudos and Marked Solutions

GCentral
Message 2 of 6
(2,862 Views)

Hi Emboar, 

I am using these two examples but have two questions.

Acquire Data Using NI Devices

Source DC voltage through NI-DCPOWER MATLAB Instrument Driver in Simulation Mode

 

1- Measure current for few seconds requires multiple current measurements. 

measurementType = 0; (instead of =1) makes it a current measurement, but it measures single data point. I would like to take many measurements during this time period, so I need to change measure_record_length somehow. 

measure = get(ictObj, 'measure'); % this measure object has Measure_Record_Length but I couldn't change it 😞

I guess invoke(measure,'???', desired_length) should solve the problem but couldn't find the list of commands to change this parameter. 

 

2- I need synchronization and planning to use signal based sync. Are there any MATLAB example codes ? All the links are for LabView.  I am guessing it will just take few lines of code in Matlab. 

 

Thanks a lot !!! 

Levent

0 Kudos
Message 3 of 6
(2,855 Views)

1. What are the results you are getting?

 

2.There are some informaitona bout syncronization on MATLAB

 

https://www.mathworks.com/help/daq/multiple-device-synchronization.html

 

 

0 Kudos
Message 4 of 6
(2,846 Views)

@Machop wrote:

1. What are the results you are getting?

 

2.There are some informaitona bout syncronization on MATLAB

 

https://www.mathworks.com/help/daq/multiple-device-synchronization.html

 

 


1- I couldn't get a continuous measurement yet. I set the source mode to sequence but it doesn't work and couldn't find an example code.
Any help appreciated. 

The error message that I am getting: 

"The instrument returned an error while executing the function.
A sequence must have at least one step." 

 

%
close all
clc
clear

% driversInfo = instrhwinfo ('ivi');
% disp(driversInfo.Modules');
%
ictObj = icdevice('nidcpower.mdd', 'DAQ::PXI1Slot5');
% disp(ictObj);
channel = '0';
src=get(ictObj, 'source');

% Configure the Source mode to Sequence ( 1020 for Single Point)
sourceMode = 1021;
invoke(src, 'configuresourcemode', sourceMode);

% Set the output function to DC Voltage
outputFunction = 1006;
invoke(src, 'configureoutputfunction', channel, outputFunction);

srcDCVoltage = get(ictObj, 'sourcedcvoltage');

% Configure the Voltage level, in volts, for the output channel generation
voltageLevel = 1.2;
invoke(srcDCVoltage, 'configurevoltagelevel', channel, voltageLevel);

% Initiate the device to start generation
control = get(ictObj, 'control');

measure = get(ictObj, 'measure');
% invoke(measure, 'configuremeasurerecordlength', channel, 82);
invoke(control, 'initiate');
% Measure current
measurementType = 0;
amps = invoke(measure, 'measure', channel, measurementType);

0 Kudos
Message 5 of 6
(2,768 Views)

Can you share exactly what you are doing, and what errors, or messages are you receving? With this I can check if I can duplicate the behaviour.

0 Kudos
Message 6 of 6
(2,753 Views)