Parsing Instrument Data in Visual Basic

Size: px
Start display at page:

Download "Parsing Instrument Data in Visual Basic"

Transcription

1 Application Note 148 Parsing Instrument Data in Visual Basic Introduction Patrick Williams Instruments are notorious for sending back cryptic binary messages or strings containing a combination of header and data information. It is often frustrating trying to make your application work with these strings, and it can be a long and painful experience trying to parse them into a usable data format. Parsing divides data into small, usable components that you can visualize, analyze, and save. The Measurement Studio Serial, GPIB, and VISA ActiveX controls provide a built-in data parsing tool to make working with instrument data easier. You can use this interactive string parsing tool to define rules for parsing information out of instrument strings so you keep only the data you need. Note Measurement Studio includes tools to build measurement applications in ANSI C, Visual C++, and Visual Basic. The Measurement Studio Visual Basic tools were formerly known as ComponentWorks. Measurement Studio Parsing Overview Use the Task, Pattern, and Token objects to define syntax rules for parsing your instrument data. Figure 1 shows the relationship between these three objects. A Task object holds information about the format of the data through a collection of patterns. You might define several tasks per control to deal with different data formats or more complex instrument strings. A Pattern object contains a collection of tokens that describe the format of the data. You can create custom patterns and choose to repeat those patterns more than once to parse a repetitive instrumentstring or you can use the built-in Number Parser pattern to extract numbers. Patterns are made up of one or more tokens, which are the basic building blocks for parsing. A Token is a single string, character, number, or binary format. You combine tokens to define a pattern in the data string. Tasks Define different parsing jobs. Create different tasks to handle different formats. Patterns Define a particular format in a task. Use Number Parser or define your own patterns for unique data formats. Tokens Define data elements in a pattern, such as a string, character, number, or binary format. Figure 1. Parsing Hierarchy ComponentWorks, Measurement Studio, National Instruments, and ni.com are trademarks of National Instruments Corporation. Product and company names mentioned herein are trademarks or trade names of their respective companies B-01 Copyright 1999, 2000 National Instruments Corporation. All rights reserved. November 2000

2 Consider the following string returned from an instrument: WFM 3.246,3.295,4.653,3.334 This string contains header information (information about the data that follows) and data. The header information WMF indicates that the data following the header is waveform data. The waveform data consists of comma-delimited float values. You can define this data format in terms of patterns and tokens so that no matter what data this instrument returns, you can always extract an array of float values. The following list identifies the tokens in the example string: "WMF" token Header information about the data that follows it <number> token A single data point expressed with ACSII characters "," token A comma to separate number tokens This example has two patterns. The first is the header information, and the pattern consists of one token: "WMF" The second pattern is repeated several times and consists of the following tokens: <number> + "," Tip Notice that the last value deviates from the pattern because it is not followed by the "," token. As you develop parsing tasks, consider how you are going to deal with header information and the last value in a data string. You might use the following algorithm to create a parsing task for this type of string: 1. Find the header information, but don t add it to the returned data. 2. Find the first <number> + "," pattern. 3. Extract the number and ignore the comma. 4. Repeat the <number> + "," pattern until the last value. 5. Add the last value to the array of numbers returned to your program. Note The ActiveX controls return parsed data as an array of tokens. The array can contain a combination of data types (for example, strings and numbers). For this example, an array of doubles is returned to your program. Parsing Patterns You can use two types of patterns a Number Parser pattern and a user-defined pattern. The built-in Number Parser pattern converts a string comma-delimited or other-delimited into an array of numbers, stripping out header information and other nonnumeric information. Data strings like the example you just examined can take advantage of the Number Parser pattern. With user-defined patterns, you can specify the format of the data through a set of tokens. Each token defines a particular element in the pattern. Tokens can represent string or binary data. You can use string tokens to parse data that is represented by a string, and binary tokens to parse binary data. You can even combine string and binary tokens in the same pattern. You can use one or more of these patterns in a single parsing task. When you run a task, you can execute each pattern once, a fixed number of times, or an unspecified number of times. If you run the task an unspecified number of times, the pattern is executed until it cannot find a match, at which time it continues to the next pattern or token. Application Note ni.com

3 Parsing Tokens There are two types of parsing tokens string and binary. String tokens parse any string or number that you can express with ASCII characters. For example, "WMF" and "1.23" are examples of string tokens. Binary tokens parse data stored as bytes. During a parsing task, the ActiveX controls use string tokens to identify numbers, special strings (such as the "WMF" token), or a string of a certain length. Binary tokens interpret the data in the buffer not as a string but as raw binary data. Binary tokens specify the number of bytes to read from the buffer and return in the format of the specified token. After the task executes, each parsed token is returned unless you specifically mark it to be ignored. If the specified token is not found, the parsing operation fails. If the parsing operation fails, the data that was found is returned and the OnError event is fired. Tip When you request that a token be ignored, the control does not return any occurrence of it in the array. For example, you might not want the commas from the <number> + "," pattern returned in the array. If you specify commas as ignored, only the numbers are returned in the array. If only one number is present, the control returns the number as a scalar (not an array). The following tables list the string and binary tokens that the ActiveX controls define: Table 1. String Tokens Token <number> <integer> <stringn> "string" Description Reads a number in the buffer and returns it as a double Reads a number in the buffer and returns is as an integer Reads a string of length n Reads the string specified by string Table 2. Binary Tokens Token Description <uint1> Parses a one-byte unsigned integer 1 <uint2> Parses a two-byte unsigned integer 1 <uint4> Parses a four-byte unsigned integer 1 <int1> Parses a one-byte signed integer <int2> Parses a two-byte signed integer <int4> Parses a four-byte signed integer <float4> Parses a four-byte floating point number <float8> Parses an eight-byte floating point number 1 Do not use unsigned integer data types in Visual Basic because it does not recognize them. National Instruments Corporation 3 Application Note 148

4 Example Defining a Parsing Task Open Visual Basic and load a Measurement Studio Instrument (CWSerial or CWGPIB) or VISA (CWVisa) control, depending on the type of instrument with which you want to communicate. Place one of the controls on the form, right click on it, and select Properties. Configure instrument communication on the General page, and then select the Parsing property page to interactively define the parsing task. When you open the Parsing page, you ll notice that there is a Number Parser parsing task already defined. Number Parser is the built-in parsing pattern that parses delimited strings. But what if you want to parse the following string and return both numeric and string This particular instrument returns strings with signs, a number, a three-character string, and a single termination character. Imagine that you want to parse a string with this format and return only the number and three-character string. In this example, you ll define a new pattern named ACK through a series of user-defined tokens to parse this string and display the number and three-character string in text boxes on the user interface. 1. Create a new task. Click Edit and change its name to ACK. 2. Add a new pattern to the ACK task. 3. Now add the first token that describes the string. Click Token to add a new token, and for Token value. Because you don t want this string returned, select Ignore token. Note To define your own string or character token, such as the "@@@" token, select any of the pattern types from the token value list and then enter the string that you want to define as a token. You can specify nonprintable ASCII characters as tokens too just use the equivalent decimal number, which you can find in an ASCII chart. Notice that the property pages include the decimal numbers for two frequently used string tokens the carriage return (\13) and the line feed (\10). 4. Add the second token to the pattern. Click Token, and select <number> from the Token value list. 5. Add the third token. Click Token, and select <string3>. The <string3> token returns any string with three characters. If the instrument always returns ACK as the three-character string, then you can create an "ACK" token rather than using the <string3> token. 6. Add the last token. You can use the <string1> token to parse the termination character. You don t want this token returned, so check Ignore token. Your Parsing property page should look like the one in Figure 2. Tasks Pattern Tokens Figure 2. Using Patterns and Tokens to Define Custom Parsing Tasks Application Note ni.com

5 7. Finally, you need to call the parsing task from your code. The following event procedure is executed when you click on a Parse String button on the user interface. The procedure sets the instrument string in data, calls the ACK parsing task with the Parse method, and then displays the returned data in two text boxes on the user interface, as shown in Figure 3. Option Explicit Dim Response As Variant Dim data As String Private Sub btnparsestring_click() data = "@@@002ACK;" Response = Comm.Tasks("ACK").Parse(data) Text1.Text = Response(0) Text2.Text = Response(1) End Sub Note You ll need to add two text boxes and a command button named btnparsestring to your user interface to complete this example. Figure 3. Displaying Parsed Data on the User Interface Example Examining Advanced Parsing Tasks Open the Measurement Studio for Visual Basic Advanced Parsing example and run it. Note If you installed Measurement Studio on your computer, you can open this example from MeasurementStudio\Vb\Samples\Instr\Advanced Parsing. Otherwise, you can download this example, Parsing Instrument Data in Visual Basic, at ni.com Press Generate Simulated Data (Ascii). Notice that the text box is populated with a string of data. The string begins with #, a number, and a colon. The first number indicates the number of data points included in the string. The simulated ASCII string follows the following format: #n: val1, val2, val3,..., valn where n is the number of values included in the string. Press the Parse and Plot Data button and watch the program parse the instrument string and plot the parsed data on the graph. National Instruments Corporation 5 Application Note 148

6 Now try pressing the Generate Simulated Data (2 byte Binary) button. Notice that the format of the string is a little different than that of the ASCII string. This 2-byte binary data can be expressed by the following format: n val1 val2 val3... valn where n is the number of data points in the string. Both strings return header information (although in a slightly different format) that indicate how many data points are contained in the string. You can use this header information to determine the number of times you should repeat a pattern. Note Check your instrument manual for information about the way your instruments returns data. Open the Parsing property page and examine it to determine how the CWSerial control uses the parsing tasks, patterns, and tokens. There are three tasks: AsciiNumber, AsciiList, and BinaryData, as shown in Figure 4. The first two tasks AsciiNumber and AsciiList parse the data that is generated with the Generate Simulated Data (Ascii) button. The BinaryData task parses the binary data that is generated with the Generate Simulated Data (2 byte Binary) button. Parsing ASCII Data Figure 4. Defining Multiple Tasks to Parse Multiple Data Formats The AsciiNumber task parses the header information from the ASCII data. AsciiNumber consists of one pattern with three tokens, as shown in Figure 4. The "#" and ":" tokens are marked as ignored, and the <number> token specifies the number of values that follow. You can use this value to determine the number of times you should repeat the AsciiList task. The AsciiList task reads the elements in the buffer. As shown in Figure 5, it consists of two patterns: List and LastNumber. The List pattern is defined by two tokens (<number> and ","), and it reads all elements in the list except the last element because the last element does not follow the pattern it doesn t contain a comma. The "," token is ignored so that it is not returned in the array. The LastNumber pattern is defined by one token (<number>), and it reads the last element in the buffer. Application Note ni.com

7 Figure 5. Parsing ASCII Data The following code from the example reads the data, parses it, and plots it on the graph. Tip The trick to parsing strings with a varying number of data points is determining the number of times to repeat the pattern. You have to specify the number of times to repeat the pattern programmatically during run time with the RepetitionFactor property. 'Parse the ASCII data and graph it. Private Sub ParseAsciiData() 'NumberOfElements is the first number in the string. 'Repeat the AsciiList task NumberOfElements-1 to parse all but the last value. Dim NumberOfElements 'parseddata is the array of parsed values. Dim parseddata 'Read the first number to find out how many times to repeat AsciiList. NumberOfElements = CWSerial1.Tasks("AsciiNumber").Parse(AsciiText.Text) 'Set RepetitionFactor to read all but the last value. CWSerial1.Tasks("AsciiList").Patterns("List").RepetitionFactor = NumberOfElements - 1 'Read values into the parseddata array. parseddata = CWSerial1.Tasks("AsciiList").Parse(AsciiText.Text) 'Plot parseddata. CWGraph1.PlotY parseddata End Sub Notice that the string is actually parsed twice. The first time you use the AsciiNumber task to look for header information to determine the number of times to repeat the AsciiList task. The second time you run the AsciiList task to find the List and LastNumber patterns and extract the numbers and ignore the commas. The AsciiList task ignores the header information because it is looking for the first occurrence of the <number> + "," pattern. National Instruments Corporation 7 Application Note 148

8 Parsing Binary Data The BinaryData task parses data in binary format. As shown in Figure 6, it consists of two patterns Number and Data. Each pattern consists of a single token, <int2>. The Number pattern reads the header information that indicates the number of items in the binary data. Use this value just like it was used to parse ASCII data to determine at run time the number of times the Data pattern needs to be executed. Figure 6. Parsing Binary Data The following code from the example shows you how to read the data, call the BinaryData task, and plot the parsed data on the graph. The subroutine parses the data twice. The first time, the task parses the data and returns only the first value, which it uses to set the repetition factor. The second time, the task ignores the first value and returns just the data. 'Parses the binary data and graphs it. Private Sub ParseBinaryData() 'NumberOfElements is the first number in the string. Dim NumberOfElements 'parseddata will be the array of parsed values. Dim parseddata 'Create a reference to the BinaryData task created in the property pages. Dim Task As CWTask Set Task = CWSerial1.Tasks("BinaryData") 'Read the first two-byte number using the Number pattern so that you can 'determine the number of times to repeat the Data pattern. Task.Patterns("Number").Tokens(1).Ignore = False 'Don t execute the Data pattern yet. Task.Patterns("Data").RepetitionFactor = 0 'Save the data from the BinaryData parsing task, which is just one value. 'Now you know the number of times to repeat the Data pattern. NumberOfElements = Task.Parse(BinaryData) 'Now ignore the first two-byte number and specify the number of times to 'repeat the Data pattern to extract all 2-byte numbers. Task.Patterns("Number").Tokens(1).Ignore = True Task.Patterns("Data").RepetitionFactor = NumberOfElements 'Return the values from the BinaryData parsing task in the parseddata array. parseddata = Task.Parse(BinaryData) 'Plot parseddata. CWGraph1.PlotY parseddata End Sub Application Note ni.com

9 Conclusion The Measurement Studio interactive parsing tool makes it easier to use the data returned from your instrument. The parsing tool is flexible enough to let you define your own parsing tasks, patterns, and tokens. The Measurement Studio parsing API is simple enough for you to use so that you can enable your program to make parsing decisions during run time, such as determining the number of times to repeat a certain task. Remember to consult your instrument manual for information about the data format that your instrument uses. National Instruments Corporation 9 Application Note 148

10

Using Measurement Studio GPIB to Accelerate Development with Visual Basic

Using Measurement Studio GPIB to Accelerate Development with Visual Basic Application Note 119 Using Measurement Studio GPIB to Accelerate Development with Visual Basic Introduction Jason White and Evan Cone Using GPIB in Visual Basic can be a complicated experience. One of

More information

Interacting with Measurement Studio Graphs in Visual Basic Heather Edwards

Interacting with Measurement Studio Graphs in Visual Basic Heather Edwards Application Note 163 Interacting with Measurement Studio Graphs in Visual Basic Heather Edwards Introduction You have collected your measurements, displayed them on a Measurement Studio 1 2D Graph or 3D

More information

MP 3 A Lexer for MiniJava

MP 3 A Lexer for MiniJava MP 3 A Lexer for MiniJava CS 421 Spring 2012 Revision 1.0 Assigned Wednesday, February 1, 2012 Due Tuesday, February 7, at 09:30 Extension 48 hours (penalty 20% of total points possible) Total points 43

More information

MP 3 A Lexer for MiniJava

MP 3 A Lexer for MiniJava MP 3 A Lexer for MiniJava CS 421 Spring 2010 Revision 1.0 Assigned Tuesday, February 2, 2010 Due Monday, February 8, at 10:00pm Extension 48 hours (20% penalty) Total points 50 (+5 extra credit) 1 Change

More information

Project 1: Scheme Pretty-Printer

Project 1: Scheme Pretty-Printer Project 1: Scheme Pretty-Printer CSC 4101, Fall 2017 Due: 7 October 2017 For this programming assignment, you will implement a pretty-printer for a subset of Scheme in either C++ or Java. The code should

More information

Programming in C++ 6. Floating point data types

Programming in C++ 6. Floating point data types Programming in C++ 6. Floating point data types! Introduction! Type double! Type float! Changing types! Type promotion & conversion! Casts! Initialization! Assignment operators! Summary 1 Introduction

More information

Data Types. Numeric Data Types

Data Types. Numeric Data Types Data Types Data comes in different types and different formats Integer Floating point numbers Characters A key issue is whether there is hardware support for a particular data type. Hardware support means

More information

Input File Syntax The parser expects the input file to be divided into objects. Each object must start with the declaration:

Input File Syntax The parser expects the input file to be divided into objects. Each object must start with the declaration: TCC Low Level Parser Purpose The TCC low level parser is designed to convert the low level ASCII based configuration files into a binary format which can then be downloaded to the Alpha processor boards.

More information

EKT 314/4 LABORATORIES SHEET

EKT 314/4 LABORATORIES SHEET EKT 314/4 LABORATORIES SHEET WEEK DAY HOUR 2 2 2 PREPARED BY: EN. MUHAMAD ASMI BIN ROMLI EN. MOHD FISOL BIN OSMAN JULY 2009 14 operations pass data to and from files. Use the VIs and functions to handle

