Reading the link status
Download: https://github.com/Beckhoff/TF6230_Samples/tree/main/TcPrpLinkStatusSample
In this sample the TcPrpAdapterLinkStatus structure is queried by TwinCAT PRP module to evaluate the link status of the two RT-Ethernet Adapters used. In this way, it can be determined whether there is an active connection on the respective adapter to the next node in the network, such as to a switch. A single active connection should be sufficient to continue to reach the other devices in the PRP network. However, the inactive connection should already be an indication of an error in the network.
- To put the sample into operation, the adapters for the two RT-Ethernet Adapters must first be configured.
- 1. At Adapter, set the compatible Network Adapter on both the X000 and X001 I/O devices.
- 2. On the TwinCAT PRP module, here with the name PRP, select the two RT-Ethernet Adapters at Parameters (Init) for the LAN-A and LAN-B
- 3. In the PLC project an interface pointer to the TwinCAT PRP module is used. Configure this interface pointer with the Symbol Initialization to select and assign the Object ID from the TwinCAT PRP module.
- 4. Activate the TwinCAT project and start the PLC project.
- Both adapters should indicate an active link by having the variables bLinkA and bLinkB both TRUE.
- For example, if you now disconnect the Ethernet cable from the adapter X001, this is immediately detected and indicated by a change of the variable bLinkB to FALSE.