94
••••
6 - Programming
Simatic 505 SoftShop
4.
Enter a title for the program in the Program Title window. The
title is optional and can be left blank.
5.
Click Yes or No in the Continue On Error selection to have the
program continue or stop when an error occurs.
6.
Select the Program Type from the Combo Box.
7.
Enter the cycle time in seconds (0.5-6553.5).
8.
Check the Enable Program to allow exaction of the SF
program.
9.
For the 555-1105/-1106 and 575-2105/-2106 CPUs, the
compile mode is selectable. When compiled mode is selected,
the SF program or subroutine is translated to the native
instruction set of the CPU’s microprocessor. The compiled
code is then executed whenever the program or subroutine is
scheduled for execution. The advantages of compiled execution
are:
•
Significant execution speed improvement. For example, a
MATH statement that adds two floating-point values will
execute in less than 10
µ
s when compiled, versus more
than 100
µ
s when executed by the SF interpreter.
Depending on the program’s size and the placement of the
target LABEL within the program, a GOTO statement may
take 1 ms or more when executed by the interpreter.
Compiled execution of a GOTO statement takes less than 1
microseconds no matter where in the program the LABEL
is located. This represents a 1,000x improvement.
•
A compiled SF program or subroutine can be executed in-
line to the user RLL program. This means that when the
enable input to the SFPGM or SFSUB box instruction is
on, the program or subroutine is executed immediately and
its result is available for use in the next rung of the current
RLL scan.
10.
There are several reasons to choose interpreted mode for a SF
program. The primary reasons are as follows:
•
If the program has one or more statements that are not allowed
in a compiled program, or if it calls a subroutine that is not
compiled, then it may not be compiled.
•
A compiled program requires both S-Memory and Compiled
Special (CS)-Memory, while an interpreted program requires
only S-Memory. As a rule of thumb, the compiled code for a SF
program requires twice as much CS-Memory as S-Memory. For
example, a SF program that uses 1 Kbyte of S-Memory also
uses 2 Kbytes of CS-Memory.
•
A second SF program or subroutine on the same execution
queue cannot pre-empt a compiled SF program or subroutine.
This may present a scheduling problem for a cyclic, loop, or
analog alarm queue. For example, if a compiled program is
executing on a loop setpoint, a higher priority loop will not
execute until the compiled program completes. This is not a
problem if the program’s execution time is small. However, if
the program requires significant execution time, this could
cause unnecessary loop overruns.