0% found this document useful (0 votes)
35 views44 pages

Embedded Systems - 1: RME40002: Mechatronics Systems Design

The document provides an overview of an embedded systems lecture focusing on the NI myRIO device. It introduces the myRIO, describes how to set it up by connecting the hardware and installing the necessary software. It also explains how to create a first LabVIEW project for the myRIO and test its onboard devices like LEDs and buttons. The document concludes with an optional section on using C support for programming the myRIO.

Uploaded by

Mai Nguyen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views44 pages

Embedded Systems - 1: RME40002: Mechatronics Systems Design

The document provides an overview of an embedded systems lecture focusing on the NI myRIO device. It introduces the myRIO, describes how to set it up by connecting the hardware and installing the necessary software. It also explains how to create a first LabVIEW project for the myRIO and test its onboard devices like LEDs and buttons. The document concludes with an optional section on using C support for programming the myRIO.

Uploaded by

Mai Nguyen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 44

Lecture 2

Embedded Systems - 1

Topics:
1. Introduction of NI myRIO
2. Connecting myRIO and getting started
3. Real-time template VI
4. NI myRIO palette
5. Creating the first LabVIEW myRIO project
6. Testing onboard devices: LEDs and button
7. C support for NI myRIO (optional)
8. Online resources

RME40002: Mechatronics Systems Design 1


1. Introduction of NI myRIO
www.ni.com/myrio

 Engineers need a powerful hardware/software


solution that allow them to be focusing on design
rather than coding to speed up the development
period.
 NI myRIO is an embedded hardware/software
device designed specifically to help students
design real, complex engineering systems more
quickly and affordably than ever before.

Nomenclature
RIO: National Instruments Reconfigurable I/O technology.
LabVIEW: Laboratory Virtual Instrumentation Engineering Workbench
FPGA: Field Programmable Gate Arrays

RME40002: Mechatronics Systems Design 2


1.1 NI myRIO device setup - Hardware

 Package includes NI myRIO device, a power


supply, USB cable, and interface board or
connector

USB cable
Interface
connector

NI myRIO

Interface
Power supply board

RME40002: Mechatronics Systems Design 3


1.2 NI myRIO device setup - Software

 Software requirements based on LabVIEW


• LabVIEW 2013 or higher version
• LabVIEW Real-Time Module
• NI myRIO Module (provides drivers and software to set up the NI
myRIO target)
• LabVIEW FPGA Module (optional, if working on FPGA)

LabVIEW is graphical programming language based on structured


dataflow (referred to as the G-code).

 Software requirements based on C support


• NI myRIO Module (included in the NI myRIO device package)
• Java x86 Runtime (freeware, required for Eclipse)
• Eclipse for NI Linux Real-Time (open-source software, provides both
the Integrated Development Environment and compilation tools)
C Support for NI myRIO is designed for users who want to program the
NI myRIO using the C programming language.
www.ni.com/myrio/c-support
RME40002: Mechatronics Systems Design 4
1.3 NI myRIO components

RME40002: Mechatronics Systems Design 5


RME40002: Mechatronics Systems Design 6
RME40002: Mechatronics Systems Design 7
Top view of myRIO

Connection to PC

USB Port Power

RME40002: Mechatronics Systems Design 8


Back view of myRIO

Built-in Accelerometer

Mounting Holes

Getting Started

RME40002: Mechatronics Systems Design 9


RME40002: Mechatronics Systems Design 10
2. Connecting NI myRIO and getting started
www.ni.com/myrio/setup/getting-started/

 Install the required software.


 Connect power to the myRIO device, then connect the
USB cable from the myRIO device to the computer.

RME40002: Mechatronics Systems Design 11


 Allow 20 t0 30 seconds for the computer to recognize the
myRIO device. Launch the Getting Started Wizard and
follow the prompts to install software on the device.

RME40002: Mechatronics Systems Design 12


 Click Next when the computer recognizes the myRIO
device.

RME40002: Mechatronics Systems Design 13


 Use the test panel to test the onboard devices
(Accelerometers, LEDs, Push Button). For example, shake the
myRIO in any direction, there will be changes of the X, Y, and
Z acceleration values.

RME40002: Mechatronics Systems Design 14


 Connect I/O accessories and start using myRIO.

Audio cables

RME40002: Mechatronics Systems Design 15


Troubleshooting

RME40002: Mechatronics Systems Design 16


3. Real-time (RT) template VI

RME40002: Mechatronics Systems Design 17


4. NI myRIO palette

RME40002: Mechatronics Systems Design 18


RME40002: Mechatronics Systems Design 19
5. Creating the first LabVIEW myRIO project
 Plug myRIO device to
your computer.
 Launch LabVIEW
2014.
 Choose LabVIEW for
myRIO in the
environment settings.
 Then click Start
LabVIEW.

RME40002: Mechatronics Systems Design 20


 Click Create Project from the Getting Started window of
LabVIEW.

RME40002: Mechatronics Systems Design 21


 Select Templates>>myRIO and then select the myRIO Project
template in the Project List.

RME40002: Mechatronics Systems Design 22


 Enter the Project Name and choose Project Root to save the
project files. Then, click Finish.

RME40002: Mechatronics Systems Design 23


 You have successfully created a myRIO project. Explore the
Project Explorer window. Open the Main.vi file.

