Using BasicX to Derive Acceleration From GARMIN GPS Text Data

Size: px
Start display at page:

Download "Using BasicX to Derive Acceleration From GARMIN GPS Text Data"

Transcription

1 Basic Express Application Note Using BasicX to Derive Acceleration From GARMIN GPS Text Data Introduction Global Positioning System (GPS) receivers are typically able to measure position, velocity and time. With additional processing, a GPS receiver can also be used as an accelerometer by differentiating velocity with respect to time. GARMIN GPS receivers, such as etrex TM, can be configured to transmit data in a format called Simple Text Output protocol. A BasicX computer is used to read and decode the text data, and derive acceleration from GPS readings. Hardware interface Figure 1 (below) illustrates the hardware interface between a GPS receiver and BasicX system: Figure 1 The BasicX serial input pin number on depends on the system. For BX-01 systems, port Com2 is used on pin 12. For BX-24 and BX-35 systems, port Com3 is used on pin 16. If you use a GARMIN etrex or similar receiver, it should be set to text out mode at 1200 baud.

2 Software Interface The GARMIN GPS data format is documented here: In this format, GPS data consists of a simple 7 bit ASCII text string with a constant length of 57 bytes. On etrex receivers, the string is transmitted about once per second. A BasicX microcontroller is used to extract GPS time and velocity data embedded in the text strings. Single precision floating point variables are used to store the data. In the BasicX demonstration program, GPS data is decoded and written to an array called NewFix, which is a 4 dimensional floating point array. Each array element is defined as follows: Array Element Definition NewFix(1) NewFix(2) NewFix(3) NewFix(4) Velocity East (m/s) Velocity North (m/s) Velocity up (m/s) Time of day (s) A similar array called OldFix stores data from the previous GPS fix. The acceleration vector A is derived by taking the velocity vector V and differentiating it with respect to time. A is approximated by taking the differences between each velocity component at times t 2 and t 1 and dividing by t = (t 2 - t 1 ). The velocity and acceleration vectors are oriented assuming a right hand coordinate system. The magnitude of the acceleration vector A is also calculated using the following formula: A = A e 2 + A n 2 + A u 2 Whenever the BasicX processor decodes a GPS fix, the velocity and acceleration data are converted to ASCII strings and transmitted out the BasicX Com1 serial port configured to baud, 8 data bits, 1 stop bit, no parity. Example format: ================== Ve: m/s Vn: m/s Vu: m/s Ae: g An: g Au: g A: g ================== 2

3 Sometimes the GPS receiver may not pick up signals from enough satellites for complete position and velocity fixes. In these cases, data may not be available, or may be only partially available. When this happens, the text string Invalid data is transmitted in place of velocity and acceleration data. Raw text display. Instead of decoded data, you can choose to display untranslated text as received from the GPS receiver. In the main program, the Boolean constant RawText controls this selection. A typical line of raw text looks like Program listing. The program GPSAccelerometer consists of the following 5 modules, which are included as separate files along with this application note: GPSAccelerometer.bas GPSVelocityDecoder.bas GPSSerialPort.bas GPSPinAssignments.bas Format3x3.bas Includes the main program and other high level code Does the low level decoding of text data Handles the GPS serial port -- Defines the serial I/O pin number and port number -- Converts floating point number to formatted string Each file is listed on the following pages. The program is written for a BX-24 system. If you want to port the program to other BasicX systems, most code changes should be localized to module GPSPinAssignments, and are flagged by comments. 3

4 Module GPSAccelerometer Attribute VB_Name = "GPSAccelerometer" Option Explicit Public Sub Main() ' This program derives acceleration by differentiating GPS velocity data. ' The GPS data is in Garmin Simple Text Output format, and is received over ' a serial port. Dim OldFixIsValid As Boolean Dim OldFix(1 To 4) As Single Dim NewFixIsValid As Boolean Dim NewFix(1 To 4) As Single Dim N As Byte Dim Acceleration(1 To 3) As Single ' Set this flag to true to display raw text from the GPS receiver. Const RawText As Boolean = False OldFixIsValid = False NewFixIsValid = False Call InitializeGPS Debug.Print Debug.Print "GPS Accelerometer" Delay 0.5 Debug.Print Debug.Print "Waiting for GPS data..." Debug.Print If (RawText) Then Call DisplayRawText Do Call GetFixGPS(NewFixIsValid, NewFix) If (NewFixIsValid) And (OldFixIsValid) Then If (SanityCheckOK(OldFix, NewFix)) Then Call DisplayVelocity(NewFix) Call ToAcceleration(OldFix, NewFix, Acceleration) Call DisplayAcceleration(Acceleration) Call LargeDivider Else Call DisplayError 4

5 Else Call DisplayError If (NewFixIsValid) Then ' NewFix becomes OldFix for the next cycle. For N = 1 To 4 OldFix(N) = NewFix(N) Next OldFixIsValid = True Loop Private Sub DisplayRawText() ' This procedure displays raw text received from the GPS receiver. Do Debug.Print Chr(GetByte); Loop Private Function SanityCheckOK( _ ByRef OldFix() As Single, _ ByRef NewFix() As Single) As Boolean ' Check that the time difference between successive GPS velocity fixes is ' within a reasonable range. Dim DeltaT As Single ' Legal range is about 1 s to 3 s. Const MinDeltaT As Single = 0.9 Const MaxDeltaT As Single = 3.1 DeltaT = NewFix(4) - OldFix(4) If (DeltaT >= MinDeltaT) And (DeltaT <= MaxDeltaT) Then SanityCheckOK = True Else SanityCheckOK = False End Function 5

6 Private Sub ToAcceleration( _ ByRef OldFix() As Single, _ ByRef NewFix() As Single, _ ByRef Acceleration() As Single) ' Approximate acceleration by taking Delta_V over Delta_T. Dim DeltaT As Single DeltaT = NewFix(4) - OldFix(4) Acceleration(1) = (NewFix(1) - OldFix(1)) / DeltaT Acceleration(2) = (NewFix(2) - OldFix(2)) / DeltaT Acceleration(3) = (NewFix(3) - OldFix(3)) / DeltaT Private Sub DisplayVelocity( _ ByRef FixGPS() As Single) Debug.Print " Debug.Print " Debug.Print " Ve: "; ToStr(FixGPS(1)); " m/s" Vn: "; ToStr(FixGPS(2)); " m/s" Vu: "; ToStr(FixGPS(3)); " m/s" Call SmallDivider Private Sub DisplayAcceleration( _ ByRef Acceleration() As Single) ' This converts m/s^2 to G. Const UnitConvert As Single = 9.81 Dim A As Single Debug.Print " Ae: "; ToStr(Acceleration(1) / UnitConvert); " g" Debug.Print " An: "; ToStr(Acceleration(2) / UnitConvert); " g" Debug.Print " Au: "; ToStr(Acceleration(3) / UnitConvert); " g" A = Sqr( Acceleration(1) * Acceleration(1) _ + Acceleration(2) * Acceleration(2) _ + Acceleration(3) * Acceleration(3) ) Debug.Print Debug.Print " A: "; ToStr(A / UnitConvert); " g" 6

7 Private Function ToStr( _ ByVal X As Single) As String ' Converts float to a 7 character string, right justified, blank filled. The ' number is displayed to 3 decimal places. The number should be in range ' to Dim LeadingBlanks As New BoundedString_2 ' Space for minus sign. If (X >= 0.0) Then LeadingBlanks = " " Else LeadingBlanks = "" ' Space for digits. If (Abs(X) < 10.0) Then LeadingBlanks = LeadingBlanks & " " ToStr = LeadingBlanks & Fmt(X, 3) End Function Private Sub DisplayError() Debug.Print "Invalid data" Debug.Print Private Sub SmallDivider() Debug.Print " " Private Sub LargeDivider() Debug.Print "==================" 7

8 Module GPSVelocityDecoder Attribute VB_Name = "GPSVelocityDecoder" Option Explicit Private Const ChrEast As Byte = 69 ' E Private Const ChrNorth As Byte = 78 ' N Private Const ChrUp As Byte = 85 ' U Private Const MaxDigits As Byte = 5 Private PowTenLookup(1 To MaxDigits) As Integer Private DataIsValid As Boolean Public Sub InitializeGPS() PowTenLookup(1) = 1 PowTenLookup(2) = 10 PowTenLookup(3) = 100 PowTenLookup(4) = 1000 PowTenLookup(5) = Call OpenSerialPortGPS Public Sub GetFixGPS( _ ByRef FixIsValid As Boolean, _ ByRef FixGPS() As Single) Dim TimeGPS(1 To 3) As Byte Dim Velocity(1 To 3) As Integer Const SentenceStart As Byte = 64 ' "@" Dim N As Byte Dim Temp As Byte Dim Sign As Integer Dim T As Single DataIsValid = True ' Character ' Position ' Start sentence. Do Until (GetByte = SentenceStart) ' 1 ' Null Loop ' Ignore year/month/day. For N = 2 To 7 ' Temp = GetByte Next ' Decode hour/minute/second. For N = 1 To 3 TimeGPS(N) = CByte(GetNumber(2)) ' Next 8

9 ' Ignore all position data. For N = 14 To 40 ' Temp = GetByte Next ' Velocity east/west. Sign = GetSign(ChrEast) ' 41 Velocity(1) = GetNumber(4) * Sign ' ' Velocity north/south. Sign = GetSign(ChrNorth) ' 46 Velocity(2) = GetNumber(4) * Sign ' ' Velocity up/down. Sign = GetSign(ChrUp) ' 51 Velocity(3) = GetNumber(4) * Sign ' ' End sentence Temp = GetByte ' 56 Temp = GetByte ' 57 ' Velocity unit conversions. FixGPS(1) = CSng(Velocity(1)) / 10.0 FixGPS(2) = CSng(Velocity(2)) / 10.0 FixGPS(3) = CSng(Velocity(3)) / ' Time unit conversions. T = CSng(TimeGPS(3)) ' Seconds. T = T + ( CSng(TimeGPS(2)) * 60.0 ) ' Minutes. T = T + ( CSng(TimeGPS(1)) * ) ' Hours. FixGPS(4) = T FixIsValid = DataIsValid 9

10 Public Function GetNumber( _ ByVal DigitCount As Byte) As Integer ' This function converts a decimal string to an integer. The string is of ' length DigitCount. ' ' Each character must be a decimal digit -- otherwise the character is ' illegal. If any illegal characters are found, they're treated as ' equivalent to "0" and the error flag DataIsValid is set to False. Dim PowTen As Integer Dim N As Byte Dim InByte As Byte PowTen = PowTenLookup(DigitCount) GetNumber = 0 For N = 1 To DigitCount InByte = GetByte ' Check for legal decimal digit. If (InByte >= 48) And (InByte <= 57) Then GetNumber = GetNumber + (CInt(InByte - 48) * PowTen) Else DataIsValid = False PowTen = PowTen \ 10 Next End Function Public Function GetSign( _ ByVal Value As Byte) As Integer ' This function reads a byte and returns a sign value that depends on the ' specified number Value. If the new byte matches, the sign is positive. ' Otherwise the sign is negative. If (GetByte = Value) Then GetSign = 1 Else GetSign = -1 End Function 10

