Do-more Technical Training Instruction Set (String)

Slides:



Advertisements
Similar presentations
EC-111 Algorithms & Computing Lecture #11 Instructor: Jahan Zeb Department of Computer Engineering (DCE) College of E&ME NUST.
Advertisements

 2003 Prentice Hall, Inc. All rights reserved Fundamentals of Characters and Strings Character constant –Integer value represented as character.
Strings.
Lecture 9. Lecture 9: Outline Strings [Kochan, chap. 10] –Character Arrays/ Character Strings –Initializing Character Strings. The null string. –Escape.
Current Assignments Homework 5 will be available tomorrow and is due on Sunday. Arrays and Pointers Project 2 due tonight by midnight. Exam 2 on Monday.
C Strings. The char Data Type for Storing Characters The char data type can is used to declare a variable that can hold a single character. Examples:
CS1061 C Programming Lecture 16: Formatted I/0 A. O’Riordan, 2004.
Chapter 8 Characters and Strings Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education Inc.
Chapter 9 Characters and Strings. Topics Character primitives Character Wrapper class More String Methods String Comparison String Buffer String Tokenizer.
Chapter 9 Formatted Input/Output Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education Inc.
Strings in C. Strings are Character Arrays Strings in C are simply arrays of characters. – Example:char s [10]; This is a ten (10) element array that.
C How to Program, 6/e © by Pearson Education, Inc. All Rights Reserved.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
Chapter 9 Formatted Input/Output. Objectives In this chapter, you will learn: –To understand input and output streams. –To be able to use all print formatting.
 Pearson Education, Inc. All rights reserved Formatted Output.
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
C Tokens Identifiers Keywords Constants Operators Special symbols.
You gotta be cool. Stream Stream Output Stream Input Unformatted I/O with read, gcount and write Stream Manipulators Stream Format States Stream Error.
Input, Output, and Processing
WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING.
 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 the.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 24 The String Section.
Chapter 2 Data types, declarations, and displays.
EXPRESSION Transformation. Introduction ►Transformations help to transform the source data according to the requirements of target system and it ensures.
Operations on Strings. 8/8/2005 Copyright 2006, by the authors of these slides, and Ateneo de Manila University. All rights reserved L: String Manipulation.
Chapter 5 Strings CSC1310 Fall Strings Stringordered storesrepresents String is an ordered collection of characters that stores and represents text-based.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI C-Style Strings Strings and String Functions Dale Roberts, Lecturer.
Strings Java Methods A & AB Object-Oriented Programming and Data Structures Maria Litvin ● Gary Litvin Copyright © 2006 by Maria Litvin, Gary Litvin, and.
Using Text Files in Excel File I/O Methods. Working With Text Files A file can be accessed in any of three ways: –Sequential access: By far the most common.
CSC141- Introduction to Computer programming Teacher: AHMED MUMTAZ MUSTEHSAN Lecture – 21 Thanks for Lecture Slides:
C++ String Class nalhareqi©2012. string u The string is any sequence of characters u To use strings, you need to include the header u The string is one.
Strings and Related Classes String and character processing Class java.lang.String Class java.lang.StringBuffer Class java.lang.Character Class java.util.StringTokenizer.
© Janice Regan, CMPT 102, Sept CMPT 102 Introduction to Scientific Computer Programming Input and Output.
 2003 Prentice Hall, Inc. All rights reserved. 11 Fundamentals of Characters and Strings Character constant –Integer value of a character –Single quotes.
