Announcement

Collapse

Maintenance

The forum could be offline for 30-60 minutes in the very near future for maintenance (said 3pm Pacific). I was behind on getting this notice. I do apologize.
See more
See less

fast timer

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • fast timer

    Gentlemen,
    For PB35, I need to be able to call a routine to create precise delays of between about a microsecond to 50 milliseconds. What is the most efficient method of doing this? Any suggestions?

    Thanks,

    Tom E

    ------------------

  • #2
    Try searching the Source Code and SRCCODE (archive) forums for "timer"...

    I posted one at http://www.powerbasic.com/support/fo...-7-000213.html

    However, I recall that when the code is running under Windows (16 or 32-bit Windows), multitasking played serious havoc with it and made it quite useless. ie: it is really only suitable only for plain DOS PC's.

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      Thomas,
      Delays of 1us and up are not really possible with the standard PC hardware alone. Minimum times are going to be around 3us regardless of CPU speed since it takes that long to access I/O ports and the hardware timer which are on the slow ISA bus. The jitter is also going to be 1-2us plus extra time for the CPU to respond to interupts, if enabled.

      If you have PCI I/O ports (a PCI plug in card with I/O ports on it) and you use the CPU Time Stamp Counter on Pentium and better CPUs then you can, in theory, get times down to the around 0.1us but you'll need to disable the interrupts and your 800MHz Pentium will be doing the job of $10 of logic chips.. only not as well.

      If you really need times down to 1us or resoloution of 1us then don't use a PC, use external logic controlled by the PC.

      Paul.

      Comment

      Working...
      X