Mitsubishi Electric MELSEC iQ-R Series Programming Manual page 71

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

Advertisement

■ When a bit type label is used
Once the boolean expression (conditional formula) is established in a select or iteration statement and if a bit type label is set
to on in <statement>, the state of the label will be always on.
Ex.
Program that keeps the label status on
ST program
Ladder program performing the processing equivalent to ST program
IF bLabel1 THEN
bLabel2 := TRUE;
END_IF;
To prevent the label from being always on, add a program that turns off the bit type label as shown below.
Ex.
Program that avoids the label from being always on
*1
ST program
Ladder program performing the processing equivalent to ST program
IF bLabel1 THEN
bLabel2 := TRUE;
ELSE
bLabel2 := FALSE;
END_IF;
*1 The above program can also be described as follows.
bLabel2:=bLabel1;
or
OUT(bLabel1,bLabel2);
Note however that if the OUT instruction is used in the <statement>, the program will be in the same state as a program that keeps the
label status on.
■ When a timer function block or counter function block is used
In a select statement, a boolean expression (conditional formula) differs from the execution conditions of timer function blocks
or counter function blocks.
Ex.
Timer function block
Program example before change
IF bLabel1 THEN
TIMER_100_FB_M_1 (Coil := bLabel2, Preset := wLabel3, ValueIn := wLabel4, ValueOut => wLabel5, Status => bLabel6);
END_IF;
(*When bLabel1 is on and bLabel2 is also on, counting starts.*)
(*When bLabel1 is on and bLabel2 is off, the counted value is cleared.*)
(*When bLabel1 is off and bLabel2 is on, counting stops. The counted value is not cleared.*)
(*When bLabel1 is off and bLabel2 is also off, counting stops. The counted value is not cleared.*)
Program example after change
TIMER_100_FB_M_1 (Coil := (bLabel1 & bLabel2), Preset := wLabel3, ValueIn := wLabel4 , ValueOut => wLabel5, Status => bLabel6);
Ex.
Counter function block
Program example before change
IF bLabel1 THEN
COUNTER_FB_M_1 (Coil := bLabel2, Preset := wLabel3, ValueIn := wLabel4, ValueOut => wLabel5, Status => bLabel6);
END_IF;
(*When bLabel1 is on and bLabel2 is on/off, the value is incremented by one.*)
(*When bLabel1 is off and bLabel2 is on/off, the value is not counted.*)
(*The counting operation does not depend on the on/off status of bLabel1.*)
Program example after change
COUNTER_FB_M_1 (Coil := (bLabel1 & bLabel2), Preset := wLabel3, ValueIn := wLabel4, ValueOut => wLabel5, Status => bLabel6);
The above examples of programs before change cause problems because the statement related to the timer or counter is not
executed unless the select statement is established.
To operate the timer or counter on the basis of the bLabel1 condition and bLabel1 AND condition, do not use control
statements but use only function blocks.
The timer and counter can be operated by using the programs after change.
6 STRUCTURED TEXT LANGUAGE
6.1 Configuration
6
69

Advertisement

Table of Contents
loading

Table of Contents