6 - 17 6 - 17
6 IEC FUNCTIONS
6.1.15 Character string type (STRING) Boolean type (BOOL) conversion STR_TO_BOOL
STR_TO_BOOL_E
Character string type (STRING) data is converted into Boolean type (BOOL) data.
Function definition
BOOL STR_TO_BOOL ( STRING(2) S1 );
Argument
Argument Name
IN/OUT
Description
S1
IN
Data to be converted (character string data)
Return value
Return Value
Description
BOOL
Conversion result (bit data)
Remarks: When the data to be converted (character string data) is 0, the return value
is "0". When the data to be converted (character string data) is other than 0,
the return value is "1".
Example of use
Argument Type
ST Program
Conversion Result
Used Instruction
STRING w_Bit1:=
STR_TO_BOOL(w_Str1);
LD<> w_Str1
K48
OUT w_Bit1
LD<>,OUT
Function definition
BOOL STR_TO_BOOL_E( BOOL EN, STRING(2) S1, BOOL D1 );
Argument
Argument Name
IN/OUT
Description
EN
IN
Execution condition (Function is executed only when the result is TRUE)
S1
IN
Data to be converted (character string data)
D1
OUT
Conversion result (bit data)
Return value
Return Value
Description
BOOL Execution
condition
Example of use
(*
(*
When execution condition X0 turns ON, the character string type data in
sData is converted into Boolean type data, and the result is stored into Result.
M0 := STR_TO_BOOL _E( X0, sData, Result ) ;
*)
*)
Summary of Contents for MELSEC L series
Page 1: ...Programming Manual Structured Text ...
Page 2: ......
Page 73: ...4 33 4 33 4 ST PROGRAM EXPRESSIONS MEMO ...
Page 297: ......