| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | private int getIndexFromAddress(String address) { |
| | |
| | | public List<Short> ReadWord(String address, int count) { |
| | | if (s7PLC == null) |
| | | return null; |
| | | |
| | | List<String> addresslist = GetAddressList(address, count, 16); |
| | | try { |
| | | return s7PLC.readInt16(addresslist); |
| | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | public byte[] Readbyte(String address, int count) { |
| | | byte[] byt=new byte[count]; |
| | | int wordcount=((count%2==0)?count/2:count+1); |
| | | List<Short> word=ReadWord(address,wordcount); |
| | | |
| | | return byt; |
| | | } |
| | | /** |
| | | * 按指定的地址 读取byte结果集 |
| | | * |
| | |
| | | } |
| | | return addresslist; |
| | | } |
| | | public void writeString(String addr,String data) { |
| | | s7PLC.writeString(addr,data); |
| | | } |
| | | |
| | | public String readStrings(String addr) { |
| | | return s7PLC.readString(addr); |
| | | } |
| | | } |