Function to read the information of the device connected in EtherCAT line.
Instruction takes a long time. It must be called continuously until it is finished.
|
i32 ecat_probe (i32 nEth, stru_ecat_probe stru [, string devName=""])
|
|
EtherCAT channel number
|
|
Structure of type stru_ecat_probe that contains the information
|
|
String where the device name is saved. (optional, default "")
|
|
Returns:
|
|
1
|
Operation completed
|
0
|
Running operation
|
-1
|
Illegal EtherCAT Line Index
|
-2
|
Ethernet channel is not EtherCAT
|
-3
|
Illegal topic
|
-4
|
No device in the selected location
|
-5
|
EtherCAT line not configured correctly
|
-6
|
EtherCAT cable disconnected
|
-7
|
Internal sw error. (contact Robox)
|
|
|
Task
|
|
RC3E 33.7.1-beta0
|
|
|
Example of use:
$LIT N_MAX_ECAT_DEV 100
stru_ecat_probe ecatDev[1+N_MAX_ECAT_DEV]
string devName[1+N_MAX_ECAT_DEV][64]
int nDev
int esitoEP
string appoName[64]
...
...
FUNCTION void hndEcatProbe(int nEth)
int howMany = 0
nDev = 1
do
ecatDev[ndev].phase = 0
ecatDev[ndev].n_Pos = nDev
esitoEp = 0
while(esitoEp = 0)
esitoEp = ecat_probe(nEth, ecatDev[nDev], apponame)
end_while
if(esitoEp = 1)
howMany = ecatDev[ndev].how_many
devName[nDev] = apponame
nDev = nDev+1
endif
end_do_while((esitoEp =1) and (nDev <= N_MAX_ECAT_DEV))
if(nDev = 1)
nDev = 0
else
if(nDev > howMany)
nDev = howMany
endif
endif
END_FUN
|
|