| | |
| | | default: |
| | | break; |
| | | } |
| | | Thread.sleep(500); |
| | | Thread.sleep(400); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | result = true; |
| | | log.info("输送线plc连接成功 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | } else { |
| | | log.info("输送线plc连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | log.error("输送线plc连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | } |
| | | siemensS7Net.ConnectClose(); |
| | | return result; |
| | |
| | | |
| | | @Override |
| | | public void close() { |
| | | |
| | | siemensS7Net.ConnectClose(); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | |
| | | devpThread.read(); |
| | | // 写 |
| | | StaProtocol staProtocol = devpThread.getStation().get(1); |
| | | staProtocol.setWorkNo((short) 9999); |
| | | staProtocol.setStaNo((short) 100); |
| | | staProtocol.setWorkNo((short) 222); |
| | | staProtocol.setStaNo((short) 2); |
| | | staProtocol.setAutoing(false); |
| | | staProtocol.setEmptyMk(false); |
| | | staProtocol.setEmptyMk(true); |
| | | staProtocol.setInEnable(true); |
| | | devpThread.write(staProtocol); |
| | | System.out.println("----------------------------------------"); |
| | | // 读 |