LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... ·...

33
LabVIEW Core 1 ni.com/training

Transcript of LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... ·...

Page 1: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

LabVIEW Core 1

ni.com/training

Page 2: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

What You Need To Get Started

• LabVIEW Core 1 Course Manual• LabVIEW Core 1 Exercise Manual• LabVIEW Core 1 Course CD• Multifunction DAQ device• GPIB interface• DAQ Signal Accessory, wires, and cable• NI Instrument Simulator and power supply• Serial and GPIB cables

ni.com/training

Computer runningLabVIEW 2009 or later

and Windows 2000 or later

• LabVIEW Core 1 Course Manual• LabVIEW Core 1 Exercise Manual• LabVIEW Core 1 Course CD• Multifunction DAQ device• GPIB interface• DAQ Signal Accessory, wires, and cable• NI Instrument Simulator and power supply• Serial and GPIB cables

Page 3: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

File Locations

The course installer places the course files in the followinglocation:

Root DirectoryExercises

<or>Solutions

LabVIEWCore 1

ni.com/training

Root DirectoryExercises

<or>Solutions

LabVIEWCore 1

Page 4: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

Instructional Methods

Quizzes

Demonstrations

ConceptExercise

ni.com/training

TopicLecture DevelopmentExercise

Page 5: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

Getting The Most Out Of This Course

• Ask questions!• Experiment with hands-on exercises to understand the

methods used• Explore solutions• Implementations explore a possible solution—you may find

a better one

ni.com/training

• Ask questions!• Experiment with hands-on exercises to understand the

methods used• Explore solutions• Implementations explore a possible solution—you may find

a better one

Page 6: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

Courses

New User

LabVIEW Core 1

LabVIEW Core 2

Experienced User

LabVIEW Core 3 Managing SoftwareEngineering in LabVIEW

LabVIEW OOP SystemDesign

Advanced Architecturesin LabVIEW

Skills learned:• LabVIEW environment

navigation• Dataflow programming• Use of common design

techniques• Event driven programming• Programmatic UI control

Skills learned:• Modular application

development• Structured design and

development practices• Inter-application

communication andconnectivity techniques

Skills learned:• Manage a LabVIEW project from

design to deployment• Object-oriented programming for

LabVIEW• Develop scalable applications and

reusable code• Advanced design patterns for LabVIEW

ni.com/training

Certifications

Certified LV AssociateDeveloper Exam

Skills tested:• LabVIEW environment

knowledge

Certified LabVIEWDeveloper Exam

Skills tested:• LabVIEW application

development expertise

Certified LabVIEWArchitect Exam

Skills tested:• LabVIEW application

development mastery

Skills learned:• LabVIEW environment

navigation• Dataflow programming• Use of common design

techniques• Event driven programming• Programmatic UI control

Skills learned:• Modular application

development• Structured design and

development practices• Inter-application

communication andconnectivity techniques

Skills learned:• Manage a LabVIEW project from

design to deployment• Object-oriented programming for

LabVIEW• Develop scalable applications and

reusable code• Advanced design patterns for LabVIEW

Page 7: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

Course Learning Map

Lesson 2Lesson 2

Lesson 1Lesson 1

Setting Up Hardware

Lesson 5Lesson 5

Lesson 4Lesson 4

Implementing a VI

Lesson 8Lesson 8

Lesson 7Lesson 7Developing Modular

Applications

ni.com/training

Lesson 3Lesson 3Troubleshooting & Debugging

VIs

Lesson 2Lesson 2

Navigating LabVIEW

Lesson 6Lesson 6

Managing Resources

Lesson 5Lesson 5

Relating Data

Lesson 9Lesson 9

Using Variables

Lesson 8Lesson 8Common Design Techniques

and Patterns

Page 8: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

Course Goals

This course prepares you for the following:• Solve problems using LabVIEW• Use data acquisition and instrument control in LabVIEW

applications• Use modular programming practices• Develop, debug, and test LabVIEW VIs• Effectively use a state machine architecture• Parallelism and variables

ni.com/training

This course prepares you for the following:• Solve problems using LabVIEW• Use data acquisition and instrument control in LabVIEW

applications• Use modular programming practices• Develop, debug, and test LabVIEW VIs• Effectively use a state machine architecture• Parallelism and variables

8

Page 9: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

TOPICS

Lesson 1Setting Up Hardware

A. DAQ HardwareB. Using DAQ SoftwareC. Instrument ControlD. GPIB

E. Serial PortCommunication

