Type Conversions; Signed 16-Bit Integer Value Conversion: Short - Mitsubishi Electric R16MTCPU Programming Manual

Hide thumbs Also See for R16MTCPU:
Table of Contents

Advertisement

4.9

Type Conversions

Signed 16-bit integer value conversion: SHORT

Format
SHORT(S)
Setting data
■Usable data
: Usable
Setting
Usable Data
data
Bit
Word device
device
16-bit
integer
type
(S)
■Description, data type of result
Setting data
Description
(S)
Data which will be converted into signed 16-bit integer value
Processing details
• The data specified with (S) is converted into a signed 16-bit integer value.
• The data range of (S) is -32768 to 32767.
• When (S) is a 64-bit floating-point type, its fractional portion is rounded down before conversion is made.
• If (S) is a 16-bit integer type, its value is returned unchanged, with no conversion processing performed.
Operation error
An operation error will occur if:
• The (S) data is outside the range -32768 to 32767.
• (S) is an indirectly specified device and its device No. is outside the range.
Program example
■Program which converts the data of D0L into a signed 16-bit integer value and substitutes the
result to #0
#0 = SHORT(D0L)
#0
K-30000
(H8AD0)
Number of basic steps
4
Constant
32-bit
64-bit
16-bit
integer
floating
integer
type (L)
point
type
type (F)
(K/H)
D1
D0
D0L
K-30000L
(HFFFF8AD0)
Usable steps
F/FS
Calculation
expression
32-bit
64-bit
integer
floating
type
point
(K/H, L)
type (K)
4 OPERATION CONTROL PROGRAMS
G
Bit
Comparison
conditional
conditional
expression
expression
Data type of result
16-bit integer type
167
4.9 Type Conversions
4

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

R64mtcpuMelsec iq-r seriesR32mtcpu

Table of Contents