Showing results for 
Search instead for 
Did you mean: 

MB_WriteListParameter already available?

MB_WriteListParameter already available?



I am looking for the MB_WriteList parameter for ethercat. Is there something already implemented for ctrlX core?



Best regards by Mauro Riboni


Community Moderator
Community Moderator

All available acyclic communication functions are part of the CXA_EthercatMaser library:

CXA_EthercatMaster libraryCXA_EthercatMaster library

Hi thanks,

I know that those are present but, how to read/write a list parameter?

Are those functions working also with List parameters and either 16 and 32 bit parameters?

As I see it ctrlX PLC Engineering doesn't have all the separate Parameter Read/Write Function Blocks like IndraLogic had (i.e. MB_ReadParameter, MB_ReadStringParameter, MB_ReadListParameter, etc.).  All Read/Write FBs are rolled into one FB (i.e. IL_ECATSoeRead, IL_ECATSoeWrite).

I have tested reading List Parameter P-0-0300 (see Declarations & attached picture below).


Axis_1_Read_Diagnostic_Message_FB: IL_ECATSoeRead;
Axis_1_Read_Diagnostic_Message_Done: BOOL;
Axis_1_Read_Diagnostic_Message_Master_Name: STRING := 'ethercatmaster';
Axis_1_Read_Diagnostic_Message_Address_Type: IL_ECAT_ADDRESS_TYPE;
Axis_1_Read_Diagnostic_Message_Slave_Address: UINT := 1001;
Axis_1_Read_Diagnostic_Message_Drive_No: BYTE;
Axis_1_Read_Diagnostic_Message_Idn: WORD := IL_ECATSoeIdnCoding(SOE_S_PARAM, 0, 95); // := S-0-0095;
Axis_1_Read_Digital_Inputs_Assignment_List: ARRAY[0..10] OF UINT;
Axis_1_Read_Diagnostic_Message: IL_ST_SOE_STRING;
Axis_1_Read_Diagnostic_Message_Timeout: TIME := TIME#500MS;




Really thanks!! I tried your example and it is working (Thanks) Now i would like to write a normal parameter like the S-0-0052 but there is something that i am missing in the function block. I started from the example: 


I always get an "ACCESS_ERROR" and i dnon't know what i have misconfigured:


The same code works instead using an indradrive. 


Is there something i need to change? 


Mauro Riboni 




Working fine on my side. Please check name of your EtherCat master and data size of the parameter.

PROGRAM Write_param
	fbECATSoeWrite: IL_ECATSoeWrite;
	strMasterName: STRING := 'ethercatmaster';
	/// Example A : write '4 Byte Parameter' (S-0-0052)
	udiWriteValue: UDINT := 16#1234;
	bExecute: BOOL;
// Example A : write '4 Byte Parameter' (S-0-0052)
fbECATSoeWrite.Execute      := bExecute;
fbECATSoeWrite.MasterName   := ADR(strMasterName);
fbECATSoeWrite.SlaveAddress := 1001;
fbECATSoeWrite.Idn          := IL_ECATSoeIdnCoding(SOE_S_PARAM,0,52); // := S-0-0052
fbECATSoeWrite.ValueAdr     := ADR(udiWriteValue);
fbECATSoeWrite.SizeOfValue  := SIZEOF(udiWriteValue);
IF TRUE = fbECATSoeWrite.Done THEN
  ; // FB finished .
IF TRUE = fbECATSoeWrite.Error THEN
  ; // Error handling

PLC write SoE S-0-0052PLC write SoE S-0-0052


Which firmware version are you using? The same code is working fine on indradrive so the master name should be correct. 


I am using a ctrlX CORE with 1.12.7 and a ctrlX DRIVE with AXS-3V08.00

I've tested this with 1.12.4 & AXS-03V06 and it works for me too.  It also works with IndraDrive.

First of all, just to rule out your PLC code...  It looks like you have the same Function Block call, one with SlaveAddress 1001 and the other with 1002.  I assume you used the same PLC Rung and simply changed the value for IndraDrive versus ctrlX DRIVE, but just to be sure you didn't copy-and-paste the Rung and now you have 2 Rungs with the same Declaration for both Function Blocks.

I believe I recall an issue with some of the Inputs to the Function Blocks where I had to leave them blank rather than assigning a Variable to them (even if I didn't set any actual value to the Variable).  It may have been this issue with the "ClientID" Input, but I can't remember for sure.  I did test my code adding the Variable like your example with it Declared as "IL_HANDLE".  It did still work, but I'm wondering if this is your problem thinking maybe you're using an older version that didn't like a Variable being mapped to this Input.

Please see the attached picture.  If I hover over the "ClientId" there's a hint stating "Do not use".

By the way, I would recommend defining your "mypos" Variable as a REAL as S-0-0052 is a REAL value.  It works either way, but I think it always makes more sense to use the proper format of parameters.



Now it is working. I tried with the same code today after i reset the ctrlX and a LoadBasic parameter on the drive. 

Maybe i had something stuck.