06-22-2018 10:01 AM
Manufacturer states that there is a delay time between receiving a signal and sending a response. The delay for processing the query is up to 50ms. The sensor then adds an additional delay before sending a response. The default is 50ms (will check this).
So I think this is why...
at 19200 baud sending 12 characters (8 bits per char, + s/stop bits, 10 bits) = 12*10*19200^-1 = 6.25ms
receiving 24 characters back = 12.5 ms
max 50ms processing time + 50ms delay = 100 ms
total is circa 120 ms.
I guess what oUDIM.Read is doing is just waiting for something to appear to read. Its waiting up to 50ms for the query to process and another 50ms because of the built in delay. So what I think I can do is knock the delay off, down to 0, and 50ms wait in between write and read.
So I would have a Write(query). (takes 6ms)
wait (50ms)
Read(response to delimiter). (takes 12.5ms)
total time = 50 + 6 + 12.5 = 68.5 ms and that gets me my 10Hz comfortably. Perhaps I don't need the wait as it seems Read() is simply waiting round for something to happen anyway.
06-22-2018 11:33 AM
Rainer, I presume the script block in DAC only calls the port initialisation and de-init once? it doesnt call them over and over does it?