I've been working on a program that communicates on SerialPort and having problem with it. It's communication is below 50% or less. If not, it times out most of the time.
From my research into this issue, I found out that global or system timer resolution by default is minimum 10ms or greater.
Serial Communication (RTS) and Windows 7
So, if you are using Thread.Sleep in your communication to pause for X number of milliseconds, the best it can do is 10ms or greater for a no-op or pause.
In my case, that is too long for my program to communicate with an external device. The device replies back within 10ms as soon as it gets a request from my program. If my program is not ready to receive the answer back, then my program will time out.
The only way to solve this issue is to adjust or alter the system timer resolution. To do that I was told to use Windows methods timeBeginPeriod and timeEndPeriod from winmm.dll. Although I am able to import these methods for my Windows .NET version of my program, I would like to know if there is any replacement for these methods in .NET frameworks.