| Issue | Likely Cause | Fix |
|-------|--------------|-----|
| TCON error 7001 | Connection ID already used | Change ID or restart CPU |
| No data received | ActiveEst wrong | Server = false, Client = true |
| TSEND busy forever | Send buffer > max segment | Reduce length to 1460 bytes |
| Disconnect on heavy load | Keep-alive missing | Add TDISCON + reconnect logic |
| CPU stops after online change | Optimized DB access conflict | Use non-optimized DB for raw buffers |
SCL implementation inside FB:
// TCON - Establish connection IF NOT tconConnect AND NOT tconDone AND NOT disconnectReq THEN tconConnect := true; END_IF;TCON( REQ := tconConnect, ID := 1, DONE => tconDone, BUSY => tconBusy, ERROR => tconError, STATUS => tconStatus, CONNECT := tconParams );
// TSEND - Send data when buffer changes IF tconDone AND sendRequest THEN TSEND( REQ := sendRequest, ID := 1, LEN := 100, DATA := sendBuffer, DONE => sendDone, ERROR => sendError ); END_IF; s7 can opener tia portal top
// TRCV - Receive data TRCV( EN_R := true, ID := 1, LEN := 100, DATA := recvBuffer, NDR => recvNew, ERROR => recvError, RCVD_LEN => recvLen );
// TDISCON - Disconnect IF disconnectReq THEN TDISCON( REQ := true, ID := 1 ); disconnectReq := false; tconDone := false; END_IF;
Create the following screens:
Unlike the Classic version where you might drag and drop blocks, the TIA version often requires a specific workflow because TIA Portal stores data differently (inside a SQL-based project database).
Typical Workflow found in the manual:
Local tags (static):
| Name | Data Type | Initial | |------|-----------|---------| | tconParams | TCON_IP_V4 | – | | tconConnect | Bool | False | | tconDone | Bool | False | | tconBusy | Bool | False | | tconError | Bool | False | | tconStatus | Word | – | | tsendReq | Bool | False | | trcvReq | Bool | False | | disconnectReq | Bool | False | | sendBuffer | Array[0..99] of Byte | – | | recvBuffer | Array[0..99] of Byte | – |