I have read dozens of articles about threading in c# and Application.DoEvents() ... Still can't use it properly to get my task done: I have a controller connected to my COM, this controller works on command (i send command, need to wait few ms to get response from it), assume the response is a data that i want to plot every time interval using a loop:
- start my loop.
- send command to controller via serialPort.
- wait for response (wait let say 20 ms).
- obtain data.
- repeat this loop every let say 100 ms.
this simply doesn't want to work!! i tried to communicate with the data controller on other thread but it seems that it can't access the serialPort which belongs to the main thread (roughly speaking).
any help is appreciated