Www.robojackets.org 2011 TE Sessions Supported by: Basic Concepts of Programming November 3, 2012.

Slides:



Advertisements
Similar presentations
A. Virtual Instruments (VIs)
Advertisements

Previously… We created a simulated temperature reader which alerts if too hot or too cold… Download the solved practice to keep in sync: Thermostat.vi.
Additional Programming Concepts MVRT 2011 – 2012 Season.
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
LabVIEW is a graphical programming development environment for data acquisition and control, data analysis, and data presentation. With LabVIEW you can.
Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 2 Virtual Instruments Read Bishop, Chapter 2. Lab #2 and Homework #2 due next week. Quiz #1 next week.
Lesson 2 Navigating LabVIEW
Based on LabVIEW 2011 Student Edition
Diego Torres LabVIEW Student Ambassador Fall 2011 ITESM CQ
CS0007: Introduction to Computer Programming
Loops in LabVIEW (while,for and case)
Introduction to LabVIEW
True or false A variable of type char can hold the value 301. ( F )
CS320n –Visual Programming LabVIEW Foundations. Visual ProgrammingLabVIEW Foundations2 What We Will Do Today Hand back and review the midterm Look at.
Loops A.About While Loops B.About For Loops C.About Case structures D.Sequence Structures E.Formula Node You Will Learn:
Introduction to Computers and Programming More Loops  2000 Prentice Hall, Inc. All rights reserved. Modified for use with this course.
© 2004 Pearson Addison-Wesley. All rights reserved5-1 Iterations/ Loops The while Statement Other Repetition Statements.
CS320n –Visual Programming LabVIEW Control Structures.
Introduction to LabVIEW Seth Price Department of Chemical Engineering New Mexico Tech Rev. 10/5/14.
5.05 Apply Looping Structures
Lecture 13LabVIEW and GPIB LabVIEW (National Instruments) –Graphical program language –Widely used in academia (lab) and industry (R&D) General Purpose.
Infinity-project.org Engineering education for today’s classroom The Infinity Project SM LabVIEW for The Infinity Project.
Workshop 3 of 7 Welcome!. Today's Topics Review of Workshop 2 Loops While For Auto-indexing Shift registers Case Structure.
V1: HMFR, V2: MFNB, 2007 LabView Seminar University of Puerto Rico Mayagüez Campus.
Design of Bio-Medical Virtual Instrumentation Tutorial 1.
Virtual Instrumentation With LabVIEW. Front Panel Controls = Inputs Indicators = Outputs LabVIEW Programs Are Called Virtual Instruments (VIs) Block Diagram.
LabVIEW an Introduction
Introduction to LabVIEW
LabVIEW Program and Data Flow Review LabVIEW Robotics Fundamentals.
Each VI has 2 Windows Front Panel User Interface (UI) –Controls = Inputs –Indicators = Outputs Block Diagram Graphical Code –Data travels on wires from.
For Loops. Challenge: Racer ● Simulate a race that says “Now on lap X” for 10 laps. ● Make X vary, so it says 1, then 2, then 3 ● Use only one output.
Lecture Set 5 Control Structures Part D - Repetition with Loops.
Part I MVRT 2011 – 2012 Season Introduction to LabVIEW.
LabView instrumentoinnissa, 55492, 3op Labview in instrumentation Lecturer: Heikki Ojala, room C204a
1. 2 LabVIEW Intro, Basics, Tips, Tricks Doug Norman & Stephanie Brierty National Instruments January 8, 2010.
Creating, Editing, & Debugging a VI A.How to Create VIs B.How to Edit VIs C.How to Debug VIs You Will Learn:
COMPUTER PROGRAMMING I 5.05 Apply Looping Structures.
1 CSCI N201 Programming Concepts and Database 9 – Loops Lingma Acheson Department of Computer and Information Science, IUPUI.
Lab 1 : Introduction to LabView 1 Southern Methodist University Bryan Rodriguez.
CS320n –Visual Programming
Design of Bio-Medical Virtual Instrumentation Tutorial 2.
Research Topics in Computational Science. Agenda Survey Overview.
Virtual Instrumentation With LabVIEW. Front Panel Controls = Inputs Indicators = Outputs Block Diagram Accompanying “program” for front panel Components.
1 A Balanced Introduction to Computer Science, 2/E David Reed, Creighton University ©2008 Pearson Prentice Hall ISBN Chapter 13 Conditional.
 In computer programming, a loop is a sequence of instruction s that is continually repeated until a certain condition is reached.  PHP Loops :  In.
