Acyclic memory access
Data traffic with acyclic CoE access
In acyclic access, the user can create up to 255 memory objects that may also be differently sized. These objects can be specifically accessed from the PLC task via acyclic SDO access (Service Data Objects) for writing or reading; see sample program. This read/write access proceeds considerably slower than the above-described cyclic memory access.
The created structure can only be changed in the status PREOP. It can also be generally locked to prevent further changes.
Background information: The entire memory capacity is administered in the form of CoE objects (CAN over EtherCAT). The administration data (number and byte size) is located in the object index 0x2F00 with its subindexes; the stored data itself in the CoE objects from 0x2000: 0x2000, 0x2008, 0x2010, 0x2018 etc.
A memory object in acyclic access can comprise 1 to 8190 bytes.
The following procedure is recommended in order to use acyclic access:
Calculation of the memory space
The available 128 KB (131,072 bytes) of memory are subdivided as follows:
- 1280 bytes for the cyclic data
- 2000 bytes for internal administration
- x bytes as defined by the user for the acyclic data in the following
- y bytes: a shadow buffer as large as the largest memory object is kept on standby in the background.
Sample: The acyclic memory objects Obj1, Obj2 and Obj3 are defined with 1,000, 3,000 and 7,000 bytes respectively --> x = 11,000 bytes and y = 7,000 bytes. Thus 113,072 bytes of memory space remain.
Definition of the memory objects via the StartUp list
The desired structure of the memory objects must be created once only in the status PREOP in the CoE directory in CoE object 0x2F00. This is also possible offline, i.e. without a connected box. At start-up, the EP6080-0000 checks whether the memory structure has changed and if necessary creates the objects in the memory accordingly.
Change in the data structure If the data structure or the object 0x2F00 is changed, all existing data in the EP6080-0000 is deleted. The data structure can be locked against modification by setting the lock object 0xF200:02. |
Procedure short form:
- Set "Lock" in CoE object 0xF200:02 to 0 (manually in TwinCAT or via PLC).
- Enter the StartUp command for the CoE object 0x2F00
Content: number of objects + respective length in bytes.
Note: complete access, byte alignment, no empty object possible, only possible in P -> S transition, 16 bit entries, max. 127 memory objects. - Reload the configuration.
- For control: reload the CoE directory.
- Set Locked in CoE object 0xF200:02 = 1 (manually in the System Manager or via PLC), thus locking the structure to prevent further changes.
Procedure in detail:
The procedure to specify the structure of the memory objects as required by the user is as follows:
Following startup, the EP6080-0000 contains either an already changed memory structure or the default memory structure. The CoE objects from 0x2000 and 0x2F00 are important in the following. In Figure Any start state of the EP6080-0000, an object of size 1 byte is already created in the EP6080-0000:
- 0x2F00:0 ("NOVRAM Size Info"): "1" = 1 memory object exists.
- 0x2F00:01 ("Subindex 001"): "0x0001" = this one memory object has been defined with a size of 1 byte.
- 0x2000 ("NOVRAM Data"): 00 - this one memory object thus bears "00" as the date of use.
Now the EP6080-0000 is to be reconfigured to the following memory structure:
- 1 byte
- 10 byte
- 256 byte
- 3 byte
i.e. a total of 270 bytes in 4 memory objects, which can each be accessed acyclically via the CoE. A corresponding entry for this must be made in the EP6080-0000’s StartUp list. This list is empty by default on the EP6080-0000.
This is achieved by New.. in the StartUp tab of EP6080-0000.
A window opens in which the new StartUp entry can be defined.
- Select object 0x2F00 from the list, so that the correct values already appear in Index/SubIndex and Comment.
- "P-->S" must be selected in Transition (the value will be loaded to the EP6080-0000 during the state transition PREOP-->SAFEOP).
- CompleteAccess must be activated.
- Enter the structure you require in Data, in the form “aa aa bb bb cc cc .....”
aa aa: Number of desired memory objects, in hex and reverse byte order (byte alignment).
bb bb, cc cc, ...: respective size definition of the objects, in hex and reverse byte order (byte alignment).
StartUp list selection dialog If no CoE entries (see Fig. Definition of the StartUp entry) are offered for selection, this is because you are working offline (i.e. without a connected box) and the ESI (EtherCAT Slave Information, XML description) of the EP6080-0000 that you are using does not contain a dictionary. |
Example:
- aa aa = 04 00: 4 memory objects are desired.
- bb bb = 01 00: 1st memory object has a size of 1 byte (00 01hex = 1dec).
- cc cc = 0A 00: 2nd memory object has a size of 10 bytes (00 0Ahex = 10dec).
- dd dd = 00 01: 3rd memory object has a size of 256 bytes (01 00hex = 256dec).
- ee ee = 03 00: 4th memory object has a size of 3 bytes (00 03hex = 256dec).
Confirm with OK. The new StartUp entry looks like this:
This configuration must now be loaded to the EP6080-0000 and, in particular, the PREOP-->SAFEOP state transition must be run through as defined in the StartUp entry.
Click the "Reload Devices" button (Fig. Reload the configuration):
The old entry is still visible in the CoE-Online tab.
The reason is that TwinCAT primarily only loads the values of CoE objects that are known to the System Manager. If the CoE structure changes on the device, the System Manager has to be instructed to load the new structure, which may differ from the default structure according to XML/Dictionary.
Load the reconfigured CoE directory (Fig. Full reload of the CoE directory):
- CoE-Online, Advanced...
- Double-click AllObjects
- then OK
The newly defined memory objects are now visible and enabled, see Fig. Modified CoE directory.
- the structure information (byte size) of memory objects 1 to 4 is defined in CoE object 0x2F00, Subindex 001 to 004
- the current memory contents are displayed in the order according to associated CoE objects 0x2000, 0x2008, 0x2010 etc.
Updating the CoE directory In order to update the display of the CoE directory, use AutoUpdate, UpdateList or the appropriate dialog under Advanced. |
Displaying larger CoE objects In the sample selected here, the content of the third memory object in the CoE object 0x2010 is not shown in the TwinCAT display, see Fig. Changed CoE directory, because the content is too large to be displayed. Regardless of that, the contents naturally exist. |
Online access to the memory objects during operation
Function blocks from the PLC library "Tc2_EtherCAT" such as FB_EcCoESdoWriteEx can be used for access from the PLC.
Sample
fbWriteCoE(
sNetId:=sAmsNetId,
nSlaveAddr:= tAmsAddr.port ,
nSubIndex:= 0,
nIndex:= 16#2000 + ((byObjectNo - 1) * 8),
pSrcBuf:= pDataForWrite,
cbBufLen:= wSizeOfData,
bExecute:= TRUE,
tTimeout:= tAdsTimeOut,
bCompleteAccess:= FALSE,
bBusy=> ,
bError=> ,
nErrId=> );
Sample program The EL6080 documentation contains a sample program that demonstrates CoE access from a PLC program. |