| | |
| | | } |
| | | s7PLC.writeMultiData(addressWrite); |
| | | } |
| | | /** |
| | | * 按指定的地址 写入多个byte |
| | | * |
| | | * @param address 地址 |
| | | * @param datas byte的值 |
| | | */ |
| | | public void WriteByte(String address, byte[] datas) { |
| | | if (s7PLC==null) |
| | | return; |
| | | // s7PLC.write(address, data); |
| | | s7PLC.writeByte(address, datas); |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 读取word结果集 |
| | |
| | | |
| | | List<String> addresslist = GetAddressList(address, count, 16); |
| | | return s7PLC.readInt16(addresslist); |
| | | } |
| | | /** |
| | | * 按指定的地址 读取byte结果集 |
| | | * |
| | | * @param address 地址 |
| | | * @param count 连续读多少个byte |
| | | * @return 结果 |
| | | */ |
| | | public byte[] ReadByte(String address, int count) { |
| | | if (s7PLC==null) |
| | | return null; |
| | | |
| | | // List<String> addresslist = GetAddressList(address, count, 16); |
| | | return s7PLC.readByte(address,count); |
| | | } |
| | | |
| | | /** |
| | |
| | | } else |
| | | return null; |
| | | |
| | | for (int i = 0; i < count; i++) { |
| | | addresslist.add(address); |
| | | for (int i = 0; i < count-1; i++) { |
| | | |
| | | int bitcurrent = bitindex + addedbit; |
| | | if (bitcurrent > 7) { |
| | |
| | | bitindex = 0; |
| | | } else |
| | | bitindex = bitcurrent; |
| | | addresslist.add(stringdatas[0] + "." + dbwindex + "." + bitindex); |
| | | |
| | | String endstr=stringdatas.length==3?"." + bitindex:""; |
| | | addresslist.add(stringdatas[0] + "." + dbwindex + endstr); |
| | | } |
| | | return addresslist; |
| | | } |