13: S
CRIPTS
13-16
S
MART
AXIS P
RO
/L
ITE
U
SER
'
S
M
ANUAL
FT9Y-B1378
Script Programming Examples
This section describes script programming examples for control statements, arithmetic operators, and functions, as well as their
operations.
1. Control Statements
Example 1.1
Conditional branch
Script
Operation Description
If the value of D0100 is not 0, then 100 is stored in D0102.
Example 1.2
Conditional branch
Script
Operation Description
If the value of D0100 is not 0, the value of D0103, D0104, and D0105 are added and the result is stored in D0102.
Example 1.3
Conditional branch
Script
Operation Description
If the value of D0100 is not 0 and the value of D0102 is not 0 either, 0x1234 is stored in D0103.
If the value of D0100 is not 0 and the value of D0102 is 0, then nothing is executed.
If the value of D0100 is 0, then nothing is executed regardless of the value of D0102.
Example 1.4
Conditional branch
Script
Operation Description
If either the value of D0100 or the value of D0102 is not 0, then 100 is stored in D0103.
If the values of both D0100 and D0102 are 0, 100 is added to D0105 and the result is stored in D0104.
if ([D0100])
{
[D0102] = 100;
}
if ([D0100])
{
[D0102] = [D0103] + [D0104] + [D0105];
}
if (0 != [D0100])
{
if (0 != [D0102])
{
[D0103] = 0x1234;
}
}
if ((0 != [D0100]) || (0 != [D0102]))
{
[D0103] = 100;
}
else
{
[D0104] = [D0105] + 100;
}
Содержание FT1A-B12RA
Страница 1: ...FT9Y B1378 5 ...
Страница 2: ......
Страница 208: ...7 DEVICE ADDRESSES 7 16 SMARTAXIS PRO LITE USER S MANUAL FT9Y B1378 ...
Страница 226: ...8 INSTRUCTIONS FUNCTION BLOCKS REFERENCE 8 18 SMARTAXIS PRO LITE USER S MANUAL FT9Y B1378 ...
Страница 340: ...13 SCRIPTS 13 36 SMARTAXIS PRO LITE USER S MANUAL FT9Y B1378 ...
Страница 384: ...APPENDIX A 18 SMARTAXIS PRO LITE USER S MANUAL FT9Y B1378 European Font ISO 8859 1 Cyrillic Font ANSI 1251 ...
Страница 385: ...SMARTAXIS PRO LITE USER S MANUAL FT9Y B1378 A 19 APPENDIX Japanese Font JIS X0201 ...
Страница 386: ...APPENDIX A 20 SMARTAXIS PRO LITE USER S MANUAL FT9Y B1378 ...