CODESYS - the IEC 61131-3 automation software

TwinCat - EL6001 Serial Communication
Page 1 of 1

Author:  fscotto_ch [ Wed Mar 20, 2019 2:05 pm ]
Post subject:  TwinCat - EL6001 Serial Communication

Hi All,
I am new to TwinCat and PLC programming and I am working towards integrating it in my current project. I am using a CX5120 and I want to use an EL6001 module to send string commands to a peristaltic pump through an RS232 connector. I have been through a series of tutorials and example files but I have been unable to establish any communication with the device. I hope this forum will help me shed some light on the matter.
I have linked the in/out Data22B to the EL6001 Inputs/Outputs but both the write and receive string commands give no results although I have no errors warnings. Is there a specific setup of the EL6001 module that needs to be executed? Or can you please send any suggestion? Thanks in advance.

Here is the VAR list:

   (* I/O variables for a EL6001 terminal*)
   stIn_EL6001 AT %I*    : EL6inData22B; (* linked to the EL6001 Inputs/Status*)
   stOut_EL6001 AT %Q*    : EL6outData22B;(* linked to the EL6001 Outputs/Ctrl *)
   (* background communication with the EL6001 terminal *)
   fbEL6001Ctrl       : SerialLineControl;
    bEL6001CtrlError   : BOOL;
    eEL6001CtrlErrorID : ComError_t;
   clearBuffer : ClearComBuffer;
   writeValue : SendString;
   readValue : ReceiveString;
   sReceivedString : STRING;

And the program:

writeValue(SendString := '1H$R' , TXbuffer := GVL.TxBufferEL);
readValue(ReceivedString := sReceivedString, RXbuffer := GVL.RxBufferEL);

IF writeValue.Error = 0 THEN
   (* background communication with the EL6001 terminal *)
   pComIn:= ADR(stIn_EL6001),
   pComOut:= ADR(stOut_EL6001),
   SizeComIn:= SIZEOF(stIn_EL6001),
   Error=> bEL6001CtrlError,
   ErrorID=> eEL6001CtrlErrorID,
   TxBuffer:= GVL.TxBufferEL,
   RxBuffer:= GVL.RxBufferEL );

Author:  wollvieh [ Sat Mar 30, 2019 11:04 am ]
Post subject:  Re: TwinCat - EL6001 Serial Communication

Do you call the background Communication in a fast Task Sa described in the Beckhoff Dokumentation?
And what about Hardware Handshaking RTS, CTS,

Page 1 of 1 All times are UTC+01:00
Powered by phpBB® Forum Software © phpBB Limited