Edge Triggered Function Blocks¶
Edge Triggered function blocks in the context of this document are defined as follows:
The input variable
xExecuteis the defining feature for this type of function block.A rising edge detected at the input variable
xExecute(start condition) starts the operation defined by this particular edge triggered function block.All inputs other than
xExecuteand the eventually present variablexAbortare sampled with this rising edge. Their values will be stored locally. Thus, later changes of these inputs can not influence the defined operation while it is running 1.The input variable
xExecutecan be set toFALSEafter the statusTRUEwas seen on the output variablexBusy.A falling edge detected at the input variable
xExecutewill not abort the defined operation. The defined operation is running normally to its ready condition, abort condition or error condition.Only the status
TRUEdetected on the eventually present input variablexAbortcancels the defined operation (abort condition).If the eventually present input variable
xAbortand the input variablexExecutehave the same valueTRUEthe abort condition is reached immediately.Only one of the output variables
xDone,xBusy,xErroror the eventually present output variablexAbortedcan have the statusTRUEat the same time.If a abort condition was detected, the output variable
xAbortedis set toTRUEafter setting the output variablexBusytoFALSE.With the falling edge of
xBusythe input variablexExecuteis sampled and its inverted value is stored as a reset request.The state of the output variables will be valid for a minimum of one invocation even though the state of the
xExecuteinput variable is already set toFALSE. In this case (reset request isTRUE) the internal state of the function block is reinitialized automatically. In the other case (xExecuteis stillTRUE) the function block is waiting for a falling edge of the input variablexExecutebefore reinitializing the function block (standard handshake).The status of any output variables other than
xDone,xBusy,xError,xAbortedoreErrorIDare valid only whilexDonehas the statusTRUE23.With an active reset request and after the status
TRUEof one of the output variablesxDone,xErrororxAbortedwas seen, the input variablexExecutecan be set toTRUEagain and the function block will restart its defined operation (quick handshake).
See the detailed descriptions of the reference implementation for the different edge triggered function blocks: ETrig (FB) | ETrigTl (FB) | ETrigTo (FB) | ETrigTlTo (FB) | ETrigA (FB) | ETrigATl (FB) | ETrigATo (FB) | ETrigATo (FB) | ETrigATlTo (FB)
Common properties of these types of function blocks:
If a specific invocation of a function block detects a start condition, the output variable
xBusyis set to the statusTRUEimmediately.As long as the defined operation of a function block is running the output variable
xBusyhas the statusTRUE.If a error condition was detected, the output variable
xErroris set toTRUEand the output variablexBusyis set toFALSE. In addition, one of the defined error codes (one value out of the local enumeration typeERROR) will be assigned to the output variableeErrorID.If the ready condition is reached, the output variable
xDoneis set toTRUEand the output variablexBusyis set toFALSE.If the defined operation can be fully processed in one invocation, the ready condition or the error condition is reached immediately and the
TRUEstatus of the output variablexBusyis never seen.With the rising edge of
xDone, the status of all output variables will be frozen.As long as one of the output variables
xDone,xBusyorxErrorhas the statusTRUEthe defined operation of this function block is not yet completed, so further invocations are necessary to complete the Resetting state.
Timing constraints of these function blocks:
udiTimeLimit([µs], 0⇒ no operating time limit):A function block could, for example, complete a complex task in a loop. The larger the task is, the more time is consumed in the current invocation of this function block. TheudiTimeLimitparameter can define how much time per invocation is permitted for consumption in the respective function block. Function blocks with audiTimeLimitinput variable are implemented in such a way that the current invocation is exited when the task is complete (Ready Condition), or when the consumed time for this invocation has exceeded the settings fromudiTimeLimit.udiTimeOut([µs], 0 ⇒ no operating time limit):When processing its defined operation, a function block could be forced for example to wait for an external event. It can do this in an internal loop (Busy Wait) or it can check in each invocation whether its task can be fully completed. TheudiTimeOutparameter can then define how much time is permitted for consumption for the defined operation. Function blocks with theudiTimeOutinput variable are implemented in such a way that the current invocation is exited towards a error condition (xError``⇒ ``TRUEandeErrorID⇒ERROR.TIME_OUT) when the time interval as defined byudiTimeOuthas been exceeded.
Error Domains and Error Codes (ERROR (Enum) and eErrorID (output)) and their organisation in different domains:
Every Function Block in this document has a Boolean output xError to indicate that there is an error condition reached.
In that case the related information will be signaled with the value of the output eErrorID.
The eErrorID represents an Integer, indicating the reason of the error.
In many cases this integer value is used as input for an additional FB which converts the number to a related localized string in an applicable language.
- 1
Sometimes it is necessary to have additional input variables which can influence the internal work flow. In this case, the special behaviour of these variables should be clearly documented.
- 2
Sometimes it is necessary to have additional output variables with a valid status while
xDoneis not set toTRUE. In this case, the special behaviour of these variables should be clearly documented.- 3
Sometimes it is necessary to have additional output variables which a valid only in combination with the status of some other output variables. In this case, the special behaviour and relationship of these variables should be clearly documented.