From Saturday, Nov 23rd 7:00 PM CST - Sunday, Nov 24th 7:45 AM CST, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Saturday, Nov 23rd 7:00 PM CST - Sunday, Nov 24th 7:45 AM CST, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
11-29-2005 02:32 PM
11-30-2005 07:15 AM - edited 11-30-2005 07:15 AM
Message Edited by Alan A. on 11-30-2005 07:15 AM
11-30-2005 01:36 PM
03-19-2016 05:40 AM - edited 03-19-2016 05:41 AM
Hello,
i ve got a similar issue with a USB-6251 (BNC): The device is connected via USB with a PC running a MATLAB script.
I have a problem with the command startBackground(s). When I try to execute this command It takes a lag of about 240 ms until it is done, i.e. until the signal leaves the NIDAQ. I find the same latency by measuring the command itself using GetSecs() inside my script in Matlab.
Part of my code:
daqreset; % In case there was still an open session, reset the NiDAQ
s = daq.createSession('ni'); % open session
addAnalogOutputChannel(s,deviceID,[0 1], 'Voltage'); % Opens two output channels. Note: first channel is designated "0"
set(s, 'Rate', fs);
queueOutputData(s,[0 5;0 0]); %For demonstration purpose i only take two samples and use them as a trigger signal which i am able to record using an
%EEG Ampflifier + Recorder
prepare(s);
outp(addressOut,2); %Direct Trigger signal via parallel port (LTP) with a lag of 2-3 ms. I use this as a reference to determine the lag in my record file
t3=GetSecs();
startBackground(s);
t3=GetSecs()-t3;
outp(addressOut,0);
s.stop();
My aim is to generate a sinusoidal signal using a NI- USB 6251 from National Instruments and the Data Acquisition Toolbox.
This signal has to be in phase with another signal that i measure in real time.
The time lag occurs once when initially start my script and is decreased for subsequent execution of startBackground(s). If I reset MATLAB workspace and DAQ connection, i.e. Control+C, clc, clear all and daqreset, the initial time lag of about 240 ms reappears. And again, subsequent executions are again processed faster ( time lag of about 35-55 ms). The short lags are still problematic because they vary in a large range, such that i cannot cope with it e.g. by involving it in my calculations of my desired signal.
I added the command prepare(s) which is proposed in the online description of DAQ. This reduces the initial lag to about 160 ms but has no influence on subsequent executions of startBackground(s).
In summary, i found a non-systematic, wide varying either about 240 ms or 35-55 ms time lag of the function startBackground(s), maybe it is a more general problem related to the Data Acquisition Toolbox. I tested it in both 32- and 64- bit version of MATLAB. In comparison a direct signal transmission using parallel port takes 2-3 ms until it is detected by my EEG recorder.
Have you got any idea?
03-23-2016 05:46 AM
Hi tion_rum,
since you created a new thread, let's keep all the communication there.