Writing local output on IndraDrive P-0-0304

Hello,

I'd like to write the local output of an IndraDrive. Reading local input P-0-0302 works fine, but when wirting output P-0-0304 there's always an ACCESS_ERROR.

---

VAR

fbAIL_ECATSoeWrite: IL_ECATSoeWrite;
iValueLocOutput: UDINT;
bLocBit7: BOOL;

END_VAR

Code:

IF NOT fbAIL_ECATSoeWrite.Done AND NOT fbAIL_ECATSoeWrite.Error THEN
fbAIL_ECATSoeWrite(Execute:= TRUE,MasterName:= ADR('ethercatmaster'),AddressType:= 1004,Idn:=IL_ECATSOEIdnCoding(SOE_P_PARAM,0,304),Element:= SOE_ELEMENT_OPDATA,SizeOfValue:= SIZEOF(iValueLocOutput),ValueAdr:=ADR(iValueLocOutput) ,);


ELSIF fbAIL_ECATSoeWrite.Done OR fbAIL_ECATSoeWrite.Error THEN
fbAIL_ECATSoeWrite(Execute:= FALSE,MasterName:= ADR('ethercatmaster'),AddressType:= 1004,Idn:=IL_ECATSOEIdnCoding(SOE_P_PARAM,0,304),SizeOfValue:= SIZEOF(iValueLocOutput),ValueAdr:= ADR(iValueLocOutput) ,);
END_IF

iValueLocOutput.0 := bLocBit7;

---

bLocBit7 is a BOOL which can be set with visu

Local output is bit 0 of P-0-0304. Writing this with ctrlX-Drive is working directly is working. So the issue is with Ethercat, I think.

Best reply by CodeShepherd

The error code tells us following as you can see in the online documentation.

"0C880007
Ecat: Invalid argument

Cause/Remedy 1: Cause: A function with one or multiple invalid argument(s) was called. Remedy: Check the arguments/parameters used and compare them to the documentation of the interface."

So did you try to implement the improvements I wrote my post before? At least the AddressType you give to the function block does not fit (and is not needed) but the SlaveAdress input missing.

View original
7 replies