Data Acquisition from a force plate

16 views (last 30 days)
This is the matlab code I have created to get force plate signals.
AI=analoginput('dtol',0);
set(AI,'InputType','SingleEnded');
chan=addchannel(AI,1:6);
set(chan,'InputRange',[-10 10]);
duration=10;
set(AI,'SampleRate',250);
actualrate=get(AI,'SampleRate');
set(AI,'SamplesPerTrigger',duration*actualrate);
set(AI,'TriggerChannel',chan(3));
set(AI,'TriggerType','software');
set(AI,'TriggerCondition','entering');
set(AI,'TriggerConditionValue',[10 10]);
start(AI)
wait(AI,duration+5);
data=getdata(AI);
plot(data)
xlabel('Time')
ylabel('signal(volts)')
But if I run, the following error shows up. Even if I put longer time into the wait funtion, the error shows up again and again.
??? WAIT reached its timeout before OBJ stopped running.
Error in ==> daqdevice.wait at 51
wait( uddobjs, waittime );

Accepted Answer

Chirag Gupta
Chirag Gupta on 27 Apr 2011
The error is probably due to the fact that you have set TriggerConditions
set(AI,'TriggerChannel',chan(3));
set(AI,'TriggerType','software');
set(AI,'TriggerCondition','entering');
set(AI,'TriggerConditionValue',[10 10]);
I am not sure what the TriggerCondition entering stands for and what the Trigger Condition Value of [10 10] means. Could you further explain that? Should'nt TriggerConditionValue be a single number or a range?
So it is possible that your acquisition has not been triggered in the 15 seconds that you wait for it. A better check would be:
while(~AI.Logging)
disp('Waiting for trigger');
pause(1);
end
disp('Triggered');
wait(AI,duration*1.1);
...
But first ensure with your conditions, whether the acquisition is even getting triggered.
  4 Comments
Chirag Gupta
Chirag Gupta on 27 Apr 2011
In the code above, you can remove both sets to Trigger as they are not doing anything.
I am assuming that the actual rate is also 250. With this code, what exactly gets printed on the MATLAB command prompt?
(You can also remove the while loop).
With TriggerChannel set and TriggerType set to 'software'. Your TriggerCondition and TriggerConditionValue specification should be clear. I am not sure of the Data Translation values for the same, but I would assume that the TriggerConditionValue would be just 10. If the signal reaches 10, you trigger!
Sangwoo
Sangwoo on 27 Apr 2011
You are right. I have deleted both sets to Trigger.
Do you mind if I ask one more question??
Initially, the signals of 6 channles were set slightly below or above the zero.
Do you know how to set it zero offset with the use of matlab code?

Sign in to comment.

More Answers (0)

Categories

Find more on Simultaneous and Synchronized Operations in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!