How to tell if DIO is OFFLINE

  • 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.

    Does anybody have ideas to solve this?

  • Is it possible for you to leave a DI ON all the time and UALM in BG Logic if it ever goes off? Simplest way I can think of.

    edit: or maybe check the port value with IF UNINIT and see how that handles offline conditions? Never tried :grinning_squinting_face:

    Edited once, last by CSaunders: another thought ().

  • Thanks for the ideas, CSaunders. The first idea is not practical for my case. I'm actually reading all the DIs in a loop to see if any have changed. I tried the UNINIT idea, but it didn't compile.

  • If it is an I/O block or similar, I couldn't say.

    But if it is another machine/PLC you can utilize a heartbeat signal. their heartbeat stops--no I/O

    robot heartbeat is setup in Menu/I-O/cell interface/heartbeat. that's a heartbeat out, just assign a DO, and cycle power.

  • Fanuc Tech Support gave me the solution. The GET_PORT_VAL Built-In Procedure will return a no-zero status if there is an error, in this case the error is PRIO-104 (Device is off-line).

Advertising from our partners