11 Public Function GetByte() As Byte ' This function reads the next byte from the input device. If the byte matches ' InvalidTag, the flag DataIsValid is set to False. Const InvalidTag As Byte = 95 ' "_" GetByte = GetByteGPS If (GetByte = InvalidTag) Then DataIsValid = False End Function 11

12 Module GPSSerialPort Attribute VB_Name = "GPSSerialPort" Option Explicit Private Const InputQueueSize As Integer = 10 ' 1 byte buffer. Private Const OutputQueueSize As Integer = 10 ' 1-byte buffer. Private InputQueue(1 To InputQueueSize) As Byte Private OutputQueue(1 To OutputQueueSize) As Byte Private Const Baud As Long = 1200 Private Const NullOutputPin As Byte = 0 Public Sub OpenSerialPortGPS() Call OpenQueue(InputQueue, InputQueueSize) Call OpenQueue(OutputQueue, OutputQueueSize) If (PortNumber = 3) Then ' Inverted logic, no parity, 8 data bits. Call DefineCom3(SerialInputPin, NullOutputPin, bx1000_1000) Call OpenCom(PortNumber, Baud, InputQueue, OutputQueue) Public Function GetByteGPS() As Byte Dim Value As Byte Call GetQueue(InputQueue, Value, 1) GetByteGPS = Value End Function 12

13 Module GPSPinAssignments Attribute VB_Name = "GPSPinAssignments" Option Explicit ' This module defines port and I/O pin numbers. ' BX-01 assignments. '>>Public Const PortNumber As Byte = 2 '>>Public Const SerialInputPin As Byte = 12 ' BX-24 assignments. Public Const PortNumber As Byte = 3 Public Const SerialInputPin As Byte = 16 ' BX-35 assignments. '>>Public Const PortNumber As Byte = 3 '>>Public Const SerialInputPin As Byte = 16 13

14 Module Format3x3 Attribute VB_Name = "Format3x3" Option Explicit Public Function Fmt( _ ByVal Value As Single, _ ByVal Aft As Byte) As String ' Converts a float to a string with up to 3 places on each side of the ' decimal point. Legal range is Dim Sign As New BoundedString_1 Dim Temp As Single Dim itemp As Long Dim N As Byte Dim D(1 To 3) As Byte Const MinValue As Single = Const MaxValue As Single = ' Check for errors. If (Value < MinValue) Or (Value > MaxValue) Then GoTo Failure If (Aft < 0) Or (Aft > 3) Then GoTo Failure End if Temp = Abs(Value) ' Discard sign for now. ' Adjust scale. Select Case Aft Case 0 Temp = Temp Case 1 Temp = Temp * 10.0 Case 2 Temp = Temp * Case 3 Temp = Temp * End Select ' Round and convert to integer. itemp = FixL(Temp + 0.5) ' Find each digit, in reverse order. For N = 1 To Aft D(4 - N) = CByte(iTemp Mod 10) itemp = itemp \ 10 Next If (Value < 0.0) Then Sign = "-" Else Sign = "" 14

15 Select Case Aft Case 0 Fmt = Sign & CStr(iTemp) Exit Function Case 1 Fmt = Sign & CStr(iTemp) & "." _ & Chr(D(3) + 48) Exit Function Case 2 Fmt = Sign & CStr(iTemp) & "." _ & Chr(D(2) + 48) & Chr(D(3) + 48) Exit Function Case 3 Fmt = Sign & CStr(iTemp) & "." _ & Chr(D(1) + 48) & Chr(D(2) + 48) & Chr(D(3) + 48) Exit Function End Select Exit Function Failure: Fmt = "*" Exit Function End Function 2002 by NetMedia, Inc. All rights reserved. Basic Express, BasicX, BX-01, BX-24 and BX-35 are trademarks of NetMedia, Inc. GARMIN is a registered trademark and etrex is a trademark of GARMIN Corporation. All other trademarks are the property of their respective owners. 2.01A 15

Using a 74HCT259 8 Bit Addressable Latch with BasicX

Using a 74HCT259 8 Bit Addressable Latch with BasicX Basic Express Application Note Using a 74HCT259 8 Bit Addressable Latch with BasicX Introduction This application note illustrates how to use a 74HCT259 8-bit addressable latch with a BasicX system. The

More information

Basic Express. Basic Express. Compiler User's Guide. Version 1.46

Basic Express. Basic Express. Compiler User's Guide. Version 1.46 Basic Express Basic Express Compiler User's Guide Version 1.46 1998-2000 by NetMedia, Inc. All rights reserved. Basic Express, BasicX, BX-01 and BX-24 are trademarks of NetMedia, Inc. 1.46A 2 Contents

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

NetMedia 2x16 Serial LCD Display Module V1.5

NetMedia 2x16 Serial LCD Display Module V1.5 NetMedia 2x16 Serial LCD Display Module V1.5 Table of Contents: Pinout... 2 Interfacing... 3 LCD Control Codes... 4 Creating Custom Characters... 6 BasicX-24 Example Program:... 7 2x16 Specifications...

More information

by NetMedia, Inc. All rights reserved. Basic Express, BasicX, BX-01, BX-24 and BX-35 are trademarks of NetMedia, Inc.

by NetMedia, Inc. All rights reserved. Basic Express, BasicX, BX-01, BX-24 and BX-35 are trademarks of NetMedia, Inc. Version 2.0 1998-2002 by NetMedia, Inc. All rights reserved. Basic Express, BasicX, BX-01, BX-24 and BX-35 are trademarks of NetMedia, Inc. Microsoft, Windows and Visual Basic are either registered trademarks

More information

Programming Timer1 as a Stopwatch

Programming Timer1 as a Stopwatch Basic Express Application Note Programming Timer1 as a Stopwatch What is Timer1? BasicX systems have a built-in timer called Timer1. This timer can be used for several functions, one of which is measuring

More information

Language Fundamentals

Language Fundamentals Language Fundamentals VBA Concepts Sept. 2013 CEE 3804 Faculty Language Fundamentals 1. Statements 2. Data Types 3. Variables and Constants 4. Functions 5. Subroutines Data Types 1. Numeric Integer Long

More information

Quick Reference Guide

Quick Reference Guide SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD mikroelektronika Development tools - Books - Compilers Quick Reference Quick Reference Guide with EXAMPLES for Basic language This reference guide

More information

NetMedia 2x16 Serial LCD Display Module V1.2

NetMedia 2x16 Serial LCD Display Module V1.2 NetMedia 2x16 Serial LCD Display Module V1.2 RS232 compatible serial interface (2400 & 9600 baud selectable) Externally selectable serial polarities (Inverted & Non-Inverted) Serially controllable contrast

More information

VARIABLES AND CONSTANTS

VARIABLES AND CONSTANTS UNIT 3 Structure VARIABLES AND CONSTANTS Variables and Constants 3.0 Introduction 3.1 Objectives 3.2 Character Set 3.3 Identifiers and Keywords 3.3.1 Rules for Forming Identifiers 3.3.2 Keywords 3.4 Data

More information

AIS Cube [THE BLAZINGCORE SERIES] LANGUAGE REFERENCE

AIS Cube [THE BLAZINGCORE SERIES] LANGUAGE REFERENCE AIS Cube LANGUAGE REFERENCE [THE BLAZINGCORE SERIES] With superior number crunching abilities and peripheral handling on our custom embedded OS, Rapid prototyping is now easy... and blazing fast. Sonata

More information

Unit 4. Lesson 4.1. Managing Data. Data types. Introduction. Data type. Visual Basic 2008 Data types

Unit 4. Lesson 4.1. Managing Data. Data types. Introduction. Data type. Visual Basic 2008 Data types Managing Data Unit 4 Managing Data Introduction Lesson 4.1 Data types We come across many types of information and data in our daily life. For example, we need to handle data such as name, address, money,

More information

AIS Cube [THE BLAZINGCORE SERIES] LANGUAGE REFERENCE

AIS Cube [THE BLAZINGCORE SERIES] LANGUAGE REFERENCE AIS Cube LANGUAGE REFERENCE [THE BLAZINGCORE SERIES] With superior number crunching abilities and peripheral handling on our custom embedded OS, Rapid prototyping is now easy... and blazing fast. Sonata

More information

Variable A variable is a value that can change during the execution of a program.

Variable A variable is a value that can change during the execution of a program. Declare and use variables and constants Variable A variable is a value that can change during the execution of a program. Constant A constant is a value that is set when the program initializes and does

More information

VB FUNCTIONS AND OPERATORS

VB FUNCTIONS AND OPERATORS VB FUNCTIONS AND OPERATORS In der to compute inputs from users and generate results, we need to use various mathematical operats. In Visual Basic, other than the addition (+) and subtraction (-), the symbols

More information

CSC Java Programming, Fall Java Data Types and Control Constructs

CSC Java Programming, Fall Java Data Types and Control Constructs CSC 243 - Java Programming, Fall 2016 Java Data Types and Control Constructs Java Types In general, a type is collection of possible values Main categories of Java types: Primitive/built-in Object/Reference

More information

DroidBasic Syntax Contents

DroidBasic Syntax Contents DroidBasic Syntax Contents DroidBasic Syntax...1 First Edition...3 Conventions Used In This Book / Way Of Writing...3 DroidBasic-Syntax...3 Variable...4 Declaration...4 Dim...4 Public...4 Private...4 Static...4

More information

Russound Controllers. RNET Protocol & Specifications RS-232 Communication. Document version

Russound Controllers. RNET Protocol & Specifications RS-232 Communication. Document version Russound Controllers RNET Protocol & Specifications RS-232 Communication Document version 1.00.01 1 Quick Reference Guide Feature CAS44 CAA66 CAM6.6 CAV6.6 Pg. Keypad Events 13 Source Control Events 14

More information

Programming Language 2 (PL2)

Programming Language 2 (PL2) Programming Language 2 (PL2) 337.1.1 - Explain rules for constructing various variable types of language 337.1.2 Identify the use of arithmetical and logical operators 337.1.3 Explain the rules of language

More information

C++ Data Types. 1 Simple C++ Data Types 2. 3 Numeric Types Integers (whole numbers) Decimal Numbers... 5

C++ Data Types. 1 Simple C++ Data Types 2. 3 Numeric Types Integers (whole numbers) Decimal Numbers... 5 C++ Data Types Contents 1 Simple C++ Data Types 2 2 Quick Note About Representations 3 3 Numeric Types 4 3.1 Integers (whole numbers)............................................ 4 3.2 Decimal Numbers.................................................

More information

FIDE Language Reference

FIDE Language Reference FIDE Language Reference (v1.6) 2008-2009 AIS Cube. All rights reserved. The FlamingICE(FI) and FIDE are either registered trademarks or trademarks of AIS Cube in Singapore and/or other countries. Microsoft,

More information

UNIT 7A Data Representation: Numbers and Text. Digital Data

UNIT 7A Data Representation: Numbers and Text. Digital Data UNIT 7A Data Representation: Numbers and Text 1 Digital Data 10010101011110101010110101001110 What does this binary sequence represent? It could be: an integer a floating point number text encoded with

More information

VBA Handout. References, tutorials, books. Code basics. Conditional statements. Dim myvar As <Type >

