10-23-2007 06:09 PM
10-24-2007 08:14 AM
Don't have LV at hand and can't look at code now - hope to get a chance later. Here's a few thoughts in no particular order.
I admit that I find the use of "DAQmx Is Task Done?" a bit puzzling based on your description of the app. Sounds like you change the pulse frequency (servo command speed) on-the-fly which only works in continuous generation mode. And continuous tasks should never become 'done' on their own -- only if an error occurs.
Don't know what kind of servo you've got but many of them allow you to configure the distance implied by each step pulse you generate. Increasing the position resolution will in turn require a higher driving frequency for a given shaft speed.
If you need a "stoptask" function, um, why not "DAQmx Stop"?
You've got the right kind of idea about the relationship between pulse freq changes and loop delay time, but have you considered inverting your solution? Instead of limiting the pulse freq to satisfy a particular loop rate, why not vary the loop delay according to the desired pulse freq? I would think that the servo operation should be the driving consideration, and your software timing could adjust as needed.
Summary: you've got a good start here. But the kinds of questions you've got sound like you're painted into a corner. Answering just those specific questions will leave you with something you would settle for, at least for now, but will probably not give you a system that behaves entirely the way you'd like. So, what is the big picture here? How critical are the servo motions? Must the 2 be coordinated? Are you updating the motion commands in a near-real-time control loop? Do you really need to allow a user to ask for a freq like 0.00001 Hz? It seems doubtful that the servo can produce usefully smooth / continuous motion when commanded with fractions of Hz.
-Kevin P.
10-24-2007 03:54 PM
10-24-2007 03:59 PM
10-24-2007 04:47 PM
Matthew,
Do you have any thoughts on what would be the best way to implement a Daqmxstop task? I ask because in my current .vi, I call the start task outside of the main while loop, and then just update using a property node. This makes me think that I'd need to handle start and stop tasks inside the main loop, correct?
If I continue on the path I'm on right now, I have to initially start the task with some non-zero value for my frequency choice, and then immediately stop it inside the loop until the value changes to a value that can require the task to be restarted. Any thoughts?
Thanks!
.jim
10-25-2007 09:55 AM
10-25-2007 11:59 AM
Matthew,
Thanks for the example! It definately was a much better method to perform the start/stop task than I was initially thinking.
I have noticed that I am still able to produce this error, but I believe I know what's causing this and how to resolve it:
"The pulse generation with previous property settings must complete a full cycle before the property can be updated."
The master/slave loops seem like an ideal way to pass my setpoints from the excel into the loop.
Much appreciated!
.jim
10-25-2007 06:46 PM - edited 10-25-2007 06:46 PM
Matthew,
I made some minor modifications to the code you posted (to handle 0 freq value at startup, error output, and finally increased the loop speed to 20ms). One of the things that I'm noticing is that, as I approach the cutoff frequency (50 Hz), I get an error:
Property Node DAQmx Channel (arg 1) in Gen Dig Pulse Train-Continuous_stopstart_JRS_10252007.vi <append>
<B>Task Name: </B>_unnamedTask<D4>
However, this only seems to occur very close to the cutoff. I discovered this by setting the dial range from 0-100, and then slowly moving the dial back and forth around that region. Also, I notice that if I have the loop speed set to 100ms, as you did in your example, I don't get this behavior.
Any thoughts?
.jim
Message Edited by JimSchwendeman on 10-25-2007 06:46 PM
10-25-2007 07:45 PM