Delta Electronics DVP15MC11T Operation Manual page 240

Table of Contents

Advertisement

Real Number to Integer
Real numbers can be converted to integers. And some instructions are shown below.
For the real number-to-integer conversion, there are two cases in which the fractional part is
truncated and rounded up as follows.
Case 1: If the first digital number of the fractional part is less than 5, the fractional part will be
truncated and the integer part will not change.
Case 2: If the first digital number of the fractional part is greater than or equal to 5, the
fractional part will be truncated and the integer part will add by 1.
Input value
Case 1
Case 2
Note:
For the Real Number-to-Integer Conversion, there are two cases for the value of a real number.
1.
If the number of input digits of a real number exceeds what is allowed, the result will be an
unsure value. Please set a limit in the user program in order to get a correct value.
For example: Then the input value is 123456789 and the number of its digits exceeds the
set limit 7. The digits which go beyond the limit are abnormal. Then the output value is
123456792.
2.
If the number of input digits does not exceed the set limit, the result is calculated based on
the conversion rule.
Real Number to Bit string
Real numbers can be converted to bit strings. And some instructions are shown below.
REAL_ TO _SINT
EN
ENO
In
O ut
LREA L_TO_DINT
EN
ENO
In
O ut
Data type
1.36
-2.4
1.6
-2.6
RE AL_TO_B YTE
EN
ENO
In
O ut
RE AL_TO_B YTE
EN
ENO
In
O ut
Chapter 8 Logic Instructions
REA L_TO _USI NT
EN
ENO
In
O ut
L RE AL_TO_L INT
EN
ENO
In
O ut
Output result
Output value
SINT
1
USINT
1
SINT
-2
USINT
254
SINT
2
USINT
2
SINT
-3
USINT
253
REAL_ TO_ WORD
EN
ENO
In
O ut
REAL_ TO_ WORD
EN
ENO
In
O ut
8_
8-169

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents