Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming for Electronics Technology Professor Nick Reeder

Similar presentations


Presentation on theme: "Programming for Electronics Technology Professor Nick Reeder"— Presentation transcript:

1 Programming for Electronics Technology Professor Nick Reeder
EET 2259 Programming for Electronics Technology Professor Nick Reeder

2 Reminders Please turn off cell phones.
No food or soft drinks in the classroom. Stow water bottles at floor level.

3 EET 2259 Unit 1 LabVIEW Basics
Read Bishop, Chapter 1. Lab #1 and Homework #1 due next week. Handouts: Syllabus and Lab #1 -Share each person’s programming experience. -Go over syllabus -Have them log on to website.

4 LabVIEW Stands for Laboratory Virtual Instrument Engineering Workbench. It’s a software package created by National Instruments ( This company bought Multisim a few years ago. (Bishop, p. 3) -Great demand among area employers. -Discuss idea of virtual instruments; using computer to behave like a DMM, scope, freq counter, function generator, ….

5 National Instruments Company founded in 1976 in Austin, TX.
In addition to Multisim, LabVIEW, and other software packages, they sell data acquisition boards and other hardware for using computers in engineering, science, and industry. (Bishop, pp. 3-4)

6 Some of LabVIEW’s Uses General-purpose programming Instrument control
Data acquisition Data analysis Data presentation Automated testing A slide on each follows.

7 General-purpose Programming
Writing programs to perform calculations, process information, play games, etc. Examples: Checkbook balancer Calorie counter Baseball statistics calculator This is not really what LabVIEW is meant for, but you can use it to do these things.

8 Instrument Control Using the computer to control multimeters, oscilloscopes, function generators, etc. Show them, using Fluke 45 Getting Started.vi (Be sure DMM’s parameters are set to 9600 baud, no parity, Echo off; to set these, push 2nd RATE, then use AUTO button to step through parameters and use up or down buttons to change values.) And use TKTDS1K2K GettingStarted.vi (Be sure scope’s parameters are set to 9600, Hardflagging, LF, Even; to set these, push UTILITY, Options, RS232 Setup.) If it doesn’t work, try TKTDS1K2K Initialize.vi

9 Data Acquisition (DAQ)
Connecting the computer directly to circuits or sensors to measure voltage, current, temperature, pressure, light intensity, chemical composition, etc. Need to have either: a special data-acquisition board installed in your computer, or an external data-acquisition device such as an NI myDAQ. -Show them a voltage measurement; first a DC voltage, then func gen output with f=50 Hz (& measurement rate = 1kHz). -Our DAQ cards are PCI-6221 (M series), which sell for about $500.

10 Data Analysis Performing statistical analysis, curve fitting, signal processing, or other kinds of mathematical calculations on the data that you’ve gathered from a DAQ board or from measuring instruments. Similar to what you can do with Microsoft Excel or other spreadsheet programs.

11 Data Presentation Using tables, charts, and graphs to present the results of your data analysis. Again, similar to what you can do with Microsoft Excel or other spreadsheet programs.

12 Automated Testing Using computers to automatically test circuit boards or other manufactured parts as they leave an assembly line.

13 G LabVIEW is built around a programming language called G.
Most of this course will be devoted to learning how to write programs in G. (Bishop, p. 4)

14 Graphical vs. Text-Based Language
Most other programming languages (Assembly, VisualBasic, C, C++, Java, Python, etc.) are text-based languages. You write programs by typing text. G is a graphical language. You write programs by placing icons and connecting them with wires. (Bishop, p. 4)

15 Example Program in C #include <stdio.h> int main() { float value1, value2, product; printf("Enter first number => "); scanf("%f", &value1); printf("Enter second number => "); scanf("%f", &value2); product = value1 * value2; printf("The product is %f", product); }

16 The Same Program in LabVIEW
-Show them how to create it and run it. Then have them run it continuously. -Then edit to add 15 to the product.

17 “Virtual Instruments”
LabVIEW programs are called virtual instruments, or VIs for short. When you save a program file in LabVIEW, its extension is “.vi” (Bishop, p. 4)

18 Front Panel & Block Diagram
Every LabVIEW program has two parts, which appear in two different windows on your computer screen: the front panel and the block diagram. You don’t have to save these two parts separately; whenever you save, they’re both saved in the same file.

19 Front Panel The front panel is the user interface for a program. It contains controls (inputs) and indicators (outputs). Controls let the user feed data into the program. Indicators let the program give results back to the user.

20 Sample Front Panel By default, front panel has gray background.

21 Block Diagram The block diagram shows the program’s underlying logic. It shows how the user’s data (entered through controls) is manipulated to give the results that are fed back to the user (through indicators). The block diagram contains components “wired” together.

22 Sample Block Diagram By default, front panel has white background.

23 Toolbar (Bishop, pp. 10-14) Additional Buttons on the Diagram Toolbar
Run Button Continuous Run Button Abort Execution Pause/Continue Button Text Settings Align Objects Distribute Objects Reorder Resize front panel objects Additional Buttons on the Diagram Toolbar Execution Highlighting Button Step Into Button Step Over Button Step Out Button Click the Run button to run the VI. While the VI runs, the Run button appears with a black arrow. Click the Continuous Run button to run the VI until you abort or pause it. While the VI runs, the Abort Execution button appears. Click this button to stop the VI immediately. Note: Best to avoid using the Abort Execution button to stop a VI. Click the Pause button to pause a running VI. (Bishop, pp )

24 Controls Palette & Functions Palette
(Used to place controls & indicators on Front Panel) Functions Palette (Used to place functions on Block Diagram) Can bring up these palettes either through the Window menu or by right-clicking in blank area of front panel or block diagram. -Show them how to configure the palettes as shown above. (Bishop, pp )

25 Menus LabVIEW has pull-down menus and short-cut menus (pop-up menus) that give you many options. Sections 1.6 and 1.7 in textbook discuss the menus. (Bishop, pp )

26 Help LabVIEW’s context help window is very useful. It automatically shows help for functions and other objects when you roll your mouse over those objects. More detailed help is also available through Help menu. (Bishop, pp ) Demo with Lab01Strings.vi.

27 Context Help Window Ctrl + H Detailed help Lock help
Simple/Complex Diagram help

28 Saving Your Control Values
When you save a VI, values that you have set on the front panel are not saved. But you can cause them to be saved by selecting Edit > Make Current Values Default before you save the VI. Or you can do this with a single control by right-clicking it and selecting Data Operations > Make Current Value Default. Demo with Lab01Strings.vi.

29 Example Programs LabVIEW comes with many example VIs, which you can access by clicking Help > Find Examples… in LabVIEW’s menus. More examples are in the textbook’s Learning Directory files, which you’ll download from the Web as part of Homework #1. Studying examples is a great way to learn any programming language. (Bishop, p. 5) -In some cases, it’s easier to find a VI similar to what you’re trying to do and then modify it, rather than starting from scratch. -Use Example Finder to demo Bouncing Cube (Fundamentals > Graphs & Charts). Other good examples: Building User Interfaces>Acquiring User Input>Keyboard & Mouse> Keyboard Puzzle Game.vi or Basic Input Demo.vi.

30 PCI-6221 or myDAQ? Recall that for programs that make measurements, we have two hardware choices: The PCI-6221 card that is installed in your computer. Or the myDAQ that plugs into a USB port. You make this choice inside the DAQ Assistant, which you place on a VI’s block diagram. For the first few labs we’ll use the myDAQ.


Download ppt "Programming for Electronics Technology Professor Nick Reeder"

Similar presentations


Ads by Google