01-04-2007 03:21 AM
01-04-2007 08:31 AM
For a finite ramping pulse train, I'd definitely recommend using correlated DO. You'll have to pre-define a fairly large buffer for the DO bit that will generate a pulse train. You can use 1 counter to generate a pulse train that acts as the "sample clock" for the DO task. (In a pinch, you could save this counter by creating a dummy AO task that continuously generates 0 volts, and then using the AO clock as the DO sample clock).
Your other counter can now read the encoder position.
There are several options for syncing the two, depending on your needs. Here's a brief outline of the basic ideas:
1. A simple one would be to use the same sample clock signal for your encoder position measurement that you used for your DO task. This will probably produce a lot of redundant data, but will give you a look at system dynamics.
2. Another way is to wire the DO bit to a PFI line and use the PFI line as the encoder position sampling clock. That would give you one encoder measurement per step command and greatly reduce the quantity of data collected. I've found that sync'ing the encoder measurement to the step command signal this way does a lot to "filter" out the step response dynamics and produce a nicer-looking overall curve. However, you must remember that the data is *not* equally-spaced in time -- it's equally-spaced in position.
3. You can wire the DO bit to a PFI line and then count edges on that PFI line. You could then use the dummy AO task idea to generate a preferred sampling clock rate, and sample both the encoder position and step command edge count with the AO sample clock.
I can vouch for the M-series boards under LabVIEW 7 -- they definitely DO support correlated DIO. Starting with DAQmx 8.0, they also support "change detection" as a means for hardware-syncing and sampling. However, as outlined above I'd use the DO to *generate* the pulse train while using a counter to measure the encoder.
-Kevin P.
01-05-2007 07:07 AM
Kevin,
Thanks to your recommandations, I have now managed to generate the pulse train through a DO (using counter0 as the sampling clock for the DO task) and read the encoder with the remaining counter (counter1).
I now want to send not a simple pulse train but a pulse train that will increase its frequency up to a certain frequency and then decrease its frequency again (trapezoidal velocity profile for the motor). Do you know how I could do that properly with the DO solution I described above?
Best Regards,
Polak
01-05-2007 10:49 AM
01-09-2007 02:25 AM
Kevin,
Thanks a lot for your advice. It was really helpful!
Best Regards,
Polak