Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Timer

ZakeZake Member Posts: 15
[b][red]This message was edited by Zake at 2004-9-25 6:43:12[/red][/b][hr]
I'm trying to make a software that interact with hardware using the parallel port connection.
The data that I want to sent by the parallel port must be sent every 1 ns. So I need to find a way to make a timer inside the software that can tell the exact time to sent the data. But the software must be avaible for anykind of computers.
Please help me, if anybody knows how to find out the speed of the computer and create a timer?


Comments

  • MasterijnMasterijn Member Posts: 188
    : I'm trying to make a software that interact with hardware using the parallel port connection.
    : The data that I want to sent by the parallel port must be sent every 1 ns. So I need to find a way to make a timer inside the software that can tell the exact time to sent the data. But the software must be avaible for anykind of computers.
    : Please help me, if anybody knows how to find out the speed of the computer and create a timer?
    :
    :
    :
    Hmm, each nsec you say?
    Under a win 32 multi-theaded operating system this simple cannot be done in a reliable way. Threads cooperate by using only a small amout of time 20 msec. But in regard to a nano-second this is huge!!! So even if you could time nano-seconds within a time slice, you can't when your process/thread is out scheduled. The best timer that can be made by using a multi media timer, but theese have their minimum at a msec interval. By looping and using QueryPerformanceCounter you could wait for a nanosec, but this is as said not reliable. (Even when the thread priority is set on real-time). B.t.w I'm sure a parallel port is not capable of deeling with nsecs either.


  • ZakeZake Member Posts: 15
    : Hmm, each nsec you say?
    : Under a win 32 multi-theaded operating system this simple cannot be done in a reliable way. Threads cooperate by using only a small amout of time 20 msec. But in regard to a nano-second this is huge!!! So even if you could time nano-seconds within a time slice, you can't when your process/thread is out scheduled. The best timer that can be made by using a multi media timer, but theese have their minimum at a msec interval. By looping and using QueryPerformanceCounter you could wait for a nanosec, but this is as said not reliable. (Even when the thread priority is set on real-time). B.t.w I'm sure a parallel port is not capable of deeling with nsecs either.
    :
    :
    :
    Thanks for your help.... It turned out that I can sent the data each 1 msec. So I can use TTimer for it. But it still a little late, can I make a timer for atleast 500 micro second?
  • MasterijnMasterijn Member Posts: 188
    [b][red]This message was edited by Masterijn at 2004-10-1 3:4:1[/red][/b][hr]
    : : Hmm, each nsec you say?
    : : Under a win 32 multi-theaded operating system this simple cannot be done in a reliable way. Threads cooperate by using only a small amout of time 20 msec. But in regard to a nano-second this is huge!!! So even if you could time nano-seconds within a time slice, you can't when your process/thread is out scheduled. The best timer that can be made by using a multi media timer, but theese have their minimum at a msec interval. By looping and using QueryPerformanceCounter you could wait for a nanosec, but this is as said not reliable. (Even when the thread priority is set on real-time). B.t.w I'm sure a parallel port is not capable of deeling with nsecs either.
    : :
    : :
    : :
    : Thanks for your help.... It turned out that I can sent the data each 1 msec. So I can use TTimer for it. But it still a little late, can I make a timer for atleast 500 micro second?
    :
    A normal timer isn't suitable for this, because of its 20 msec resolution (or something like that). With a multimedia timer you can set the resolution to a msec yourself with the mmsystem.timeBeginPeriod function. A call to this function boosts the hardware timer up to 1000 ticks per sec. With mmsystem.timeSetEvent one can create such timer.






Sign In or Register to comment.