FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
Dear Community User! We are updating our platform to a new
system.
Read more: Important
information on the platform change.
09-02-2022 12:08 PM
Hello,
I'd like to write S-0-0141 'Engine-Type' / 'Name' for a connected drive (IndraDrive MPB20) via EtherCat.
When using IL_ECATSoeWrite like this:
WriteText:='AKM24D'; //WriteText : STRING;
fbIL_ECATSoeWrite(
Execute:= TRUE,
Done=> ,
Active=> ,
Error=> ,
ErrorID=> ,
ErrorIdent=> ,
ClientId:= ,
MasterName:= ,
AddressType:= ,
SlaveAddress:= 1004,
DriveNo:= ,
Element:= ,
Idn:= IL_ECATSOEIdnCoding(SOE_S_PARAM,0,141),
SizeOfValue:= SIZEOF(WriteText),
ValueAdr:= ADR(WriteText),
Timeout:= , );
This ends up in an 'ACCESS_ERROR'
When using an integer for WriteText (between 0..9) there is no error, but the result, what is written into parameter, is complete wrong (for example it is 4D. Using more than 1 integer charakter ends up with 'ACCESS_ERROR' as well.
Because it works with one charakter, there is no ACCESS - issue! And no issue with the FB.
So what's wrong?
Thanks
Solved! Go to Solution.
09-05-2022 08:37 AM
Hello @alink,
please check out the example shown in "IL_ECATSoeRead" and use the data type "IL_ST_SOE_STRING".
Kind regards
09-05-2022 08:57 AM - edited 09-05-2022 11:19 AM
I adapted the "CXA_EtherCatMaster -> AcyclicCommunication -> SoE -> _Examples -> Example_IL_ECATSoeWrite" example to your needs. We will add it to the online and library documentation:
PROGRAM Write_StringParameter
VAR
fbECATSoeWrite : IL_ECATSoeWrite ;
WriteText: IL_ST_SOE_STRING;
strText: STRING(255):='AKM24D';
MaxLength: UINT := 0;
ActLength: UINT := 6;
bExecute: BOOL;
strMasterName : STRING := 'ethercatmaster';
END_VAR
WriteText.Text := strText;
WriteText.MaxLength := MaxLength; //not relevant for writing
WriteText.ActLength := LEN(strText); //number of bytes/letters of string
fbECATSoeWrite.Execute := bExecute;
fbECATSoeWrite.MasterName := ADR(strMasterName);
fbECATSoeWrite.SlaveAddress := 1001;
fbECATSoeWrite.Idn := IL_ECATSOEIdnCoding(SOE_S_PARAM,0,141);
fbECATSoeWrite.ValueAdr := ADR(WriteText);
fbECATSoeWrite.SizeOfValue := WriteText.ActLength + SIZEOF(WriteText.MaxLength) + SIZEOF(WriteText.ActLength);
fbECATSoeWrite();
IF TRUE = fbECATSoeWrite.Done THEN
; // FB finished .
END_IF
IF TRUE = fbECATSoeWrite.Error THEN
fbECATSoeWrite.ErrorID;
fbECATSoeWrite.ErrorIdent.Table;
fbECATSoeWrite.ErrorIdent.Additional1;
fbECATSoeWrite.ErrorIdent.Additional2;
; // Error handling
END_IF
09-05-2022 11:03 AM
Great, thanks, it's working now.
It's a bit hard to find if it is just to find within "Examples"
09-05-2022 11:12 AM - edited 09-05-2022 11:16 AM
Which version of the library are you using? It is present in 1.12.8.0 that is part of the official long term service version.
The example has to be searched in the library manager directly as it is functional code and not an own function block.
09-05-2022 11:41 AM - edited 09-05-2022 11:43 AM
Ethercat libary 1.16.
It is available, the issue I had/have is that the function "IL_ST_SOE_STRING" is located inside the "Example" - folder instead directly in SoE or Data Types.
Now, it's just an issue because of the ordering (IMO) but not an working problem anymore, so everything is fine 🙂