VBA Handout. References, tutorials, books. Code basics. Conditional statements. Dim myvar As <Type > VBA Handout References, tutorials, books Excel and VBA tutorials Excel VBA Made Easy (Book) Excel 2013 Power Programming with VBA (online library reference) VBA for Modelers (Book on Amazon) Code basics

More information

Quick Reference Guide

Quick Reference Guide SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD mikroelektronika Development tools - Books - Compilers Quick Reference Quick Reference Guide with EXAMPLES for Pascal language This reference guide

More information

Number representations

Number representations Number representations Number bases Three number bases are of interest: Binary, Octal and Hexadecimal. We look briefly at conversions among them and between each of them and decimal. Binary Base-two, or

More information

Excel VBA Variables, Data Types & Constant

Excel VBA Variables, Data Types & Constant Excel VBA Variables, Data Types & Constant Variables are used in almost all computer program and VBA is no different. It's a good practice to declare a variable at the beginning of the procedure. It is

More information

Application Note 101 um-fpu64. Reading GPS Data. Microcontroller. GPS Receiver. Introduction. um-fpu64

Application Note 101 um-fpu64. Reading GPS Data. Microcontroller. GPS Receiver. Introduction. um-fpu64 Application Note 101 um-fpu64 Reading GPS Data Introduction GPS data is used in a wide range of embedded systems applications. Adding a GPS device to an application can consume significant resources on

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

ZBasic. Application Note. Interfacing with the LCD03 Text Display. Introduction. Hardware Hookup

