5 - 60 5 - 60
5 MELSEC FUNCTIONS
5.14.3 Bit check SUM_M
The number of bits having 1 in the specified BIN 16-bit data is counted.
Function definition
BOOL SUM_M (BOOL EN, ANY16 S1, ANY16 D);
Argument Name
IN/OUT
Description
EN IN
Execution condition (Function is executed only when the
result is TRUE)
S1
IN
Data to be counted (BIN 16-bit data)
D
OUT
Count result (BIN 16-bit data)
Return Value
Description
BOOL Execution
condition
Example of use
(* When execution condition X0 turns ON, the number of bits having 1 in dData *)
(* is stored into Result.
*)
SUM_M (X0, iData, Result);
Corresponding MELSEC command
SUM (16-bit data bit check)
5.14.4 32-bit data bit check DSUM_M
The number of bits having 1 in the specified BIN 32-bit data is counted.
Function definition
BOOL DSUM_M (BOOL EN);
Argument Name
IN/OUT
Description
EN IN
Execution condition (Function is executed only when
the result is TRUE)
S1
IN
Data to be counted (BIN 32-bit data)
D
OUT
Count result (BIN 16-bit data)
Return Value
Description
BOOL Execution
condition
Example of use
(* When execution condition X0 turns ON, the number of bits having 1
*)
(* in iData is stored into Result.
*)
DSUM_M (X0, dData, Result);
Corresponding MELSEC command
DSUM (32-bit data bit check)
For the usable data type, refer to "3.2.2 About
ANY type".
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: ......