FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
Dear Community User! We have started the migration process.
This community is now in READ ONLY mode.
Read more: Important
information on the platform change.
05-30-2022 10:32 AM
Hi,
I am looking for the MB_WriteList parameter for ethercat. Is there something already implemented for ctrlX core?
Best regards by Mauro Riboni
Solved! Go to Solution.
05-30-2022 11:45 AM - edited 05-30-2022 11:46 AM
All available acyclic communication functions are part of the CXA_EthercatMaser library:
05-30-2022 11:49 AM
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?
06-21-2022 05:39 PM - edited 06-22-2022 03:36 PM
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).
Declarations
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;
07-05-2022 05:08 PM - edited 07-05-2022 05:10 PM
Hi,
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
07-06-2022 11:31 AM
Working fine on my side. Please check name of your EtherCat master and data size of the parameter.
PROGRAM Write_param
VAR
fbECATSoeWrite: IL_ECATSoeWrite;
strMasterName: STRING := 'ethercatmaster';
/// Example A : write '4 Byte Parameter' (S-0-0052)
udiWriteValue: UDINT := 16#1234;
bExecute: BOOL;
END_VAR
// 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);
fbECATSoeWrite();
IF TRUE = fbECATSoeWrite.Done THEN
; // FB finished .
END_IF
IF TRUE = fbECATSoeWrite.Error THEN
; // Error handling
END_IF
07-06-2022 11:52 AM
Hi,
Which firmware version are you using? The same code is working fine on indradrive so the master name should be correct.
07-06-2022 12:08 PM
I am using a ctrlX CORE with 1.12.7 and a ctrlX DRIVE with AXS-3V08.00
07-06-2022 07:04 PM
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.
07-20-2022 08:42 AM
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.