IDEC FT1A Series User Manual page 321

Hide thumbs Also See for FT1A Series:
Table of Contents

Advertisement

Example 1.5
Conditional branch
Script
if ([D0100] == 0)
{
[D0102] = 0x1234;
}
else if ([D0100] == 1)
{
[D0102] = 0x5678;
}
else
{
[D0102] = 0x9999;
}
Operation Description
If the value of D0100 is 0, then 0x1234 is stored in D0102.
If the value of D0100 is 1, then 0x5678 is stored in D0102.
If the value of D0100 is not 0 nor 1, then 0x9999 is stored in D0102.
Example 1.6
Conditional branch
Script
if ([D0100])
{
if ([D0102])
{
if ([D0103])
{
[D0104] = 100;
}
else
{
[D0104] = 200;
}
}
}
Operation Description
If the value of D0100, D0102, and D0103 are all not 0, then 100 is stored in D0104.
If the values of D0100 and the value of D0102 are not 0 and the value of D0103 is 0, then 200 is stored in D0104.
If either the value of D0100 or D0102 is 0, then nothing is executed regardless of the value of D0103.
Example 1.7
Iteration
Script
[D0100] = 10;
[D0102] = 10;
while (0 < [D0100])
{
[D0102] = [D0102] + 1;
[D0100] = [D0100] - 1;
}
Operation Description
If the value of D0100 is larger than 0, then 1 is repeatedly added to the value of D0102 and 1 is repeatedly subtracted from the
value of D0100.
In the script example above, when the while statement repeats ten times, the value of D0100 becomes 0 and the while statement
ends.
After this script is executed, the value of D0100 is 0 and the value of D0102 is 20.
S
AXIS P
/L
U
'
MART
RO
ITE
SER
S
M
FT9Y-B1378
ANUAL
13: S
CRIPTS
13-17

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents