BOLT (FB) ¶ FUNCTION_BLOCK FINAL BOLT This function block gives exclusive or simultaneous access to a critical section. It is based on the runtime system function SysCpuTestAndSet . Exclusive access is only possible after all simultaneous accesses have been ended. As long as there is an exclusive access, the simultaneous access calls are rejected. Simultaneous accesses are initiated with the method Enter . This means the number of accesses in the critical section is increased by one. The method Leave is required to leave the critical section. It reduces the number of accesses in the critical section by one. Exclusive access is requested with the method Reserve . This call can only be successful if the number of accesses in the critical section equals zero. If this is not the case, all new calls of the method Enter are denied to make sure the number of accesses is not increased further. If all those who previously accessed the critical section have left with the method Leave , the next call of the method Reserve will be successful. The critical section can now be accessed exclusively. When all work is done, the section has to be returned with the method Free . If exclusive access has already been granted, calls for simultaneous access are denied. Further calls for exclusive access are also denied but they are counted. The calls for simultaneous access are successful as soon as all exclusive accesses have been ended. If the method was executed successfully, TRUE is returned, else FALSE is returned. A critical section may only be accessed if the methods Enter or Reserve have returned TRUE. Methods: Enter Free Leave Reserve Structure: Enter (Method) Free (Method) Leave (Method) Reserve (Method)
BOLT.Enter (METH) ¶ METHOD Enter : BOOL InOut: Scope Name Type Return Enter BOOL
BOLT.Free (METH) ¶ METHOD Free : BOOL InOut: Scope Name Type Return Free BOOL
BOLT.Leave (METH) ¶ METHOD Leave : BOOL InOut: Scope Name Type Return Leave BOOL
BOLT.Reserve (METH) ¶ METHOD Reserve : BOOL InOut: Scope Name Type Comment Return Reserve BOOL Inout ctValue COUNT Reservation ticket number
SEMA (FB) ¶ FUNCTION_BLOCK FINAL SEMA This function block realizes a counting semaphore. It is based on the runtime system function SysCpuTestAndSet . A function block of type SEMA is used to manage limited resources. The counter of the semaphore symbolizes the number of resources available. If there is no special parameterization, the semaphore counter has the value one. The resources assigned to the semaphore are accessed with the Request method. This works as long as the counter is not zero at the time of the Request call. The counter is then reduced by one. With the method Release the resource previously called is released and the counter is increased by one. The call of the method Preset adjusts the initial counter of the semaphore in accordance with the requirements. If the method was executed successfully TRUE is returned, else FALSE is returned. A resource may thus only be used if the call Request returns TRUE. InOut: Scope Name Type Initial Input Const ctPreset COUNT 1 Properties: Preset Methods: Init Release Request Structure: Init (Method) Preset (Property) Release (Method) Request (Method)
SEMA.Init (METH) ¶ METHOD PROTECTED Init
SEMA.Preset (PROP) ¶ PROPERTY Preset : COUNT Init value of SEMA
SEMA.Release (METH) ¶ METHOD Release : BOOL InOut: Scope Name Type Return Release BOOL
SEMA.Request (METH) ¶ METHOD Request : BOOL InOut: Scope Name Type Return Request BOOL