Workshop 2 of 4 Welcome!. Survey While You Wait ni.com/duke >> Recent Documents >> LabVIEW Workshop Participation Survey.
Controlling Program Flow with Looping Structures
A Balanced Introduction to Computer Science, 3/E David Reed, Creighton University ©2011 Pearson Prentice Hall ISBN Chapter 13 Conditional.
CS320n – Elements of Visual Programming Assignment Help Session.
Digital Electronics and Computer Interfacing Tim Mewes 2. LabVIEW Basics part II.
Fourth Quarter.  Involves loops or cycles ◦ Loops: means that a process may be repeated as long as certain condition remains true or remains false. ◦
MEH108 - Intro. To Engineering Applications KOU Electronics and Communications Engineering.
COMPUTER PROGRAMMING I 5.05 Apply Looping Structures.
Chapter 6 Controlling Program Flow with Looping Structures.
26/06/ Iteration Loops For … To … Next. 226/06/2016 Learning Objectives Define a program loop. State when a loop will end. State when the For.
EE 200 Design Tools Laboratory 14
EET 2259 Unit 5 Loops Read Bishop, Sections 5.1 and 5.2.
Introduction to LabVIEW
Lab 2 : Structures Muhammad Zaigham Abbas Shah DIGITAL INSTRUMENTATION SYSTEMS.
Chapter 5 Structures.
Outline Altering flow of control Boolean expressions
EET 2259 Unit 5 Loops Read Bishop, Sections 5.1 and 5.2.
Iteration: Beyond the Basic PERFORM
LabVIEW.
Structures- case, sequence, formula node
Introduction to Computer Science
EET 2259 Unit 5 Loops Read Bishop, Sections 5.1 and 5.2.
EET 2259 Unit 2 Virtual Instruments
Module 4 Loops and Repetition 9/19/2019 CSE 1321 Module 4.
Presentation transcript:

TE Sessions Supported by: Basic Concepts of Programming November 3, 2012

Good programs: Take time Can be easily read Are easy to improve upon The best way to make a good program is to break the project up into smaller tasks. Before you begin…

Dataflow is from left to right – the wires show the order the code is run If two different blocks of code are not connected in any way, they will run at the same time when the VI starts Pressing ctrl+h in labview shows a dialog box that briefly summarizes each icon function as well as wire data. General LabVIEW Info

This box contains the operations that will be used while coding. The programming header contains the operations that will be used most frequently. Function Palette

Picture of Function Palette

Basic Constant Types Numeric Strings (usually words) Boolean (true or false?) LabVIEW Constants

Usually trigger parts of a program Come in many forms such as buttons, knobs and dropdown boxes (known as ring controls in LabVIEW) Controls

Show outputs Examples: graphs, gauges, slide fills Indicators

2 main types in programming: “while” and “for” Biggest difference: while can be infinite, for is always finite Loops While Loop For Loops

Called “while loops,” because the code keeps running while a condition is met (while x < 5, while x ≠ 7, or while a = “false”) NOTE: Your code runs until the while loop condition is met. While Loops Index Stop

Stopping While Loops

Stopping While Loops (cont’d)

Normally, while loops run as fast as your computer can allow them to run. However, that may be too fast for your program. Timing Changes

Timing Changes (cont’d)

Shift registers remember the value that occurs at the end of the loop and bring it back to the beginning of the loop. Shift registers can be found in both while and for loops. Shift registers usually have to be initialized (this means, set the first value). Shift Registers

Example without Shift Registers Initialize

Example with Shift Registers Shift Registers

Make a while loop that does the following – Increments an integer by 1 every loop iteration – Multiplies a double by 2 every loop iteration Displays both of these numbers – Waits.5 seconds for each loop iteration – Has a stop button to terminate the loop While Loop Example

Solution

For loops are a special type of while loop that can only be stopped when it has run a set number of times. For Loops

For loops are great for making arrays in LabVIEW Array- indexed list of similar elements [4, 7, 12, 16, 25] : an array of numbers [dog, cat, bird, fish] : an array of animal words For Loops Usage: Arrays

For Loop Array Example Array Indicator Index Count Random Numbers

You can divide your code to run when certain conditions are met. Case statements should be used in while loops. Case Statements This code adds 1 every second the button is pushed down.

Case Statement Example (False) Case: False

Case Statement Example (True) Case: True

Write code to simulate an input device – Using a while loop, two case structures, and two buttons, have two counters that increment by 1 for each unit of time that each button is pressed – If button 1 is pressed, counter 1 will increment – If button 2 is pressed, counter 2 will increment – If both buttons are pressed, both counters will increment Activity

Solution