OMRON
CHAPTER 6 – Functions and Methods
Revision 2.0
Page 93
Remarks
Argument Type
Description
textpoint
text
point
A text point which holds the formatted text.
formattext
string
The text (with appropriate formatting characters) that the result
expression
is inserted into.
expression
Integer /
real
The value(s) or expression(s) that is inserted into
formattext
.
Typical Examples
TextPoint = FormatText (“Boiler temperature is %ld degrees.”,
BoilerTemp)
The value of the ‘BoilerTemp’ point is inserted into the specified text at the position marked by the
formatting characters (%ld) and then stored in the point ‘TextPoint’.
If the value of ‘BoilerTemp’ was 57 then the resultant text that is stored in ‘TextPoint’ is as follows:
“Boiler temperature is 57 degrees.”
TextPoint = FormatText (“Boiler %ld temperature is %ld degrees.”,
BoilerNo, BoilerTemp)
The value of ‘BoilerNo’ point is inserted at the first ‘%ld’ marker and the value of the ‘BoilerTemp’
point is inserted at the second ‘%ld’ marker and the resulting string is stored in the point ‘TextPoint’.
If the value of ‘BoilerNo’ was 7 and the value of ‘BoilerTemp’ was 43 then the resultant text stored
in the ‘TextPoint’ is as follows:
“Boiler 7 temperature is 43 degrees.”
Note:
The formatting characters are standard ‘C’ formatting characters (as used by the C-
language sprintf function). Some commonly used types are:
♦
%ld. Insert integer value;
♦
%f. Insert decimal value. Prefix with decimal point and number to control position
(for instance ‘%.2f’ for 2 decimal places);
♦
%s. Insert string;
♦
%IX. Insert hexadecimal value (upper case HEX characters, for instance ‘FFFF’);
♦
%lx. Insert hexadecimal value (lower case HEX characters, for instance ‘ffff’);
♦
%c. Insert character (can be used to convert value to character, for instance to
insert control character).
With the text left aligned, and with a width field (for instance ‘%-6ld’ to insert a value left aligned
with a field 6 characters wide).
Содержание CX-SUPERVISOR - SCRIPT REFERENCE REV2.0
Страница 2: ...CX Supervisor Script Language Software Revision 2 0...
Страница 3: ......
Страница 5: ...CX Supervisor Script Language OMRON Page ii Revision 2 0...
Страница 7: ...CX Supervisor Script Language OMRON Page iv Revision 2 0...
Страница 9: ...CX Supervisor Script Language OMRON Page vi Revision 2 0...
Страница 13: ......
Страница 15: ...CHAPTER 1 Introduction OMRON Page 2 Revision 2 0...
Страница 19: ...CHAPTER 2 Expressions OMRON Page 6 Revision 2 0...
Страница 21: ...CHAPTER 3 Scripts OMRON Page 8 Revision 2 0...
Страница 151: ...CHAPTER 8 Colour Palette OMRON Page 138 Revision 2 0...