Mitsubishi Electric MELSEC iQ-R Series Programming Manual page 75

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

Advertisement

Precautions
• The pointer type cannot be used in ST programs.
• When the timer, counter, or retentive timer device is used as current value, the data type will be the word [unsigned]/bit
string [16 bits]. When the long timer, long counter, or long retentive timer device is used as current value, the data type will
be the double word [unsigned]/bit string [32 bits].
• When performing assignment using digit specification, match the data type between the left and right sides.
Ex.
D0:=K5X0;
In this example, a program error occurs because K5X0 is the double word type and D0 is the word type.
• If the right side is greater than the left side when performing assignment using digit specification, data is transferred to
within the range of the number of applicable points of the left side.
Ex.
K5X0:=2#1011_1101_1111_0111_0011_0001;
In this example, K5X0 has 20 applicable points and therefore 1101_1111_0111_0011_0001 (20 digits) is assigned to K5X0.
• When using the current value (such as TNn) of the counter (C), timer (T), or retentive timer (ST) as a type other than the
word [unsigned]/bit string [16 bits], or when using the current value (such as LTNn) of the long counter (LC), long timer (LT),
or long retentive timer (LST) as a type other than the double word [unsigned]/bit string [32 bits], use the type conversion
functions.
Ex.
varInt:=WORD_TO_INT(T0);(*A type conversion function is used.*)
• If a coil (TC, STC, LTC, LSTC, CC, or LCC) of timer or counter devices is used at the right side of an assignment statement
or as an input argument of a function or function block, it operates as a contact (TS, STS, LTS, LSTS, CS, or LCS).
• To use a coil of the timer or counter as an input argument, use a timer type label or counter type label.
Ex.
Timer device and timer type label
M1 := TC0; (*Assign a value of the contact (TS0) to M1.*)
M2 := INV(TC1); (*Assign the inversion result of the contact (TS1) to M2.*)
M1 := tLabel0.C; (*Assign a value of the coil of the timer type label, tLabel0, to M1.*)
M2 := INV(tLabel1.C); (*Assign the inversion result of the coil of the timer type label, tLabel0, to M1.*)
■ When performing automatic conversion of data type with devices
Add a device type specifier when using a word device in a data type other than word [signed]. ( Page 72 Notation of
devices with a type specifier)
Ex.
When transferring the values of D2 and D3 to dwordLabel1, a double word [unsigned] label
//Example of when adding a device type specifier and transferring the values in a correct data type
dwordLabel1 := D2:UD;
//Since the data type of D2:UD (D2 with a device type specifier) is double word [unsigned], the values of D2 and D3 are transferred to dwordLabel1.
//Example of an unintended transfer result
dwordLabel1 := D2;
//Since the data type of D2 without a device type specifier is word [signed], the data type is automatically converted into double word [unsigned] and data is
transferred to dwordLabel1.
//Therefore, the value of D3 is not transferred but only the value of D2 is transferred.
6 STRUCTURED TEXT LANGUAGE
6.1 Configuration
6
73

Advertisement

Table of Contents
loading

Table of Contents