LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting a vi from NI-DAQ to DAQmx

I downloaded an example NI-DAQ vi for doing a PID loop and have it running successfully. I got it from (it is also attached to this message):

http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/b06d5e50f04f280b86256b3e0070ba2d?OpenDocument

It worked great, but since I am trying to get familiar with DAQmx I thought I would try to convert it. I have gotten something that works, but it is not as fast and the timing is not as stable. The way you go about configuring things is very different between the two systems, and I guess I am overlooking something. Would someone like to take a stab at doing the conversion? I set it up for continuous conversion on input and output, using the onboard clock for the AI and rout
ing the scan clock to PFI7 for use with the AO, much like the NI-DAQ example. I configured both for a buffer length of 0, but they are not happy acquiring a single sample. I get an error telling me that I must acquire at least 2. That kills the PID speed, of course.
0 Kudos
Message 1 of 3
(2,754 Views)
Hello Richard,

I've attached a NI-DAQmx PID example to this posting. To acquire one point at a time with NI-DAQmx you need to change the the polymorphic DAQmx Read VI to (1 Chan 1 Samp).

The attached example is designed to be connected to your external system. Enter your Device number and Rate. Connect the Process Variable you want to read to your chosen Input Channel. Connect the PID output from the chosen Output Channel to your system. Run the VI. Choose a Setpoint value to which you want your system to adjust. The Tuning Parameters can be used to adjust the PID output to control your system.

This is a hardware timed control system which means that counter/timers on your DAQ device control the rate of acquisition and generation. The acquisition and
generation are also controlled with the same clock, so the PID output occurs at the same time the Process Variable is acquired. While hardware controls the timing of analog-to-digital and digital-to-analog conversions, this data must be written to and read from software buffers. This part of the control is software dependent. The Keeping Real-Time boolean lets you know if your software is able to keep up with the hardware Rate you chose. View the help window description of each control for more information about its use.

I hope this helps.

Regards,

Todd D.
NI Applications Engineer
0 Kudos
Message 2 of 3
(2,754 Views)
Thanks, Todd. It did help me out, but I am still disappointed that the DAQmx version will only run at about half the rate of the NI-DAQ version. I expected it to be at least as fast, if not faster.

Rich
0 Kudos
Message 3 of 3
(2,754 Views)