Fanuc does this VIA the PMC ladder. You would take X2.1 and write to a G-coil. So you would write normally open X2.1 turning on G54.0 coils. Then the macro would look at the status of G54.0 by stating IF #1000 EQ 1 GOTO 100 where 100 would be a NET number in the macro program. Assuming you have a 16/18/21 CNC type.