EasyManuals Logo

Beckhoff EtherCAT EL6022 User Manual

Beckhoff EtherCAT EL6022
204 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #143 background image
Commissioning
EL600x, EL602x 143Version: 4.6
Timeout:= T#1S,
DataReceived=> DataReceived,
busy=> ReceiveBusy,
Error=> ReceiveErrorID,
RxTimeout=> ReceiveTimeout );
IF DataReceived THEN
// DataReceived := FALSE;
ReceiveCounter := ReceiveCounter + 1;
IF NOT ReceiveBusy THEN
// Compare checksum
nRxChecksum := aDataRX[nDataLen];
nCalcChecksum := F_CALC_LIN_CHKSUM(pData := ADR(aDataRX), nLen := nDataLen);
IF(nRxChecksum = nCalcChecksum) THEN
// Response received - clear databuffer:
memset(ADR(LastReceivedDataBytes[1]), 0, (SIZEOF(aDataRX)-1));
// Take-over data when checksum OK:
memcpy(ADR(LastReceivedDataBytes[1]), ADR(aDataRX), (nDataLen +1));
END_IF
nState := 0;
END_IF
ELSE
Timer(IN:=TRUE, PT:=T#0.1S); // Receive-Timeout 100 ms: no data
IF Timer.Q THEN
nState := 0;
END_IF
END_IF
END_CASE
(*==================================================================
*)
Program fast task / RS232 background communication
In this example, third task should be created with as few “cycle ticks” as possible, which deals with the
background communication with the EL6001 terminal (as master).
Declaration part:
PROGRAM FAST
VAR
(* background communication with the EL6001 as Master device *)
COMportControl_MASTER: SerialLineControl;
COMportControlError_MASTER: BOOL;
COMportControlErrorID_MASTER: ComError_t;
END_VAR
Execution part:
COMportControl_MASTER(
Mode:= SERIALLINEMODE_EL6_22B,
pComIn:= ADR(COMin_EL6001_MASTER),(* I/O data; see global variables *)
pComOut:= ADR(COMout_EL6001_MASTER),(* I/O data; see global variables *)
SizeComIn:= SIZEOF(COMin_EL6001_MASTER),(* I/O data; see global variables *)
TxBuffer:= TxBuffer_MASTER,(* transmit buffer; see global variables *)
RxBuffer:= RxBuffer_MASTER,(* receive buffer; see global variables *)
Error=> COMportControlError_MASTER,(* indicating an error *)
ErrorID=> COMportControlErrorID_MASTER );(* contains the error-ID *)

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Beckhoff EtherCAT EL6022 and is the answer not in the manual?

Beckhoff EtherCAT EL6022 Specifications

General IconGeneral
BrandBeckhoff
ModelEtherCAT EL6022
CategoryI/O Systems
LanguageEnglish

Related product manuals