Quantcast
Channel: Multifunction DAQ topics
Viewing all articles
Browse latest Browse all 6878

PCI-6010 Sampling

$
0
0

Hello NI Experts,

 

I am using PCI-6010 DAQ Device in order to acquire and generate signals from/to a pneumatic system. I am using channels that are following;

 

AI9 : First Pressure Sensor Input

AI10 : Second Pressure Sensor Input

CTR0 : Sony SJ300 Scale Unit / A signal for position (Edge-Count)

CTR1 : Sony SJ300 Scale Unit / B signal for position (Edge-Count)

AO0 : First Valve Analog Output

AO1 : Second Valve Analog Output

 

I am also using MatLab for accessing the device, and I am using the code following,

 

clear
clc
close all

 

UpB=4;
Ts=0.05;


s=daq.createSession('ni');
s.DurationInSeconds=UpB;
s.addAnalogInputChannel('Dev1',9,'Voltage');
s.addAnalogInputChannel('Dev1',10,'Voltage');
s.addCounterInputChannel('Dev1','ctr0', 'EdgeCount');
s.addCounterInputChannel('Dev1','ctr1', 'EdgeCount');
s.addAnalogOutputChannel('Dev1',0,'Voltage');
s.addAnalogOutputChannel('Dev1',1,'Voltage');

 

I want to launch the session for UpB (4) seconds with respect to Ts (0.05) sampling time.I am getting the following error if I run these codes.

 

Warning: A channel that does not support clocked sampling was added to the
session. Clocked operations using startForeground and startBackground will be
disabled. Only on-demand operations using inputSingleScan and outputSingleScan
can be done.

 

I know it occurred because of the analog outputs. In order to get over this problem, I am using a timer function to send and acquire signals conditionally to a specific sample rate.

 

t = timer('TimerFcn', 'stat=false; disp(''Finish'')',...
'StartDelay',UpB);
start(t)
stat=true;
i=1;
while(stat==true)
dataAcquired(i,:)=s.inputSingleScan();
P1(i,1)=dataAcquired(i,1);
P2(i,1)=dataAcquired(i,2);
x(i,1)=dataAcquired(i,3)-dataAcquired(i,4);
pause(Ts)
i=i+1;
end

 

But instead of having 80 samples, I can only read data for 64 samples. This means that my timer works for 3.2 seconds instead of 4 seconds.

What is the problem, any ideas? Cannot I use external clock of the PCI-6010 if I want to send signals to my system? 

 

I tried using two sessions and assign analog outputs one of them, but nothing changed, I think I still have to create a timer function to send signals with a sample rate.

 

By the way PCI-6010 is not supported from Real-Time Windows Target, I cannot use it neither.

 

Thanks in advance.


Viewing all articles
Browse latest Browse all 6878

Trending Articles