31
27/03/2014 1 ni.com ni.com NI myRIO Design Real Systems, Fast

Concevez des systèmes réels, rapidement, avec NI LabVIEW ...lyon2014.udppc.asso.fr/conf_textes/A32_Concevez des systemes reels... · 27/03/2014 3 ni.com 5 From Core Concepts to

Embed Size (px)

Citation preview

27/03/2014

1

ni.com

ni.com

NI myRIODesign Real Systems, Fast

27/03/2014

2

3ni.com

Agenda

• Overview of NI myRIO

• Introduction to LabVIEW

• Connecting NI myRIO

• Introduction to LabVIEW Real-Time

• Introduction to LabVIEW FPGA

• Resources and Next Steps

ni.com

Overview of NI myRIO

ni.com/students/learn-rio

27/03/2014

3

5ni.com

From Core Concepts to System Design

Controls Mechatronics

Embedded Systems

Robotics

Final Year

Design

6ni.com

NI myRIO

Enclosed

Board-Only

Feature RichFeature Rich

Protective CasingProtective Casing

EcosystemEcosystem

Optimized for Cost• No Wi-Fi

• No myDAQ connector

Optimized for Cost• No Wi-Fi

• No myDAQ connector

Integrate into a Larger ProjectIntegrate into a Larger Project

27/03/2014

4

7ni.com

NI myRIO Product Overview: Front View

XILINX Zynq SoC

8ni.com

What is Zynq?

ProcessorProcessor

I/OI/O

I/OI/O

Specialty I/OSpecialty I/O

FPGAFPGAPCI BusAXI Bus

Traditional Implementation

27/03/2014

5

ni.com

667 MHz Dual-Core ARM Cortex-A9 processor28K Logic Cells (Artix-7)80 DSP slices, 16 DMA channels92 Billion calculations per second

Xilinx ZYNQ

10ni.com

Why Zynq Matters in Education

•Smaller Size, Lower Power

•667 MHz Dual-Core ARM Cortex-A9 Processor

•Artix-7 FPGA, 28k logic cells

•16 DMA Channels

•NI Linux Real-Time

27/03/2014

6

11ni.com

Why Zynq Really Matters in Education

Leading Industry Grade Technology

12ni.com

NI myRIO Product Overview: Front View

User Defined LEDs

27/03/2014

7

13ni.com

Back View

Built-in Accelerometer

Getting Started

Mounting Holes

14ni.com

Top View

USB Port

Connection to PC

Power

27/03/2014

8

15ni.com

NI myRIO Expansion Port (MXP)

4 AI

2 AO

3 PWMs

1 Quad Encoder

1 UART

1 SPI

1 I2C

6 DIO

MXP B

Identical Connectors

MXP A

16ni.com

NI miniSystems Port (MSP)Side

27/03/2014

9

ni.com

Introduction to NILabVIEW

ni.com/students/learn-rio

18ni.com

Graphical System DesignA platform-based approach for measurement and control

27/03/2014

10

19ni.com

Data Flow

20ni.com

LabVIEW Getting Started Window

27/03/2014

11

21ni.com

LabVIEW Getting Started Window

Additional support, tutorials, and explanations can all be found using the links here. These are specifically

tailored to NI myRIO users.

22ni.com

Create a Project

• Click the Create Project button

• Select Blank Project.

• Click Finish.

• To save the project:• File >> Save

• Select the desired directory and choose a meaningful name.

• Remember, two LabVIEW projects cannot share the same directory.

27/03/2014

12

23ni.com

Group Activity

• Create and save a LabVIEW project.

Group Activity

24ni.com

Project Explorer

• Find, access, and organize project files

• Deploy or download files to targets

• Manage code for build options

• Executables, installers, and zip files

27/03/2014

13

25ni.com

Parts of a VIVIs have three main components:

26ni.com

Parts of a VI – Front Panel

The front panel is constructed using controls (inputs) and indicators

(outputs).

27/03/2014

14

27ni.com

Parts of a VI – Block Diagram

Front panel object appear as

terminals on the block diagram.

This is where “programming” is done in LabVIEW.

28ni.com

Parts of a VI – Icon/Connector Pane

Icons and connector panes are necessary to use a VI as a subVI.

o A subVI is a VI that appears on the block diagram of another VI.

o A subVI is similar to a subroutine or function in a text-based programming language.

27/03/2014

15

29ni.com

Exercise 1 – Building a LabVIEW VI in Windows

Temperature conversion from Fahrenheit to Celsius.

Group Activity

ni.com

NI myRIO Hardware Setup

27/03/2014

16

31ni.com

Group Activity

• Plug in and power the NI myRIO.• Power the NI myRIO with the AC to DC adaptor included in the

device’s packaging or a similarly rated power source.

• Connect the NI myRIO with a Male Type A – to – Male Type B USB Cable.

• Click “Launch the Getting Started Wizard”

• Follow the prompts in the Getting Started Wizard

Group Activity

ni.com

Introduction to LabVIEW Real-Time

ni.com/students/learn-rio

27/03/2014

17

33ni.com

What is Real-Time?

• Real-time does not always mean real fast

• Real-time means absolute reliability

• Hard Real-time systems have timing constraints that must be met to avoid failure

• Determinism is the timing reliability of the system

34ni.com

Critical Applications to Consider

Event Response Closed-Loop Control Critical Tests

27/03/2014

18

35ni.com

When General Purpose OSs Fall Short

• Design for fairness and user responsiveness vs. strictly prioritizing tasks

