-> Hier kostenlos registrieren
Hello
i am writing to a drive parameter through COE using a standard twincat function Fb_EcCoeSdoWrite. I have created a function which scans the all the drives i.e ethercat slaves from the network and writes to each slave parameter with its correspoding slave address. it writes in all slave parameters when i declare these as array e.g.
Fb_EtherCatWritePara:ARRAY [0..MaxSlaves] OF FB_EcCoESdoWrite; (MaxSlaves :=255)
but as it takes too much memory size,i want to write all slaves parameter just using a single instance of this function block and when i do like that it executes sometimes only the slave parameter which has the odd number index in a for loop. I also have changed the task cycle time to slow but its of no use. The following is my programm to write the sdo data in the slave
FOR _iWrite:=0 TO ScannedSlaves-1 DO
_Fb_EtherCatWritePara(
sNetId:=strNetID,
nSlaveAddr:=_arrScannedDevices[_iWrite].nAddr,
nIndex:=_Windex ,
nSubIndex:=0,
pSrcBuf:=ADR(_arrScannedDevices[_iWrite].sName),
bExecute:=TRUE,
cbBufLen:=SIZEOF(_arrScannedDevices[_iWrite].sName),
tTimeout:=T#5S
);
IF NOT _Fb_EtherCatWritePara.bBusy THEN
_Fb_EtherCatWritePara(bExecute:=FALSE);
END_IF
END_FOR
_arrScannedDevices is a structure variable with slave device description which is scanned from the slave config data.
With single instance from the function block Fb_EcCoeSdoWrite it should work but its not what is desired.
Thanks and regard
as17050
i am writing to a drive parameter through COE using a standard twincat function Fb_EcCoeSdoWrite. I have created a function which scans the all the drives i.e ethercat slaves from the network and writes to each slave parameter with its correspoding slave address. it writes in all slave parameters when i declare these as array e.g.
Fb_EtherCatWritePara:ARRAY [0..MaxSlaves] OF FB_EcCoESdoWrite; (MaxSlaves :=255)
but as it takes too much memory size,i want to write all slaves parameter just using a single instance of this function block and when i do like that it executes sometimes only the slave parameter which has the odd number index in a for loop. I also have changed the task cycle time to slow but its of no use. The following is my programm to write the sdo data in the slave
FOR _iWrite:=0 TO ScannedSlaves-1 DO
_Fb_EtherCatWritePara(
sNetId:=strNetID,
nSlaveAddr:=_arrScannedDevices[_iWrite].nAddr,
nIndex:=_Windex ,
nSubIndex:=0,
pSrcBuf:=ADR(_arrScannedDevices[_iWrite].sName),
bExecute:=TRUE,
cbBufLen:=SIZEOF(_arrScannedDevices[_iWrite].sName),
tTimeout:=T#5S
);
IF NOT _Fb_EtherCatWritePara.bBusy THEN
_Fb_EtherCatWritePara(bExecute:=FALSE);
END_IF
END_FOR
_arrScannedDevices is a structure variable with slave device description which is scanned from the slave config data.
With single instance from the function block Fb_EcCoeSdoWrite it should work but its not what is desired.
Thanks and regard
as17050