time problem .NET 2008

Discussion in 'Programmer's Corner' started by m7mood, Feb 23, 2011.

  1. m7mood

    Thread Starter New Member

    Dec 26, 2010
    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!!!
  2. spinnaker

    AAC Fanatic!

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


    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.
  3. mbabayan


    Jul 12, 2010
    .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.