
Getting Started with the LabVIEW Real-Time Module 6 ni.com
The VI reads analog data and sends the data to the PID VI. The PID VI
processes the data using a PID control algorithm. The VI returns the results
to the device. Refer to the LabVIEW PID Control Toolset User Manual for
information about using PID VIs.
(ETS) Refer to the examples\Real-Time\ETS\RT Control.llb for
examples of control VIs.
Setting Priority of the VI to Time Critical
To ensure determinism, you must assign time-critical priority to the control
loop VI. A VI set to time-critical priority receives enough processor
resources to complete time-critical tasks.
1. Right-click the connector pane icon at the top right corner of the
VI and select VI Properties from the shortcut menu to open the
VI Properties dialog box.
2. Select Execution from the Category pull-down menu.
3. Select time critical priority (highest) from the Priority
pull-down menu.
4. Click the OK button to set the priority.
Refer to Chapter 3, Building Deterministic Applications, of the LabVIEW
Real-Time Module User Manual for information about dividing and
prioritizing application tasks. Refer to the Priority Trouble VI in the
examples\Real-Time\RT Tutorial.llb for an example of priority
settings.
Adding Timing to the Control Loop
You must add a timing mechanism that pauses, or sleeps, the control VI to
ensure that other VIs in the application have enough processor resources to
complete. A time-critical VI that does not have any sleep time monopolizes
the embedded CPU resources. Refer to Chapter 3, Building Deterministic
Applications, of the LabVIEW Real-Time Module User Manual for
information about programming deterministic applications.
1. Place the Wait Until Next ms Multiple VI in the control loop on the
block diagram.
2. Right-click the millisecond multiple input of the Wait Until Next ms
Multiple VI and select Create»Constant from the shortcut menu.
3. Enter 10 into the millisecond multiple constant. The timing
mechanism assures you that the control loop code runs and then sleeps
until the time equals 10 ms from the start of the iteration. Other VIs in
the application can run during the sleep time.
4. Select File»Save As and save the VI as First PID Control.vi.