cancel
Showing results for 
Search instead for 
Did you mean: 
SOLVED

MB_WriteListParameter already available?

MB_WriteListParameter already available?

MauroRiboniMX
Contributor

Hi,

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

MauroRiboniMX_0-1653899398311.png

 

Best regards by Mauro Riboni

9 REPLIES 9

CodeShepherd
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).

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;

tommorassini_0-1655825828676.png

 

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: 

MauroRiboniMX_0-1657032607903.png

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

MauroRiboniMX_1-1657032948555.png

The same code works instead using an indradrive. 

MauroRiboniMX_2-1657033308419.png

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
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

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

Hi, 

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.

tommorassini_0-1657126686731.png

 

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. 

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist