Академический Документы
Профессиональный Документы
Культура Документы
www.conselt.eletrica.ufu
Abordagem da Instrumentação Virtual
Sistema de Desenvolvimento Gráfico LabVIEW
• Ambiente de Programação Gráfica
• Compatível com vários Sistemas Operacionais e Dispositivos
• Útil em uma ampla gama de aplicações
Aplicações da Instrumentação Virtual
• Design
– Processamento de Sinal e Imagem
– Programação de Sistemas Embarcados A single graphical development platform
• (PC, DSP, FPGA, Microcontroladores)
– Simulação e Prototipagem Design Prototype Deploy
• Controle
– Controle Automático e Sistemas Dinâmicos
– Mecatrônica e Robótica
• Medição
– Circuitos Eletrônicos
– Medição e Automação
A Abordagem NI - Plataforma de Integração de Hardware
High-Speed High-Resolution Multifunction Dynamic Instrument Digital I/O Counter/ Machine Motion Distributed I/O and
Digitizers Digitizers and DMMs Data Acquisition Signal Acquisition Control Timers Vision Control Embedded Control
Signal Conditioning
and Switching
• Sound Card
– Built into most computers
Que tipo de dispositivo eu poderei usar?
Icon Found on
Windows Desktop
Exercício 1 – Configurando seu Despositivo
• Usando Measurement and Automation Explorer (MAX) para:
– Configurar e testar seu Data Acquisition (DAQ) dispositivo
Exercício 1 – Configurando seu Despositivo
• Usando a Janela para:
– Verificando sua Placa de Audio
Un-Mute Microphone
Abrindo e Rodando o LabVIEW
Start»All Programs»National Instruments LabVIEW
»
Startup Screen:
Start from a Blank VI:
New»Blank VI
or
Start from an Example:
Examples»Find
Examples…
Programas em LabVIEW são chamados de Virtual
Instruments (VIs)
Cada VI tem 2 Janelas
Front Panel
• User Interface (UI)
– Controls = Inputs
– Indicators = Outputs
Block Diagram
• Graphical Code
– Data travels on wires from
controls through functions to
indicators
– Blocks execute by Dataflow
Controls Palette (Place items on the Front Panel Window)
(Controls & Indicators)
Control: Customize
Numeric Palette
View
Indicator:
Numeric Slide
Functions (and Structures) Palette
Structure:
While Loop
Status Toolbar
Run Button
Abort Execution
Additional Buttons on
the Diagram Toolbar
Graph
Indicator
Output
Terminal
Boolean
Control
Input
Terminals
Dataflow Programming
• Execução do Diagrama de Blocos
– Depende do fluxo de dados
– O diagrama de blocos NÃO é
executado da esquerda p/ a direita
• Nó é executado quando os dados
são disponíveis para TODOS os
terminais de entrada
• Nós fornecem dados para todos
os terminais de saída quando
executados
Técnicas de Execução
• Procurando Erros
Clique no Run button.
Window showing error appears.
• Executando Highlighting
Click on Execution Highlighting button; data
flow is animated using bubbles. Values are
displayed on wires.
• Probes
Right-click on wire to display probe and it shows
data as it flows through wire segment.
• While Loops
– i terminal counts iteration
– Always runs at least once
– Runs until stop condition is met
For Loop
• For Loops
– i terminal counts iterations
– Run according to input N of
count terminal
Drawing a Loop
2. Enclose code to be repeated
2. Select
(a) (b)
(c)
File I/O
• File I/O – Allows recording or reading data in a file.
• LabVIEW creates or uses the following file formats:
– Binary: underlying file format of all other file formats
– ASCII: regular text files
– LVM: LabVIEW measurement data file
– TDM: created for National Instruments products
High Level File I/O Functions
• Easy to use
• High Level of abstraction
Functions»Express»Graph Indicators»Chart
Graphs – Display many data points at once
Waveform graph – special numeric indicator that
displays an array of data
• Graph updates after all points have been collected
• May be used in a loop if VI collects buffers of data
Functions»Express»Graph Indicators»Graph
Building Arrays with Loops (Auto-Indexing)
• Loops can accumulate Auto-Indexing Enabled
Wire becomes thicker
arrays at their boundaries
with auto-indexing
• For Loops auto-index by
1D Array
default
• While Loops output only 012345
the final value by default
Auto-Indexing Disabled
• Right-click tunnel and
Wire remains the same size
enable/disable auto-
indexing
(Functions»Programming»
Structures»MathScript)
View/Modify
Variable Contents
User Commands
m-file Script
(LabVIEW»Tools»MathScript Window)
Track A,B,&C
Exercise 3.2 – Using MathScript
Use the MathScript Node and Interactive Window to process the
acquired signal (logarithmic decay) in the MathScript and save
the script.
(Terminal labels
reflect data type)
Bundle
Bundle By Name
Using Arrays and Clusters with Graphs
The Waveform Datatype contains 3 pieces of data:
• t0 = Start Time
• dt = Time between Samples
• Y = Array of Y magnitudes
Initial
Value Value 3
Before
Loop First Second Last
Begins Iteration Iteration Iteration
Modularity in LabVIEW – SubVIs
• Top terminals are usually reserved for references, such as a file reference
• Bottom terminals are
usually reserved for
error clusters
Icon and Connector Pane – Create Icon
• Create custom icons by right-clicking the icon in the upper right corner of
the front panel or block diagram and selecting Edit Icon or by double-
clicking the icon
• You also can drag a graphic from anywhere in your file system and drop it
on the icon
• Refer to the
Icon Art Glossary at
ni.com for standard
graphics to use in
a VI icon
Do Not Delete
Exercise Instructions
Do Not Delete
Exercise Instructions
State Machines
• While Loop
• Case Structure
• Shift Register
State Machines Transitions
• Several programming
techniques exist for transitioning
from state to state in LabVIEW
using State Machines
• Default transition implies that
after one state, another state
always follows
• Transitions between two
potential states can be handled
by a Select Function
Communicating between loops
•Communicating between loops using data
flow is not possible
•The left loop will execute completely
before the right loop
•Variables are needed when communication
with wires does not give the desired behavior
Local Variables
• Local Variables allow data to be passed between parallel loops.
• A single control or indicator can be read or written to from more than one
location in the program
– Local Variables break the dataflow paradigm and should be used sparingly
Creating a Local Variable - Walk Through
In this example we will see
how Local Variables allow us
to share data between
parallel loops. We will
create a program that
toggles two separate LEDs
using one switch. It also
stops two loops with one
button.
(LabVIEW»Project»New)
Shared Variables
• Shared Variables are used to send data between VIs.
• Variable Types:
– Single Process: share the data among VIs on the local computer.
– Network-published: communicate between VIs, remote
computers, and hardware through the Shared Variable Engine.
• LabVIEW Certification
– LabVIEW Fundamentals Exam (free on www.ni.com/academic)
– Certified LabVIEW Associate Developer Exam (industry recognized certification )
Associate Developer
• Proficiency in navigating
Certified LabVIEW Associate
LabVIEW environment Developer
• Some application
development experience
Fundamentals Exam
• Pre-Certification Skills Test Free On-Line Fundamentals Exam
Electronics Workbench and Multisim