Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Using the timer

Using the timer

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    wicked_guy
    wrote on last edited by
    #1

    Hi I am controlling an electrical circuit using the computer through the computer ports. I am trying to capture a fast changing analog signal using sampling. So I am just enquiring about the maximum frequency that we could set the timer to using the following function: SetTimer(1, 2000, 0); I actually want the timer to interrupt every ten micro seconds (10uS). Is it possible with this type of timers. If not, can anyone guide me to a timer that is capable of doing so. Thanx in advance

    A 1 Reply Last reply
    0
    • W wicked_guy

      Hi I am controlling an electrical circuit using the computer through the computer ports. I am trying to capture a fast changing analog signal using sampling. So I am just enquiring about the maximum frequency that we could set the timer to using the following function: SetTimer(1, 2000, 0); I actually want the timer to interrupt every ten micro seconds (10uS). Is it possible with this type of timers. If not, can anyone guide me to a timer that is capable of doing so. Thanx in advance

      A Offline
      A Offline
      Antony M Kancidrowski
      wrote on last edited by
      #2

      Timers are set in milliseconds and therefore do not have the resolution you require. I suggest that you use another thread to do this work. You could then use the high-resolution performance counters QueryPerformanceCounter() and QueryPerformanceFrequency() to monitor the time. Ant. I'm hard, yet soft.
      I'm coloured, yet clear.
      I'm fruity and sweet.
      I'm jelly, what am I? Muse on it further, I shall return!
      - David Williams (Little Britain)

      W 1 Reply Last reply
      0
      • A Antony M Kancidrowski

        Timers are set in milliseconds and therefore do not have the resolution you require. I suggest that you use another thread to do this work. You could then use the high-resolution performance counters QueryPerformanceCounter() and QueryPerformanceFrequency() to monitor the time. Ant. I'm hard, yet soft.
        I'm coloured, yet clear.
        I'm fruity and sweet.
        I'm jelly, what am I? Muse on it further, I shall return!
        - David Williams (Little Britain)

        W Offline
        W Offline
        wicked_guy
        wrote on last edited by
        #3

        Are these actually counters or are they functions that retrieve the frequeny and index of a counter? Check out this link plz. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/timers/timerreference/timerfunctions/queryperformancefrequency.asp

        A 1 Reply Last reply
        0
        • W wicked_guy

          Are these actually counters or are they functions that retrieve the frequeny and index of a counter? Check out this link plz. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/timers/timerreference/timerfunctions/queryperformancefrequency.asp

          A Offline
          A Offline
          Antony M Kancidrowski
          wrote on last edited by
          #4

          I was suggesting that you uses the performance counter functions in order to write your own high-resolution timer. Ant. I'm hard, yet soft.
          I'm coloured, yet clear.
          I'm fruity and sweet.
          I'm jelly, what am I? Muse on it further, I shall return!
          - David Williams (Little Britain)

          W 1 Reply Last reply
          0
          • A Antony M Kancidrowski

            I was suggesting that you uses the performance counter functions in order to write your own high-resolution timer. Ant. I'm hard, yet soft.
            I'm coloured, yet clear.
            I'm fruity and sweet.
            I'm jelly, what am I? Muse on it further, I shall return!
            - David Williams (Little Britain)

            W Offline
            W Offline
            wicked_guy
            wrote on last edited by
            #5

            Ahhaaa.. Ok then, but these are useful functions as well, Thanx Ant.;)

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups