Mitsubishi Electric MELSEC iQ-R Series Programming Manual page 1893

Hide thumbs Also See for MELSEC iQ-R Series:
Table of Contents

Advertisement

Precautions
When using CPY_BIT_OF_INT(_E) in ST, create a program which assigns the return value to a variable.
//The return value of CPY_BIT_OF_INT is assigned to a variable and used.
g_int2 := CPY_BIT_OF_INT(g_int1,5,3);
g_bool1 := GET_BIT_OF_INT(g_int2,3);
The return value of CPY_BIT_OF_INT(_E) also works as input/output. Do not directly assign it to the input argument of
another instruction, function, or function block.
//In the following program, the value of the first argument of GET_BIT_OF_INT is undefined.
g_bool1 := GET_BIT_OF_INT( CPY_BIT_OF_INT(g_int1,5,3), 3);
Operation error
There is no operation error.
By using the bit specification of labels, a concise program having the same operation as CPY_BIT_OF_INT
can be created.
The following example changes the value in bit 3 (b3) of g_int2 to the value of bit 5 (b5) of g_int1 the same as
when CPY_BIT_OF_INT is used.
Ladder
ST
g_int2.3 := g_int1.5;
FBD/LD
25 TYPE CONVERSION FUNCTIONS
25.68 Copying the Specified Bit of the Word Label
25
1891

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents