| | |
| | | public class S7object extends Thread { |
| | | public S7control plccontrol; // PLC通讯类实例 |
| | | private EPlcType plcType = EPlcType.S1200; // 西门子PLC类型 |
| | | private String ip = "192.168.10.1"; // plc ip地址 |
| | | private String ip = "192.168.30.100"; // plc ip地址 |
| | | private int port = 102; // plc 端口号 |
| | | |
| | | |
| | |
| | | private S7object() { |
| | | if (plccontrol == null) { |
| | | plccontrol = new S7control(plcType, ip, port, 0, 0); |
| | | |
| | | String PlcCacheGlass=S7object.class.getResource("/JsonFile/PlcdownGlass.json").getPath(); |
| | | //log.info(PLCAutoMes.class.getResource("").getPath()); |
| | | String PlcCacheGlass = System.getProperty("user.dir") + "/JsonFile/PlcdownGlass.json"; |
| | | PlcMesObject = InitUtil.initword(PlcCacheGlass); |
| | | } |
| | | } |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | byte[] getplcvlues= plccontrol.ReadByte(PlcMesObject.getPlcAddressBegin(),PlcMesObject.getPlcAddressLength()); |
| | | byte[] getplcvlues = plccontrol.readByte(PlcMesObject.getPlcAddressBegin(), PlcMesObject.getPlcAddressLength()); |
| | | PlcMesObject.setPlcParameterList(getplcvlues); |
| | | |
| | | } |