RME40002: Mechatronics Systems Design 24


 By default, LabVIEW opens the front panel of Main.vi. The
front panel is the user interface of a VI.
 Main.vi contains a myRIO project template that can acquire
data from the onboard accelerators and display their values.

RME40002: Mechatronics Systems Design 25


 Press <Ctrl-E> to switch to the block diagram. The block
diagram contains the graphical code (G-code) of a VI. This VI
uses the Accelerometer Express VI to read acceleration
values from the onboard accelerometer and uses the
waveform chart indicator to display the acceleration values.

RME40002: Mechatronics Systems Design 26


 Double click the Accelerometer Express VI to display the
Configure Accelerometer dialog box.
 Click Help to display the context help information.

RME40002: Mechatronics Systems Design 27


 Press <Ctrl-E> to switch to the front panel and click Run on
the toolbar or from the Menu <Operate/Run>.

 The program will be complied and then deployed to the


myRIO device.

RME40002: Mechatronics Systems Design 28


 Rotate or shake the myRIO device to see the changes of the
X, Y, and Z acceleration values on the waveform chart.
 Click Abort Execution to stop the program.

RME40002: Mechatronics Systems Design 29


6. Testing onboard devices: LEDs and button
6.1 Testing the LEDs
 In the block diagram window, click menu
View/Functions Palette and select
Functions>>myRIO>>default FPGA
personality to the locate the LED
Express VI.

RME40002: Mechatronics Systems Design 30


 Click the LED Express VI and add it to the While Loop in
the block diagram.

RME40002: Mechatronics Systems Design 31


 In the Configure LED dialog box, select the LEDs you
want to test and click OK.

RME40002: Mechatronics Systems Design 32


 Right click each block diagram input of the LED Express
VI and select Create>>Control to create Boolean controls
for the four LEDs. You can click a Boolean control to
toggle between the TRUE and FALSE states, which
determines the ON and OFF states of the onboard LED.

RME40002: Mechatronics Systems Design 33


 Press <Ctrl-E> to switch to the front panel. You can arrange
the four Boolean controls in a layout that you like.
 Click Run.
 Click the four Boolean controls and see the status changes
of the onboard LEDs.
 Click Abort Execution to stop the program.

RME40002: Mechatronics Systems Design 34


Error checking in LabVIEW
• You may need to add code to handle errors that the VI might
return. You can use the Merge Errors function, available in
Functions Palette by selecting
Functions>>Programming>>Dialog & User Interface>>Merge
Errors, to merge errors from the Accelerometer and LED
Express VIs.
• Error checking is important because it can tell you why and
where errors occur.

Merge Errors

RME40002: Mechatronics Systems Design 35


6.2 Testing the button
 Follow the preceding procedure by selecting Button
Express VI and add it to the While Loop in the block
diagram.

RME40002: Mechatronics Systems Design 36


 Right click the Value output of the Button Express VI and
select Create>>Indicator to create a Boolean indicator for
the user function. The TRUE and FALSE states of the
Boolean indicator represent the ON and OFF states of
the user button.

RME40002: Mechatronics Systems Design 37


 Press <Ctrl-E> to switch to the front panel and click Run.
 Press the user button on the NI myRIO and observe the
state changes of the indicator.
 Click Abort Execution to stop the program.

Button state
RME40002: Mechatronics Systems Design 38
You have successfully created a myRIO project and tested the
onboard devices. It is ready to get started creating applications
of your own!

RME40002: Mechatronics Systems Design 39


7. C support for NI myRIO (optional)
 Eclipse provides an integrated development
environment (IDE) to build an executable from your
project source code written in C/C++ language, and run
and debug the executable on your NI Linux Real-Time
target.
 It is free and independent from LabVIEW.
 Eclipse will not be involved in RME40002 and is
optional for students to explore the programming skills
themselves by referring to the NI online tutorials.

Online tutorials on C support for NI myRIO


www.ni.com/myrio/c-support
www.ni.com/tutorial/14625/en/#toc5

RME40002: Mechatronics Systems Design 40


NI myRIO example under Eclipse IDE:

RME40002: Mechatronics Systems Design 41


8. Online resources
 Download software package and learn/develop project at home
1. Go to http://www.ni.com/academic/download.htm
(You will be prompted to register an NI account. Please complete the registration
and login).

2. Expand the list of Additional Software Download. Download the following


essential software for your project development. Choose the 2014 Versions to
be consistent with the software in laboratory AD208:
• LabVIEW Development System 32-Bit: English (located at LabVIEW
Development Environment)
• LabVIEW Real-Time Module (located at Real-Time and Embedded)
• LabVIEW myRIO Toolkit 2013 (located at Control and Robotics)

3. The other software modules are optional and covered by the license.

4. Install the software by following the sequence of the above download procedure
and use the serial number provided to activate during installation.

RME40002: Mechatronics Systems Design 42


 Free 6-Month Evaluation of LabVIEW Student Edition for at-home
learning (Not include LabVIEW Real Time and LabVIEW FPGA
modules for MyRIO development)
https://decibel.ni.com/content/docs/DOC-30610

 Learning resources
NI Self-Paced Online Training
www.ni.com/self-paced-training (required registration)
Community
www.ni.com/community/myrio
Projects and Example Code
www.ni.com/myrio/projects

RME40002: Mechatronics Systems Design 43


RME40002: Mechatronics Systems Design 44

You might also like