Character String Type (String) Boolean Type (Bool) Conversion - Mitsubishi Electric MELSEC Q Series Programming Manual

Structured text
Hide thumbs Also See for MELSEC Q Series:
Table of Contents

Advertisement

6 IEC FUNCTIONS
6.1.15 Character string type (STRING)
Character string type (STRING) data is converted into Boolean type (BOOL) data.
Function definition
Function definition
6 - 17
BOOL STR_TO_BOOL ( STRING(2) S1 );
Argument
Argument Name
IN/OUT
S1
IN
Return value
Return Value
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
STRING
w_Bit1:=
STR_TO_BOOL(w_Str1);
BOOL STR_TO_BOOL_E( BOOL EN, STRING(2) S1, BOOL D1 );
Argument
Argument Name
IN/OUT
EN
IN
S1
IN
D1
OUT
Return value
Return Value
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 ) ;
Boolean type (BOOL) conversion
Data to be converted (character string data)
ST Program
Conversion Result
LD<>
OUT
Execution condition (Function is executed only when the result is TRUE)
Data to be converted (character string data)
Conversion result (bit data)
STR_TO_BOOL
STR_TO_BOOL_E
Description
Description
Used Instruction
w_Str1 K48
LD<>,OUT
w_Bit1
Description
Description
*)
*)
6 - 17

Advertisement

Table of Contents
loading

This manual is also suitable for:

Melsec l series

Table of Contents