Script – IDEC High Performance Series User Manual
Page 1007
![background image](/manuals/350385/1007/background.png)
WindO/I-NV2 User’s Manual
20-43
5 Script Coding Examples
20
Script
Script
Operation description
Converts the stored string starting at LDR200 to a decimal and stores the result in LDR100.
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 NULL or characters that cannot be converted to numeric values, the string is
converted up to that character.
Setting the string “1234” (when the data type is BIN16+)
Setting the string “1234567” (when the data type is BIN16+)
Setting the string “-12345” (when the data type is BIN16+/-)
String “1234567890” (when the data type is BIN32+)
■
Example 5.7.21 Convert string to decimal
[LDR 100] = ASCII2DEC([LDR 200]);
• This function can be used with data types BIN16(+), BIN16(+/-), BIN32(+), BIN32(+/-), BCD4, and
BCD8.
• Only internal devices can be used.
• When using functions that handle strings, check the Storage Method of string data setting on the
System tab in the Project Settings dialog box. Depending on the setting, the upper and lower bytes
are stored in the reverse of the following explanation.
For details, refer to Chapter 4 “3.1 System Tab” on page 4-26.
Device
Stored value
Upper byte
Lower byte
Device
Stored value
4
3
2
1
0
0
1
R
D
L
2
3
x
0
=
'
2
'
1
3
x
0
=
'
1
'
0
0
2
R
D
L
LDR 201
'3' = 0x33
'4' = 0x34
LDR 202
0x00
0x00
Terminating character
Device
Stored value
Upper byte
Lower byte
Device
Stored value
5
4
3
2
1
0
0
1
R
D
L
2
3
x
0
=
'
2
'
1
3
x
0
=
'
1
'
0
0
2
R
D
L
LDR 201
'3' = 0x33
'4' = 0x34
LDR 202
'5' = 0x35
'6' = 0x36
LDR 203
'7' = 0x37
0x00
Terminating character
Device
Stored value
Upper byte
Lower byte
Device
Stored value
5
4
3
2
1
-
0
0
1
R
D
L
1
3
x
0
=
'
1
'
D
2
x
0
=
'
-
'
0
0
2
R
D
L
LDR 201
'2' = 0x32
'3' = 0x33
LDR 202
'4' = 0x34
'5' = 0x35
LDR 203
0x00
0x00
Terminating character
Device
Stored value
Upper byte
Lower byte
Device
Stored value
0
9
8
7
6
5
4
3
2
1
1
0
1
-
0
0
1
R
D
L
2
3
x
0
=
'
2
'
1
3
x
0
=
'
1
'
0
0
2
R
D
L
LDR 201
'3' = 0x33
'4' = 0x34
LDR 202
'5' = 0x35
'6' = 0x36
LDR 203
'7' = 0x37
'8' = 0x38
LDR 204
'9' = 0x39
'0' = 0x30
LDR 205
0x00
0x00
Terminating character