请你发一个例子在DB上设置/写一个位吗?
用这个我写DB的整个字节(我想)
ClientPlc.ReadArea(S7.S7AreaDB, 200, 0, 1, Buffer);
非常感谢
答案 0 :(得分:0)
byte[] data = new byte[2];
res = client.ReadArea(S7.S7AreaDB, 59001, 0, 2, data); //I want to read DB7.DBD0 (it is a real)
if (res == 0) {
retEmerg01 = S7.GetBitAt(data, 0, 0);
retEmerg02 = S7.GetBitAt(data, 0, 1);
retEmerg03 = S7.GetBitAt(data, 0, 2);
retEmerg04 = S7.GetBitAt(data, 0, 3);
retEmerg05 = S7.GetBitAt(data, 0, 4);
retEmerg06 = S7.GetBitAt(data, 0, 5);
retEmerg07 = S7.GetBitAt(data, 0, 6);
retEmerg08 = S7.GetBitAt(data, 0, 7);
retEmerg09 = S7.GetBitAt(data, 1, 0);
retEmerg10 = S7.GetBitAt(data, 1, 1);
retEmerg11 = S7.GetBitAt(data, 1, 2);
retEmerg12 = S7.GetBitAt(data, 1, 3);
retEmerg13 = S7.GetBitAt(data, 1, 4);
}
您可以这样做。
答案 1 :(得分:0)
对我来说,它是这样的:
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
public class RemoveDuplicates {
public static void main(String[] args) {
String string = "PayPalIndia";
List<Character> strings = string.chars().mapToObj(c -> (char) c).collect(Collectors.toList());
Set<Character> set = new HashSet<>();
Iterator<Character> iterator = strings.iterator();
Set<Character> invalid = new HashSet<>();
while (iterator.hasNext()) {
Character c = iterator.next();
if (set.contains(c)) {
iterator.remove();
invalid.add(c);
} else {
set.add(c);
}
}
System.out.println("Duplicate parents");
invalid.forEach(System.out::print);
System.out.println();
strings.removeAll(invalid);
System.out.println("=============");
System.out.println("After removing Duplicates...");
strings.forEach(System.out::print);
System.out.println();
}