FB_IEC870_5_101TProtocol
From product version: TwinCAT PLC Library IEC60870-5-101 Substation v2.0.2 and higher
The FB_IEC870_5_101TProtocol communication block implements the transmission procedures of the connection layer according to IEC 60870-5-1 and IEC 60870-5-2 standard. 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. E.g. the TX/RX data buffers are reset. The communication block expects a TX/RX data buffer variable and a connection handle to FB_IEC870_SerialLineCtrl. These variablen 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; (* Serial link control handle *)
buffer : ST_IEC870_5_101TBuffer; (* TX/RX data buffer *)
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; (* IEC60870-5-101 protocol parameters *)
bOutDbg : BOOL; (* Enable/disable debug output *)
END_VAR
protPara: IEC60870-5-101protocol parameters
bOutDbg:: Activates/deactivates the debug output of the frames in the TwinCAT System Manager logger view.
VAR_OUTPUT
VAR_OUTPUT
bError : BOOL;
nErrID : UDINT;
eDTState : E_IEC870_5_101SerialLinkState := eSERIALLINK_DISCONNECTED; (* Data transfer state *)
ND_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: status of the data exchange to the master
Example:
Sample projects: IEC60870-5-101 Serial Link Interface
Requirements
Development Environment | Target System Type | PLC Libraries to include |
---|---|---|
TwinCAT v2.10.0 Build >= 1301 | PC or CX (x86) | TcIEC870_5_101Link.Lib ( Standard.Lib; TcBase.Lib; TcSystem.Lib; TcUtilities.Lib; TcIEC870_5_101.Lib; COMlibV2.Lib; are included automatically ) |