Unsigned 16-Bit Integer Value Conversion: Ushort - Mitsubishi Electric R16MTCPU Programming Manual

Hide thumbs Also See for R16MTCPU:
Table of Contents

Advertisement

Unsigned 16-bit integer value conversion: USHORT

Format
USHORT(S)
Setting data
■Usable data
: Usable
Setting
Usable Data
data
Bit
device
(S)
■Description, data type of result
Setting data
Description
(S)
Data which will be converted into unsigned 16-bit integer value
Processing details
• The data specified with (S) is converted into an unsigned 16-bit integer value.
• The data range of (S) is 0 to 65535.
• 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 0 to 65535.
• (S) is an indirectly specified device and its device No. is outside the range.
Program example
■Program which converts the data of D0L into an unsigned 16-bit integer value and substitutes
the result to #0
#0 = USHORT(D0L)
#0
K-5536
(HEA60)
Unsigned value is K60000
4 OPERATION CONTROL PROGRAMS
168
4.9 Type Conversions
Number of basic steps
4
Word device
16-bit
32-bit
64-bit
integer
integer
floating
type
type (L)
point
type (F)
D1
D0L
(H0000EA60)
Usable steps
F/FS
Constant
16-bit
32-bit
64-bit
integer
integer
floating
type
type
point
(K/H)
(K/H, L)
type (K)
D0
K60000L
G
Calculation
Bit
expression
conditional
expression
Data type of result
16-bit integer type
Comparison
conditional
expression

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

R64mtcpuMelsec iq-r seriesR32mtcpu

Table of Contents