I encountered a problem, when I used the as_db_read to read the DB, I found that there is a data in the returned result that is inconsistent with the return result of the db_read, which is amazing, first of all, I need to make sure that during the query, the PLC will not change the value, for this I changed 3 PLCs for verification, and two PLCs reproduce this problem, both of which appear on the 2nd bit, and the other data are correct, even if the length is 1000. Does anyone have this problem? Or please give me some directions, such as the configuration of the PLC or something, or the possible problems with the PLC logic.❤ hello, anybady can help? this is simple test script like: """ test snap7 as method """ import asyncio import ctypes import pytest from snap7 import Client # plc is a simple CPU, only once command in the connection async_lock = asyncio.Lock() async def as_db_read(client: Client, db, start, size) -> bytearray: """read db size """ # noinspection PyCallingNonCallable,PyTypeChecker data_buffer = (ctypes.c_uint8 * size)() async with async_lock: c7_code = client.as_db_read(db, start, size, data_buffer) if c7_code != 0: raise RuntimeError(f"not able to read DB to plc data: {c7_code}") while client.check_as_completion(data_buffer) == 1: # The polling waits for the completion and # adds hibernation to prevent the CPU from idling await asyncio.sleep(0.000_001) return bytearray(data_buffer) def db_read(client: Client, db, start, size) -> bytearray: """sync read db""" return client.db_read(db, start, size) async def main(): """ read db """ host = "10.8.7.221" # host = "10.8.7.212" # host = "10.3.43.219" db = 1000 start = 0 size = 100 client = Client() client.connect(host, 0, 1) # async_rawdata = await as_db_read(client, db, start, size) # This note has nothing to do with order sync_rawdata = db_read(client, db, start, size) async_rawdata = await as_db_read(client, db, start, size) sync_bin_data = [bin(byte)[2:] for byte in sync_rawdata] async_bin_data = [bin(byte)[2:] for byte in async_rawdata] # always not passed # assert async_rawdata.hex() == sync_rawdata.hex() # we can see the difference for bit_index, (sync_bit, async_bit) in enumerate(zip(sync_bin_data, async_bin_data)): if sync_bit != async_bit: print(f"bit[{bit_index}] async is [{sync_bit}], but sync is [{async_bit}].") # other bit is right. # Executing both methods directly does not have data modifications # PLC: S7 1200/1500 CPU @pytest.mark.asyncio async def test_it(): """ test """ await main() if __name__ == '__main__': # also you can use asyncio.run(main()) asyncio.run(main()) I've tried allowing the script multiple times to correct for time bias, but unfortunately the result is always the following ouput user@user:~/dispatch-platform/backend$ docker exec -it dsp-worker python tests/dispatch/clients/test_s7_polling.py sync time: 1,166,942 ns async time: 1,217,073 ns bit[2] async is [0], but sync is [1]. maybe return the same of rawdata, but it: bit[2] async is [0], but sync is [1]. other bit data is right Continue reading...