Nj-Series Instructions Reference Manual (W502 - Omron NJ501-1500 Reference Manual

Machine automation controller nj-series
Hide thumbs Also See for NJ501-1500:
Table of Contents

Advertisement

2 Instruction Descriptions
Additional Information
• To convert an integer to a real number, use an Integer-to-Real Number Conversion Group Instruction.
• To convert data with any data type to an integer, use an Integer Conversion Group Instruction.
• You can use the following instructions to convert a real number to an integer: TRUNC (Truncate),
Round (Round Off Real Number), and RoundUp (Round Up Real Number). All of these instructions
have a REAL input and DINT output, or a LREAL input and LINT output. The differences between
these instructions are shown in the following table.
Input value
REAL_TO_INT
REAL#1.6
INT#2
REAL#1.5
INT#2
REAL#1.5
INT#1
REAL#2.5
INT#2
REAL#-1.6
INT#-2
REAL#-1.5
INT#-2
REAL#-1.4
INT#-1
REAL#-2.5
INT#-2
Precautions for Correct Use
• Always use the correct instruction name for the data types of In and Out.
• If the conversion result exceeds the valid range of Out, Out will contain an illegal value.
2-248
Output value
TRUNC
Round
DINT#1
DINT#2
DINT#1
DINT#2
DINT#1
DINT#1
DINT#2
DINT#2
DINT#-1
DINT#-2
DINT#-1
DINT#-2
DINT#-1
DINT#-1
DINT#-2
DINT#-2
RoundUp
DINT#2
DINT#2
DINT#2
DINT#3
DINT#-2
DINT#-2
DINT#-2
DINT#-3

NJ-series Instructions Reference Manual (W502)

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Nj501-1300Nj501-1400

Table of Contents