Omron NJ-series User Manual page 255

Machine automation controller cpu unit software
Hide thumbs Also See for NJ-series:
Table of Contents

Advertisement

6 Programming
Note You cannot omit {data_type}# and just enter {base}#{numeric_value]. Any variables that are entered in that
form for instruction parameters result in errors.
Example: You cannot enter only #16#1A.
If different data types are used, an error may occur when you build the program. We therefore recommend
that you include {data_type}# when you specify data types.
 Real Data
Notation
{data_type}#{base}#{numeric_value]
{data_type}#{numeric_value]
{numeric_value}
Note Express real-number variables as REALnumeric_value.
Example:
Bit Strings
 Bit String Data
Notation
{data_type}#{base}#{numeric_value]
Note Express bit string data as bit_string_data_type#base#numeric_value.
Example:
Precautions for Correct Use
Precautions for Correct Use
• You cannot compare the sizes of bit string data types (BYTE, WORD, DWORD, and LWORD).
You must convert variables of these types to an integer data type with a data conversion
instruction (e.g., WORD_TO_UINT) before you can compare the values.
Example:
BCD_data : WORD
IF WORD_BCD_TO _UINT(BCD_data)> UINT#1234 THEN
• You cannot perform logic processing on integer data types (SINT, INT, DINT, LINT, USINT,
UINT, UDINT, and ULINT). You must convert variables of these types to a bit string data type
with a data conversion instruction (e.g., INT_TO_WORD) before you can perform logic opera-
tions.
Example:
a : INT
IF INT_TO_WORD(a) AND WORD#16#0001 THEN (*When a is odd*)
6-68
Example
LREAL#10#3.14
LREAL#3.14
3.14
Correct: REAL_variable:= REAL#3.14
Wrong: REAL_variable:=3.14;
Example
WORD#16#0064
Correct: bit_string_variable:=WORD#16#3
Wrong: bit_string_variable:=3
Remarks
Data types: REAL or LREAL
Base: 10
This is interpreted as decimal data.
If {data_type} is omitted, the value is interpreted
as LREAL decimal data.
Remarks
• Data types: BYTE, WORD, DWORD, or LWORD
• Base: 2, 8, 10, or 16
NJ-series CPU Unit Software User's Manual (W501)

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents