ENGR 1000, Introduction to Engineering Design

Similar documents
ENGR 1000, Introduction to Engineering Design

Basic LabVIEW Programming Amit J Nimunkar, Sara Karle, Michele Lorenz, Emily Maslonkowski

Lab experience 1: Introduction to LabView

Data Acquisition Using LabVIEW

Introduction To LabVIEW and the DSP Board

DSP Laboratory: Analog to Digital and Digital to Analog Conversion *

Fig. 1. The Front Panel (Graphical User Interface)

ME EN 363 ELEMENTARY INSTRUMENTATION Lab: Basic Lab Instruments and Data Acquisition

Virtual instruments and introduction to LabView

(Skip to step 11 if you are already familiar with connecting to the Tribot)

Analyzing and Saving a Signal

Quick Reference Manual

Configuring the Stack ST8961 VS Module when used in conjunction with a Stack ST81xx series display.

Automation Interface Requirements for J602 Basic I/O Interface of a DPC 4 Welding System

Getting Started with the LabVIEW Sound and Vibration Toolkit

Sample. Data Acquisition and Signal Conditioning. Course Manual. Course Software Version 2011 February 2012 Edition Part Number P-01

Ultra 4K Tool Box. Version Release Note

Lab 2: A/D, D/A, and Sampling Theorem

Integration of Virtual Instrumentation into a Compressed Electricity and Electronic Curriculum

Altera s Max+plus II Tutorial

KRAMER ELECTRONICS LTD. USER MANUAL

Using the Remote Control

Word Tutorial 2: Editing and Formatting a Document

LAX_x Logic Analyzer

Amplification. Most common signal conditioning

AcoustiSoft RPlusD ver

DX-10 tm Digital Interface User s Guide

Bruce Chubb s Computer/Model Railroad Interface (C/MRI) 101- The Basics

PRODUCT MANUAL. Product Description. Waterproof 4 Channel DMX to RGB-W LED Controller

Software Quick Manual

LA-1440 and LA-4440 Sound Level Meter

DA CHANNEL AES AUDIO MIXER/ ROUTER MODULE

Table of Contents Introduction

Using SignalTap II in the Quartus II Software

TV Character Generator

Boonton 4540 Remote Operation Modes

THE LXI IVI PROGRAMMING MODEL FOR SYNCHRONIZATION AND TRIGGERING

Kaleidescape Co-Star for Lumagen

Aurora Grid-Tie Installation Instructions (Model Number: PVI-3.0-OUTD-US-W) Revision 4.1

Remote Application Update for the RCM33xx

D-Lab & D-Lab Control Plan. Measure. Analyse. User Manual

PLASMA MONITOR (PT20 UVVis) USER GUIDE

INSTALATION AND OPERATION MANUAL ABYSSAL OS Overlay Module Version 1.3

NOTICE: This document is for use only at UNSW. No copies can be made of this document without the permission of the authors.

C Module Description

Research of Intelligent Traffic Light Control System Design Based on the NI ELVIS II Platform Yuan Wang a, Mi Zhou b

Classroom Setup... 2 PC... 2 Document Camera... 3 DVD... 4 Auxiliary... 5

CHAPTER 3 EXPERIMENTAL SETUP

NI-DAQmx Device Considerations

SignalTap: An In-System Logic Analyzer

RF Solution for LED Display Screen

application software

Lab 23 Controller Diagnostics

FS1-X. Quick Start Guide. Overview. Frame Rate Conversion Option. Two Video Processors. Two Operating Modes

Tebis application software

Press Publications CMC-99 CMC-141

MonitorKey Operation Manual: content/uploads/ MonitorKey Operation Manual.pdf

Features/Specifications

Defining and Labeling Circuits and Electrical Phasing in PLS-CADD

LEGO MINDSTORMS PROGRAMMING CAMP. Robotics Programming 101 Camp Curriculum

Agilent Parallel Bit Error Ratio Tester. System Setup Examples

ET398 LAB 4. Concurrent Statements, Selection and Process

Select Presentation from System Mode

F7000NV ROBOT VISION OPERATING MANUAL

MadiXtreme / Alpha-Link XLogic I/O system for PC and Mac Setup Guide V1.0 XLogic. This is SSL.

