Book LabVIEW For Engineers
Book LabVIEW For Engineers
I- Introduction:
National Instruments Corporation, or NI, is an American company with
international operation. Headquartered in Austin, Texas, it is a producer
of automated test equipment and virtual instrumentation software. Common
applications include data acquisition, instrument control and machine vision.
Since 1976, NI has made it possible for engineers and scientists to solve the
world’s greatest engineering challenges with powerful, flexible technology
solutions that accelerate productivity and drive rapid innovation ,using NI’s
integrated hardware and software platform for a wide variety of industrial
applications .
Over the next several years, the engineers at NI continued to break the
boundaries of virtual instrumentation, to progress the hardware and software
controlling system and they designed a very capable embedded hardware device
aimed at students to provide a small device with lots of ports which allow it to be
used for a wide variety of projects .
NI myRIO is a revolutionary tool that places the power of the LabVIEW RIO
architecture, a globally adopted, industry proven hardware/software design
approach, in the hands of students.
NImyrio is an embedded hardware device created specifically to help students
design real, complex engineering systems more quickly and affordably.
With a gradual approach to learning advanced concepts in embedded and
FPGA programming.
NI myRIO delivers the powerful hardware and software technology needed for
students to complete meaningful projects in a single semester while being
assured that they are learning on a tool that prepares them for their careers as
professional engineers.
A Gradual Approach to Advanced Programming
When designing NI myRIO, our aim was to give students access to the same
industry-grade technology they would see upon graduation;
Students can copy and paste this code to a LabVIEW block diagram or can program from scratch with
lower level peripherals using the Advanced I/O subpalette.
At the most fundamental level, students can investigate and implement the same LabVIEW
programming techniques used by professional engineers. By double-clicking on any Advanced
I/O VI, students can see the low-level handshake between processor code and the FPGA bitfile.
It features a 667
MHz dual-core ARM Cortex-A9 programmable processor and a customizable Xilinx field-
programmable gate array (FPGA) that students can use to start developing systems and solve
complicated design problems faster—all in a sleek enclosure with a compact form factor.
The NI myRIO device features the Zynq-7010 All Programmable system on a chip (SoC) to
unleash the power of NI LabVIEW system design software both in a real-time (RT)
application and on the FPGA level.
How Xilinx All Programmable technology has
fundamentally changed business at National Instruments
, National Instruments (NI) announced an exciting product for engineering students called the NI
myRIO hardware/software development platform, which is based on the Zynq-7010 All Programmable SoC.
About the size of a small paperback book (so that it easily drops into a backpack), the NI myRIO features
the Zynq SoC’s dual-core ARM Cortex-A9 processor and 7 series FPGA logic cells for hardware and
software development.
The NI myRIO box sports ten analog inputs, six analog outputs, left and right audio channels, 40 digital I/O
lines (SPI, I2C, UARD, PWM, rotary encoder) and an on-board, 3-axis accelerometer, and two 34-pin
expansion headers. Most of that functionality comes straight from the on-board Zynq-7010 SoC.
The NI myRIO was only one of three major NI announcements built upon the Xilinx Zynq SoC. The second
new product, announced on Tuesday, is the NI CompactRIO-9068 measurement and control platform. NI
introduced its first RIO (reconfigurable I/O) platform in 2004. It was based on a mix of discrete processors,
FPGAs, and pluggable I/O modules. The addition of an FPGA into the NI RIO platform permits large
performance improvements.
NI now offers more than 70 different I/O modules for its multiple generations of the NI cRIO platforms. The
newly announced NI cRIO-9068, based on a Zynq-7020 SoC.
The NI CompactRIO-9068 uses a Zynq-7020 SoC to boost performance 10x
Every FRC team competing in 2015 will receive a free Zynq-based NI roboRIO to control its robot
National Instruments has been working on a device called NI myRIO, an hardware & software
platform that aims at giving engineering students the ability to design real systems quickly
for automation, robotics, data logging or embedded systems. The hardware is based on Xilinx
Zynq-7010 with a dual-core ARM Cortex-A9 processor and an FPGA with 28,000
programmable logic cells, and features 10 analog inputs, 6 analog outputs, audio I/O
channels, and up to 40 lines of digital input/output (DIO).
NI myRIO Hardware Specifications:
SoC – Xilinx Zynq-7010 with a dual core Cortex A9 processor and FPGA with 28,000 cells
System Memory – Unknown
Storage – Unknown
Expansion Ports:
o myRIO exPansion Ports (MXP) – Two identical ports (MXP A and MXP B) with 4 analog inputs,
6 digital inputs/outputs, 2 analog outputs, 1 quad encoder, 3 PWMs, 1 UART, 1 I2C and 1 SPI
by default. Ports configuration is customizable with Labview FPGA.
o miniSystems Port (MSP) – Power, 2 analog outputs, 4 analog inputs, and 8 digital
inputs/outputs by default. Ports configuration is customizable with Labview FPGA.
Connectivity – Wi-Fi
USB – 1x USB host port, 1x USB device port for connection to PC
Audio – Audio In, Audio Out
Misc – User and reset buttons, power, status and Wi-Fi LEDs, 4 user-defined LEDs, on-board
accelerometer.
Power – 6-16V input, or battery.
The device runs Linux, and is programmable with C/C++, or Labview. It will also possible to
purchase the board only without enclosure, but you’ll lose Wi-Fi connectivity, a few IO pints,
and compatibility with NI miniSystems. The tables below show the difference between myRIO
products with regards to hardware/software:
and education resources and uses:
What Is NI myRIO? NI myRIO is a revolutionary hardware/software platform that gives students the
ability to “do engineering” and design real systems more quickly than ever before.
Complete with the latest Zynq integrated system-on-a-chip (SoC) technology from Xilinx, the NI myRIO
boasts a dual-core ARM® Cortex™-A9 processor and an FPGA with 28,000 programmable logic cells, 10
analog inputs, 6 analog outputs, audio I/O channels, and up to 40 lines of digital input/output (DIO).
Designed and priced for the academic user, NI myRIO also includes onboard WiFi, a three-axis
accelerometer, and several programmable LEDs in a durable, enclosed form factor.
When you receive the myRIO hardware,you install the software (3 Disks) and you use the NI update
service to make sure you made the latest versions .
during developement you normally connect NImyRIO to your computer with USB cable.
when i click "next" (or directly on the myRIO detected) it tells me that it can communicate with the myRIO...
I double-checked power supply and USB cable and everything works well.
The unit is powered and connected to the USB port on my computer, because the myRIO Unit does show
up under MAX .
NI-MAX is also detecting myRIO .It communicates .when i try to access myRIO configuration, web page
configuration is also reachable....
If you are having any trouble connecting,then if you create a myRIO project in LabVIEW and if you use
the "Launch the Getting Started Wizard" , the project wizard detects your myRIO.
If so, when you complete the wizard and after development is complet, you can easily deploy your
LABVIEW project as a stand-alone application stored on the MyRIO solid-state hard drive that
starts automatically when you power up the myrio .
4 MAX
Measurement & Automation Explorer (MAX) provides access to your National Instruments
devices and systems.
.you can access MAX by selecting Tools »Measurement &Automation Explorer in LABVIEW .this displays
the primary MAX window.
Before using a data acquisition board, you must confirm that the software can communicate
with the board by configuring the devices. For Windows, the Windows Configuration Manag
er keeps track of all the hardware installed in the computer, including National Instruments
NImyRIO devices. The
Windows Configuration Manager automatically detects and configures Plug & Play (PnP) devic
es.
pmmlm
The NI myRIO-1900 provides analog input (AI), analog output (AO), digital input and output (DIO), audio, and
power output in a compact embedded device. The NI myRIO-1900 connects to a host computer over USB and
wireless 802.11b,g,n.
• Analog
• Digital
The NI myRIO-1900 has analog input channels on myRIO Expansion Port (MXP) connectors A and B, Mini System
Port (MSP) connector C, and a stereo audio input connector. The analog inputs are multiplexed to a single analog-
to-digital converter (ADC) that samples all channels.
MXP connectors A and B have four single-ended analog input channels per connector, AI0-AI3, which you can use
to measure 0-5 V signals. MSP connector C has two high-impedance, differential analog input channels, AI0 and
AI1, which you can use to measure signals up to
±10 V. The audio inputs are left and right stereo line-level inputs with a ±2.5 V full-scale range
The NI myRIO-1900 has analog output channels on myRIO Expansion Port (MXP) connectors A and B, Mini
System Port (MSP) connector C, and a stereo audio output connector. Each analog output channel has a dedicated
digital-to-analog converter (DAC), so they can all update simultaneously. The DACs for the analog output channels
are controlled by two serial communication buses from the FPGA. MXP connectors A and B share one bus, and
MSP connector C and the audio outputs share a second bus. Therefore, the maximum update rate is specified as an
aggregate figure in the Analog Output section of the Specifications.
MXP connectors A and B have two analog output channels per connector, AO0 and AO1, which you can use to
generate 0-5 V signals. MSP connector C has two analog output channels, AO0 and AO1, which you can use to
generate signals up to ±10 V. The audio outputs are left and right stereo line-level outputs capable of driving
headphones.
DIO Lines :
The NI myRIO-1900 has 3.3 V general-purpose DIO lines on the MXP and MSP connectors. MXP connectors A and
B have 16 DIO lines per connector. On the MXP connectors, each DIO line from 0 to 13 has a 40 kΩ pullup resistor
to 3.3 V, and DIO lines 14 and 15 have 2.2 kΩ pullup resistors to 3.3 V. MSP connector C has eight DIO lines. Each
MSP DIO line has a 40 kΩ pulldown resistor to ground. DGND is the reference for all the DIO lines. You can
program all the lines individually as inputs or outputs. Secondary digital functions include Serial Peripheral interface
Bus (SPI), I2C, pulse-width modulation (PWM), and quadrature encoder input. Refer to the NI myRIO software
documentation for information about configuring the DIO lines.
When a DIO line is floating, it floats in the direction of the pull resistor. A DIO line may be floating in any of
the following conditions:
• when the myRIO device is starting up
• when the line is configured as an input
• when the myRIO device is powering down
You can add a stronger resistor to a DIO line to cause it to float in the opposite direction.
UART Lines :
The NI myRIO-1900 has one UART receive input line and one UART transmit ouput line on each MXP connector.
The UART lines are electrically identical to DIO lines 0 to 13 on the MXP connectors. Like those lines, UART.RX
and UART.TX have 40 kΩ pullup resistors to 3.3 V. Use LabVIEW Real-Time to read and write over the UART
lines.
ACCELEROMETRE :
NI myRIO-1900 contains a three-axis accelerometer. The accelerometer samples each axis continuously and
updates a readable register with the result. Refer to the Accelerometer section of the Specifications for the
accelerometer sample rates.
1 NI MyRIO
The myRIO is a very capable embedded hardware device designed by Na-
tional Instruments and aimed at students to provide a small device with lots
of ports which allow it to be used for a wide variety of projects. The myRIO
features ten analog input channels, six analog output channels and forty
digital input/output channels. It also has audio input and output, a USB
host port, a USB device port, an accelerometer, a programmable button
and four programmable LEDs. The myRIO also has wireless capabilities
allowing it to act as a wireless host or connect to a server, this means that
the myRIO can be controlled or reprogrammed without hooking it up via
USB.
The myRIO acts as the processing unit for the robot and was the only pro-
cessing power allowed by National Instruments for the Competition, the only
exception to this is certain cameras which include onboard image process- ing. This
meant that while the myRIO is reasonably powerful containing a Xilinx Z-7010
(Instruments,2013) which is a dual-core ARM Cortex A9 processor with a small
FPGA, the processing power is still limited and any particularly taxing algorithms
would have trouble running on the device.
Using the NI myRIO project template, write a LabVIEW VI to run on the NI myRIO device to explore
some of the built-in functionality of the device. In this exercise, you will create a stand-alone application
using the push button and onboard LEDs.
If the project from the last exercise is still open, follow the steps below to create the RT VI. If the project
from the last section is not open, go back to the last section and follow the instructions to create a new NI
myRIO project.
1. Open Main.vi under the myRIO-1900 (xxx.xx.xx.x) target device in the LabVIEW Project Explorer.
2. Open the block diagram.
3. Enlarge the center frame of the sequence structure and the While Loop within.
a. Move the mouse cursor to the bottom edge of the sequence structure and locate the
blue resizing node that appears in the center of the bottom border of the structure. Click and drag the node
down to increase the space available for placing icons.
b. Move the cursor to the right edge of the center frame of the sequence structure and locate the blue
resizing node. Click and drag this node to the right to increase the area in the center frame.
c. Move the cursor to the bottom right corner of the While Loop. Click and drag the resizing
node to enlarge the While Loop to fill the space created in steps a and b.
4. Create a rising-edge trigger to detect when the button on the NI myRIO unit is pressed (ignoring the
output when the button is held).
a. Place a Button Express VI on the block diagram from the NI myRIO palette.
i. Right-click and navigate to myRIO»Onboard»Button. Place the Express VI inside the While Loop just
below the accelerometer VI.
ii. Press OK in the configuration dialog box to keep the default settings for the Express VI. This
Express VI handles opening a reference to the physical hardware through the default FPGA personality
on the NI myRIO device and reading the current value from the button. Since you are placing this VI in
the
While Loop, all the code in the VI executes during each iteration of the loop. This might seem wasteful
because the code has to open a reference to the particular data channel you are reading from on the FPGA
every cycle. However, the Express VIs for the NI myRIO device have been written with a “smart open”
feature that avoids opening the reference on every iteration. So, after the first iteration of the code, the VI
executes faster because it needs to only read data in from the button.
b. Wire the Value output of the button Express VI to the right edge of the While Loop.
c. Right-click on the tunnel created at the right edge of the While Loop by the button value
Boolean data and select Replace with Shift Register. This changes the icon of the tunnel and
generates another icon in the same location on the left side of the While Loop. Both of these tunnels
create a shift register. The right side of the register stores data from the current iteration, while the
left side of the register calls the data from the previous iteration. With this register, you can compare
the value of the button on the current iteration to the value of the button on the previous iteration (on
the first iteration the previous value defaults to FALSE).
d. Each of the four Boolean constants (one true, three false) just placed on the block
diagram is used to track the state of one of the four LEDs on board the NI myRIO device. This code is
a very simple and straightforward implementation of the concept of shifting the value of the LED to the
next LED in the set. Another method could use a counter and modulus function to take the remainder
of the count and compare it to an assigned LED value (0, 1, 2, or 3) and light up the corresponding
LED. This approach could use one
shift register but requires placing more function blocks down on the block diagram.
e. Place a case structure on the block diagram.
i. Right-click and navigate to Programming»Structures»Case Structure. Place a case structure in
the While Loop just below and to the right of the rising-edge trigger logic (Exclusive Or and And
nodes).
ii. Wire the output of the And node to the case selector on the case structure.
iii. Switch the case structure to the false case by pressing the small arrows to the left or right of the
case indicator box or by selecting the drop-down arrow just to the right of the case name and
choosing false from the drop-down menu.
iv. Wire the shift registers straight through the case structure by wiring from the left registers to
the left edge of the case structure, and then wiring straight to the right side of the register on the
While Loop. If the value isn’t first wired to the left edge of the case structure, the automatic wiring
tool passes the wire around the case structure rather than going through it.
f. The logic here is that when the rising edge of the signal from the button is detected (in
other words, the moment someone presses the button), the true case of the case structure shifts the
value of each LED to the next LED. Then the LED that is on shifts to the next LED and the others are
off. Each time the button is pressed this happens, and when the fourth LED is lit and the button is
pressed, the first LED lights up and the fourth turns off. However, none of this code works if you
don’t tell the NI myRIO device to interpret the Boolean data as a signal for the LEDs.
6. Signal the onboard LEDs to turn on and off based on the logic that you have created.
a. Place an onboard LED Express VI on the block diagram.
i. Right-click and navigate to myRIO»Onboard»LED. Place the LED Express VI in the lower right
corner of the While Loop. Select OK on the Configure LED Express VI dialog box to keep the default
settings. By default, the Express VI allows all four LEDs to be written to.
ii. Wire each of the Boolean values created in the previous step to the inputs LED0, LED1, LED2,
and LED3 on the LED Express VI.
7. Run the VI by pressing the run arrow on the toolbar. Verify the functionality of the code by
pressing the button on the NI myRIO device and observing the lit LED shift to the next one over, and
loop back from the fourth to the first on the fourth button press.
8. To verify that the code is running on the NI myRIO device and not on the development
computer, right-click on NI myRIO in the LabVIEW project and select Disconnect.
9. Unplug the USB cable from the NI myRIO device and verify that the code is still running.
10. When finished, reconnect the USB cable.
11. In the LabVIEW project, select Connect.
12. Click the stop button on the LabVIEW front panel to stop your code.