• Focus on multitasking instead of maximum reliability / uptime

• Not the result of bad products, only certain design goals

36ni.com

Key Careabouts for Critical Applications

• Jitter: execution time variability of a given operation or application

ExecutionTime (ms)

Iterations

21.9

2.1

1.3

2.8

2.1Mean = 2.03 ms

Jitter

27/03/2014

19

37ni.com

Key Careabouts for Critical Applications

• Determinism: a condition that is met if an operation or application has bounded jitter

ExecutionTime (ms)

Iterations

21.9

2.1

1.3

2.8

2.1Mean = 2.03 ms

Jitter

Bound (for hardreal-time systems)

…n

38ni.com

Running Real-Time Code – Modes

• “Real-Time Code” typically refers to VI’s running on a target that are at processor level (non-FPGA).

• RT code can be run in two modes.• Stand-alone

• Interactive Front Panel Mode

• In both modes, the code is deployed to the target (NI myRIO) and is running on the NI myRIO processor.

ni.com/students/learn-rio

27/03/2014

20

39ni.com

Exercise 2 – Investigate and Run Main.vi

• Create a project based on the myRIO project template.

• Open main.vi

• Features to understand:• Flat Sequence Structure

• Wait (ms) function (loop refresh rate)

• Accelerometer Express VI

Group Activity

40ni.com

NI myRIO Express VIs - Overview

• Express VIs are special VIs that allow the user to configure their settings when placed on the block diagram.

• This avoids having to wire controls/constants to terminals taking up time and block diagram space.

• NI myRIO has a palette of express VI that can be found by right-clicking on the block diagram and navigating to myRIO.

27/03/2014

21

41ni.com

NI myRIO Express VIs - Configuration

• When an Express VI is placed on the block diagram, a configuration dialog box opens.

This is the Digital Input Express VI.

More I/O channels can be accessed by selecting Add Channel.

LabVIEW generates G-code with View Code.

Relevant configuration options are

shown in this space.

42ni.com

NI myRIO Express VIs – G-Code

• If the View Code button is selected in the configuration dialog, LabVIEW will generate a window like this:

Copy to Clipboard allows the user to

copy this code into their VI if they want to customize

options programmatically.

=

27/03/2014

22

43ni.com

Exercise 3 – Create RT code for NI myRIO

• Expand the functionality of the default Main.vi in the default myRIO project.

• Features to learn:• Creating space on the block diagram and resizing.

• Shift-Registers

• Boolean Palette Functions

• myRIO LED Express VI

Group Activity

ni.com

Introduction to LabVIEW FPGA

27/03/2014

23

45ni.com

FPGA Technology

I/O Blocks

Programmable

Interconnects

Logic

Blocks

46ni.com

FPGAs are Dataflow Systems

A

B

C

D

FE

Implementing Logic on FPGA:

F = {(A+B)CD} ⊕ E

27/03/2014

24

47ni.com

FPGAs are Dataflow Systems

A

B

C

D

FE

Implementing Logic on FPGA: F = {(A+B)CD} ⊕ E

LabVIEW FPGA Code

48ni.com

A

B

C

D

FE

FPGAs are Parallel Dataflow Systems

YW X

Z

27/03/2014

25

49ni.com

LabVIEW FPGA vs. VHDL

I/O with DMA

66 Pages ~4000 lines

50ni.com

Why Are FPGAs Useful?

• True Parallelism – Provides parallel tasks and pipelining

• High Reliability – Designs become a custom circuit

• High Determinism – Runs algorithms at deterministic rates down to 25 ns (faster in many cases)

• Reconfigurable – Create new and alter existing task-specific personalities

27/03/2014

26

51ni.com

LabVIEW FPGA: How does it work?

LabVIEW FPGA

Xilinx ISE Compiler

LabVIEW FPGA

Xilinx FPGA ChipLabVIEW VI VHDL Bitfile

52ni.com

LabVIEW Programming and myRIO

User Interface

LabVIEW

Real-Time Processor

LabVIEW Real-Time

ReconfigurableFPGA

LabVIEW FPGA

27/03/2014

27

53ni.com

Exercise 4 – Exploring the NI myRIO FPGA Shipping Personality

• Explore the FPGA shipping functionality on NI myRIO.

Group Activity

ni.com/students/learn-rio

54ni.com

Instructor Demo

Customizing the FPGA

27/03/2014

28

55ni.com

Optional Instructor Demo

• Programming the Processor with C

ni.com

Resources and Next Steps

ni.com/students/learn-rio

27/03/2014

29

57ni.com

NI myRIO Kits | ni.com/myrio

Starter EmbeddedMechatronics

LEDs & switches7-segment display

PotentiometerThermistor

Photo resistorHall effect

Microphone/SpeakerBattery holder

DC motor

DC gear motors/encodersH-bridge driverAccelerometerTriple-axis gyro

Infrared proximity sensorAmbient light sensor

Ultrasonic range finderCompass

Hobby servo motors

RFID reader kitNumeric keypad

LED matrixDigital potentiometer

Character LCD Digital temp sensor

EEPROM

58ni.com

NI myRIO | Courseware

27/03/2014

30

59ni.com

C Support for NI myRIO – ni.com/myrio/c-support

•Processor Programming•Eclipse IDE•C/C++ Support•Free•One Installer from ni.com

60ni.com

Learn More About Programming NI myRIO

ni.com/learn-myrio

27/03/2014

31

61ni.com

Learn More About Programming NI myRIO

ni.com/community/myrio

ni.com