CDN36X User Manual
revision 1.30
The
Precision
attribute is only used for transmitted messages. It defines the number of digits (1
to 6) after the decimal point for a floating-point number. The gateway will automatically add
trailing zeros to the converted number if needed.
Precision
is only used for the REAL data type.
The following examples show how to calculate the
Data Size
,
Width
, and
Precision
attributes for
the different
Data Types
. Remember to add a length byte to the Short_String
Data Size
.
Data Type
ASCII
chars
Data Size
Width
Precision
SINT
‘-12’
1
3
not
used
INT
‘-12345’
2
6
not
used
USINT
‘123’
1
3
not
used
UINT
‘1234’
2
4
not
used
REAL
‘1.23E+4’
4
7
2
REAL
‘-1.1234E-12’
4
11
4
Short_String
‘ABCDEF’
7 (length=6)
not used
not used
The
Conversion
attribute is different for
Serial Receive Object
and
Serial Transmit Object
. For
the
Serial Receive Object
, the
Conversion
attribute denotes if the ASCII bytes represent a
decimal integer or a hexadecimal integer. If decimal is selected, then the gateway converts the
ASCII bytes as a decimal number. If hexadecimal is selected, then the gateway converts the
ASCII bytes as a hex number.
‘1234’
Æ
If decimal, integer = 1234.
‘1234’
Æ
If hexadecimal (0x1234), integer = 4660.
For the
Serial Transmit Object
, the
Conversion
attribute also denotes if the ASCII bytes
represent a decimal or hexadecimal integer. If decimal is selected, then the gateway converts the
integer into a decimal ASCII representation. If hexadecimal is selected, then the gateway
converts the integer into a hex ASCII representation.
Integer = 1234
Æ
If decimal, ASCII representation = ‘1234’
Integer = 1234
Æ
If hexadecimal, ASCII representation = ‘04D2’
The
Serial Transmit Object
Conversion
attribute can also be used to insert leading zeros into a
converted number. If the ASCII representation of a number contains fewer characters than the
selected
Width
, then leading zeros can added in front of the number.
Integer = 1234, Width = 7
Æ
If leading zeros enabled, ASCII representation = ‘0001234’
Integer = 1234, Width = 7
Æ
If leading zeros disabled, ASCII representation = ‘1234’
The following examples show a variety of different gateway data conversions for received and
transmitted data values.
MKS Instruments, Inc.
D.I.P. Products Group
20