ZBasic. Application Note. Interfacing with the LCD03 Text Display. Introduction. Hardware Hookup ZBasic Application Note AN-214 Interfacing with the LCD03 Text Display Introduction This application note describes how to connect and use the Devantech LCD03 text display (see http://www.robotelectronics.co.uk/shop/i2c_serial_display_lcd032058.htm).

More information

MarshallSoft GPS Component. Reference Library

MarshallSoft GPS Component. Reference Library MarshallSoft GPS Component Reference Library (MGC_REF) Version 2.2 June 8, 2011. This software is provided as-is. There are no warranties, expressed or implied. Copyright (C) 2002-2011 All rights reserved

More information

Programming. C++ Basics

Programming. C++ Basics Programming C++ Basics Introduction to C++ C is a programming language developed in the 1970s with the UNIX operating system C programs are efficient and portable across different hardware platforms C++

More information

Project 3: RPN Calculator

Project 3: RPN Calculator ECE267 @ UIC, Spring 2012, Wenjing Rao Project 3: RPN Calculator What to do: Ask the user to input a string of expression in RPN form (+ - * / ), use a stack to evaluate the result and display the result

More information

The SPL Programming Language Reference Manual

The SPL Programming Language Reference Manual The SPL Programming Language Reference Manual Leonidas Fegaras University of Texas at Arlington Arlington, TX 76019 fegaras@cse.uta.edu February 27, 2018 1 Introduction The SPL language is a Small Programming

More information

BASIC ELEMENTS OF A COMPUTER PROGRAM

BASIC ELEMENTS OF A COMPUTER PROGRAM BASIC ELEMENTS OF A COMPUTER PROGRAM CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING LOGO Contents 1 Identifier 2 3 Rules for naming and declaring data variables Basic data types 4 Arithmetic operators

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

Arduino Uno. Power & Interface. Arduino Part 1. Introductory Medical Device Prototyping. Digital I/O Pins. Reset Button. USB Interface.

Arduino Uno. Power & Interface. Arduino Part 1. Introductory Medical Device Prototyping. Digital I/O Pins. Reset Button. USB Interface. Introductory Medical Device Prototyping Arduino Part 1, http://saliterman.umn.edu/ Department of Biomedical Engineering, University of Minnesota Arduino Uno Power & Interface Reset Button USB Interface

More information

ITC213: STRUCTURED PROGRAMMING. Bhaskar Shrestha National College of Computer Studies Tribhuvan University

ITC213: STRUCTURED PROGRAMMING. Bhaskar Shrestha National College of Computer Studies Tribhuvan University ITC213: STRUCTURED PROGRAMMING Bhaskar Shrestha National College of Computer Studies Tribhuvan University Lecture 07: Data Input and Output Readings: Chapter 4 Input /Output Operations A program needs

More information

Today. o main function. o cout object. o Allocate space for data to be used in the program. o The data can be changed

Today. o main function. o cout object. o Allocate space for data to be used in the program. o The data can be changed CS 150 Introduction to Computer Science I Data Types Today Last we covered o main function o cout object o How data that is used by a program can be declared and stored Today we will o Investigate the

More information

BIT Java Programming. Sem 1 Session 2011/12. Chapter 2 JAVA. basic

BIT Java Programming. Sem 1 Session 2011/12. Chapter 2 JAVA. basic BIT 3383 Java Programming Sem 1 Session 2011/12 Chapter 2 JAVA basic Objective: After this lesson, you should be able to: declare, initialize and use variables according to Java programming language guidelines

More information

Number Systems Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. Indian Institute of Technology Kharagpur Number Representation

Number Systems Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. Indian Institute of Technology Kharagpur Number Representation Number Systems Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. Indian Institute of Technology Kharagpur 1 Number Representation 2 1 Topics to be Discussed How are numeric data items actually

More information

FORTRAN 90: Formatted Input/Output. Meteorology 227 Fall 2018

FORTRAN 90: Formatted Input/Output. Meteorology 227 Fall 2018 FORTRAN 90: Formatted Input/Output Meteorology 227 Fall 2018 Formatted Output Two output statements in FORTRAN PRINT and WRITE PRINT format-descriptor, output-list What is a format descriptor? * A character

More information

CS313D: ADVANCED PROGRAMMING LANGUAGE

CS313D: ADVANCED PROGRAMMING LANGUAGE CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 2 : C# Language Basics Lecture Contents 2 The C# language First program Variables and constants Input/output Expressions and casting

More information

Introduction to C# Applications

Introduction to C# Applications 1 2 3 Introduction to C# Applications OBJECTIVES To write simple C# applications To write statements that input and output data to the screen. To declare and use data of various types. To write decision-making

More information

Microsoft Visual Basic 2015: Reloaded

Microsoft Visual Basic 2015: Reloaded Microsoft Visual Basic 2015: Reloaded Sixth Edition Chapter Three Memory Locations and Calculations Objectives After studying this chapter, you should be able to: Declare variables and named constants

More information

Microsoft Visual Basic 2005: Reloaded

Microsoft Visual Basic 2005: Reloaded Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 3 Variables, Constants, Methods, and Calculations Objectives After studying this chapter, you should be able to: Declare variables and named

More information

VISUAL BASIC SERVER INTERFACE CODE. Visual Basic 6 Graphical Interface 103. Visual Basic Module rtsscomm.bas Code.115

VISUAL BASIC SERVER INTERFACE CODE. Visual Basic 6 Graphical Interface 103. Visual Basic Module rtsscomm.bas Code.115 APPENDIX E VISUAL BASIC SERVER INTERFACE CODE Page E.1: E.2: E.3: E.4: E.5: Visual Basic 6 Graphical Interface 103 Visual Basic Form gyrofront.frm Code.....104 Visual Basic Module mydatatypes.bas Code..114

More information

Primitive Types. Four integer types: Two floating-point types: One character type: One boolean type: byte short int (most common) long

Primitive Types. Four integer types: Two floating-point types: One character type: One boolean type: byte short int (most common) long Primitive Types Four integer types: byte short int (most common) long Two floating-point types: float double (most common) One character type: char One boolean type: boolean 1 2 Primitive Types, cont.

More information

Aaronia GPS Logger Programming Guide

Aaronia GPS Logger Programming Guide Aaronia GPS Logger Programming Guide Introduction The Aaronia GPS Logger is a battery-powered mobile device to measure and record location and orientation related information from a multitude of sensors:

More information

Number Representation & Conversion

Number Representation & Conversion Number Representation & Conversion Chapter 4 Under the covers of numbers in Java 1 How (Unsigned) Integers Work Base 10 Decimal (People) Base 2 Binary (Computer) 10 2 10 1 10 0 2 3 4 2 7 2 6 2 5 2 4 2

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

UNIT - I. Introduction to C Programming. BY A. Vijay Bharath

UNIT - I. Introduction to C Programming. BY A. Vijay Bharath UNIT - I Introduction to C Programming Introduction to C C was originally developed in the year 1970s by Dennis Ritchie at Bell Laboratories, Inc. C is a general-purpose programming language. It has been

More information

IA Super SEL Driver Help Kepware Technologies

IA Super SEL Driver Help Kepware Technologies 2012 Kepware Technologies 2 Table of Contents Table of Contents 2 4 Overview 4 Device Setup 5 Modem Setup 5 Data Types Description 6 Address Descriptions 7 Super SEL Addressing 7 Input Port (Super SEL)

More information

Chapter-8 DATA TYPES. Introduction. Variable:

Chapter-8 DATA TYPES. Introduction. Variable: Chapter-8 DATA TYPES Introduction To understand any programming languages we need to first understand the elementary concepts which form the building block of that program. The basic building blocks include

More information

\\OHARARP-PC\Users\ohararp\Documents\PICBASIC\18F25K20\GM862\GM862_D.bas

\\OHARARP-PC\Users\ohararp\Documents\PICBASIC\18F25K20\GM862\GM862_D.bas Device = 18F25K20 Xtal = 16 'Declare PLL_REQ = On 'OPTIMISER_LEVEL = 6 Clear All_Digital = TRUE 'Device Fuse configuration Config_Start FOSC = HS ; HS oscillator FCMEN = OFF ; Fail-Safe Clock Monitor disabled

More information

DTSX3000 Communications(Modbus) Guide

DTSX3000 Communications(Modbus) Guide User s Manual DTSX3000 Communications(Modbus) Guide First Edition Blank Page < Introduction > i Introduction About this Manual Thank you for purchasing the DTSX3000 Distributed Temperature Sensor. This

More information

Expressions. Arithmetic expressions. Logical expressions. Assignment expression. n Variables and constants linked with operators

Expressions. Arithmetic expressions. Logical expressions. Assignment expression. n Variables and constants linked with operators Expressions 1 Expressions n Variables and constants linked with operators Arithmetic expressions n Uses arithmetic operators n Can evaluate to any value Logical expressions n Uses relational and logical

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

4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning

4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning 4 Operations On Data 4.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: List the three categories of operations performed on data.

More information

COMP Overview of Tutorial #2

COMP Overview of Tutorial #2 COMP 1402 Winter 2008 Tutorial #2 Overview of Tutorial #2 Number representation basics Binary conversions Octal conversions Hexadecimal conversions Signed numbers (signed magnitude, one s and two s complement,

More information

Agenda & Reading. VB.NET Programming. Data Types. COMPSCI 280 S1 Applications Programming. Programming Fundamentals

Agenda & Reading. VB.NET Programming. Data Types. COMPSCI 280 S1 Applications Programming. Programming Fundamentals Agenda & Reading COMPSCI 80 S Applications Programming Programming Fundamentals Data s Agenda: Data s Value s Reference s Constants Literals Enumerations Conversions Implicitly Explicitly Boxing and unboxing

More information

VARIABLES. 1. STRINGS Data with letters and/or characters 2. INTEGERS Numbers without decimals 3. FLOATING POINT NUMBERS Numbers with decimals

VARIABLES. 1. STRINGS Data with letters and/or characters 2. INTEGERS Numbers without decimals 3. FLOATING POINT NUMBERS Numbers with decimals VARIABLES WHAT IS A VARIABLE? A variable is a storage location in the computer s memory, used for holding information while the program is running. The information that is stored in a variable may change,

More information

3. Java - Language Constructs I

3. Java - Language Constructs I Educational Objectives 3. Java - Language Constructs I Names and Identifiers, Variables, Assignments, Constants, Datatypes, Operations, Evaluation of Expressions, Type Conversions You know the basic blocks

More information

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types

More information

Microsoft Dynamics GP. This paper provides guidance for ISV products that integrate with Inventory transaction posting.

Microsoft Dynamics GP. This paper provides guidance for ISV products that integrate with Inventory transaction posting. INTEGRATE Microsoft Dynamics GP Integrating with the Historical Inventory Trial Balance White Paper This paper provides guidance for ISV products that integrate with Inventory transaction posting. Date:

More information

Function: function procedures and sub procedures share the same characteristics, with

Function: function procedures and sub procedures share the same characteristics, with Function: function procedures and sub procedures share the same characteristics, with one important difference- function procedures return a value (e.g., give a value back) to the caller, whereas sub procedures

More information

WYSE Academic Challenge 2002 Computer Science Test (Sectional) SOLUTION

WYSE Academic Challenge 2002 Computer Science Test (Sectional) SOLUTION Computer Science - 1 WYSE Academic Challenge 2002 Computer Science Test (Sectional) SOLUTION 1. Access to moving head disks requires three periods of delay before information is brought into memory. The

More information

The PCAT Programming Language Reference Manual

The PCAT Programming Language Reference Manual The PCAT Programming Language Reference Manual Andrew Tolmach and Jingke Li Dept. of Computer Science Portland State University September 27, 1995 (revised October 15, 2002) 1 Introduction The PCAT language

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

Operating Software Instruction Manual for MCC Series of Motion Controllers

Operating Software Instruction Manual for MCC Series of Motion Controllers Operating Software Instruction Manual for MCC Series of Motion Controllers Control Panel Stand-alone Operation Command Reference Manual Host Controlled Operation Power-up Help System Operation Controlling

More information

3DM-GX1 Data Communications Protocol

3DM-GX1 Data Communications Protocol DCP Manual Version 3.1.02 3DM-GX1 Data Communications Protocol Little Sensors, Big Ideas www.microstrain.com 2010 by MicroStrain, Inc. 459 Hurricane Lane Suite 102 Williston, VT 05495 USA Phone: 802-862-6629

More information

MODBUS TESTER SOFTWARE U S E R M A N U A L

MODBUS TESTER SOFTWARE U S E R M A N U A L MODBUS TESTER SOFTWARE U S E R M A N U A L TABLE OF CONTENTS 1. General information 3 2. Starting the program 3 3. Main window 3 3.1. Setting communication 4 3.2. Read and write registers 6 3.3. Setting

More information

Pointer Basics. Lecture 13 COP 3014 Spring March 28, 2018

Pointer Basics. Lecture 13 COP 3014 Spring March 28, 2018 Pointer Basics Lecture 13 COP 3014 Spring 2018 March 28, 2018 What is a Pointer? A pointer is a variable that stores a memory address. Pointers are used to store the addresses of other variables or memory

More information

CS5000: Foundations of Programming. Mingon Kang, PhD Computer Science, Kennesaw State University

CS5000: Foundations of Programming. Mingon Kang, PhD Computer Science, Kennesaw State University CS5000: Foundations of Programming Mingon Kang, PhD Computer Science, Kennesaw State University Overview of Source Code Components Comments Library declaration Classes Functions Variables Comments Can

More information

cs3157: another C lecture (mon-21-feb-2005) C pre-processor (3).

cs3157: another C lecture (mon-21-feb-2005) C pre-processor (3). cs3157: another C lecture (mon-21-feb-2005) C pre-processor (1). today: C pre-processor command-line arguments more on data types and operators: booleans in C logical and bitwise operators type conversion

More information

Text Input and Conditionals

Text Input and Conditionals Text Input and Conditionals Text Input Many programs allow the user to enter information, like a username and password. Python makes taking input from the user seamless with a single line of code: input()

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

M4.1-R3: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE

M4.1-R3: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE M4.1-R3: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE is to be

More information

DATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6)

DATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6) Technology & Information Management Instructor: Michael Kremer, Ph.D. Database Program: Microsoft Access Series DATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6) AGENDA 3. Executing VBA

More information

MODBUS Protocol for MiCOM P30 Series

MODBUS Protocol for MiCOM P30 Series MODBUS Protocol for MiCOM P30 Series Substation Protocols Technical Documentation This document does not replace the Technical Manual Version: MiCOM P30, MODBUS Index: B Release: 08 / 2011 MODBUS Protocol

More information

Digital Fundamentals

Digital Fundamentals Digital Fundamentals Tenth Edition Floyd Chapter 2 2009 Pearson Education, Upper 2008 Pearson Saddle River, Education NJ 07458. All Rights Reserved Decimal Numbers The position of each digit in a weighted

More information

Program Fundamentals

Program Fundamentals Program Fundamentals /* HelloWorld.java * The classic Hello, world! program */ class HelloWorld { public static void main (String[ ] args) { System.out.println( Hello, world! ); } } /* HelloWorld.java

More information

CSI33 Data Structures

CSI33 Data Structures Outline Department of Mathematics and Computer Science Bronx Community College October 24, 2018 Outline Outline 1 Chapter 8: A C++ Introduction For Python Programmers Expressions and Operator Precedence

More information

CSC 1214: Object-Oriented Programming

CSC 1214: Object-Oriented Programming CSC 1214: Object-Oriented Programming J. Kizito Makerere University e-mail: jkizito@cis.mak.ac.ug www: http://serval.ug/~jona materials: http://serval.ug/~jona/materials/csc1214 e-learning environment:

More information

BINARY SYSTEM. Binary system is used in digital systems because it is:

BINARY SYSTEM. Binary system is used in digital systems because it is: CHAPTER 2 CHAPTER CONTENTS 2.1 Binary System 2.2 Binary Arithmetic Operation 2.3 Signed & Unsigned Numbers 2.4 Arithmetic Operations of Signed Numbers 2.5 Hexadecimal Number System 2.6 Octal Number System

More information

UNIT 2 USING VB TO EXPAND OUR KNOWLEDGE OF PROGRAMMING

UNIT 2 USING VB TO EXPAND OUR KNOWLEDGE OF PROGRAMMING UNIT 2 USING VB TO EXPAND OUR KNOWLEDGE OF PROGRAMMING UNIT 2 USING VB TO EXPAND OUR KNOWLEDGE OF PROGRAMMING... 1 IMPORTANT PROGRAMMING TERMINOLOGY AND CONCEPTS... 2 Program... 2 Programming Language...

More information

SMART MOTOR DEVICES. SMC-Program. Manual

SMART MOTOR DEVICES.   SMC-Program. Manual SMART MOTOR DEVICES http://www.stepmotor.biz SMC-Program Manual 1. Program assignment 3 2. Driver installation 3 3. User interface 4 4. Port selection and setup 5 5. Panel of status indicator group 6 6.

More information

Long (or LONGMATH ) floating-point (or integer) variables (length up to 1 million, limited by machine memory, range: approx. ±10 1,000,000.

Long (or LONGMATH ) floating-point (or integer) variables (length up to 1 million, limited by machine memory, range: approx. ±10 1,000,000. QuickCalc User Guide. Number Representation, Assignment, and Conversion Variables Constants Usage Double (or DOUBLE ) floating-point variables (approx. 16 significant digits, range: approx. ±10 308 The

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

: Principles of Imperative Computation Victor Adamchik. Practice Exam - I

: Principles of Imperative Computation Victor Adamchik. Practice Exam - I 15-122 Practice Exam - I Page 1 of 10 15-122 : Principles of Imperative Computation Victor Adamchik Practice Exam - I Name: Andrew ID: Answer the questions in the space provided following each question.

More information

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this

More information

An overview about DroidBasic For Android

An overview about DroidBasic For Android An overview about DroidBasic For Android from February 25, 2013 Contents An overview about DroidBasic For Android...1 Object-Oriented...2 Event-Driven...2 DroidBasic Framework...2 The Integrated Development

More information

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved. Assoc. Prof. Dr. Marenglen Biba (C) 2010 Pearson Education, Inc. All for repetition statement do while repetition statement switch multiple-selection statement break statement continue statement Logical

More information

Binary. Hexadecimal BINARY CODED DECIMAL

Binary. Hexadecimal BINARY CODED DECIMAL Logical operators Common arithmetic operators, like plus, minus, multiply and divide, works in any number base but the binary number system provides some further operators, called logical operators. Meaning

More information

Chapter 4. Operations on Data

Chapter 4. Operations on Data Chapter 4 Operations on Data 1 OBJECTIVES After reading this chapter, the reader should be able to: List the three categories of operations performed on data. Perform unary and binary logic operations

More information

n Group of statements that are executed repeatedly while some condition remains true

n Group of statements that are executed repeatedly while some condition remains true Looping 1 Loops n Group of statements that are executed repeatedly while some condition remains true n Each execution of the group of statements is called an iteration of the loop 2 Example counter 1,

More information

Data Types Literals, Variables & Constants

Data Types Literals, Variables & Constants VISUAL BASIC Data Types Literals, Variables & Constants Copyright 2013 Dan McElroy Under the Hood As a DRIVER of an automobile, you may not need to know everything that happens under the hood, although

More information

COMP6700/2140 Data and Types

COMP6700/2140 Data and Types COMP6700/2140 Data and Types Alexei B Khorev and Josh Milthorpe Research School of Computer Science, ANU February 2017 Alexei B Khorev and Josh Milthorpe (RSCS, ANU) COMP6700/2140 Data and Types February

More information

DFL168A.net Component Dafulai Electronics

DFL168A.net Component Dafulai Electronics 2 Table of Contents I Features Highlights 7 II How to install DFL168A Component? 7 III How to use the component? 10 IV Enumeration 23 V DFL168A Class 23 1 Properties... 23 2 Members... 24 3 Event... 24

More information

ASPRS LiDAR SPRS Data Exchan LiDAR Data Exchange Format Standard LAS ge Format Standard LAS IIT Kanp IIT Kan ur

ASPRS LiDAR SPRS Data Exchan LiDAR Data Exchange Format Standard LAS ge Format Standard LAS IIT Kanp IIT Kan ur ASPRS LiDAR Data Exchange Format Standard LAS IIT Kanpur 1 Definition: Files conforming to the ASPRS LIDAR data exchange format standard are named with a LAS extension. The LAS file is intended to contain

More information

1.3b Type Conversion

1.3b Type Conversion 1.3b Type Conversion Type Conversion When we write expressions involved data that involves two different data types, such as multiplying an integer and floating point number, we need to perform a type

More information