Can you know the state of EtherNet/IP?
I found that this test code works, but don't try to use IOBusStart!
I think there is a reset method for EIP.f
Q: is there a simpler or more-straightforward way? (thanks)
Code
VAR num nBusState := 0;
VAR busstate bstate;
VAR string bname := "EtherNetIP";
nBusState := 0;
!Don't uncomment this line:
!IOBusStart bname; <------ FYI, BLOWS UP HERE IF THIS LINE IS PRESENT ----------<<<<<
!Test Physical...
IOBusState bname, bstate \Phys;
TEST bstate
CASE IOBUS_PHYS_STATE_RUNNING:
! Possible to access the signals on the bus
nBusState := 1;
DEFAULT:
! Actions for not up and running bus
nBusState := 0;
ENDTEST
!Test Logical...
IOBusState bname, bstate \Logic;
TEST bstate
CASE IOBUS_LOG_STATE_STARTED:
! The bus is started
nBusState := nBusState + 1;
DEFAULT:
! Actions for stopped IBS bus
nBusState := 0;
ENDTEST
IF nBusState = 2 THEN
SetGO ROB2PLC_Var1, 1;
ENDIF
Display More