time problem .NET 2008

Thread Starter

m7mood

Joined Dec 26, 2010
8
i'm using C# 2008 .NET , and i'm using a 100 msec timer to read data from microcontroller through USB and save it in a file but i have a problem with timing and i want to know :
1- the time of the code located in the timer tick.
2- if the time of the code located in the timer tick event is longer than tick time what is the solution??
plz anybody help me!!!
 

spinnaker

Joined Oct 29, 2009
7,830
What type of timer are your trying to use? The timer object in .net?

System.Windows.Forms.Timer????

If so and had you bothered to check the help file you would see it is that intervals are 1 millisecond. If you need anything faster than that then you will need to write your own timer.
 

mbabayan

Joined Jul 12, 2010
30
.NET, and Windows in general, is not a real time OS. Timer will not give you any guarantee that it will fire on time.
If you truly need precise timing, you'd have to do it in the hardware, buffer the data, and just read it through USB.
 
Top