09-18-2008 10:28 AM - edited 09-18-2008 10:35 AM
Hi @all,
I have a question about using my PCI6259 DAQ board. At first let me describe what I would like to do. In my System there are 4 different sensors. And two motors to control. (2 Sensors on each motor). Now I would like to control this system with a rate of 100Hz. That means to get the sensorvalues with 100Hz and to write the values calculated by the PID-Algorythm with the same 100Hz to the motors.
In case that I want sometimes to use both groups of sensors at the same time and sometimes only one group, I think I should create three Tasks.
ai_sensorsMotor1 //with 2 channels to read the two sensors on Motor1
ai_sensorsMotor2 //with 2 channels to read the two sensors on Motor2
ao_Motors //with 2 channels to write the calculated values to the Motors
Now I configured on each task a SampleClock with a rate of 100Hz. When I started the tasks I began to read multisamples. There you can define a AsyncCallback function.
But this is only called when the read is done and not when 0,01seconds passed. What I want is to have a callback function which is called 100times a second and gives me the aquired values from each Task. So that I can calculate the new values and write them 100times a second to the Motors.
For me it´s important to work on a deterministic time base with every task.
So how would you do this? What kind of solution do you have in mind?
Would be great if you can drop some ideas or explanations.
With best regards,
Cube
EDIT:
I work with MS VS2008 and C#
09-22-2008 06:51 AM
09-23-2008
02:40 AM
- last edited on
09-04-2025
01:28 PM
by
Content Cleaner
Hi,
well the only real solution to run your application deterministically is using a real-time OS. On a Windows system you never can be sure, that the OS doesn't interrupt your control algorithm, but stable loop rates are at least as important as a good tuning of your PID parameters.
In fact I can see two options here:
I hope that helps,
Jochen Klier
National Instruments