Interactive Virtual Laboratory for Distance Education in Nuclear Engineering. Abstract

C Module Description

Logic Controls LV3000 VGA Connected Virtual Pole Display

WCS-V82 Programming Software for the Icom IC-V82

LAB 3 Verilog for Combinatorial Circuits

Palette Master Color Management Software

Training Note TR-06RD. Schedules. Schedule types

Using a Photron FASTCAM APX RS High-Speed Camera with MiDAS DA

Advanced Synchronization Techniques for Data Acquisition

Tutorial 11 ChipscopePro, ISE 10.1 and Xilinx Simulator on the Digilent Spartan-3E board

AAW TOTAL EXPERIENCE VIDEOS

FS3. Quick Start Guide. Overview. FS3 Control

LCD STIMULUS DISPLAY for ENV-007/008 CHAMBERS

EAGLE RE-1 CONTROLLER For Use On MotoSAT HD Mounts

Microcontrollers and Interfacing week 7 exercises

FOUR CHANNEL USB RECORDER PCRU01. User manual. Table of Contents

LEDBlinky Animation Editor Version 6.5 Created by Arzoo. Help Document

Scan Converter Installation Guide

NI-DAQmx Key Concepts

Installation / Set-up of Autoread Camera System to DS1000/DS1200 Inserters

Background. About automation subtracks

There are three categories of unique transitions to choose from, all of which can be found on the Transitions tab:

Digital Video User s Guide THE FUTURE NOW SHOWING

VISSIM TUTORIALS This document includes tutorials that provide help in using VISSIM to accomplish the six tasks listed in the table below.

NORTHWESTERN UNIVERSITY TECHNOLOGICAL INSTITUTE

8 DIGITAL SIGNAL PROCESSOR IN OPTICAL TOMOGRAPHY SYSTEM

How-to Setup Motion Detection on a Dahua DVR/NVR

INSTALLATION AND OPERATION INSTRUCTIONS EVOLUTION VIDEO DISTRIBUTION SYSTEM

Design and Realization of the Guitar Tuner Using MyRIO

DM1624, DM1612, DM812

INSTALATION AND OPERATION MANUAL ABYSSAL OS Overlay Module Version 1.0.1

pc-based controller user guide for vers software

Field Test 2. Installation and operation manual OPDAQ Installation and operation manual

***Please be aware that there are some issues of compatibility between all current versions of EndNote and macos Sierra (version 10.12).

Operating Instructions

Transcription:

ENGR 1000, Introduction to Engineering Design Unit 2: Data Acquisition and Control Technology Lesson 2.4: Programming Digital Ports Hardware: 12 VDC power supply Several lengths of wire NI-USB 6008 Device with USB cable Digital I/O Interface Board for the NI-USB 6008 Device Traffic light Objectives: Work effectively in a cooperative learning environment. Explain the difference between programming with lines and programming with ports. Explain the characteristics and function of the digital I/O programmed as ports on the NI USB-6008 device. Write a simple program in LabVIEW to control inputs and outputs using the following new commands: DAQ Assistant (digital port input) DAQ Assistant (digital port output) Introduction In previous lessons we have interfaced the NI USB-6008/9 with LabVIEW using the DAQ Assistant. The DAQ Assistant was programmed using line outputs and inputs with Boolean values. This lesson will increase the versatility of the DAQ Assistant by introducing techniques to program the interface with port outputs and inputs using numeric values. This lesson will largely follow lessons 2.1 and 2.2 but will use the port option of programming the DAQ Assistant. Port outputs using numeric values Example 1 Our first example will perform the same function as the example in lesson 2.1, controlling a street light. The first program we will write will perform the following functions in the sequence outlined below: Lesson 2.4 - page 1