Chapter 8 Characters and Strings. Objectives In this chapter, you will learn: –To be able to use the functions of the character handling library ( ctype).
C++ Programming Lecture 19 Strings The Hashemite University Computer Engineering Department (Adapted from the textbook slides)
Files A collection of related data treated as a unit. Two types Text
Principles of Programming - NI Chapter 10: Character & String : In this chapter, you’ll learn about; Fundamentals of Strings and Characters The difference.
Do-more Technical Training Communications ( ).
Do-more Technical Training Instruction Set (Program-Looping)
Do-more Technical Training Instruction Set (Analog/Process)
Winter 2016CISC101 - Prof. McLeod1 CISC101 Reminders Quiz 3 this week – last section on Friday. Assignment 4 is posted. Data mining: –Designing functions.
© Oxford University Press All rights reserved. Data Structures Using C, 2e Reema Thareja.
Do-more Technical Training Instruction Set (Misc/Data Manipulation)
Do-more Technical Training Project Management. Project File Project Saving Project Storage Project Creation Project Editing DMD.
Formatted I/O ä ä Standard Output ä ä printf() family of functions ä ä Standard Input ä ä scanf() family of functions.
Do-more Technical Training Instruction Set (Math).
EC-111 Algorithms & Computing Lecture #10 Instructor: Jahan Zeb Department of Computer Engineering (DCE) College of E&ME NUST.
Do-more Technical Training
Data Representation COE 308 Computer Architecture
Do-more Technical Training
Do-more Technical Training
Data Representation ICS 233
Lec 3: Data Representation
Strings CSCI 112: Programming in C.
Data Representation.
Do-more Technical Training
Fundamentals of Characters and Strings
Strings, Characters and Regular Expressions
Strings, StringBuilder, and Character
TMF1414 Introduction to Programming
Chapter 2 part #3 C++ Input / Output
Input and Output Lecture 4.
ECE 103 Engineering Programming Chapter 8 Data Types and Constants
Introduction to Computer Science
Chapter 2 part #3 C++ Input / Output
C++ Programming Lecture 20 Strings
Data Representation COE 308 Computer Architecture
Presentation transcript:

Do-more Technical Training Instruction Set (String)

Instruction Set THE BASICS ▫1▫181 instructions CContact (14) CCoil/Bit Output (11) AAnalog/Process (13) DDate/Time/Calendar (7) EEthernet (5) HHardware/Device (9) HHigh Speed/CTRIO (19) MMath (5) MMisc/Data Manipulation (23) PProgram Control (20) PProgram-Looping (8) PProtocol-Custom/ASCII (7) PProtocol-Standard (10) SString (14) TTimer/Counter/Drum (16)

String ▫STR2INT ▫STR2REAL ▫STRCASE ▫STRCLEAR ▫STRCMP ▫STRDELETE ▫STRFIND ▫STRGETB ▫STRINSERT ▫STRPRINT ▫STRPUTB ▫STRSUB ▫STRTRIM ▫STRTRUNC Instruction Set (String)

STR2INT “Convert String to Integer” ▫C▫Converts ASCII digits to integer value ▫P▫Parameters: IInput String – string to be converted IInput Radix – determines valid characters DDecimal (base 10): characters “0-9” HHexadecimal (base 16): characters “0-F” OOctal (base 8): characters “0-7” IImplied Base: characters “0x” (hex), “0” (octal), “1-9”(decimal) OOther (2-36): e.g. 36 would validate characters “0-Z” NNumeric Output – location of converted value IIndex Where Stopped – character location in string ▫N▫NOTES: IIf Input String is empty then Index Where Stopped = -1; ERR = “STR2INT input string is empty” IIf Input String contains invalid characters then Index Where Stopped = -1; ERR = “STR2INT input string couldn’t be converted to an integer value”

STR2REAL “Convert String to Real” ▫C▫Converts ASCII digits to real value ▫P▫Parameters: IInput String – string to be converted NNumeric Output – location of converted value IIndex Where Stopped – character location in string ▫N▫NOTES: VValid characters are: “ E+-” IIf Input String is empty then Index Where Stopped = -1; ERR = “STR2REAL input string is empty” IIf Input String contains invalid characters then Index Where Stopped = -1; ERR = “STR2REAL input string couldn’t be converted to an integer value”

STRCASE “Convert String to UPPER/lower Case” ▫C▫Converts all characters in a string to either upper case or lower case letters ▫P▫Parameters: IInput/Output String – string to be converted CConvert to: aall lower case AALL UPPER CASE ▫N▫NOTES: VValid characters are only alphabetic letters IIf character is not alphabetic, no change occurs to that character SS0abcd!EFgH abcd!efgh LowLow ABCD!EFGH UpUp

Instruction Set (String) STRCLEAR “Clear Strings” ▫D▫Deletes all characters from a single string or a range of strings ▫P▫Parameters: SStart String – 1 st (or only) string to be cleared NNumber of Strings to Clear – 1 to (or variable) ▫N▫NOTES: TThe Status display will only show as many characters that fit in its borders (about 50 characters)

STRCMP “String Compare” ▫C▫Compares two strings to determine if they are equal, less than or greater than ▫L▫Less than & greater than values are determined by the ASCII byte values ▫E▫Each byte position is compared until: BByte values don’t match with one value > or < EEnd of one string reached 1 st meaning it is < EEnd of both strings reached simultaneously meaning equality ▫P▫Parameters: FFirst String CCase Sensitive: YYes, upper/lower case are different NNo, upper/lower case are equal SSet If Equal (optional) SSet If Less Than (optional) SSet If Greater Than (optional) SSecond String or Text – the 2 nd string can be a literal text in quotes IInput Leg: EEdge triggered PPower flow enabled SS0abcd!EFgH SS1abcd!EFgH Yes, upper/lower case are different SS0 = SS1SS0 < SS1SS0 > SS1 YES No, upper/lower case are equal YES SS0abcd!EFgH SS1abcd!E Yes, upper/lower case are different SS0 = SS1SS0 < SS1SS0 > SS1 YES No, upper/lower case are equal YES SS0abcd!EFgH SS1abcd!eF Yes, upper/lower case are different SS0 = SS1SS0 < SS1SS0 > SS1 YES No, upper/lower case are equal YES E = 45 hex e = 65 hex SS0’s E is < SS1’s e SS0’s E & SS1’s e are equal in value & SS0 is longer

Instruction Set (String) STRDELETE “Delete Substring” ▫D▫Deletes characters from a string ▫T▫Trailing characters are shifted to take the place of deleted ones ▫P▫Parameters: IInput / Output String SStarting at Offset: 0 – 1023 (or variable) TThe 1 st character is 0 (zero) NNumber of Characters to Delete SS0abcd!EFgH To delete the ! character: Starting at Offset = 4 Number of Characters to Delete = SS0abcdEFgH

Instruction Set (String) STRFIND “Find within String” ▫S▫Search a target string for a particular string ▫I▫If successful the where-found offset could be used in STRSUB, STRDELETE or STRINSERT instructions ▫P▫Parameters: FFind within – string in which to search SSearch from: BBeginning to end EEnd to beginning CCase Sensitive: YYes, upper/lower case are different NNo, upper/lower case are equal IIn Offset: Start / Out Offset: Where Found – will contain -1 if nothing is found SSet if found (optional) SSet if NOT found (optional) FFind Text/String: EExact sequence AAny one of these characters – text box IInput Leg: EEdge triggered / Power flow enabled SS0abceEEFgH To find the E character: Search from: Beginning to end Case Sensitive: Yes Find Text/String: Any one of these characters: “E”

Instruction Set (String) STRPUTB “Put Bytes Into a String” ▫P▫Puts bytes of data from a specified location range into a string ▫P▫Parameters: PPut Into String – string that will contain data bytes SStart at Index – 1 st location in the string for the bytes LLength in Bytes – number of bytes to write into string FFrom Starting Element – 1 st location to read bytes <<Create Byte Buffer> button – convenient way to create a Memory Block of bytes (shows up in Memory Configuration) ▫N▫NOTES: NNot intended to operate on strings with ASCII text

