Ni Labview Rio Eval Tutorial
Ni Labview Rio Eval Tutorial
[ Tutorial ]
NI LabVIEW RIO Evaluation Kit
Tutorial
Note: It may be easier to complete the step-by-step exercises if you print this
document before proceeding. Otherwise, the Table of Contents contains links to
the exercises for more convenient navigation of this document.
Control Tasks
Note: If you would like to open and modify the system diagram shown above you can
download the free editor at http://www.yworks.com/yed and load the diagram files from
.\Tutorials\Additional Resources\LabVIEW RIO Eval Kit SysDiagram.
After completing these exercises, explore a variety of LabVIEW Real-Time and LabVIEW FPGA
applications, getting started resources, more tutorials built for the kit, and the RIO platform
products on an online Community for LabVIEW RIO Evaluation Kit owners at
ni.com/rioeval/nextstep.
Windows 7
C:\Users\Public\Documents\National Instruments\LabVIEW RIO Evaluation
Kit\Tutorials
Windows XP
C:\Documents and Settings\All Users\Documents\National Instruments\LabVIEW
RIO Evaluation Kit\Tutorials
Alternatively, you may locate these files from the Start menu at All Programs National
Instruments LabVIEW RIO Evaluation Kit Tutorial Folder. The original files are also located
on the DVD included in the evaluation kit.
1. Update the LabVIEW project with your devices IP address. Reference Appendix B for
more details on this process.
2. For Exercise 4 and 5 the solution requires that you update the IP address on the
Windows UI.vi front panel to match the IP address of your LabVIEW RIO Evaluation
device. Reference Step 1-4 of Exercise 4 on Page 66 for more details on how to do this.
Activating LabVIEW
The evaluation kit installs a 90-day full evaluation version of LabVIEW; you will be prompted to
activate LabVIEW when you open the environment. To continue in evaluation mode, click the
Launch LabVIEW button.
This tutorial assumes you ran the LabVIEW RIO Evaluation Setup utility upon reboot. If you
have not done so, run it now. You can access the utility from your Windows Start menu, select
All Programs National Instruments LabVIEW RIO Evaluation Kit Setup Utility.
The hardware device included in your kit is based on the NI Single-Board RIO (reconfigurable
I/O) platform and presents a hardware architecture found on other NI RIO devices which
consist of two processing devices: a real-time processor that you can program with the
LabVIEW Real-Time Module and an FPGA that you can program with the LabVIEW FPGA
Module. These devices are connected by a PCI bus and the LabVIEW development
environment includes built-in interfaces for communicating between them. The hardware
device in your kit will be referred to as your NI-RIO Evaluation HW in this tutorial.
A LabVIEW application is called a VI, or virtual instrument, and is composed of two primary
elements: a front panel and a block diagram, which you can program using the LabVIEW
Functions Palette.
Front panel The front panel is what you use to create a LabVIEW user interface (UI).
For embedded applications, such as FPGA applications, you either create subfunctions,
or subVIs, where controls and indicators are used to pass data within the target
application or you use the front panel to define sockets/registers that are exposed to
other elements of your system (such as the real-time processor) with read/write access.
Note: If you close the front panel, it will also close the block diagram, so be sure to
minimize it instead if you wish to use the block diagram.
Block diagram The block diagram is where you program LabVIEW applications using a
combination of graphical and textual notations. To program the block diagram, right-click
anywhere on the diagram (blank white window) to bring up the Functions palette.
Objects on the front panel window appear as terminals on the block diagram. Terminals
are entry and exit ports that exchange information between the front panel and block
diagram. Terminals are analogous to parameters and constants in text-based
programming languages.
Functions palette The Functions palette contains components for creating FPGA, RT,
and host interface applications. To do this, place the components on the block diagram
and wire them together by left-clicking on a terminal and dragging the wire to your
destination, completing this wire segment with another left-click.
Using the functions palette In this tutorial, bold text denotes an item to select from the
Functions palette. To access the Function palette, right-click anywhere on the LabVIEW block
More on Using LabVIEW - To learn more about the LabVIEW graphical programming
environment including syntax, deployment, debugging, and more, reference
http://www.ni.com/gettingstarted/labviewbasics/.
2. Use the included NI screw driver and wire to connect the Signal Generator OUT and
AGND terminals to the AI0 and AGND terminals as shown below.
3. In preparation for application development verify that the function generator is set to 0-
1KHz and Square Wave generation.
1. Launch LabVIEW and navigate to the ToolsOptions menu. Click on the Block
Diagram category and uncheck the Place front panel terminals as icons check box. Click
OK. This will conserve space on the block diagram.
2. Create a new application (called a VI) by selecting FileNew VI. Click on the Block
Diagram window to bring it to the front and right-click it to make the Functions Palette
appear. Pin down the Functions Palette (upper left corner of its window) and click on
CustomizeChange Visible Palettes
Palettes Needed
Programming
Connectivity
Real-Time
FPGA Interface
2. Change the IP address of the NI-RIO Evaluation HW target in the Project Explorer
window to match the IP address of your evaluation board.
a. Right-click the NI-RIO Evaluation HW target in the Project Explorer window and
select Properties from the menu to display the General properties page.
b. In the IP Address / DNS Name box, enter the IP address you wrote down from
the National Instruments LabVIEW RIO Evaluation Kit Setup utility and click OK.
Note: If you forgot to write down the IP address from the setup utility and need to determine
the IP address of your RIO device, see Appendix B - Changing the IP Address in the LabVIEW
Project at the end of this tutorial for further instructions.
4. Note that the front panel of an FPGA application is simple as it is not intended to be
used as a User Interface (UI) but instead the controls/indicators represent the FPGA
registers that are accessible for communication between the FPGA and the real-time
processor.
7. In the project, navigate to and double-click on the RT Microprocessor.vi that will execute
on the Real-Time Operating System (RTOS) running on the processor.
8. Note that this front panel is also very simple because the real-time operating system is
headless, without graphics support. As a result, the front panel of a real-time application
is useful for development and debugging but should not be used for final deployment.
10. Observe on the left side of your block diagram that the real-time application opens a
reference to a pre-compiled bitfile that will run on your FPGA Target with the resource
name RIO0 from your project. Then commands are sent to the FPGA to drive the LCD
screen based on those commands through digital I/O lines.
You will be writing text to the LCD screen and then scrolling it across the display moving right
or left.
1. Deploy and run the real-time application by pressing the Run button on the toolbar
for the RT Microprocessor.vi. Select Save if it prompts you.
Once you kick off the deployment, a dialog box will appear showing the current
compilation process and then will deploy the application down to the microprocessor on
the NI-RIO Evaluation Device. In this case, the FPGA VI is deployed through the real-
time VI so it is not required to deploy it separately.
Note: When the following conflict dialog appears click OK as you want to overwrite the
initial application that was loaded on the real-time processor during the wizard
configuration.
2. Keep the real-time application running. View the LCD screen on your target and the
scrolling text. Click on the direction horizontal toggle switch on the front panel of your VI
to scroll the text in the opposite direction. Click on the STOP button.
3. Modify the text string control with a word or short phrase of your choosing to display on
the LCD screen. Press the Run button and select Save if it prompts you.
4. View your text scroll on the LCD screen. When finished, click on the STOP button.
5. When you are finished exploring the project, right-click on the NI-RIO Evaluation HW
target in the LabVIEW project and select Disconnect. Note the bright green Boolean
turns off, indicating the target is disconnected. Finally, close out all the LabVIEW files
and save the files if prompted.
Tip: If you do not disconnect your current LabVIEW project from the target, then any
subsequent LabVIEW projects that you attempt to deploy files from will present an error. To
release this reservation, press the reset button to reboot the device.
Congratulations, you have deployed and run your first LabVIEW built
embedded application on RIO hardware!
In this exercise you will develop the FPGA application which has direct access to the
hardwares I/O, to acquire samples on inputs and drive control through outputs. You will
implement monitoring logic for the battery cell voltage, battery cell temperature, motor
encoder, and on-board push buttons. Based on the current voltage and temperature your
FPGA logic will then control digital outputs to the system in this case controlling on-board
LEDs.
1. In LabVIEW select FileOpen Project and open up the Exercise 2-FPGA project file in
the Exercise 2 folder at .\2- Create FPGA Application\.
2. Change the IP address of the NI-RIO Evaluation HW target in the Project Explorer
window to match the IP Address of your evaluation board.
a. Right-click the NI-RIO Evaluation HW target in the Project Explorer window and
select Properties from the menu to display the General properties page.
b. In the IP Address / DNS Name box, enter the IP address you wrote down from
the National Instruments LabVIEW RIO Evaluation Kit Setup utility and click OK
c. Right-click on the NI-RIO Evaluation HW target in the Project Explorer window
and select Connect to verify connection to the device.
d. Click OK if a dialog appears requesting to overwrite the files that are still running
on the device from Exercise 1.
Note: If you forgot to write down the IP address from the setup utility and need to determine
the IP address of your RIO device, see Appendix B - Changing the IP Address in the LabVIEW
Project at the end of this tutorial for further instructions.
6. Observe that the LCD Display from FPGA/RT while loop has already been inserted from
the Functions palette (ConnectivityLCDHitachi HD44780Command Handling Loop)
as well as a while loop for each of the tasks that will be programmed.
Note: Each of the while loops on a LabVIEW FPGA VI executes in true parallelism since each
task is mapped to dedicated logic on the FPGA. Also because the loops are implemented in
dedicated hardware logic the stop conditions are wired to false constants.
8. Once the subVI is inserted into the FPGA Button Press while loop, double-click on it to
bring up its front panel and press CTRL+E to view the block diagram code.
Note: As shown in the figure below, the block diagram of the State Selector VI reads in the
digital input lines from the four outer onboard push-buttons and uses a case structure to select
the appropriate display state. DIO12 corresponds to Push Button 1 (PB1 on the board), DIO13
corresponds to PB2, and so on.
9. Close out the State Selector front panel and block diagram to return back to the FPGA.vi
To insert the enum, back in the Project Explorer, expand out the FPGA Custom Controls
folder and drag the Display State.ctl to the left of the FPGA Button Press while loop as
shown.
11. Wire the enum constant through the edge of the while loop and into the Display State In
input of the State Selector subVI. Wire the Display State Out output of the State
Selector subVI to the right side of the while loop, creating a tunnel on the loop border.
Tip: Reference the Getting Started LabVIEW Programming Basics section on page 11 for
more information about how to wire and other LabVIEW environment fundamentals.
12. Right-click on the left-hand tunnel created on the while loop and select Replace with
Shift Register from the drop down menu. LabVIEW replaces the tunnel you right-clicked
with a shift register terminal, and the cursor becomes a shift register icon ( ). Hover
over the tunnel on the opposite side of the loop until it flashes, then click the tunnel to
replace it with a shift register. A shift register enables the passing of data from one loop
iteration to the next.
14. By default the custom controls are dropped down as controls on the front panel. Right-
click on Battery State and select Change to Indicator. Repeat this for the FPGA Display
Command control.
15. Right-click on the Temp indicator, select Properties, and click on the Data Type tab. Click
on the Representation icon that shows I16, and in the menu that appears select FXP.
16. Enter the following values to define the Encoding value, Integer word length and the
Word length which communicates to LabVIEW the maximum size of the integer portion
of the data and the maximum overall integer plus decimal representation required.
Encoding: Signed
Word length: 32 bits
Integer word length: 13 bits
17. Repeat steps 15 and 16 for the two remaining numeric indicators and one numeric
control with the following Encoding values, Word lengths, and Integer word lengths:
Control/Indicator Name Encoding Word length (bits) Integer word length (bits)
RPM Unsigned 32 16
Voltage Signed 24 5
Max Temp Signed 32 13
19. Branch the Display State Out output wire of the State Selector subVI and connect it to
the FPGA Display Command indicator.
The FPGA Button Press handling loop is now complete and should look as follows:
1. In the Project Explorer window under the FPGA Target expand out Connector0 which
exposes the I/O channels available from that connector. Locate the Temp
(Connector0/AI7) channel and drag it into the left-hand side of the Convert Voltage to
Temp while loop.
2. Still in the Project Explorer window, expand out Connector1 and locate the LEDWarning
(Connector1/DIO9) digital channel. Drag and insert it on the right-hand side of the while
loop.
4. To re-use IP already generated to scale the temperature units, expand the FPGA SubVIs
folder under the FPGA Target in the Project Explorer, and select the Convert to Temp.vi.
5. Drag the Convert to Temp.vi into the middle of the Convert Voltage to Temp while loop.
1. In the Project Explorer window under the FPGA Target expand out Connector0 and drag
EnginePWM (Connector0/AI0) into the left-hand side of the Getting PWM while loop.
After insertion, the Analog Period Measurement VI configuration dialog box will appear,
click Cancel. Wire the EnginePWM output to the input data input terminal on the Analog
Period Measurement VI.
Level: 1
Hysteresis: 0.5
Interpolate crossings: Checked
Direction: Rising
Number of periods: 1
5. Right-click on the Count (usec) input of the Loop Timer and select CreateConstant.
Enter a value of 100, so that the acquisition loop for the EnginePWM will run at 100
microseconds (10kHz rate).
11. Wire the output valid Boolean output of the Analog Period Measurement VI to the case
selector of the case structure (input terminal with a question mark on it), so that the
division and RPM value update occurs only when the period measurement calculation is
valid. Ensure there is nothing in the false case of the Case Structure by left-clicking on
the Case Selector label that currently says True.
12. Wire the rest of the components in the loop as highlighted in red below.
1. In the Project Explorer window under the FPGA Target expand out Connector0 and drag
BattVolt (Connector0/AI6) into the left-hand side of the Get Battery State while loop.
2. To assert the digital lines, expand out Connector1 in the Project Explorer and drag over
the following digital lines into the right-hand side of the same loop.
Digital Lines
Connector1Charged (Connector1/DIO6)
Connector1Running (Connector1/DIO5)
Connector1LowBatt (Connector1/DIO4)
5. In the Project Explorer window, under the FPGA Target expand out the FPGA SubVIs
folder and drag the Determine Battery State.vi into the middle of the Get Battery State
while loop.
6. Wire up the components in the Get Battery State while loop as highlighted in red below,
with the Fully Charged, Running, and Low Battery subVI outputs wired to the
appropriate I/O node.
2. In this case, select Use the local compile server option. The FPGA compilation process
can also be offloaded onto a remote machine, farm servers, or to the cloud.
3. The intermediate file generation process will then start, and once complete, will kick off
the Xilinx compilation. In total, the process should take about 20 minutes to finish
compilation.
Next Step
While you are waiting for your FPGA application to compile, continue on to
the development of your real-time application in Exercise 3.
In this exercise you will complete two processes running on the real-time microprocessor. The
first one will transfer the values from the FPGA and then forward them on to the Windows user
interface through network communication. The second process, LCD Control, will decide what
to write down to the LCD screen based on push button presses.
1. With your Exercise 2 project still open in the Project Explorer Window, select FileSave
As to copy the project files into the Exercise 3 folder.
2. In the Save As dialog box that appears select Duplicate .lvproj file and contents
Select contents to copy and click Continue
3. Uncheck the Dependencies category for the FPGA target hierarchy and select OK.
These LabVIEW dependency files are not necessary since you will still be saving the
files on the development machine.
4. Navigate to the .\3- Create Real-Time Application\ folder and rename your project as
Exercise 3- RT.lvproj. Click OK to save the project and supporting files.
5. Leave the Exercise 2 project open so that the FPGA VI can compile and open the
Exercise 3- RT.lvproj from .\3- Create Real-Time Application\ that was just created.
7. To include the network published shared variables used to communicate with the
Windows UI, right-click on NI-RIO Evaluation HW and select AddFile Navigate to the
.\3- Create Real-Time Application\ folder and select RT-Host Shared Variables.lvlib.
9. Select the Custom Controls folder that was just added to the project, press F2, and
rename it RT Custom Controls.
1. Open up the RT Microprocessor VI from the project and toggle to the block diagram
(press CTRL+E).
3. From the project find the FPGA VI under ChassisFPGA Target. Drag it into the
unconfigured Open FPGA VI Reference to the left of the top while loop.
Note: The Run Arrow will be broken because the FPGA VI that you copied over to the project is
not yet compiled. In testing you will reference the compiled bitfile from Exercise 2.
4. Insert two Invoke Method nodes (FunctionsFPGA Interface) on the block diagram
between the Open FPGA VI Reference and the while loop to reset and load the FPGA
application.
5. Wire the FPGA Target reference out of the Open FPGA VI Reference to the first Invoke
Method, and then click on the white section titled Method and select Reset.
7. Next wire the FPGA reference output of the Run Invoke Method to the border of the
FPGA Variable Output while loop
8. Right-click on the Wait Until Done input of the Run Invoke Method and select
CreateConstant. This should be a False constant by default.
11. Wire the FPGA reference from the loops tunnel to the Read/Write Control input along
with the error wire.
12. Expand the Read/Write Control to include six terminals by clicking on the lower border
and dragging it down as shown below.
14. Without setting timing in the while loop it will execute as fast as it can, potentially
starving resources allocated to the other loop. To avoid this insert a Wait Until Next ms
Multiple (FunctionsProgrammingTiming) function inside the loop. Right-click on its
millisecond multiple input and select CreateConstant.
Enter a value of 100 in the constant to execute the loop every 100 milliseconds.
15. By default the Read/Write Control terminals should all be inputs. Right-click on terminals
2-6 and select Change to Read to change them to outputs.
16. Wire the terminals on the Read/Write Control to the matching front panel control and
indicators on the real-time application VI.
1. Inside the project under the NI-RIO Evaluation HW target, locate the RT-Host Shared
Variables.lvlib. This library contains the Network Published Shared Variables that have
been created for communication.
2. Expand the library (.lvlib) to show the Network Published Shared Variables. Drag an
instance of each variable, excluding Display State and Stop, into the block diagram.
4. Create a wire branch from the FPGA Read/Write control outputs and wire to their
respective shared variables as shown in the next screenshot.
5. In order to enforce dataflow and ensure correct error propagation, wire the error out
from the FPGA Read/Write Control through each of the Shared Variable static nodes, in
any order.
1. To begin, navigate on the Functions palette to the Hitachi HD44780 LCD screen API
(FunctionsConnectivityLCD Hitachi HD44780) and insert the following functions:
Initialize HD44780.vi
Clear Display.vi (in the Advanced palette)
Two Output.vi
Close.vi
3. Branch the FPGA VI Reference wire from after the Run Method next to the top while
loop and wire it to the Read/Write Control inserted in the previous step. Also wire it to
the FPGA VI Reference in input of the Initialize HD44780 VI.
6. Wire the FPGA Display Command output to the case selector of the nearby case
structure to select the appropriate text to display on the LCD screen. The logic in the
case structure polls the chosen shared variable for the most recent value and generates
the value and name string to write to the LCD screen.
7. To propagate any errors through both loops appropriately, wire the Error line through the
Initialize HD44780 VI and through both while loops as shown below.
Device Index: 0
Screen Size: 8x2
Font Configuration: 5x8 & 2 lines
9. Wire the LCD out reference of the Initialize HD44780 VI to the LCD in of the Clear
Display VI. Wire the LCD out of the Clear Display to the LCD in of the Output VI.
Continue this wiring to carry the reference through to the Close VI.
10. Next add network published shared variables to the LCD Display Update Characters
while loop to communicate the current LCD display state to the Windows User
Interface.
Inside the LabVIEW project under the NI-RIO Evaluation HW target, locate the Display
State and Stop shared variables inside the RT-Host Shared Variables.lvlib. Drag these
variables into the LCD Display Update Characters while loop and insert them to the right
of the case structure.
11. By default the shared variable static nodes are in read mode; change the Display State
variable to write by selecting it, right-clicking, and choosing Access ModeWrite.
13. Right-click on the position input terminal on each Output VI and select CreateConstant.
This is a cluster constant with two elements, row and column. Leave the first constant
as default [0,0] and change the second Output VI cluster constant to [1,0] as shown
below.
14. Create a branch off the FPGA Display Command output and wire to the Display State
shared variable along with the error line from the second Output VI as shown below.
Enter a value of 100 in the constant to execute the loop every 100 milliseconds.
17. Inside the project under the NI-RIO Evaluation HW target, locate the Stop shared
variable inside the RT-Host Shared Variables.lvlib. Drag an instance of this variable into
the block diagram to the left of the Open FPGA VI Reference VI and one to the left of
the Close FPGA VI Reference VI.
18. Change the Stop variables to write mode by selecting them, right-clicking, and going to
Access ModeWrite.
19. Right-click on the Stop input terminal of both shared variables and select
CreateConstant. Leave the constant as the default False value.
20. Wire the error line from the error out terminal of both Stop shared variables to the error
in terminal of the Open FPGA VI Reference VI and Close FPGA VI Reference VI to
enforce dataflow and ensure that initializing the Stop shared variable to False executes
before those VIs every time you run the program.
22. Right-click on the left-hand error tunnel on the while loop and select Replace with Shift
Register from the drop down menu. LabVIEW replaces the tunnel you right-clicked with
a shift register terminal, and the cursor becomes a shift register icon ( ). Hover over
the error tunnel on the opposite side of the loop until it flashes, then click the tunnel to
replace it with a shift register. A shift register enables the passing of data from one loop
iteration to the next.
23. Repeat this step to turn the LCD Driver Reference loop tunnels to shift registers.
24. Right-click on the error out terminal of the Close FPGA VI Reference VI and select
CreateIndicator to display any errors to the user on the front panel.
Note: If you did not complete the Exercise 2 FPGA application, reference the solution at . \2-
Create FPGA Application\_Solution and open the Exercise 2-FPGA.lvproj. The solution VI will
need to be compiled for your specific target. Reference the Using the Solutions section on
Page 9 for more details on using the solution.
2. Click the run button if it is not already running and complete the following tests:
Turn the potentiometer in the lower right-hand corner of the board and verify
that on the FPGA front panel that the battery cell voltage indicator, called
Voltage, increases and the Battery State indicator also changes. Also note the
changes in the board LEDs representing the different digital signals that would
be sent to the power distribution circuit based on the battery state (Low Batt,
Running, and Charged).
Put your finger on the temp sensor shown below and verify that the Temp signal
responds accordingly on the FPGA front panel. Reduce or increase the Max
Temp so that you can test the Temp Warning and ensure that if the temp is
above the maximum that the Temp Warning front panel alarm LED is on. Also
verify that the on board LED turns on providing notice to the operator of an
alarm.
Note: Since the real-time application creates and controls the LCD screen, it will
not yet work. The next testing section for the real-time application will exercise
this functionality.
3. When you are finished testing the FPGA VI, click the Abort button .
4. Right-click on the NI-RIO Evaluation HW target in the LabVIEW project and select
Disconnect. Note the bright green Boolean turns off, indicating the target is
disconnected. Finally, close out all of the Exercise 2 LabVIEW files and save the files if
prompted.
1. Transition back to the Exercise 3-RT project to test the real-time application. Open up
the RT Microprocessor VI if it is not already in memory.
2. Since the FPGA VI was compiled in a different project, the static FPGA compiled
application, or bitfile, needs to be referenced in the current project. Toggle to the block
diagram (CTRL+E), right-click on the FPGA Open VI Reference VI and select Configure
FPGA Open VI Reference
3. In the dialog that appears click the radio button next to Bitfile and browse to .\2- Create
FPGA Application\FPGA Bitfiles\ and select the file inside. Click OK on the dialog to exit.
Note: This is the bitfile that is a result of your Exercise 2 LabVIEW FPGA code compilation.
4. To finish the FPGA setup, right-click on the resource name input terminal on the FPGA
Open VI Reference and select CreateConstant. From the constant drop down select
RIO0. This is the name of your FPGA target resource from the LabVIEW Project.
1. Click the Run button to compile and deploy the real-time application to the NI-RIO
Evaluation Device, which also includes the FPGA application since the VI references the
FPGA bitfile you just selected. Save the VI if prompted.
Note: If a Conflict Resolution dialog box appears on deployment click Apply to overwrite the
current real-time application that is still running on the device.
2. For the real-time application testing, run the same tests as you did for the FPGA except
now look to the Real-Time application front panel for verification of values.
3. Also note that the LCD screen now displays the different menus that the real-time
application generates and transfers to the FPGA.
4. When you are finished testing the real-time VI, click the Abort button.
5. Right-click on the NI-RIO Evaluation HW target in the LabVIEW project and select
Disconnect.
6. Save all of the Exercise 3 files by selecting FileSave All in the Project Explorer window.
In this exercise you will finish the overall embedded system by completing a user interface
running on your Windows development machine. The user interface components have already
been placed for you, but the backend communication architecture needs to be completed so
that you can update the user interface with current values and the state of the battery and
motor.
1. With your Exercise 3 project still open in the Project Explorer Window, select FileSave
As to copy the project files into the Exercise 4 folder.
2. In the Save As dialog box that appears select Duplicate .lvproj file and contents
Select contents to copy and click Continue
3. Uncheck the Dependencies category for the Real-time and FPGA target hierarchies and
select OK. These LabVIEW dependency files are not necessary since you will still be
saving the files on the development machine.
4. Navigate to the \4- Create Windows UI\ folder and rename your project as Exercise 4-
Windows UI.lvproj.
5. Click OK to save the project and supporting files. If a Load Warning occurs click Ignore
as it is confirming the new file locations.
6. Close the Exercise 3 project and open the Exercise 4- Windows UI.lvproj from
.\4- Create Windows UI\ that was just created. If prompted save the Exercise 3 project.
7. To add the skeleton Windows UI application already created, in the Project Explorer
window right-click on My Computer and select AddFile Navigate to the
.\4- Create Windows UI\VIs folder and select Windows UI.vi.
1. In the Exercise 4- Windows UI Project Explorer window, double click to open Windows
UI.vi to view the User Interface. Note there are indicators for each of the values youve
been monitoring on the Real-Time front panel thus far:
Current Voltage, Temperature, and RPM, as well a variable history of these three
values.
Temperature Warning alarm Boolean indicator
Along the bottom are LCD indicators to display the current LCD screen state
2. On the user interface, update the IP Address string control value to the IP address of
your NI-RIO Evaluation Device.
3. To set this IP address as the default on start up, select EditMake Current Values
Default after entering the IP address.
5. Press CTRL+E to view the block diagram logic. To the left of the while loop the IP
address of the NI-RIO Evaluation Device is collected with the IP Address string control
on the front panel and a connection to its shared variable engine, hosted on the
microprocessor, is established with the Initialize Shared Variables Host.vi. This VI takes
an IP address and builds references to all the shared variables used on the host, in this
case, your NI-RIO Evaluation Device. Those references are bundled in a cluster to easily
transmit the data in one wire.
6. Inside the UI Update and Event Handler while loop, observe the Timeout case of the
event structure. The LabVIEW Event Structure executes when a defined event is
detected, in this case, if no event is detected within 10 ms, the timeout case is
executed. This timeout case:
Reads the network published shared variables that were written to in the real-
time application with the Read Shared Variables Host.vi.
Contains all of the mapping to connect the user interface components to data
from the shared variables so that those components update with the most
recent values. You will complete this wiring in the next section.
7. Now toggle the event structure to the Stop Button: Value Change case by clicking the
arrow next to the Timeout case text.
9. Finally, to the right of the while loop the shared variable connections are closed before
errors are checked the application exits.
1. In the UI Update and Event Handler loop the shared variables that are read need to be
unbundled for connection to their respective front panel indicators.
2. Add a Bundle function and wire it up as shown to group Voltage, RPM, and
Temperature values for input into the Variable History chart.
3. Switch the event structure to the Stop Button: Value Change case by clicking the
arrow next to the Timeout case text.
4. Inside the project under the NI-RIO Evaluation HW target, locate the Stop shared
variable inside the RT-Host Shared Variables.lvlib. Drag this variable into the block
diagram and insert it into the current event case to communicate the stop condition to
the NI-RIO Evaluation Device.
6. Branch the wire from the Stop Button terminal and connect it to the Stop input of the
Stop shared variable. Wire the error line from the left tunnel to the shared variable error
in terminal and wire the error out to the right-hand tunnel.
1. Open and run the RT Microprocessor VI from the Exercise 4- Windows UI project. If you
have a broken Run arrow refer to the note below.
Note: If you did not complete the optional real-time application testing at the end of Exercise 3,
go to page 60 and complete the Initial Setup section of the real-time application to link to the
FPGA application bitfile.
Note: If a Conflict Resolution dialog box appears on deployment click Apply to overwrite the
current real-time application that is still running on the device.
2. Open and run the Windows UI VI from the Exercise 4- Windows UI project.
Note: If the Windows application throws an error or does not respond, verify that the correct IP
address for your NI-RIO Evaluation Device is entered on the user interface. If it is not, re-enter
it, select EditMake Current Values Default, and click the Run button to restart the Windows
application.
3. On the daughter card push PB4 to display the voltage on the LCD screen and turn the
potentiometer.
Verify that the battery voltage changes on the Windows User Interface and on
the LCD screen accordingly.
Note the battery state as you change it from Low Batt, to Running, to Charged
and the corresponding LEDs that turn on like a gauge.
4. On the daughter card push PB2 to display the motor RPM on the LCD screen.
Turn the frequency potentiometer for the function generator and verify that the
RPM value changes on the Windows User Interface and on the LCD screen
accordingly.
6. When you are finished testing the system, right-click on the NI-RIO Evaluation HW
target in the LabVIEW project and select Disconnect. Note the bright green Boolean
turns off, indicating the target is disconnected.
Next Step
Deploy and Replicate Your Embedded System
Project Setup
1. With your Exercise 4 project still open in the Project Explorer Window, select FileSave
As to copy the project files into the Exercise 5 folder.
2. In the Save As dialog box that appears select Duplicate .lvproj file and contents
Select contents to copy and click Continue
4. Navigate to the \5- DeployReplicate System folder and rename your project as
Exercise 5- Deploy Replicate.lvproj. Click OK to save the project and supporting files.
5. Close the Exercise 4 project and open the Exercise 5- Deploy Replicate.lvproj from
.\5- DeployReplicate System\ that was just created. Save Exercise 4 files if prompted.
1. In the LabVIEW Project Explorer window expand out the My Computer target, right-click
on the Build Specification, and select NewApplication (EXE).
2. An Application Builder Information dialog window may open upon building an application
for the first time. Check the Do not prompt again for this operation box and click OK.
3. Once the My Application Properties dialog window appears, enter the Build
Specification name and Target filename as Exercise 5 Windows Application and the
Destination directory as .\5- DeployReplicate System\builds\ Windows Application.
4. In the Category list on the left-hand side of the window, click on Source Files and select
Windows UI.vi from the Project Files section. Add the VI as the Startup VI by clicking
the right arrow. This designates the VI to build into an executable and its User Interface
that will appear when running the executable.
5. Leave the remainder of the categories as defaults and click Build. Once the build is
successful click Done.
6. In the LabVIEW Project Explorer window expand out the NI-RIO Evaluation HW target,
right-click on the bottom Build Specification, and select NewReal-Time Application.
7. In the dialog window, enter the Build specification name as Exercise 5 RT Application.
9. In the Category list on the left-hand side of the window, click on Source Files and select
RT Microprocessor.vi from the Project Files section and add the VI as the Startup VI by
clicking the right arrow.
10. Leave the remainder of the categories as defaults and click Build. Once the build is
successful click Done.
11. In the LabVIEW Project Explorer window, right-click on the Exercise 5 RT Application
build specification that you created and select Run as startup.
Note: If a Conflict Resolution dialog box appears on deployment click Apply to overwrite the
current real-time application that is still running on the device.
12. LabVIEW will deploy the application to the target hard drive and then will prompt you to
reboot the target to start executing the startup application. Click Yes to continue with
the reboot.
Note: Allow for a few minutes for the Real-Time Operating System (RTOS) to boot up after
reboot. Once it does successfully reboot the LCD screen will start updating.
13. Navigate to and run on the Windows executable that you built, located at .\5-
DeployReplicate System\builds\Windows Application\Exercise 5 Windows
Application.exe
Verify that the initial deployment of the system works by running through the system
tests from the Run and Verify the Completed System section of Exercise 4 on page 72.
It should now execute, communicate with the headless real-time application, and
update the LCD screen.
1. National Instruments provides a utility to rapidly create and deploy hardware images of
your application. The utility is called the Replication and Deployment (RAD) Utility and
can be downloaded and installed from the following location on ni.com:
2. Once you have downloaded the RAD Utility from the above location run the installer.
3. Navigate to and open the NI Replication and Deployment (RAD) Utility from Windows
Start MenuAll ProgramsNI Replication And DeploymentRAD Utility.
4. When the RAD utility opens, it will scan for systems on the network and will populate
your target in the left-hand table. If you are connected to a router and there are other
targets on the network, they will appear as well. Select the NI-sbRIO9636-<Your Device
serial number and IP address> target and click Retrieve to retrieve an image.
6. Choose the image storage directory by browsing to the folder .\5- DeployReplicate
System\images. Click Retrieve Image from NI-sbRIO-<Your Device serial number and IP
address> to start saving the targets image.
8. Once the image has been successfully copied to your development computer, you will
now format the NI-RIO Evaluation Device to simulate how you would go about
deploying this image to a new system.
To format the target, launch the Measurement & Automation Explorer (NI MAX), located
on your Windows Desktop or at (StartAll ProgramsNational InstrumentsNI MAX).
9. Expand Remote Systems in the left-hand navigation window to expose your target.
Right-click on your target (it may be named NI-sbRIO-<Your Device serial number and IP
address>) and select Format Disk.
Note: If after clicking Format Measurement & Automation Explorer displays the following
warning dialog:
Then navigate to the Controller Settings tab for the NI-RIO Evaluation Device (shown below),
check the box next to Safe Mode to force the device into safe mode and click Save. When
prompted to restart, click Yes and wait for the device to reboot before retrying steps 8-10.
13. In the utility click Refresh to force the application to rescan the network and update the
target information.
14. Since you have not specified your exercise folder as the default place to scan for images
there are no image files showing up in the Application Images table. To change the
location where the RAD scans:
Click on Settings in the upper left corner above the Application Images table
Browse to .\5- DeployReplicate System\images and select Use Current Folder
Click OK
15. Select your target on the left and the image on the right and then click Deploy. Verify in
the dialog window that appears that the target is listed and then click Deploy Application
Image to Listed Targets to start the replication process.
Note: If you put the device into Safe Mode before, follow these steps to disable it now:
Navigate to the Controller Settings tab for the NI-RIO Evaluation Device (shown
below) in Measurement & Automation Explorer (NI MAX).
Uncheck the box next to Safe Mode to reboot the target out of safe mode and click
Save.
When prompted to restart click Yes.
Wait for the device to reboot and then move on to the next step.
17. To verify that the target has successfully been replicated, re-run your Windows
application (.\5- DeployReplicate System\builds\Windows Application\Exercise 5
Windows Application.exe) and you should receive updates from the embedded system.
Congratulations! Using NIs graphical system design approach, you have now
completed the development, deployment, and replication of a LabVIEW RIO-based
embedded system with three targets (Desktop PC running Windows OS, Processor
running a Real-Time OS, and an FPGA).
For developing embedded control and monitoring systems, the combination of NI LabVIEW
software and NI CompactRIO or NI Single-Board RIO hardware offers powerful benefits
including the following:
Precision and accuracy - Precise, high-speed timing and control combined with accurate
measurements
Flexibility Hundreds of I/O modules for sensors, actuators and networks that with
LabVIEW can connect quickly to control and processing algorithms and system models
Productivity LabVIEW system design software for programming processors, FPGAs,
I/O and communications
Quality & ruggedness High-quality hardware and software for deploying reliable
embedded systems that last
However, there is still a learning curve to effectively take advantage of these benefits, and
your application or job in part determines the size of that curve. Every project is different. To be
successful, you should determine up front what you need to learn to deliver a system that
meets or exceeds requirements while also minimizing development time. If the requirements
for your next project differ significantly from your current one, assess what additional concepts
you should learn to successfully complete it. For example, you may be currently developing a
functional prototype and just want a system that works, but if the design is approved you will
likely want something that is built to last and minimizes long-term maintenance costs. Consider
the different capabilities needed for each stage of developing an application based on
CompactRIO or NI Single-Board RIO, and take advantage of resources that can help you
efficiently learn those necessary skills.
To begin with, everyone who uses LabVIEW and CompactRIO or NI Single-Board RIO should
have the ability to
To help you learn these abilities, National Instruments recommends the following resources:
From there, attributes of your application or job determine whether you need additional
capabilities.
To determine the level of skills you need, ask the following four questions (circle one answer
for each). For each of your answers, look at the following table to identify the capabilities you
need and learning resources you can use.
4. Will this system be used in the medical device industry to automate a manufacturing
process or test products?
a. Yes
b. No
Table 1. Identify the capabilities you need for your project and the learning resources you can
use.
No Time to Learn?
Many National Instruments Alliance Partners have already invested in the level of proficiency
required for your application. If you have a CompactRIO or NI Single-Board RIO project that
requires a greater skill level than you currently have and you are unable to gain the required
level in the time allotted for your project, NI can temporarily augment your expertise by
connecting you with an Alliance Partner that can provide consulting services while you get up
to speed. Find an Alliance Partner in your area at ni.com/alliance.
3. Click on your NI-RIO Evaluation Device in the Remote Systems tree and on the right
hand side note the IP address that appears in the System Settings tab.
4. Change the IP address of the NI-RIO Evaluation HW target in the LabVIEW Project
Explorer window to match the IP address of your evaluation board.
a. Right-click the NI-RIO Evaluation HW target in the LabVIEW Project Explorer
window and select Properties from the menu to display the General properties
page.
b. In the IP Address / DNS Name box, enter the IP address you wrote down from
the National Instruments LabVIEW RIO Evaluation Kit Setup utility or just now
from Measurement & Automation Explorer and click OK.
c. Right-click on the NI-RIO Evaluation HW target in the Project Explorer window
and select Connect to verify connection to the evaluation device.