More information

printf( Please enter another number: ); scanf( %d, &num2);

printf( Please enter another number: ); scanf( %d, &num2); CIT 593 Intro to Computer Systems Lecture #13 (11/1/12) Now that we've looked at how an assembly language program runs on a computer, we're ready to move up a level and start working with more powerful

More information

OUTLINE. Number system. Creating MATLAB variables Overwriting variable Error messages Making corrections Entering multiple statements per line

OUTLINE. Number system. Creating MATLAB variables Overwriting variable Error messages Making corrections Entering multiple statements per line 1 LECTURE 2 OUTLINE Number system Integer number Decimal number Binary number Hexadecimal number Creating MATLAB variables Overwriting variable Error messages Making corrections Entering multiple statements

More information

Interactive MATLAB use. Often, many steps are needed. Automated data processing is common in Earth science! only good if problem is simple

Interactive MATLAB use. Often, many steps are needed. Automated data processing is common in Earth science! only good if problem is simple Chapter 2 Interactive MATLAB use only good if problem is simple Often, many steps are needed We also want to be able to automate repeated tasks Automated data processing is common in Earth science! Automated

More information

1. Lexical Analysis Phase

1. Lexical Analysis Phase 1. Lexical Analysis Phase The purpose of the lexical analyzer is to read the source program, one character at time, and to translate it into a sequence of primitive units called tokens. Keywords, identifiers,

More information

Hardware: Acquiring Data and Communicating with Instruments

Hardware: Acquiring Data and Communicating with Instruments Hardware: Acquiring Data and Communicating with Instruments 4 Acquiring a Signal This chapter introduces you to the Express VIs you use to acquire data and communicate with instruments on Windows. These

More information

.. Cal Poly CPE 101: Fundamentals of Computer Science I Alexander Dekhtyar..

