Twincat SdoWrite data to ethercat slaves

as17050

Level-1
Beiträge
5
Reaktionspunkte
0
Zuviel Werbung?
-> 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
 
The FB_EcCoESdoWrite is an acyclic call. Between the rising edge and the result you are not allowed to trigger it with different parameters again.
Generally, there is also a limit of the number of parallel instanzen you can execute (ADS-limitation, should be about 80 active instances as far as I recall).

There is no solution to your wish of a super SDO-Write block.
If you sequentialize the work you have to take into account the required time (in general you need 3 cycles before you can re-start the block after having it triggered the last time). By 255 calls it will take about 255*3*cycletime..

Guga
 
Zurück
Oben