F. Using Instrument ControlSoftware

ni.com/training

A. DAQ HardwareB. Using DAQ SoftwareC. Instrument ControlD. GPIB

E. Serial PortCommunication

F. Using Instrument ControlSoftware

Page 10: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

Setting Up Hardware

• LabVIEW is a graphical programming environment used bymillions of engineers and scientists to develop sophisticatedmeasurement, test, and control systems• LabVIEW can integrate with wide variety of hardware

devices• In this course, you will interact with DAQ, GPIB, and serial

hardware

ni.com/training

• LabVIEW is a graphical programming environment used bymillions of engineers and scientists to develop sophisticatedmeasurement, test, and control systems• LabVIEW can integrate with wide variety of hardware

devices• In this course, you will interact with DAQ, GPIB, and serial

hardware

10

Page 11: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

A. DAQ Hardware

1. Signal2. Terminal Block3. Cable4. DAQ Device5. Computer

ni.com/training

1. Signal2. Terminal Block3. Cable4. DAQ Device5. Computer

11

Page 12: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

DAQ Hardware – Terminal Block & Cable

DAQ Signal Accessory—terminal block used in this course

ni.com/training12

Page 13: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

DAQ Hardware – DAQ Device

• Most DAQ devices have four standard elements: analoginput, analog output, digital I/O, and counters• You can transfer the signal you measure with the DAQ

device to the computer through a variety of different busstructures

ni.com/training

• Most DAQ devices have four standard elements: analoginput, analog output, digital I/O, and counters• You can transfer the signal you measure with the DAQ

device to the computer through a variety of different busstructures

13

Page 14: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

DAQ Hardware – Analog Input

The process of measuring an analog signal and transferringthe measurement to a computer for analysis, display, orstorage• An analog signal is a signal that varies continuously• Analog input most commonly measures voltage or current

ni.com/training

The process of measuring an analog signal and transferringthe measurement to a computer for analysis, display, orstorage• An analog signal is a signal that varies continuously• Analog input most commonly measures voltage or current

14

Page 15: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

DAQ Hardware – Analog Output

The process of generating analog signals from your computer• Performing digital-to-analog (D/A)

conversions generates analog output• The available analog output types

are voltage and current• To perform a voltage or current

output, a compatible device must beinstalled that can generate thattype of signal

ni.com/training

The process of generating analog signals from your computer• Performing digital-to-analog (D/A)

conversions generates analog output• The available analog output types

are voltage and current• To perform a voltage or current

output, a compatible device must beinstalled that can generate thattype of signal

15

Page 16: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

DAQ Hardware – Digital I/O

• Digital signals:− Electrical signals that transfer digital data (on/off, high/low, 1/0)

using a wire− Used to control or measure digital or finite state devices, such

as switches and LEDs− Used to transfer data• program devices• communicate between devices

− Use digital signals as clocks or triggers tocontrol or synchronize other measurements

ni.com/training

• Digital signals:− Electrical signals that transfer digital data (on/off, high/low, 1/0)

using a wire− Used to control or measure digital or finite state devices, such

as switches and LEDs− Used to transfer data• program devices• communicate between devices

− Use digital signals as clocks or triggers tocontrol or synchronize other measurements

16

Page 17: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

DAQ Hardware – Counters

• A counter is a digital timing device typically used for eventcounting, frequency measurement, period measurement,position measurement, and pulse generation• A counter has a fixed number it can count to as determined

by the resolution of the counter• For example, a 24-bit counter

can count to:2(Counter Resolution) – 1 = 224 – 1 = 16,777,215

ni.com/training

• A counter is a digital timing device typically used for eventcounting, frequency measurement, period measurement,position measurement, and pulse generation• A counter has a fixed number it can count to as determined

by the resolution of the counter• For example, a 24-bit counter

can count to:2(Counter Resolution) – 1 = 224 – 1 = 16,777,215

17

Page 18: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

B. Using DAQ Software – Configuration

• Configure and test your DAQ device using the Measurement& Automation Explorer (MAX)

ni.com/training18

Page 19: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

Simulating a DAQ Device

• Using NI-DAQmx simulated devices, you can try NI productsin your application without the hardware• With NI-DAQmx simulated devices, you also can export a

physical device configuration onto a system that does nothave the physical device installed

ni.com/training

• Using NI-DAQmx simulated devices, you can try NI productsin your application without the hardware• With NI-DAQmx simulated devices, you also can export a

physical device configuration onto a system that does nothave the physical device installed

19

Page 20: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

Exercise 1-1Concept: Measurement and Automation Explorer

GOAL

Use MAX to examine, configure, and test a DAQ device.

Page 21: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

Exercise 1-1Concept: Measurement and Automation Explorer

DISCUSSION

• What is a possible real-world application using DAQ?

Page 22: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

C. Instrument Control

• Use software on a PC to control an instrument over aninstrument control bus• Mix and match instruments from various categories• Understand the properties of the instrument, such as the

communication protocols to use

ni.com/training

• Use software on a PC to control an instrument over aninstrument control bus• Mix and match instruments from various categories• Understand the properties of the instrument, such as the

communication protocols to use

Page 23: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

C. Instrument Control

Benefits of Instrument Control• Automate processes• Save time• One platform for multiple tasks• Ease of use• Many types of instruments available

ni.com/training

Benefits of Instrument Control• Automate processes• Save time• One platform for multiple tasks• Ease of use• Many types of instruments available

Page 24: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

D. GPIBGPIB (general purposeinterface bus) is astandard interface forcommunication betweeninstruments and controllersfrom various vendors

ni.com/training24

Page 25: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

GPIB

• The bus supports one system controller, usually a computer,and up to 14 additional instruments• Controller:

− Defines the communication links− Responds to devices that request service− Sends GPIB commands− Passes/receives control of the bus

ni.com/training

• The bus supports one system controller, usually a computer,and up to 14 additional instruments• Controller:

− Defines the communication links− Responds to devices that request service− Sends GPIB commands− Passes/receives control of the bus

25

Page 26: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

E. Serial Port Communication

Serial communication• Transmits data between a computer and a peripheral

device, such as a programmable instrument or anothercomputer• Uses a transmitter to send data one bit at a time over a

single communication line to a receiver• Best method when data transfer rates are low, or you must

transfer data over long distances• Most computers have one or more serial ports, so you do

not need any extra hardware other than a cable

ni.com/training

Serial communication• Transmits data between a computer and a peripheral

device, such as a programmable instrument or anothercomputer• Uses a transmitter to send data one bit at a time over a

single communication line to a receiver• Best method when data transfer rates are low, or you must

transfer data over long distances• Most computers have one or more serial ports, so you do

not need any extra hardware other than a cable

26

Page 27: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

F. Using Instrument Control Software

• Interface Drivers: Instrument interfaces such as GPIBinclude a set of drivers for the interface• Configuration: Use MAX to configure the interface

ni.com/training27

Page 28: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

Exercise 1-2Concept: GPIB Configuration with MAX

GOAL

Learn to configure the NI Instrument Simulator and use MAXto examine the GPIB interface settings, detect instruments,and communicate with an instrument.

Page 29: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

Exercise 1-2Concept: GPIB Configuration with MAX

DISCUSSION

• What is a possible real-world application using instrumentcontrol?

Page 30: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

Summary—Quiz

1. You can use the Measurement & Automation Explorer(MAX) to examine, configure, and test your DAQ deviceand GPIB instruments.a) Trueb) False

ni.com/training

1. You can use the Measurement & Automation Explorer(MAX) to examine, configure, and test your DAQ deviceand GPIB instruments.a) Trueb) False

Page 31: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

Summary—Quiz Answer

1. You can use the Measurement & Automation Explorer(MAX) to examine, configure, and test your DAQ deviceand GPIB instruments.a) Trueb) False

ni.com/training

1. You can use the Measurement & Automation Explorer(MAX) to examine, configure, and test your DAQ deviceand GPIB instruments.a) Trueb) False

Page 32: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

Summary—Quiz

2. Which of the following are benefits of instrument control?a) Automate processesb) Save timec) One platform for multiple tasksd) Limited to only one type of instrument

ni.com/training

2. Which of the following are benefits of instrument control?a) Automate processesb) Save timec) One platform for multiple tasksd) Limited to only one type of instrument

Page 33: LabVIEW Core 1 - portal.unimap.edu.myportal.unimap.edu.my/portal/page/portal30/Lecturer Notes... · LabVIEW Core 1 LabVIEW Core 2 Experienced User LabVIEW Core 3 Managing Software

Summary—Quiz Answers

2. Which of the following are benefits of instrument control?a) Automate processesb) Save timec) One platform for multiple tasksd) Limited to only one type of instrument

ni.com/training

2. Which of the following are benefits of instrument control?a) Automate processesb) Save timec) One platform for multiple tasksd) Limited to only one type of instrument