Parameter-Updating at Functions

Top  Previous  Next

 

The following differences just concern functions, not function blocks. Assigning to an Out- or In-Out-parameter whose actual-parameter is not another parameter of the calling block but an direct operand (in-/output, marker, data word) the actual-parameter is changed in the moment of the assignment in a S7. Accessing an In-parameter to which an operand is connected the actual state of this operand will be detected even if this one has changed since the call of the block, in the same way.

In TrySim the updating of the actual-parameter which are connected to Out- and In-Out-parameter does not happen until the return to the calling block. The In- and In-Out-parameter are updated once at calling the block, after that the actual-parameter are not read again. But the differences caused by this will only occur if you access an operand directly as well as by a parameter.

 

Pay attention to this program example:

 

 S7        TrySim

 

OB 1



|OB 1





Status

|


Status


SET

1

|

SET

1


= M 1.2

1

|

= M 1.2

1


CALL FC 2


|

CALL FC 2



Par1: M 1.2


|

Par1: M 1.2



U M 1.2

0

|

A M 1.2

0

 

FC 2



|FC 2



OUT

Par1

BOOL

|OUT

Par1

BOOL









Status

|


Status


U #Par1

1

|

A #Par1

1


U M 1.2

1

|

A M 1.2

1


CLR

0

|

CLR

0


= #Par1

0

|

= #Par1

0


U #Par1

0

|

A #Par1

0


U M 1.2

0

|

A M 1.2

1

 

Avoid such mixed accesses which can lead to program errors that are hardly to locate. In the upper example the state of the marker M 1.2 has changed from 1 to 0 on the left side during the program process and this is not perceptible by an explicit assignment.

 

Differing implemented properties

Out parameter of functions

 

S7-300 and S7-400 are registered trademarks of the Siemens AG.