Your SICK ID gives you access to our extensive range of services. This includes direct online orders, price and availability checks, and access to our digital services.
This article demonstrates how to read ISDUs / acyclic data using a CtrlX PLC programmed with Codesys.
Often, these functions become complicated because it’s unclear where to write specific values and why. To clarify, we will provide screenshots and explain the origins of these values.
First, we need to declare some variables.
As you can see, we are working with the AOE feature. Therefore, we need to activate it in the IO Engineering. This number is then assigned byte by byte to the variable "strTargetNetID".
Under the “General” section, you will find the information for the EtherCAT address, which will be written into the variable "uiEthercatAddr".
The name “ethercatmaster” is assigned by the CtrlX when the EtherCAT Master feature is installed and used.
The remaining elements are the IO-Link index and sub-index, along with the declaration of the function block of type IL_ECATAoeRead named "fbIOLinkRead". Here is what the code looks like:
Please do not be confused by the value "TargetPort", as it is the same as the "SlaveAddress". This value simply indicates the port to which your sensor is connected: 1001 = port 1, 1002 = port 2, etc.
The value "IndexGroup" is define by AOE which means "read a specific value".
IndexGroup = 0x0000F302 for reading the content of the parameter.
The calculation for the "IndexOffset" is provided by the PLC manufacturer as an example, so we should adhere to it. We will read index 16 (vendor name).
Here it is for easy copy-pasting:
IndexOffset:=(16#FFFF0000 AND SHL(ANY_TO_UDINT(wIoLinkIndex), 16)) OR (16#000000FF AND ANY_TO_UDINT(byIoLinkSubIndex))
After executing the function block, you can see the following content in the variable "arrData":
And as every programmer at SICK knows, the data reads “SICK AG” (when it is retrieved from a SICK sensor).