Felix Posted July 6, 2012 Share Posted July 6, 2012 When assigning EtherCAT slaves to the ECAT.IO structure I have run into problems when the resulting IO structure has non continuous indexes. The following code fragment will result in a configuration which works perfectly. I can observe the value of ECAT[0].IO[1].Data changing as expected. However, if I change ioIndex to 10 prior to initializing the second slave, as indicated by the comment below, ECAT[0].IO[10].Data does not update. master = 0; ioIndex = 0; ECAT[master].IO[ioIndex].Slave = 0; ECAT[master].IO[ioIndex].Index = $6000 ECAT[master].IO[ioIndex].SubIndex = $1 ECAT[master].IO[ioIndex].BitLength = 16 ECAT[master].IO[ioIndex].Input = 1; ioIndex = 1; //CHANGE THIS TO 10 for second run i = 0; while( i < 2) { ECAT[master].IO[ioIndex].Slave = 3; index = $6000 + i*$10; ECAT[master].IO[ioIndex].Index = index; ECAT[master].IO[ioIndex].SubIndex = $11; ECAT[master].IO[ioIndex].BitLength = 32; ECAT[master].IO[ioIndex].Input = 1; ioIndex = ioIndex + 1; i = i + 1; } ECAT[master].IOCount = ioIndex; call timer(0.1); ECAT[master].Enable = 1; Is it possible to assign slaves to ECAT.IO in such a manner that the resulting ECAT.IO structure is not continuous or am I missing something? I am currently working on an initialization routine for a project with about 100 EtherCAT modules and want to make sure I understand the mapping of slaves to ECAT.IO before getting too far. Thank you, Felix Link to comment Share on other sites More sharing options...
hbausley Posted July 9, 2012 Share Posted July 9, 2012 No it is not. The resulting ECAT.IO structure is not continuous. ECAT[master].IOcount dictates how many I/O you want serviced. Link to comment Share on other sites More sharing options...
Recommended Posts