0% found this document useful (0 votes)
11 views18 pages

Basic Programing For Electronics-Chap 2-1-2024

Uploaded by

so8vaso9
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)
11 views18 pages

Basic Programing For Electronics-Chap 2-1-2024

Uploaded by

so8vaso9
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/ 18

Faculty of Electrical and Electronic Engineering

Basic Programming for


Electronics
Dr. Nguyen Viet Chien Email: [email protected]

phenikaa-uni.edu.vn
Chapter 2 : Basic LabVIEW Programming

Contents:
1. LabVIEW Programming Development
2. Loops and Waveform Graphs
3. Data Files and Character Strings
4. Important Programming Structures: cases, shift registers...

phenikaa-uni.edu.vn
Outline

Sensor DAQ Algorithm DAQ Output

Display

Load data
Save data

PC

3
phenikaa-uni.edu.vn
2.1 LabVIEW Programming Development
Graph-based programming:
Graphical icons

Create VI
Create Project:
Includes many VIs

VI: Virtual Instrument

4
phenikaa-uni.edu.vn
2.1 LabVIEW Programming Development
Switching: Ctrl + E
Graph-based programming:
Graphical icons

Front panel (interface) & Block


diagram (code)

Front panel: knobs, switches,


numeric, graphs, charts...

Block diagram: wire, functions


(VIs)...

5
phenikaa-uni.edu.vn
2.1 LabVIEW Programming Development
Text-based example Graphic-based example

#include<iostream.h>
#include<stdlib.h> “Plus” operator
(function)
Int main()
Variables
{
Int a, b; // Variable Variables
cout << “Enter a, b”;
cin >> a >> b;
cout << (a+b) // “Plus”
} Numeric:
control
Numeric:
indicator
phenikaa-uni.edu.vn
2.1 LabVIEW Programming Development
➢ Front panel ➢ Block diagram
▪ Controls Palette ▪ Terminals
▪ Controls, Indicators ▪ Variables & Constant
▪ Nodes
▪ Functions palette
▪ Search for Controls, VIs & Functions

7
phenikaa-uni.edu.vn
2.1 LabVIEW Programming Development
Front panel (user interface): simulate instrument devices
• Controls: knobs, push buttons, numeric, ... -> Input
• Indicators: graphs, LEDS, numeric, ... -> Output

8
phenikaa-uni.edu.vn
2.1 LabVIEW Programming Development
Right-click on Front panel ->
Controls pallet
Numeric: control & indicator
can be switched (right-click)

9
phenikaa-uni.edu.vn
2.1 LabVIEW Programming Development
Right-click on
Front panel ->
Controls pallet

10
phenikaa-uni.edu.vn
2.1 LabVIEW Programming Development
Block diagram (G-code): program the front panel objects
• Terminals, variables, constants, (nodes) functions, structures, wires
• subVIs
Variables
Block diagram Front panel

11
phenikaa-uni.edu.vn
2.1 LabVIEW Programming Development
Block Diagram
Example

Wires Indicator
Control terminals
terminals

Constant

Structure Node
(function)
12
phenikaa-uni.edu.vn
2.1 LabVIEW Programming Development
Block Diagram
Terminals: Inputs or outputs
Controls = Inputs
Variables Indicator
Indicators = Outputs Control
Wires
terminals
Constants = Fixed values terminals

Nodes:
build-in functions (+,-,*,/...)
Constant
Or VIs (functions)
Structure Node
(function)

13
phenikaa-uni.edu.vn
2.1 LabVIEW Programming Development
Wires

*Broken wire: Do nối hai đối tượng với các kiểu dữ liệu không tương thích

Clean Up Wire: LabVIEW tự động chọn một con


đường đi hợp lý nhất cho các dây nối

Ctrl + B: LabVIEW tự động xoá tât cả broken wire

phenikaa-uni.edu.vn
2.1 LabVIEW Programming Development
Block
Diagram
Right-click on
Block diagram
-> Functions
-> Search

Toolbox
functions
Or load VIs
15
phenikaa-uni.edu.vn
2.1 LabVIEW Programming Development
Block Diagram
View Variable as Icon
Select variable Un-tick
-> Right click -> View as icon

16
phenikaa-uni.edu.vn
2.1 LabVIEW Programming Development
Block Diagram
Practice: Create the block diagram shown below
You can change the name of indicators, controls,
and constants by double-clicking the label and
typing in the desired name.
If there is no label showing, right-click the desired
object and select Visible Items → Label.

Front panel

Summary:
• Common tools and IDE of LABVIEW
• Front panel, block diagram, functions pallet, controls pallet
17
phenikaa-uni.edu.vn
Thanks for your attention!
Q&A

phenikaa-uni.edu.vn

You might also like