If I try to read a DI on a device that is OFFLN, my Karel program throws INTP-347 (Read I/O failed) with an underlying cause of PRIO-104 (Device is off-line). I'd like to ignore this error and continue program execution or detect that the device is offline before attempting to read the DI. I already detect if the DI is not assigned using GET_PORT_ASG, which works well.
Is there a way to determine if a DIO device is offline before reading it? Either in Karel or TP code.?
Is there a way to continue execution after receiving this error? I tried using a condition handler but it does not work. Here is the code for that.
Code
CONDITION[OFFLINE_CH]:
WHEN ERROR[13104] DO
WHEN ERROR[12347] DO
NOMESSAGE
NOPAUSE
NOABORT
CONTINUE
ENDCONDITION
ENABLE CONDITION[OFFLINE_CH]
FOR i = 1 TO DI_COUNT DO
IF assigned(PORT_TYPE_DI, i) THEN
dis[i] = DIN[i]
ENDIF
ENDFOR
Display More
Does anybody have ideas to solve this?