.. Cal Poly CPE 101: Fundamentals of Computer Science I Alexander Dekhtyar.. .. Cal Poly CPE 101: Fundamentals of Computer Science I Alexander Dekhtyar.. A Simple Program. simple.c: Basics of C /* CPE 101 Fall 2008 */ /* Alex Dekhtyar */ /* A simple program */ /* This is a comment!

More information

BSM540 Basics of C Language

BSM540 Basics of C Language BSM540 Basics of C Language Chapter 3: Data and C Prof. Manar Mohaisen Department of EEC Engineering Review of the Precedent Lecture Explained the structure of a simple C program Introduced comments in

More information

Introduction to Computers and Programming. Numeric Values

Introduction to Computers and Programming. Numeric Values Introduction to Computers and Programming Prof. I. K. Lundqvist Lecture 5 Reading: B pp. 47-71 Sept 1 003 Numeric Values Storing the value of 5 10 using ASCII: 00110010 00110101 Binary notation: 00000000

More information

Certified LabVIEW Associate Developer Exam. Test Booklet

Certified LabVIEW Associate Developer Exam. Test Booklet Certified LabVIEW Associate Developer Exam Test Booklet Note: The use of the computer or any reference materials is NOT allowed during the exam. Instructions: If you did not receive this exam in a sealed

More information

Motivation was to facilitate development of systems software, especially OS development.

Motivation was to facilitate development of systems software, especially OS development. A History Lesson C Basics 1 Development of language by Dennis Ritchie at Bell Labs culminated in the C language in 1972. Motivation was to facilitate development of systems software, especially OS development.

More information

Program Elements -- Introduction

Program Elements -- Introduction Program Elements -- Introduction We can now examine the core elements of programming Chapter 3 focuses on: data types variable declaration and use operators and expressions decisions and loops input and

More information

ucalc Patterns Examine the following example which can be pasted into the interpreter (paste the entire block at the same time):

ucalc Patterns Examine the following example which can be pasted into the interpreter (paste the entire block at the same time): [This document is far from complete but discusses some pattern essentials. Check back for more in the future; ask questions for clarity] ucalc Patterns ucalc patterns represent a key element of all current

More information

These are notes for the third lecture; if statements and loops.

These are notes for the third lecture; if statements and loops. These are notes for the third lecture; if statements and loops. 1 Yeah, this is going to be the second slide in a lot of lectures. 2 - Dominant language for desktop application development - Most modern

More information

The type of all data used in a C (or C++) program must be specified

The type of all data used in a C (or C++) program must be specified The type of all data used in a C (or C++) program must be specified A data type is a description of the data being represented That is, a set of possible values and a set of operations on those values

More information

CS 31: Introduction to Computer Systems. 03: Binary Arithmetic January 29

CS 31: Introduction to Computer Systems. 03: Binary Arithmetic January 29 CS 31: Introduction to Computer Systems 03: Binary Arithmetic January 29 WiCS! Swarthmore Women in Computer Science Slide 2 Today Binary Arithmetic Unsigned addition Subtraction Representation Signed magnitude

More information

Parsing INI Files in Lisp

Parsing INI Files in Lisp Parsing INI Files in Lisp Gene Michael Stover created Sunday, 2005 February 20 updated Sunday, 2005 February 20 Copyright c 2005 Gene Michael Stover. All rights reserved. Permission to copy, store, & view

More information

Variables and Data Representation

Variables and Data Representation You will recall that a computer program is a set of instructions that tell a computer how to transform a given set of input into a specific output. Any program, procedural, event driven or object oriented

More information

Building an Interactive Web Page with DataSocket

Building an Interactive Web Page with DataSocket Application Note 127 Introduction Building an Interactive Web Page with DataSocket Heather Edwards This application note explains how you can create an interactive Web page with which users can view data

More information

1

1 0 1 4 Because a refnum is a temporary pointer to an open object, it is valid only for the period during which the object is open. If you close the object, LabVIEW disassociates the refnum with the object,

More information

ROC Plus Ethernet Driver

ROC Plus Ethernet Driver Emerson Process Management ROC Plus Ethernet Driver 1 System Configuration... 3 2 External Device Selection... 4 3 Communication Settings... 5 4 Setup Items... 6 5 Supported Devices... 10 6 Error Messages...

More information

CMSC 330: Organization of Programming Languages. OCaml Imperative Programming

CMSC 330: Organization of Programming Languages. OCaml Imperative Programming CMSC 330: Organization of Programming Languages OCaml Imperative Programming CMSC330 Spring 2018 1 So Far, Only Functional Programming We haven t given you any way so far to change something in memory

More information

Virtual Instrumentation With LabVIEW

Virtual Instrumentation With LabVIEW Virtual Instrumentation With LabVIEW Course Goals Understand the components of a Virtual Instrument Introduce LabVIEW and common LabVIEW functions Build a simple data acquisition application Create a subroutine

More information

Topics Power tends to corrupt; absolute power corrupts absolutely. Computer Organization CS Data Representation

Topics Power tends to corrupt; absolute power corrupts absolutely. Computer Organization CS Data Representation Computer Organization CS 231-01 Data Representation Dr. William H. Robinson November 12, 2004 Topics Power tends to corrupt; absolute power corrupts absolutely. Lord Acton British historian, late 19 th

More information

UNIVERSAL SERIAL INTERFACE

UNIVERSAL SERIAL INTERFACE UNIVERSAL SERIAL INTERFACE Coastal Environmental Systems Application Note ZENO_MANUAL_USI.DOC 4/21 UNIVERSAL SERIAL INTERFACE Overview The Universal Serial Interface lets you program your ZENO to communicate

More information

Objectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program

Objectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program Objectives Chapter 2: Basic Elements of C++ In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates

More information

Chapter 2: Basic Elements of C++

Chapter 2: Basic Elements of C++ Chapter 2: Basic Elements of C++ Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates

More information

More on Images and Matlab

More on Images and Matlab More on Images and Matlab Prof. Eric Miller elmiller@ece.tufts.edu Fall 2007 EN 74-ECE Image Processing Lecture 3-1 Matlab Data Types Different means of representing numbers depending on what you want

More information

Programming for Engineers Iteration

Programming for Engineers Iteration Programming for Engineers Iteration ICEN 200 Spring 2018 Prof. Dola Saha 1 Data type conversions Grade average example,-./0 class average = 23450-67 893/0298 Grade and number of students can be integers

More information

Chapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction

Chapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction Chapter 2: Basic Elements of C++ C++ Programming: From Problem Analysis to Program Design, Fifth Edition 1 Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers

More information

Motivation was to facilitate development of systems software, especially OS development.

Motivation was to facilitate development of systems software, especially OS development. A History Lesson C Basics 1 Development of language by Dennis Ritchie at Bell Labs culminated in the C language in 1972. Motivation was to facilitate development of systems software, especially OS development.

More information

Spoke. Language Reference Manual* CS4118 PROGRAMMING LANGUAGES AND TRANSLATORS. William Yang Wang, Chia-che Tsai, Zhou Yu, Xin Chen 2010/11/03

Spoke. Language Reference Manual* CS4118 PROGRAMMING LANGUAGES AND TRANSLATORS. William Yang Wang, Chia-che Tsai, Zhou Yu, Xin Chen 2010/11/03 CS4118 PROGRAMMING LANGUAGES AND TRANSLATORS Spoke Language Reference Manual* William Yang Wang, Chia-che Tsai, Zhou Yu, Xin Chen 2010/11/03 (yw2347, ct2459, zy2147, xc2180)@columbia.edu Columbia University,

More information

ML 4 A Lexer for OCaml s Type System

ML 4 A Lexer for OCaml s Type System ML 4 A Lexer for OCaml s Type System CS 421 Fall 2017 Revision 1.0 Assigned October 26, 2017 Due November 2, 2017 Extension November 4, 2017 1 Change Log 1.0 Initial Release. 2 Overview To complete this

More information

Le L c e t c ur u e e 2 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Variables Operators

Le L c e t c ur u e e 2 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Variables Operators Course Name: Advanced Java Lecture 2 Topics to be covered Variables Operators Variables -Introduction A variables can be considered as a name given to the location in memory where values are stored. One

More information

Programming in C++ 4. The lexical basis of C++

Programming in C++ 4. The lexical basis of C++ Programming in C++ 4. The lexical basis of C++! Characters and tokens! Permissible characters! Comments & white spaces! Identifiers! Keywords! Constants! Operators! Summary 1 Characters and tokens A C++

More information

CIS 110: Introduction to Computer Programming

CIS 110: Introduction to Computer Programming CIS 110: Introduction to Computer Programming Lecture 3 Express Yourself ( 2.1) 9/16/2011 CIS 110 (11fa) - University of Pennsylvania 1 Outline 1. Data representation and types 2. Expressions 9/16/2011

More information

InfoTag KE28xx Communications for 186 CPU Firmware Version 4

InfoTag KE28xx Communications for 186 CPU Firmware Version 4 InfoTag KE28xx Communications for 186 CPU Firmware Version 4 *KE28xx models include: KE2800, KE2852, KE2853, KE2856 This document applies to printer firmware versions 4.x only. Note that changes made to

More information

Virtual Instrumentation With LabVIEW

Virtual Instrumentation With LabVIEW Virtual Instrumentation With LabVIEW Section I LabVIEW terms Components of a LabVIEW application LabVIEW programming tools Creating an application in LabVIEW LabVIEW Programs Are Called Virtual Instruments

More information

Call DLL from Limnor Applications

Call DLL from Limnor Applications Call DLL from Limnor Applications There is a lot of computer software in the format of dynamic link libraries (DLL). DLLCaller performer allows your applications to call DLL functions directly. Here we

More information

Variables in VB. Keeping Track

Variables in VB. Keeping Track Variables in VB Keeping Track Variables Variables are named places in the computer memory that hold information. Variables hold only a single value at a time. Assigning a new value to them causes the old

More information

LabVIEW VI Analyzer Toolkit

LabVIEW VI Analyzer Toolkit USER GUIDE LabVIEW VI Analyzer Toolkit The LabVIEW VI Analyzer Toolkit allows you to interactively and programmatically test VIs to find areas for improvement. The toolkit contains tests that address a

More information

Universal Format Plug-in User s Guide. Version 10g Release 3 (10.3)

Universal Format Plug-in User s Guide. Version 10g Release 3 (10.3) Universal Format Plug-in User s Guide Version 10g Release 3 (10.3) UNIVERSAL... 3 TERMINOLOGY... 3 CREATING A UNIVERSAL FORMAT... 5 CREATING A UNIVERSAL FORMAT BASED ON AN EXISTING UNIVERSAL FORMAT...

More information

ARM Cortex A9. ARM Cortex A9

ARM Cortex A9. ARM Cortex A9 ARM Cortex A9 Four dedicated registers are used for special purposes. The IP register works around the limitations of the ARM functional call instruction (BL) which cannot fully address all of its 2 32

More information

Week 3 Lecture 2. Types Constants and Variables

Week 3 Lecture 2. Types Constants and Variables Lecture 2 Types Constants and Variables Types Computers store bits: strings of 0s and 1s Types define how bits are interpreted They can be integers (whole numbers): 1, 2, 3 They can be characters 'a',

More information

flex is not a bad tool to use for doing modest text transformations and for programs that collect statistics on input.

flex is not a bad tool to use for doing modest text transformations and for programs that collect statistics on input. flex is not a bad tool to use for doing modest text transformations and for programs that collect statistics on input. More often than not, though, you ll want to use flex to generate a scanner that divides

More information

Part 1. Summary of For Loops and While Loops

Part 1. Summary of For Loops and While Loops NAME EET 2259 Lab 5 Loops OBJECTIVES -Understand when to use a For Loop and when to use a While Loop. -Write LabVIEW programs using each kind of loop. -Write LabVIEW programs with one loop inside another.

More information

Non-numeric types, boolean types, arithmetic. operators. Comp Sci 1570 Introduction to C++ Non-numeric types. const. Reserved words.

Non-numeric types, boolean types, arithmetic. operators. Comp Sci 1570 Introduction to C++ Non-numeric types. const. Reserved words. , ean, arithmetic s s on acters Comp Sci 1570 Introduction to C++ Outline s s on acters 1 2 3 4 s s on acters Outline s s on acters 1 2 3 4 s s on acters ASCII s s on acters ASCII s s on acters Type: acter

More information

CHAPTER 2. Troubleshooting CGI Scripts

CHAPTER 2. Troubleshooting CGI Scripts CHAPTER 2 Troubleshooting CGI Scripts OVERVIEW Web servers and their CGI environment can be set up in a variety of ways. Chapter 1 covered the basics of the installation and configuration of scripts. However,

More information

2SKILL. Variables Lesson 6. Remembering numbers (and other stuff)...

2SKILL. Variables Lesson 6. Remembering numbers (and other stuff)... Remembering numbers (and other stuff)... Let s talk about one of the most important things in any programming language. It s called a variable. Don t let the name scare you. What it does is really simple.

More information

C++ Basics. Lecture 2 COP 3014 Spring January 8, 2018

C++ Basics. Lecture 2 COP 3014 Spring January 8, 2018 C++ Basics Lecture 2 COP 3014 Spring 2018 January 8, 2018 Structure of a C++ Program Sequence of statements, typically grouped into functions. function: a subprogram. a section of a program performing

More information

Number Representations

Number Representations Simple Arithmetic [Arithm Notes] Number representations Signed numbers Sign-magnitude, ones and twos complement Arithmetic Addition, subtraction, negation, overflow MIPS instructions Logic operations MIPS

More information

Recitation #11 Malloc Lab. November 7th, 2017

Recitation #11 Malloc Lab. November 7th, 2017 18-600 Recitation #11 Malloc Lab November 7th, 2017 1 2 Important Notes about Malloc Lab Malloc lab has been updated from previous years Supports a full 64 bit address space rather than 32 bit Encourages

More information

X Language Definition

X Language Definition X Language Definition David May: November 1, 2016 The X Language X is a simple sequential programming language. It is easy to compile and an X compiler written in X is available to simplify porting between

More information

UNIT- 3 Introduction to C++

UNIT- 3 Introduction to C++ UNIT- 3 Introduction to C++ C++ Character Sets: Letters A-Z, a-z Digits 0-9 Special Symbols Space + - * / ^ \ ( ) [ ] =!= . $, ; : %! &? _ # = @ White Spaces Blank spaces, horizontal tab, carriage

More information

LabVIEW Basics I: Introduction Course

LabVIEW Basics I: Introduction Course www.ni.com/training LabVIEW Basics I Page 1 of 4 LabVIEW Basics I: Introduction Course Overview The LabVIEW Basics I course prepares you to develop test and measurement, data acquisition, instrument control,

More information

Maciej Sobieraj. Lecture 1

Maciej Sobieraj. Lecture 1 Maciej Sobieraj Lecture 1 Outline 1. Introduction to computer programming 2. Advanced flow control and data aggregates Your first program First we need to define our expectations for the program. They

More information

CS52 - Assignment 8. Due Friday 4/15 at 5:00pm.

CS52 - Assignment 8. Due Friday 4/15 at 5:00pm. CS52 - Assignment 8 Due Friday 4/15 at 5:00pm https://xkcd.com/859/ This assignment is about scanning, parsing, and evaluating. It is a sneak peak into how programming languages are designed, compiled,

More information

INTRODUCTION 1 AND REVIEW

INTRODUCTION 1 AND REVIEW INTRODUTION 1 AND REVIEW hapter SYS-ED/ OMPUTER EDUATION TEHNIQUES, IN. Programming: Advanced Objectives You will learn: Program structure. Program statements. Datatypes. Pointers. Arrays. Structures.

More information

Bits. Binary Digits. 0 or 1

Bits. Binary Digits. 0 or 1 Data Representation Bits Binary Digits 0 or 1 Everything stored in a computer is stored as bits. Bits can mean different things depending on how the software or hardware interpret the bits Bits are usually

More information

CITS2401 Computer Analysis & Visualisation

CITS2401 Computer Analysis & Visualisation FACULTY OF ENGINEERING, COMPUTING AND MATHEMATICS CITS2401 Computer Analysis & Visualisation SCHOOL OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING Topic 3 Introduction to Matlab Material from MATLAB for

More information

CS 251 Intermediate Programming Java Basics

CS 251 Intermediate Programming Java Basics CS 251 Intermediate Programming Java Basics Brooke Chenoweth University of New Mexico Spring 2018 Prerequisites These are the topics that I assume that you have already seen: Variables Boolean expressions

More information

1 Overview. 2 Basic Program Structure. 2.1 Required and Optional Parts of Sketch

1 Overview. 2 Basic Program Structure. 2.1 Required and Optional Parts of Sketch Living with the Lab Winter 2015 What s this void loop thing? Gerald Recktenwald v: February 7, 2015 gerry@me.pdx.edu 1 Overview This document aims to explain two kinds of loops: the loop function that

More information

Chapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. Overview. Objectives. Teaching Tips. Quick Quizzes. Class Discussion Topics

Chapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. Overview. Objectives. Teaching Tips. Quick Quizzes. Class Discussion Topics Java Programming, Sixth Edition 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics Additional Projects Additional

More information

Number Systems Using and Converting Between Decimal, Binary, Octal and Hexadecimal Number Systems

Number Systems Using and Converting Between Decimal, Binary, Octal and Hexadecimal Number Systems Number Systems Using and Converting Between Decimal, Binary, Octal and Hexadecimal Number Systems In everyday life, we humans most often count using decimal or base-10 numbers. In computer science, it

More information

Presented By : Gaurav Juneja

Presented By : Gaurav Juneja Presented By : Gaurav Juneja Introduction C is a general purpose language which is very closely associated with UNIX for which it was developed in Bell Laboratories. Most of the programs of UNIX are written

More information

ARG! Language Reference Manual

ARG! Language Reference Manual ARG! Language Reference Manual Ryan Eagan, Mike Goldin, River Keefer, Shivangi Saxena 1. Introduction ARG is a language to be used to make programming a less frustrating experience. It is similar to C

More information

Exercise: Using Numbers

Exercise: Using Numbers Exercise: Using Numbers Problem: You are a spy going into an evil party to find the super-secret code phrase (made up of letters and spaces), which you will immediately send via text message to your team

More information

Grammars and Parsing, second week

Grammars and Parsing, second week Grammars and Parsing, second week Hayo Thielecke 17-18 October 2005 This is the material from the slides in a more printer-friendly layout. Contents 1 Overview 1 2 Recursive methods from grammar rules

More information

The type of all data used in a C++ program must be specified

The type of all data used in a C++ program must be specified The type of all data used in a C++ program must be specified A data type is a description of the data being represented That is, a set of possible values and a set of operations on those values There are

More information

Data Definition, Movement, and Comparison

Data Definition, Movement, and Comparison Topics covered include: Data Definition, Movement, and Comparison 1. Data Definition: the DS and DC statements. 2. The use of literals as statements to define constants. 3. Data movement commands 4. Data

More information

Introduction to Programming (Java) 2/12

Introduction to Programming (Java) 2/12 Introduction to Programming (Java) 2/12 Michal Krátký Department of Computer Science Technical University of Ostrava Introduction to Programming (Java) 2008/2009 c 2006 2008 Michal Krátký Introduction

More information

Functions. Using Bloodshed Dev-C++ Heejin Park. Hanyang University

Functions. Using Bloodshed Dev-C++ Heejin Park. Hanyang University Functions Using Bloodshed Dev-C++ Heejin Park Hanyang University 2 Introduction Reviewing Functions ANSI C Function Prototyping Recursion Compiling Programs with Two or More Source Code Files Finding Addresses:

More information

Using BasicX Block Data Objects with PlaySound

Using BasicX Block Data Objects with PlaySound Basic Express Application Note Using BasicX Block Data Objects with PlaySound Introduction The BasicX system library includes a procedure called PlaySound, which can be used to generate audio signals from

More information

CS 4240: Compilers and Interpreters Project Phase 1: Scanner and Parser Due Date: October 4 th 2015 (11:59 pm) (via T-square)

CS 4240: Compilers and Interpreters Project Phase 1: Scanner and Parser Due Date: October 4 th 2015 (11:59 pm) (via T-square) CS 4240: Compilers and Interpreters Project Phase 1: Scanner and Parser Due Date: October 4 th 2015 (11:59 pm) (via T-square) Introduction This semester, through a project split into 3 phases, we are going

More information

Communication settings: Network configuration can be done via the Anybus IP configuration setup tool or via the on board Web server

Communication settings: Network configuration can be done via the Anybus IP configuration setup tool or via the on board Web server SmartLinx EtherNet/IP instruction and use APPLICATION GUIDE Objective: Show the user how to configure and use an EtherNet/IP SmartLinx communication module. AG082415 While every effort was made to verify

More information

CS1622. Semantic Analysis. The Compiler So Far. Lecture 15 Semantic Analysis. How to build symbol tables How to use them to find

CS1622. Semantic Analysis. The Compiler So Far. Lecture 15 Semantic Analysis. How to build symbol tables How to use them to find CS1622 Lecture 15 Semantic Analysis CS 1622 Lecture 15 1 Semantic Analysis How to build symbol tables How to use them to find multiply-declared and undeclared variables. How to perform type checking CS

More information

STEVEN R. BAGLEY THE ASSEMBLER

STEVEN R. BAGLEY THE ASSEMBLER STEVEN R. BAGLEY THE ASSEMBLER INTRODUCTION Looking at how to build a computer from scratch Started with the NAND gate and worked up Until we can build a CPU Reached the divide between hardware and software

More information

BASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I

BASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I BASIC COMPUTATION x public static void main(string [] args) Fundamentals of Computer Science I Outline Using Eclipse Data Types Variables Primitive and Class Data Types Expressions Declaration Assignment

More information

Chapter 2 THE STRUCTURE OF C LANGUAGE

Chapter 2 THE STRUCTURE OF C LANGUAGE Lecture # 5 Chapter 2 THE STRUCTURE OF C LANGUAGE 1 Compiled by SIA CHEE KIONG DEPARTMENT OF MATERIAL AND DESIGN ENGINEERING FACULTY OF MECHANICAL AND MANUFACTURING ENGINEERING Contents Introduction to

More information

ECE251 Midterm practice questions, Fall 2010

ECE251 Midterm practice questions, Fall 2010 ECE251 Midterm practice questions, Fall 2010 Patrick Lam October 20, 2010 Bootstrapping In particular, say you have a compiler from C to Pascal which runs on x86, and you want to write a self-hosting Java

More information

PROGRAMMING FUNDAMENTALS

PROGRAMMING FUNDAMENTALS PROGRAMMING FUNDAMENTALS Q1. Name any two Object Oriented Programming languages? Q2. Why is java called a platform independent language? Q3. Elaborate the java Compilation process. Q4. Why do we write

More information

Network configuration can be done via the Anybus IP configuration setup tool or via the on board Web server.

Network configuration can be done via the Anybus IP configuration setup tool or via the on board Web server. SmartLinx EtherNet/IP instruction and use Objective: Show the user how to configure and use a EtherNet/IP SmartLinx communication module. AG052813 While every effort was made to verify the following information,

More information

A lexical analyzer generator for Standard ML. Version 1.6.0, October 1994

A lexical analyzer generator for Standard ML. Version 1.6.0, October 1994 A lexical analyzer generator for Standard ML. Version 1.6.0, October 1994 Andrew W. Appel 1 James S. Mattson David R. Tarditi 2 1 Department of Computer Science, Princeton University 2 School of Computer

More information

VLC : Language Reference Manual

VLC : Language Reference Manual VLC : Language Reference Manual Table Of Contents 1. Introduction 2. Types and Declarations 2a. Primitives 2b. Non-primitives - Strings - Arrays 3. Lexical conventions 3a. Whitespace 3b. Comments 3c. Identifiers

More information

Version N 2.0. LaurTec. RS232 Terminal. Debugging Embedded Systems. Author : Mauro Laurenti ID: PJ11004-EN. Copyright Mauro Laurenti 1/33

Version N 2.0. LaurTec. RS232 Terminal. Debugging Embedded Systems. Author : Mauro Laurenti ID: PJ11004-EN. Copyright Mauro Laurenti 1/33 Version N 2.0 LaurTec RS232 Terminal Debugging Embedded Systems Author : Mauro Laurenti ID: PJ11004-EN Copyright 2009-2017 Mauro Laurenti 1/33 License Copyright (C) 2009-2017 Author: Mauro Laurenti Web

More information

Java Notes. 10th ICSE. Saravanan Ganesh

Java Notes. 10th ICSE. Saravanan Ganesh Java Notes 10th ICSE Saravanan Ganesh 13 Java Character Set Character set is a set of valid characters that a language can recognise A character represents any letter, digit or any other sign Java uses

More information

The following steps will create an Eclipse project containing source code for Problem Set 1:

The following steps will create an Eclipse project containing source code for Problem Set 1: Problem Set 1 Programming Music Out: 27 August Due: Monday, 1 Sept (beginning of class) Collaboration Policy - Read Carefully For this problem set, you should work alone, but feel free to ask other students

More information

Chapter 2 Bits, Data Types, and Operations

Chapter 2 Bits, Data Types, and Operations Chapter 2 Bits, Data Types, and Operations Original slides from Gregory Byrd, North Carolina State University Modified slides by Chris Wilcox, Colorado State University How do we represent data in a computer?!

More information

Chapter 7 File Access. Chapter Table of Contents

Chapter 7 File Access. Chapter Table of Contents Chapter 7 File Access Chapter Table of Contents OVERVIEW...105 REFERRING TO AN EXTERNAL FILE...105 TypesofExternalFiles...106 READING FROM AN EXTERNAL FILE...107 UsingtheINFILEStatement...107 UsingtheINPUTStatement...108

More information

CS1 Lecture 3 Jan. 18, 2019

CS1 Lecture 3 Jan. 18, 2019 CS1 Lecture 3 Jan. 18, 2019 Office hours for Prof. Cremer and for TAs have been posted. Locations will change check class website regularly First homework assignment will be available Monday evening, due

More information

Programming Lecture 3

Programming Lecture 3 Programming Lecture 3 Expressions (Chapter 3) Primitive types Aside: Context Free Grammars Constants, variables Identifiers Variable declarations Arithmetic expressions Operator precedence Assignment statements

More information

Full file at

Full file at Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class

More information