Title: Real Time Programming with LabVIEW
1Real Time Programming with LabVIEW RT
John Limroth Software Engineer Thurs Aug
17 1015-115 p.m., 145-445 p.m. Exhibit (3G)
2Agenda
- LabVIEW RT basics
- Current RT hardware targets
- Using LabVIEW RT
- Advanced programming techniques
- Software/hardware watchdogs
- Application builder
3What is Real-time?
- Real-time does NOT mean real fast!
- Requires deterministic response
- Windows does NOT guarantee determinism
4RT Hardware Architecture
5LabVIEW RT Software
- LabVIEW RT adds two extra components to regular
LabVIEW
- The RT Development System
- Part of it runs on host PC
- Programming and debugging LabVIEW code
- The RT Engine
- Runs on target
- Executes embedded code
- Independent of host PC
6Software Architecture
- Three separate instances of LabVIEW
7Software Architecture
(Instance B)
(Instance C)
8Agenda
- LabVIEW RT basics
- Current RT hardware targets
- Using LabVIEW RT
- Advanced programming techniques
- Software/hardware watchdogs
- Application Builder
9RT Series DAQ Devices
- Hardware
- Processor
- 486 133 MHz AMD chip
- Memory
- 8 MB of DRAM for LabVIEW executable and
NI-DAQ.dll - 1 kB of SRAM for shared memory
- Two user-defined LEDs
10RT Series DAQ Devices
- Form Factors
- Single product based on DAQ devices
- 7030/6040E 16 channel, 12-bit resolution, 250
kS/s - 7030/6030E 16 channel, 16-bit resolution, 100
kS/s - 7030/6533 32 high-speed digital lines
- Single PCI slot
- Double PXI slot
- All SCXI and accessories supported
11Installing the RT Series DAQ Card
- Installed and seen in MAX
- RT intelligent card has one device number
- Daughter card has separate device number
- No test panels
12RT PXI Controller
- General description
- Connected through Ethernet
- Pre-loaded RTOS and software
- Available with LV RT 5.1.2 and NI-DAQ 6.7
- PXI-8156B (233 or 333 MHz) must be configured
- Communication
- Default user interface thread
- VI Server
- TCP/IP
13RT PXI Hardware
- Supported hardware
- All PXI chassis without monitors
- All of regular NI-DAQ
- MXI-3
- Configure your own system
14Remote System Explorer
- Configures system
- Installs or upgrades software
- Creates utility disks
- Lists installed software or hardware
15Installation Procedure
- Ensure the system is ready to be configured
- Must reside on same subnet
- Run the uninstall disk if questionable
- Create boot floppy (RT system specific)
- Reboot system with floppy installed
- IP 0.0.0.0
- Serial number is from Ethernet chip set
16Installation Procedure (cont.)
- Assign IP address, name, password, etc
- Password is optional
- Upgrade/download software
- Choose install script
- Verify software versions
17Exercise 1 Configuring a PXI Controller
18File Structure
- Viewable through Windows OS
- Ph_exec.exe and ni-rt.ini in root directory
- Embedded PXI File Structure (c\ni-rt\)
- \system\ includes emblview.exe, ni-daq.dll, etc
- \startup\ includes boot up executables
19Useful Tools in MAX
- Remote DAQ Configuration
- Sets the properties of the remote DAQ boards
- Also available through Remote System Explorer
- Remote Device Access
- RDA Server enabled on RT Series PXI controller
- Allows user to test the board with test panels
20Exercise 2 Troubleshooting RT Series PXI
controller
21Agenda
- LabVIEW RT Basics
- Current RT hardware targets
- Using LabVIEW RT
- Advanced programming techniques
- Software/hardware watchdogs
- Application Builder
22Embedding a VI Step 1
- PXI controller on network
23Embedding a VI Step 2
24Embedding a VI Step 3
- Exit without closing RT Engine
25Exercise 3 Download a VI
26Shared Memory
- Incremental read/write high-level continuous
transfer of array of singles - Read/write VIs incorporates a flag (8-bit word)
to make reading and writing more efficient - Low-level peeks and pokes basic building blocks
for other levels
27VI Server
- Similar to normal VI Server
- Different machine name that corresponds to RT
Series Intelligent Card device number (DAQ1) - Requirements
- VI must be loaded in memory
- LabVIEW RT must be running on target
28Download Application
- Loads VI into dynamic memory without running it
- VI is now ready to run (Download bar will not
appear)
29LabVIEW RT Running on Target
- Important aspect of VI Server
- Exit without closing RT Engine VIs
- Keeps LabVIEW RT open
- Closes user interface
30Exercise 4 Using VI Server
31TCP/IP with LabVIEW RT
- Similar to regular LabVIEW
- Requires different machine names to correspond to
Intelligent DAQ Cards (DAQ1) - Used to communicate large chunks of data
- Not deterministic
32Exercise 5 Using TCP/IP
33Agenda
- LabVIEW RT basics
- Current RT hardware targets
- Using LabVIEW RT
- Advanced programming techniques
- Software/hardware watchdogs
- Application Builder
34Programming Tips Timing
- Keep unnecessary computations outside of the
time-critical loop - Keep configuration VIs outside of the loop
- Sleep mode helps maintain loop rates while
allowing other loops to share time
35Programming Tips Memory
- Determinism
- Pre-allocate arrays
- Avoid shared resources
- Performance
- Cast data to the proper type
- Inplaceness
- Global Variables
36Exercise 6 Reducing the Jitter in a LabVIEW RT
Program
37Single-Threaded LabVIEW
Computer
Thread
Co-routines
User Interface Loop
Exec( )
38Multithreaded LabVIEW
Computer
Messages
Thread
UI Loop Exec()
39LabVIEW RT Target System
RT Computer
Messages
Thread
Communication Loop Exec()
TCP/IP
40LabVIEW RT Deployed System
-Shared memory -TCP/IP -VI server
RT Series hardware target
Host PC
Thread
Thread
Communication Exec()
UI Loop Exec()
41Understanding Priorities
- Normal priority
- Allows the CPU to be shared
- Time-critical priority
- 100 of CPU time
- Sleep mode is very important
- Subroutine priority
- Highest priority level
- Releases thread only when done
42Exercise 7 Understanding Priorities
43Agenda
- LabVIEW RT basics
- Current RT hardware targets
- Using LabVIEW RT
- Advanced programming techniques
- Software/hardware watchdogs
- Application Builder
44Watchdogs
- Hardware or software mechanism that checks the
status of the embedded system - Increases the systems robustness
- Generally requires a low overhead
45Software Watchdog
Host PC
- Software watchdog can use the shared memory
- One side writes a value that is constantly
changing - Both host PC and embedded PC can implement
watchdogs
(?)
1K
(?)
Embedded PC
46Hardware Watchdog
- Digital/counter lines can be used to trigger
other systems
External System 1
(?)
External System 2
(?)
Embedded PC
CTR/DIO
47Built-in Hardware Watchdog API
- Extra hardware counter/timer
- Continuously counts down
- Software continually resets the counter
- Can be configured to take action
- Reset PXI System
- Set Occurrence
- Trigger
48Exercise 8 Implementing a Hardware Watchdog
49Agenda
- LabVIEW RT basics
- Current RT hardware targets
- Using LabVIEW RT
- Advanced programming techniques
- Software/hardware watchdogs
- Application Builder
50Application Builder
- Usually targeted to host PC
- Extra RT options
- Show RT target selection dialog
- Quit RT boot application after downloading
51Targeting to the PXI Controller
- Able to save executable to disk
- Remove serpdrv
- App Settings Tab is disabled
52Networked Preferences
- Application Builder (when connected to TARGET)
- Default name Startup.exe (C\ni-rt\startup)
- NETWORKED PREFERENCES-gtRT Target Miscellaneous
- Install path
- Name must be 8.3
53Command Line Arguments
- Used to alter execution
- Ex c\mybuiltapp.exe target DAQ1 reset
quithost
RT Series DAQ device RT Series PXI system
-target DAQ1 130.164.48.51
-reset Resets device not available
-quithost Exits without closing RT Engines Exits without closing RT Engines
54Exercise 9 Using Application Builder
55End of LabVIEW RT Hands-onQuestions?