STRGETB “Get Bytes Out of a String” ▫E▫Extracts bytes of data out of a string & stores them in specified location ▫P▫Parameters: GGet out of String – string with data bytes SStart at Index – 1 st location in the string for the bytes LLength in Bytes – number of bytes to copy IInto Starting Element – 1 st location to put extracted bytes <<Create Byte Buffer> button – convenient way to create a Memory Block of bytes (shows up in Memory Configuration) ▫N▫NOTES: NNot intended to operate on strings with ASCII text Values are manually written to a custom byte memory MyBuffer The STRPUTB writes the range MyBuffer10-13 into SS0 The STRGETB writes the bytes in SS0 to the range MyBuffer0-3 ASCII values of 10, 20, 30 are not displayable characters. 40 decimal ASCII is (.

Instruction Set (String) STRINSERT “Insert Substring” ▫I▫Inserts characters into a string ▫P▫Parameters: IInsert String or Text IInto String SStarting at Offset IIf > length of string, it is appended to string IIf > allowable size of the Into String, then: ▫T▫Text is appended to string ▫$▫$OutOfRange (ST132) = ON ▫E▫ERR = “Argument out of range in STRINSERT…” The text “not ” is to be inserted into SS0 starting at offset 12.

Instruction Set (String) STRPRINT “Print to String” ▫W▫Writes text & formatted data into a string ▫P▫Parameters: PPrint to AAppend to String (optional) AAutomatically insert space after each term (optional) PPrint Script – text with optional embedded fields (text, control characters, strings, elements, formatting & string selection functions, raw data) – See next slide  IInput Leg – Edge triggered / Power flow enabled

Instruction Set (Ethernet) STRPRINT “Print to String” ▫P▫Parameters: PPrint Script SString Literals – ASCII text in double quotes (e.g. “Hi!”) DData Elements – (e.g. “The current count is” CT0.Acc) CControl Characters ▫$▫$$  $ ▫$▫$”  “ ▫$▫$L  <LF> (line feed) ▫$▫$N  <CR><LF> (carriage return, line feed) ▫$▫$P  <FF> (form feed) ▫$▫$R  <CR> (carriage return) ▫$▫$T  <TAB> (tab) ▫$▫$hh  hh (any one-byte hex value) FFormatting Functions [see Do-more Designer Help Topic DMD0168] ▫F▫FmtString – Sets length and/or justifies text within a string ▫F▫FmtBit – Formats bits’ values as a text instead of just 0 or 1 ▫F▫FmtInt – Formats how an integer is represented in a string ▫F▫FmtReal – Formats how real numbers are represented in a string ▫F▫FmtTMR – Formats how Timer Accumulator values are represented in a string ▫F▫FmtDate – Formats how a Date stamp is represented in a string ▫F▫FmtTime – Formats how a Time stamp is represented in a string ▫L▫Lookup – Selects a string in a list to represent a value ▫R▫Raw – Places bytes of data from a data block into a string

Instruction Set (String) STRSUB “Get Sub-String” ▫C▫Copies characters from one string to another ▫P▫Parameters: IInput String SStarting Offset OOffset From – Beginning / End LLength – variable or Remainder of input string OOutput String IInput Leg – Edge triggered / Power flow enabled

STRTRIM “Trim Whitespace” ▫R▫Removes all whitespace characters from the beginning and/or end of a string WWhat is “Whitespace”?  SSpace (ASCII 20 hex) HHorizontal tab <TAB> (ASCII 09 hex) CCarriage return <CR> (ASCII 0D hex) LLine feed <LF> (ASCII 0A hex) FForm feed <FF> (ASCII 0C hex) VVertical tab <VT> (ASCII 0B hex) ▫P▫Parameters: SString TTrim LLeading (optional) TTrailing (optional)

STRTRUNC “Set String Length” ▫S▫Sets the length of a string ▫P▫Parameters: SString LLength IIf 0 (zero) or negative (-) clears string <empty string> IIf > string’s length then string is padded with nulls (0; not spaces) to reach the specified length IIf > string’s allowed length (e.g. >64 for SS, >256 for SL) then entire string is padded with nulls (0; not spaces) and… ▫$▫$BufferOverflow (ST140) = ON ▫E▫ERR: “Length was greater than max string length in STRTRUNC…”