167
Restrictions
Section 5-7
ENO:=true;
ELSE
ENO:=false;
RETURN;
END_IF;
Num_BCD:=INT_TO_BCD_WORD(Input_Num);
(*For example, if
Num
is 100 (16#0064), it is converted to BCD 0100*)
Output_String:=WORD_TO_STRING(Num_BCD);
(*Convert BCD 0100 to text string*)
5-7
Restrictions
5-7-1
Restrictions
■
Nesting
• There is no restriction on the number of nests that can be used in IF,
CASE, FOR, WHILE, or REPEAT statements.
■
Data Type Restrictions
• Integers can only be allocated to variables with data types WORD,
DWORD, INT, DINT, UINT, UDINT, or ULINT. For example, if A is an INT
data type, A:=1; it possible. If the value is not an integer data type, a syn-
tax error will occur. For example, if A is an INT data type, a syntax error
will occur for A:=2.5;.
• If a real number (floating point decimal data) can only be allocated to vari-
ables with data types REAL and UREAL. For example, if A is a REAL data
type, A:=1.5; is possible. If the value is not an real data type, a syntax
error will occur. For example, if A is a REAL data type, a syntax error will
occur for A:=2;. Use A:=2.0;.
• Bits (TRUE, FALSE) can only be allocated to variables with the BOOL
data type. For example, if A is a BOOL data type, A:=FALSE; is possible.
If a BOOL data type is not used, a syntax error will occur. For example, if
A is an INT data type, a syntax error will occur for A:=FALSE;.
• Data types must all be consistent within the structured text. For example,
if A, B, and C are INT data types, A:=B+C; is possible. If, however, A and
B are INT data types, but C is a REAL data type or LINT data type, a syn-
tax error will occur for A:=B+C;.
• In the structured text, the following cannot be used:
P_CY, P_EQ, P_ER, P_N, P_GE, P_GT, P_LE, P_LT, P_NE, P_OF, and
P_UF
5-7-2
Commonly Asked Questions
Q: How is a hexadecimal value expressed?
A: Add “16#” before the value, e.g., 16#123F.
The prefixes 8# and 2# can also be added to express octal numbers and
binary numbers, respectively. Numbers without these prefixes will be inter-
preted as decimal numbers.
Q: How many times can FOR be used?
A: In the following example, the contents of the FOR statement is executed
101 times. The loop processing ends when the value of “i” is equal to 101.
Summary of Contents for CX-PROGRAMMER V8.1
Page 3: ...iv...
Page 5: ...vi...
Page 7: ......
Page 15: ...xvi...
Page 19: ...xx...
Page 25: ...xxvi Application Precautions 4...
Page 26: ...Part 1 Function Blocks...
Page 27: ......
Page 153: ...128 Procedures Section 3 2...
Page 154: ...Part 2 Structured Text ST...
Page 155: ......
Page 159: ...134 CX Programmer Specifications Section 4 2...
Page 205: ...180 Procedures Section 6 1...
Page 207: ...182 System defined external variables supported in function blocks Appendix A...
Page 229: ...204 Revision History...
Page 230: ......