ERROR (ENUM) ¶ TYPE ERROR : Attributes: qualified_only InOut: Name Initial NO_ERROR 0 PENDING 2 NO_MEMORY WRONG_PARAMETER WRONG_CONFIGURATION QUEUE_IS_BROKEN QUEUE_EMPTY
SncDevDesc.FSpsAddress (PROP) ¶ PROPERTY FSpsAddress : UDINT Property of type ‘UDINT’ to get the F-SPS address
SncDevDesc.FSpsDevAddress (PROP) ¶ PROPERTY FSpsDevAddress : STRING Property of type ‘STRING’ to get the device address of the F-SPS <busAddress>:<FSpsAddress>
SharedArea ¶ Think about data structures like a STRING , ARRAY or STRUCT We can model this kind of data structures in a general way as a block of data with an start address pData and a size udiDataSize : In CODESYS this kind of structures may be declared as following: sString : STRING ( 255 ) := 'The quick brown fox jumps over the lazy dog' ; wsString : WSTRING ( 255 ) := "✞♄℮ ⓠʊї¢к ♭ґøωη ḟ◎✖ ʝυღ℘﹩ øṽℯґ ⊥ℌ℮ ʟ@ℨƴ ḓøℊ" ; aiArray : ARRAY [0..9] OF INT := [2,3,5,7,11,13,17,19,23,29] ; TYPE STRUCTURE : STRUCT sString : STRING ( 255 ); wsString : WSTRING ( 255 ); aiArray : ARRAY [0..9] OF INT ; END_STRUCT END_TYPE myStructure : STRUCTURE := ( sString := sString , wsString := wsString , aiArray := aiArray ); In a single-core environment a simple function call to SysMemCpy will be enough to assign the content of this variables to a other variable. SysMemCpy ( pDest := ADR ( sOtherString ), pSrc := ADR ( sString ), udiCount := DINT_TO___XWORD ( MIN ( LEN ( sString ), SIZEOF ( STRING ( 255 ))))); This approach will not result in a consistent content of the other variable if we execute this statement in a multi-core environment and there are multiple writers and/or multiple readers at the same point in time on the same memory area. In a typical application we will have some writers for each area and multiples readers. The basic idea for an proper implementation approach is based on the possibility to assign the data types POINTER or INTERFACE consistently in a multi-core environment with a simple assignment statement. pElement := ADR ( element ); itfString := StringBuilder ( 'The quick brown fox' ); The problem which is left is: How can we implement a adequate SysMemCpy in a multi-core environment. The function block SharedArea and its methods will solve this problem. Function Blocks SharedArea (FunctionBlock) IInstance Dispose (Method) ISharedArea AreaCompareAndSwap (Method) AreaCurrentCapacity (Property) AreaIncreaseCapacity (Method) AreaRead (Method) AreaSetObserver (Method) AreaWrite (Method) SharedAreaFactoryArgs (FunctionBlock) SharedAreaFactoryBase (FunctionBlock) Create (Method) prvInstCount (Property) prvInstSize (Property) SharedAreaRefDisposer (FunctionBlock) Interfaces IReadableSharedArea (Interface) AreaRead (Method) ISharedArea (Folder) AreaCurrentCapacity (Property) AreaIncreaseCapacity (Method) AreaSetObserver (Method) ISharedAreaObserver (Interface) AreaWritten (Method) ISharedAreaRef (Interface) AreaDataPointer (Property) AreaDataSize (Property) AreaDispose (Method) ISharedAreaUtilities (Interface) AreaCopyData (Method) AreaIsEqual (Method) IWriteableSharedArea (Interface) AreaCompareAndSwap (Method) AreaWrite (Method)
SncDevDesc.FSpsMasterIdx (PROP) ¶ PROPERTY FSpsMasterIdx : UINT Property of type ‘UINT’ to get the device address of the F-SPS
SncDevDesc.FSpsVendorID (PROP) ¶ PROPERTY FSpsVendorID : UDINT Property of type ‘UINT’ to get the vendor ID of the F-SPS
Function Blocks ¶ SharedArea (FunctionBlock) IInstance Dispose (Method) ISharedArea AreaCompareAndSwap (Method) AreaCurrentCapacity (Property) AreaIncreaseCapacity (Method) AreaRead (Method) AreaSetObserver (Method) AreaWrite (Method) SharedAreaFactoryArgs (FunctionBlock) SharedAreaFactoryBase (FunctionBlock) Create (Method) prvInstCount (Property) prvInstSize (Property) SharedAreaRefDisposer (FunctionBlock)
SncServiceProvider.NumOfHandledServices (PROP) ¶ PROPERTY NumOfHandledServices : UDINT Property of type ‘UDINT’ to get the number of handled SNC services
SncServiceProvider.SimulateServiceRequest (METH) ¶ METHOD SimulateServiceRequest : ERROR Method to simulate a service request which comes normally from the RTS service handler. InOut: Scope Name Type Comment Input pParameter POINTER TO GSH.SERVICEHANDLER_PARAMETER pointer to the service data from a simulated service handler Return SimulateServiceRequest ERROR
SharedArea (FB) ¶ FUNCTION_BLOCK FINAL SharedArea EXTENDS FBF.InstanceBase IMPLEMENTS ISharedArea , IReadableSharedArea , IWriteableSharedArea A shared area allows only ONE writer at the same time, reading the shared area is always allowed InOut: Scope Name Type Initial Comment Input Const pData __XWORD udiDataSize UDINT udiInitialCapacity UDINT 5 The initial max number ( >1 ) of possible references of the shared data pPool POINTER TO BYTE The optinonal memory space for the background pool. pPool = 0 => Memory is allocated from Heap pPool <> 0 => The related static Memory of size udiPoolSize is used. udiPoolSize UDINT The size of the memory area referenced by pPool Condition: udiPoolSize >= TO_UDINT(MBM.PoolGetSize(udiInitialCapacity, udiDataSize + SIZEOF(AreaData) - SIZEOF(DWORD))); itfObserver ISharedAreaObserver An optional observer implemetation registered with initilaization. itfUtilities ISharedAreaUtilities An optional specialized implementations for AreaCopyData and AreaIsEqual . Properties: AreaCurrentCapacity Methods: AreaCompareAndSwap AreaIncreaseCapacity AreaRead AreaSetObserver AreaWrite Dispose Structure: IInstance Dispose (Method) ISharedArea AreaCompareAndSwap (Method) AreaCurrentCapacity (Property) AreaIncreaseCapacity (Method) AreaRead (Method) AreaSetObserver (Method) AreaWrite (Method)