Hy!
I have an infrared sensor connocted to the serial port. A semnal from the sensor is connected to the DSR bit. The transmission protocol is (lenght coded):
Logic Physic
1 Logic = ~600microsec 1 and ~1600microsec 0
0 Logic = ~600microsec 1 and ~500microsec 0
How can I check the DSR bit state and the time between the changes?
I can't use Timer or AsyncTimer, because 1 millisec is too long. I lose data.
I have tried installing a ComCallback function on DSR bit change, but is not working properly. I recive incorrect data's
I have tried using a separate thread and in an infinite loop I check the DSR bit state. In this way I can recive the data correctly, but the CPU usage is 100%.
If I use the ProcessSystemEvents() function, the CPU usage is ok, but I lose data.
Any advice?
Thanks in advance,
Balogh Szabolcs