Topic: DMD0307 STRPUTB - Put Bytes Into a String |
|
The Put Bytes Into a String (STRPUTB) instruction will copy bytes of data from memory locations in the controller and place them in the specified String.
The primary use of this instruction - and its companion instruction Get Bytes Out of a String (STRGETB) - is in creating protocol drivers, where the data in the String is not ASCII text but consists of 16-bit, or 32-bit integers, or floating point numbers.
Note: this instruction is NOT intended to operate on Strings containing ASCII text; working with Strings that contain ASCII text is better handled through the STRCMP, STRFIND, STRSUB, STRDELETE, STRINSERT, STRCASE,STRCLEAR, STRTRIM, STRTRUNC instructions that are purpose-built to handle Strings containing ASCII data.
|
|
Element References:Note: Use the F9 key to open the Default Element Selection Tool (the Element Picker or the Element Browser) or use the Down-Arrow key (Auto-Complete) on any parameter field to see a complete list of the memory locations that are valid for that parameter of the instruction.
Put Into String - designates the String to receive the bytes of data. This can be any of the system-defined Short Strings (SS0 - SS127), or system-defined Long Strings (SL0 - SL63), or any user-defined Strings.
Start at Index - designates the location in the String to begin placing the bytes of data. This can be any readable numeric location or a constant value from 0 to the maximum number of characters in the string.
Length in Bytes - designates the total number of bytes of data to copy and place in the string. This can be any readable numeric location or a constant value from 1 to the maximum number of bytes available in the string.
From Starting Element - designates the first location in the controller where the bytes of data are copied from. This can be any readable numeric location.
|
|
Status Display:
The Status display of the Put Bytes Into a String instruction will only display as many of the characters of the Put Into String as will fit within the borders of the instruction, typically this is about 50 characters.
|
|
See Also:STRGETB - Get Bytes Out of a String
STRPUTB - Put Bytes Into a String
|
|
Related Topics:STR2REAL - Convert String to Real
STR2INT - Convert String to Integer
STRCASE - Convert String to UPPER / lower Case
STRCOPYR - Copy a Range of Strings
String Scripting Language Reference
|
|
Rung Example:
|
|