IDEC FT1A Series User Manual page 334

Hide thumbs Also See for FT1A Series:
Table of Contents

Advertisement

13: S
CRIPTS
Converting -12345 (when the data type is I (integer))
Device
Stored value
D0200
Converting 1234567890 (when the data type is D (double word))
Device
Stored value
D0200
D0201
Converting -1234567890 (when the data type is L (long))
Device
Stored value
D0200
D0201
Example 7.21 Convert string to decimal
Script
[D0100] = ASCII2DEC([D0200]);
Operation Description
Converts the stored string starting at D0200 to a decimal and stores the result in D0100.
The number of digits that can be converted is the maximum number of digits for each data type with added sign.
If the string to convert contains a NULL or characters that cannot be converted to numeric values, the string is converted up to
that character.
Notes:
This function can be used with data types W (word), I (integer), D (double word), and L (long).
The NULL terminating character (0x00) is added to the end of the string.
Setting the string "1234" (when the data type is W (word))
Device
D0200
D0201
D0202
13-30
-12345
1234567890
-1234567890
Stored value
Upper byte
Lower byte
'1' = 0x31
'2' = 0x32
'3' = 0x33
'4' = 0x34
0x00
0x00
Terminating character
S
AXIS P
MART
Stored value
Device
Upper byte
D0100
'-' = 0x2D
D0101
'2' = 0x32
D0102
'4' = 0x34
D0103
0x00
Terminating character
Stored value
Device
Upper byte
D0100
'1' = 0x31
D0101
'3' = 0x33
D0102
'5' = 0x35
D0103
'7' = 0x37
D0104
'9' = 0x39
D0105
0x00
Terminating character
Stored value
Device
Upper byte
D0100
'-' = 0x2D
D0101
'2' = 0x32
D0102
'4' = 0x34
D0103
'6' = 0x36
D0104
'8' = 0x38
D0105
'0' = 0x30
/L
U
'
M
FT9Y-B1378
RO
ITE
SER
S
ANUAL
Lower byte
'1' = 0x31
'3' = 0x33
'5' = 0x35
0x00
Lower byte
'2' = 0x32
'4' = 0x34
'6' = 0x36
'8' = 0x38
'0' = 0x30
0x00
Lower byte
'1' = 0x31
'3' = 0x33
'5' = 0x35
'7' = 0x37
'9' = 0x39
0x00
Terminating character
Device
Stored value
D0100
1234

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents