Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Use hardware trigger for analog output with measurement computing USB-2527 board

Subject: Use hardware trigger for analog output with measurement computing USB-2527 board

From: Stephane Carlier

Date: 17 Feb, 2012 15:53:20

Message: 1 of 3

The data acquisition toolbox (2011b) only support HwDigital for AI (analog input) with Measurement Computing product. Now I have a MCC USB-2527, which has built-in hardware digital trigger for analog output, and which is not supported by Matlab. So what's my option if I still wish to use Matlab?

The MCC provides a C Universal Library, is it easy to use that in Matlab with "external interface"? I have used some DLLs with MATLAB before for instrument control, but am not exactly sure how to start with this. Any input is welcome!

Subject: Use hardware trigger for analog output with measurement computing USB-2527 board

From: Stephane Carlier

Date: 22 Feb, 2012 21:54:13

Message: 2 of 3

After reading various posts on web, it seems it has been a recurrent question since at least four years ago. Is there someone from Mathworks giving us some clues that when this will be implemented, or Mathworks already deem Measurement Computing boards non-worthy products. I saw the news (maybe rumors) that NI already acquired MCC. Is that NI purposely interfere with the implementation and force people to buy their over-priced boards?

"Stephane Carlier" <youfellow@hotmail.com> wrote in message <jhlt5g$a4d$1@newscl01ah.mathworks.com>...
> The data acquisition toolbox (2011b) only support HwDigital for AI (analog input) with Measurement Computing product. Now I have a MCC USB-2527, which has built-in

Subject: Use hardware trigger for analog output with measurement computing USB-2527 board

From: Liane

Date: 28 Mar, 2013 02:35:06

Message: 3 of 3

Hello Stephane,

I had to overcome the same issue (I have a USB-1604 MCC DAQ box and want to use analog input and output simultaneously).
I could make it work by using my second analog output channel to create a signal that triggers the analog input (AI). So if you have one analog output left this might be an option for you.

What I did is the following: I simply connected my second output channel directly to my external trigger input and used the code below:
(For testing purposes I connected my first output channel 'DAC0' to 'Ch1')
 
clear all; close all; clc

% Parameters
T = 10e-3; % time duration for DAQ
Fs = 1e6; % sampling frequency
N = T*Fs; % number of samples to be acquired

% Input Signal
outputSignal = sin( linspace(0,pi*2,N)' ); % DAC0: output test signal
triggerSignal = zeros(N,1); % DAC1: Trigger signal for AI
triggerSignal(1) = 3;

% Create analog output (AO) and analog input (AI)
ao = analogoutput('mcc',0);
addchannel(ao,[0 1]); % 'DAC0' for output signal; 'DAC' as trigger for AI
ao.SampleRate = Fs;

ai = analoginput('mcc',0);
addchannel(ai,[0 1]); % the second trace 'Ch1' is connected to 'DAC0' for testing purposes
ai.SampleRate = Fs;
ai.SamplesPerTrigger = N;

% Specify Trigger type
set(ao,'TriggerType','Immediate') % execute immediately after issuing 'start'
set(ai,'TriggerType','HwDigital') % execute after trigger signal occurs (DAQ1)
set(ai,'TriggerCondition','TrigPosEdge')

putsample(ao,[0 0])
putdata(ao,[outputSignal triggerSignal]) % queue output data: Ch0 = Test signal; Ch1 = Trigger signal for AI
start(ai) % start AI, waiting for trigger
start(ao) % AO starts immediately
wait([ai,ao],2) % wait 2 sec to allow the operation to complete
[data,time] = getdata(ai); % get data


%% Plot
figure('Position', [200 100 400 650])

subplot(311)
plot(time*1e3, outputSignal)
xlabel('[ms]'); ylabel('[V]'); title('DAQ output: Test signal')
ylim(1.3*[min(outputSignal) max(outputSignal)])

subplot(312)
plot(time*1e3, data(:,2))
xlabel('[ms]'); ylabel('[V]'); title(['DAQ input'])
ylim(1.3*[min(outputSignal) max(outputSignal)])

subplot(313)
plot(time*1e3, outputSignal-data(:,2))
xlabel('[ms]'); ylabel('[V]'); title('Error = DAQ output - DAQ input')

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us