turn on output 1 for 1 second turn on output 2 for 1 second turn on both outputs 1 and 3 for 1 second turn all outputs off for 1/2 second repeat sequence Wire the red lamp of the traffic light to Port 0 line 0, the yellow lamp to Port 0 line 1, and the green lamp to Port 0 line 2. We can now begin programming. Programming a While Loop We first need to construct a base for our program. We will again use a While Loop. As in previous lessons, we will begin by inserting a While Loop with a Stop button. Refer to lesson 2.1 for questions on this or any other procedures used in this lesson. As was stated previously, this lesson will follow the same steps as lesson 2.1 with the exception that the DAQ Assistant will be programmed using port outputs. Programming a Stacked Sequence Structure Next we will insert a Stacked Sequence Structure into our While Loop. Again, a Sequence Structure is used to organize events chronologically. Programming a DAQ Assistant as a Digital Port Output This is where the new idea of programming the DAQ Assistant comes in. To proceed, an interface command needs to be created for our application. We will again use the DAQ Assistant to interface. It will be programmed using a port output. At this point, you need to make sure the NI USB-6008 data acquisition and control device is connected to your USB port or a virtual device is set up on your computer. First, close the Programming menu and open the Measurement I/O menu on the Functions Palette. Select the DAQmx Data Acquisition submenu. Select the DAQ Assistant command and place inside the Stacked Sequence Structure. The DAQ Assistant command will initialize, and the Create New Express Task window will open. We will now configure our DAQ Assistant to communicate with our hardware. Select and open the Digital I/O submenu from the list of options on the right. Select Port Output from the submenu. Select Port0 from the Supported Physical Channels and select Finish. The DAQ Assistant window will open, and everything should be configured correctly 1 Sample (On Demand) should be selected, and Invert All Lines in Port unchecked. Select OK in the lower right corner. This procedure establishes the 8 lines (0-7) associated with Port 0 as outputs. The DAQ Assistant will take a moment to configure. To help interpret your program, it will be helpful to change the name of the DAQ Assistant to identify what it specifically controls. The easiest way to change the name is to have your Tools Palette s automatic feature turned on; it is turned on when the program is first run. You can tell if the automatic feature is on or off by the green indicator at the top of the palette; green indicates it is on. The automatic feature is programmed to be toggled on or off with a left click of the mouse. With the feature on, Lesson 2.4 - page 2

double click on the name of the DAQ Assistant command and change its name to P0.0-7 OUT, identifying it as an output controlling port 0, lines 0 to 7. Programming an Array Constant with Numeric Constant The DAQ Assistant interface we are using requires an array for its input data. Since we configured our DAQ Assistant (P0.0-7 OUT) as a digital port output, all output lines for this port will be controlled with one numeric value located in an array of numeric values. We will use a constant. The easiest way to install this type of constant is to right click on the data bar of the DAQ Assistant and select Create and Constant in the submenu. An array of numbers will appear and be wired to the data in node of the DAQ Assistant. Each numeric constant in this array would represent and control a different port if more than one port were configured. The left number (0) is an index representing various ports, and if changed, can cause problems for this application. As a result, we will remove it. Right click on the index (left 0) and highlight Visible Items and on its submenu, uncheck Index Display. The number still visible is the decimal equivalent to the binary number for port 0. Since we want line 0 of port 0 to go high, we need to change the decimal value of this constant to 1. The easiest way to do this is to double click on the constant and enter 1. An optional, but slower, method would be to get the Edit Text tool from the Tools Palette and change the numeric value of the constant. Programming a Wait (ms) The final item that needs to be inserted into this frame is a Wait (ms) command with a controlling Numeric Constant. Your program should look like the following graphic. The structure below will perform the first sequence in the program; turn on output 1 for 1 second. Adding a Second Frame To allow the program to be run in stages of completion, we will write the frame for the last sequence next; turn all outputs off for a 1/2 second. This will allow us to run part of the program before the remainder is written. The quickest way to do this is to duplicate the first frame and edit it. With the pointer, hover over the right border of the stacked sequence and right click. Select Duplicate Frame. This procedure will create and take you to the new frame. Finally, edit the numeric constants so the data entering the DAQ Lesson 2.4 - page 3

Assistant equals 0, turning off all outputs, and the data for the Wait (ms) command is 500, delaying the event 1/2 second. Running the Program We can now test this portion of the program. To run, select the Run arrow in the tool bar of the Front Panel. Notice Output 0 of Port 0 turns on for 1 second, then off for 1/2 second, and continues to repeat. To turn off the program, select the Stop button on the Front Panel that was created when the While Loop was placed. Avoid using the Abort Execution button (stop sign) on the tool bar as this will stop your program before completion. The Abort Execution button should be used with caution, if used at all. Adding Frames 2 & 3 After stopping the program, the other two sequences can be written using the same procedure as above by duplicating frames and editing constants. The order of duplicating frames is important; the duplicated frame is always placed behind the frame being duplicated. When creating the second frame, be sure to duplicate it from the first frame in the stack. For the third output in the sequence, turn on two output lines. Add the decimal equivalence of the binary value for each output line. When completed, the stacks should look similar to the graphics below. This concludes our alternate example of lesson 2.1, programming with port outputs. We will now continue with an alternate example of lesson 2.2 which will introduce programming port inputs. If the previous example is important, save and close it. Open a new Blank vi for the next two examples. Lesson 2.4 - page 4

Port inputs using numeric values Example 2 The next two examples will parallel lesson 2.2. We will again be programming inputs, but this time we will be using a DAQ Assistant programmed as a digital port input. We will connect two toggle-style push-button switches to channels P1.0 and P1.3. To begin, connect a wire from channel P1.0 on the USB-6008 device to the USB/DI terminal on the first input channel of the digital I/O interface. Connect a second wire from P1.3 of the NI device to the USB/DI terminal on the second input channel of the interface. On the right side of the digital I/O interface, at terminals IN1 and IN2, connect two toggle-style pushbutton switches. Programming a Single Input Example 2.a This program will perform the following sequence after an input switch is activated: Conditions Switch 1 is high Switch 1 is low Traffic Light Sequence turn on the red and green lamps for 1/2 second turn on the yellow lamp for 1/2 second repeat the sequence (Note: program the sequence so all lamps are off when the stop button is selected) All lamps are off Wire the red lamp of the traffic light to port 0 line 0, the yellow lamp to port 0 line 1, and the green lamp to port 0 line 2. Wire a toggle switch to port 1 line 0. We will begin programming with a While Loop as our base structure or the outer most structure. To begin, insert a While Loop in the Block Diagram. Programming a DAQ Assistant as a Digital Port Input In the last lesson, the DAQ Assistant was used to interface the software with the hardware outputs. The same command, with a different configuration, will be used to interface the software with the hardware inputs. The primary difference between a digital output and a digital input is how the port or channel is addressed. When programming outputs, a value is sent to the port to turn channels on or off. When programming inputs, a value is read from the port that indicates its status telling us which channels are high or low. Using the Functions Palette, navigate to the DAQ Assistant command and place inside the While Loop. The location of the DAQ Assistant can be viewed in the diagram below. The DAQ Assistant command will initialize, and the Create New Express Task window will open. Select and open the Digital I/O submenu from the list of options on the right. Select Port Input from the submenu. Select port1 from the Supported Physical Channels and select Finish. The DAQ Assistant window will open. This time, check the Invert All Lines In Port box. The configuration should also have 1 Sample (On Demand) selected. To finish the configuration, select OK in the lower right corner. The DAQ Assistant will take a moment to configure. Lesson 2.4 - page 5

To help with the interpretation of your program, change the name of the DAQ Assistant following the procedure described in the previous lesson. This time, name it P1.0-3 IN, identifying it as an input controlling port 1, lines 0 to 3. Isolating Port 1 (P1) as an Input The DAQ Assistant is capable of utilizing an array of ports, and we have configured it for only one. (Programming examples for the configuration of multiple ports will be presented later.) As a result, we must first isolate the port we configured in P1 from the array of potential ports. This will be accomplished by using the Index Array command. Place an Index Array command to the lower right of P1. Wire the data bar of P1 to the array node of the Index Array. Create a numeric constant for the Index Array and keep the value 0 of the Numeric Constant to select the first element/channel, or the first port configured from the array of potential ports. Create a Numeric Indicator in the Front Panel A Numeric Indicator will be used to display the decimal value of the port we have configured for our inputs. The decimal value will be displayed on the Front Panel for the convenience of the operator. The binary equivalent of this decimal value is representative of the status of each channel of the port, 0 or 1, low or high. Both the Front Panel and Block Diagram should look similar to the diagrams below. Lesson 2.4 - page 6

