3.6. Process Data Memory
All mapped process data objects of the SubDevices are copied by the MainDevice into a process data memory image. New input values received from the SubDevices are written to the input process data image. New output values to be sent to the SubDevices are read from the output process data image.
The EC-Master uses two separate buffers where process data input values and process data output values are stored. The buffers used may either be always the same (fixed buffers) or be changed on every process data transfer cycle (dynamic buffers).
The EC-Master has different options for how the process data memory is provided.
EC-Master provides process data memory (fixed buffers)
User application registers an external memory provider with fixed buffers
User application registers an external memory provider with dynamic buffers
3.6.1. EC-Master as process data memory provider
If the application does not register a memory provider, the EC-Master internally allocates the required memory needed to store input and output process data values during emConfigureNetwork().
The EC-Master always uses the same buffers for reading/writing process data.
3.6.2. Application as process data memory provider with fixed buffers
The application may register a memory provider with emIoCtl - EC_IOCTL_REGISTER_PDMEMORYPROVIDER in case the EC-Master shall use externally allocated memory to store input and output process data values.
The memory provider may optionally supply callback functions to synchronize memory access between the application and the EC-Master.
- Receiving new input process data:
- Sending new output process data:
3.6.3. Application as process data memory provider with dynamic buffers
The application registers an external memory provider without fixed buffers via emIoCtl - EC_IOCTL_REGISTER_PDMEMORYPROVIDER with the parameters EC_T_MEMPROV_DESC::pbyPDInData and EC_T_MEMPROV_DESC::pbyPDOutData set to EC_NULL. In this case, the EC-Master requests via the callback functions the buffer addresses cyclically when reading or writing process data. This mode can be used to implement dynamic buffering mechanisms between the application and the EC-Master, e.g. double buffering, triple buffering.