Board index » delphi » Delay Loop Implementaton Under WIN95???

Delay Loop Implementaton Under WIN95???

Hi All:

     I have experienced a problem in setting a delay loop in my
     program under WIN95.

     In Pascal format:

     // ******************* Procedure Time Delay (200us) *****  
     procedure Pause;
     var i:integer;
     Begin
        for i:=1 to 4000 do
              // Nothing
     End;
     // ******************* End of the Procedure *************

     There is a signal that I want to sample under a external trigger
     pulse. Since the signal has a certain RC effect, I have to wait
     for 200us after triggering. This is illustrated as follows:

               ----
               |  |
               |  |
           ----    ---------------------- Triggering Signal

               ----
               |  |
               |  |
           ----    ----------------------- Signal to be sampled

           --->  <----- 200us Delay from the procedure for-loop
                 ^
                 |______ Sampling Point

    However, the above situation does not always happen due to some
    WIN95 background task?? I am not sure. Here is what happens
    I observed from the Oscilloscope SOMETIMES:

              ----
              |  |
              |  |
          ----    ------------------------ Triggering Signal

              ----
              |  |
              |  |
          ----    ------------------------ Signal to be sampled

          ---->        <----- 200us Delay pluse some WEIRED delay
                       ^      The extra delay may due to WIN95
                       |      background task or internal task
                       |      maintenance (?????)
                       |
                       |______ Wrong Sampling point

    Note the duration of both signals are 1ms. The signal to be sampled
    must be sampled within 1ms (In my case, I set to 200us).

    My questions:

       Is there a method that can implement an accurate delay loop
       under WIN95 (I am using Delphi-2 to write program)?

       Is it possible to disable all other WIN95 tasks interrupt when
       the program enters the delay loop?

       What if I am using assembly language (80x88) to write this
       delay loop, can I disable the interrupt from WIN95 tasks?

       Is there a timer that can be start and stop at any time in
       Delphi-2? Can Timer component in Delphi-2 be controlled under
       this way?

  I would greatly appreciate for any suggestions or inputs.

  Patrick

 

Re:Delay Loop Implementaton Under WIN95???


In article <5cd5kc$...@b1.hkstar.com>, h...@b1.hkstar.com (Hui Pak Ki

Quote
Partick) writes:
>       Is there a timer that can be start and stop at any time in
>       Delphi-2? Can Timer component in Delphi-2 be controlled under
>       this way?

I think the problem is Windows, which was not designed to be used for real
time applications with such small time slices.  I would suggest a DOS
based acquisition program, then manipulate the data in Windows as you
like.

If you persist in wanting to do it under Windows, I think you need to set
the critical code flag so nothing interrupts you, do the time delay and
data acquisition in assembly, and then you might get away with it.
However, bugs will hang your machine.

Other Threads