Running the Program The program can be run by selecting the Run arrow on the Front Panel s tool bar. The virtual indicator will monitor status of port 1 (input 1), and its value (0 or 1/false or true/low or high) will change as the switch is toggled. Stop the program by pressing the stop button associated with the While Loop. This would be a good time to name and begin saving your program. Program a Case Structure for a Numeric Input Insert a Case Structure within the While Loop to the right of the Index Array command using a left click and drag technique. Wire the output of the Index Array to the selector terminal (question mark) of the Case Structure. Your program should look similar to the graphic below. Programming the Digital Outputs The rest of the program will utilize programming commands and techniques previously taught. See the previous example if unsure of the procedures. In Case 1 of the Case Structure, create the following stacked sequence, frames 0-2. frame 0 turn on red & green lamp for 1/2 second frame 1 turn on yellow lamp for 1/2 second frame 2 turn off all lamps (at the speed of light or the speed of your computer s processor, whichever is faster) Lesson 2.4 - page 7

In Case 0, Default of the Case Structure, turn off all outputs using the DAQ Assistant as shown on the right. Test your program. Once you have determined your program is running successfully, you should save it. Programming Multiple Inputs Example 2.b The next program we will write will use a numeric case structure to perform multiple sequences based on the status of two input switches. The two sequences are as follows: Conditions Switch 1 is high & Switch 2 is low Switch 1 is low & Switch 2 is high Switches 1 & 2 are low Traffic Light Sequence turn on the red and green lamps for 1/2 second turn on the yellow lamp for 1/2 second repeat the sequence turn on the red, yellow, and green lamps for 1 second turn off all lamps for 1/2 second repeat the sequence all lamps are off Wire the red lamp of the traffic light to port 0 line 0, the yellow lamp to port 0 line 1, and the green lamp to port 0 line 2. Wire two toggle switches, the first to port 1 line 0, and the second to port 1 line 3. Note: In order to save time, the wiring of the traffic light and the programming of the sequence for the first switch are the same as in example 2.a of this lesson. Lesson 2.4 - page 8

Adding another Case to the Structure The final procedure will be to add a case after case 1. This is similar to duplicating frames in a stacked sequence. Right click on the border of case 1 and select Add Case After. Change the numeric value of the new case to 8 since this will represent the decimal equivalent of the Boolean value of switch 2 (P1.3). Complete the program by adding a Stacked Sequence Structure, DAQ Assistant with Numeric Constants, and Wait (ms) commands to case 8. Follow the procedure described in programming example 1 of this lesson. Case 8 should look similar to the graphics below. In our example program, we are only using three of the four possible cases with two switches (cases 0, 1, & 8). As the program is written now, when both switches are pressed, the program runs the default case since the decimal equivalent of both switches would be 9 and we do not have a case equal to the value 9. An additional case could be developed for this program. If we had 3 switches, we would have a possibility of eight cases from the various combinations of switches. A switch wired to P1.1 would represent the decimal value 2, and a switch wired to P1.2 would represent the decimal value 4. We could build different cases by simply adding the decimal values of the various switches. Lesson 2.4 - page 9

Team Assignment As a team, write a program to perform the following sequences depending on the conditions of two toggle switches. Wire the traffic light and toggle switches as directed below. Conditions Switch 1 is high & Switch 2 is low Switch 1 is low & Switch 2 is high Switches 1 & 2 are high Switches 1 & 2 are low Traffic Light Sequence turn on the green lamp for 3 seconds turn on the yellow lamp for 1 second turn on the red lamp for 4 seconds repeat the sequence turn on the red lamp for 1 second turn off all lamps for 1 second repeat the sequence turn on the yellow lamp for 1 second turn off all lamps for 1 second repeat the sequence all lamps are off Wire the red lamp of the traffic light to port 0 line 0, the yellow lamp to port 0 line 2, and the green lamp to port 0 line 4. Wire switch 1 to port 1 line 1 and switch 2 to port 1 line 2. Save your program on a removable storage device under the name HW2-2T# (use your team number in place of the # symbol). Have the next person representing your team turn in your team assignment at the beginning of the next lab. Each person in your team should be able to perform this assignment and the lesson s objectives independently. Each of you will have an opportunity to demonstrate your knowledge independently on a quiz. A team is successful when all members are able to demonstrate the objectives. Have fun with the control technology and helping each other learn the material. Lesson 2.4 - page 10