RSC PROFINET Services
The PROFINET component can be extended via interfaces for PROFINET services. You can use one interface for acyclic communication (RecordRead
, RecordWrite
). The interface is available via the RSC protocol. The parameter data, diagnostic information, and status information (PDI = Parameters, Diagnostics and Information) of a PROFINET device can be read or written with the RSC service. Acyclic communication is suitable for the exchange of data that does not recur cyclically.
Note: The execution of RSC services can take some time. For this reason, avoid direct calls from ESM tasks that are scheduled for real-time execution.
IAcyclicCommunicationService
The IAcyclicCommunicationService
RSC service in the Arp/Io/ProfinetStack/Controller/Service
namespace for acyclic communication makes the following methods available:
RecordRead
:
Enables parameters, diagnostics and information of a PROFINET device to be readRecordWrite
:
Enables parameters, diagnostics and information of a PROFINET device to be written
RecordResult RecordRead(const RecordParam& recordParam, std::vector<uint8>& data)
RecordResult RecordWrite(const RecordParam& recordParam, const std::vector<uint8>& data)
Parameters are necessary for executing RecordRead
and RecordWrite
. The RecordParam
structure is used for transmitting the input parameters. The structure provides two ways of addressing a module:
- Approach 1: Addressing via the ID
- Approach 2: Addressing via an address that is made up of DeviceName, Slot and Subslot
If one approach for addressing is picked, the parameters for the other approach must be 0
or empty.
The RecordParam
structure has the following elements:
Parameter | Description |
uint16 Id |
Node ID of the submodule The ID is assigned automatically. It can be viewed in PLCnext Engineer (approach 1). For this, open the submodule list of the PROFINET submodule node: To determine the ID, you can also use the AddressToID method of the IAddressConversionService.hpp service.
|
RscString<512> DeviceName |
Device name Name of the device that is to be addressed (approach 2) |
uint16 Slot |
Device number (approach 2) |
uint8 Subslot |
Subdevice number (approach 2) |
uint16 Index |
Object index |
uint8 Length |
Maximum data amount; specifies the maximum amount of data to be written in bytes ( RecordRead ) or the amount of data that is to be written to an object (RecordWrite ). |
The return values are written to the RecordResult
structure. The structure has the parameters below. Further information on the parameters is available in the PROFINET v2.3 specification.
- boolean ServiceDone
- uint8 ErrorCode
- uint8 ErrorDecode
- uint8 ErrorCode1
- uint8 ErrorCode2
- unit16 AddData1
- unit16 AddData2
ErrorCode1
Error code | Description |
0 |
No errors |
0xF0 |
Internal error The error can be evaluated more precisely via ErrorCode2. |
Further error codes | If a value other than 0xF0 or 0 is displayed in the ErrorCode1 element, the error is described in the ErrorCode , ErrorDecode , ErrorCode1 , ErrorCode2 , AddData1 , and AddData2 fields by the PROFINET specification. |
ErrorCode2
Error code | Description |
0x03 |
InvalidAddress ID or DeviceName/Slot/Subslot is invalid. |
0x15 |
RecordReadFailed RecordRead failed. This error can occur, for example, if several devices simultaneously attempt to execute “RecordRead” on one device. |
0x16 |
RecordWriteFailed RecordWrite failed. This error can occur, for example, if several devices simultaneously attempt to execute “RecordWrite” on one device. |
0x17 |
Timeout No confirmation was received. |
Data that is read (RecordRead
) or data that is to be written (RecordWrite
) is transferred in a type unit8 vector (data
). A description of the data (maximum size, type, etc.) of the object description is available in the PROFINET v2.3 specification.
You need the following headers to use the service. If necessary, include them via the #include
command:
Arp/Io/ProfinetStack/Controller/Services/IAcyclicCommunicationService.hpp
Arp/Io/ProfinetStack/Controller/Services/AcyclicCommunicationServiceProxyFactory.hpp
Arp/Io/ProfinetStack/Controller/Services/RecordParam.hpp
Arp/Io/ProfinetStack/Controller/Services/RecordResult.hpp