FB_IEC870_5_101TProtocol
The communication block FB_IEC870_5_101TProtocol implements the transfer procedures of the link layer according to the IEC 60870-5-1 and IEC 60870-5-2 standards.
In the event of a protocol error an associated error code is issued at the function block output and the data transfer is interrupted. The data exchange can be reactivated by calling the INIT task. The TX/RX data buffers are reset. The communication block expects a TX/RX data buffer variable. This variable must be transferred to the block via VAR_IN_OUT.
The function block features the following tasks:
- INIT (initializes the function block);
Protocol configuration
The communication block has a structured protPara variable. Protocol parameters such as timeout times or connection addresses etc. can be configured via this variable
VAR_IN_OUT
VAR_IN_OUT
hSerial : T_HSERIALCTRL;
buffer : ST_IEC870_5_101TBuffer;
END_VAR
hSerial: Connection handle to FB_IEC870_SerialLineCtrl.. The data to be sent and received are excahged with the FB_IEC870_SerialLineCtrl function block.
buffer: TX/RX data buffer.
VAR_INPUT
VAR_INPUT
protPara : ST_IEC870_5_101ProtocolParams;
bOutDbg : BOOL;
END_VAR
protPara: IEC 60870-5-101 protocol parameters
bOutDbg: Activates/deactivates the debug output of the frames in the TwinCAT XAE->"Error List" window.
VAR_OUTPUT
VAR_OUTPUT
bError : BOOL;
nErrID : UDINT;
eState : E_IEC870_5_101SerialLinkState := eSERIALLINK_DISCONNECTED;
END_VAR
bError: This output is switched to TRUE if an error occurs during data transfer.
nErrID: Returns an error code if the bError output is set.
eState: Connection status to the other communication partner.
Examples (Low-Level Interface):
Requirements
Development environment |
Target system type |
PLC libraries to be linked (category group) |
---|---|---|
TwinCAT v3.1.4012.0 |
PC oder CX (x86, x64, ARM) |
Tc2_IEC60870_5_10x (Communication->IEC60870) |