拜托,您可以发表一个示例来在数据库上设置/写入单个位吗?

这样我写了数据库的整个字节(我想)

ClientPlc.ReadArea(S7.S7AreaDB, 200, 0, 1, Buffer);


非常感谢

最佳答案

 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);

    }


您可以这样做。

关于java - Moka7-Java-单个位读-写,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/47000536/

10-10 19:26