In our project, it is not rare to have I/O cards issues.
I wanted to have a way to check their statuses ( Eg. INIT, OP, PREOP, etc.. )
I was trying to use the GetDeviceDiagnosisInfo method from the IoConfig_Globals, but there is no info available on the Web with a simple example; does someone have a link to some tutorial or anything else ?
Kind Regards,
Andre.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Alternatively, you can iterate through the device tree to get the status of all (Ethercat) nodes. See here an example (no guarantee it works, just give as suggestion):
PROGRAMP_IO_StateVARCONSTANTuiMAX_NR_OF_TERMINALS:UINT:=100;END_VARVAR// general device diagnosis// can only be used when the Device - PLC Settings - Advanced settings - enable diagnosis for devices is enabled// this will add the DED librarycoupler:DED.INode;terminal:DED.INode;aDeviceState:ARRAY[0..uiMAX_NR_OF_TERMINALS-1]OFDED.DEVICE_STATE;uiTerminalCount:UINT;uiIndex:UINT;// for each terminal check if it implements device diagnosticsxQueryResult:BOOL;itfDevice:DED.IDevice2;xDiagAvailable:BOOL;eError:DED.ERROR;xEverythingOK:BOOL;END_VAR
In the meantime, I did some experiments and could find a way to achieve similar result.
I made some tests, removing the last card from the array, seeing the change on status.
Hi,
In our project, it is not rare to have I/O cards issues.
I wanted to have a way to check their statuses ( Eg. INIT, OP, PREOP, etc.. )
I was trying to use the GetDeviceDiagnosisInfo method from the IoConfig_Globals, but there is no info available on the Web with a simple example; does someone have a link to some tutorial or anything else ?
Kind Regards,
Andre.
You can get the state by just using the name of your node (same name as in device tree):
Alternatively, you can iterate through the device tree to get the status of all (Ethercat) nodes. See here an example (no guarantee it works, just give as suggestion):
Hi @TimvH,
In the meantime, I did some experiments and could find a way to achieve similar result.
I made some tests, removing the last card from the array, seeing the change on status.
Many thanks for your quick and extensive reply.