| | |
| | | List<String> addressList21 = Arrays.asList(config.getProperty("PlcIO.State").split(",")); |
| | | List<Boolean> plclist = S7control.getinstance().readBits(addressList21); |
| | | // System.out.println("急停"+S7control.getinstance().ReadBits("DB10.0.5", 1)); |
| | | // int index = 0; |
| | | // for (String item : addressList21) { |
| | | // System.out.println("地址:"+item+"值"+plclist.get(index)+"下标"+index); |
| | | // index++; |
| | | // } |
| | | |
| | | if (plclist != null) { |
| | | // 将获取的布尔类型转换为整数类型 |
| | | List<Integer> Intlist = new ArrayList<>(); |
| | | // System.out.println("长度"+plclist.size()); |
| | | for (Boolean value : plclist) { |
| | | if (value != null) { |
| | | Intlist.add(value == true ? 0 : 1); |
| | | }else { |
| | | Intlist.add(1); |
| | | System.out.println("null"); |
| | | } |
| | | |
| | | } |