Guest DavisG Posted April 6, 2009 Share Posted April 6, 2009 This is a plc to reset comms after a hang - also can be used to suspend comms while other devices come up. Some devices will hang on startup if you begin comms before they are ready (Turck I/O, or very old Phoenix stuff) [code] m1658->x:$ffffc2,3 ;modbus_ready m1659->x:$ffffc2,4 ;modbus_disable #define m_modbus_ready m1659 #define m_modbus_disable m1658 OPEN PLC 10 CLEAR dis plc 2..31 dis plcc 0..31 del look ;turn on Turck power m_output_io_power = 1 I_cs1_timer1 = 30000* con_msec While ( i_cs1_timer1 > 0) ;this loop keeps modbus disabled m_modbus_disable = 1 ;set cmd list disable bit m_modbus_ready = 0 ; reset PMAC_READY bit endwhile ;now turn on modbus m_modbus_disable = 0 ;reset cmd list disable bit m_modbus_ready = 1 ; set PMAC_READY bit m_output_io_handshake = 1 DISABLE PLC10 CLOSE [/code] Davis Link to comment Share on other sites More sharing options...
Recommended Posts