Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Timer... 1

Status
Not open for further replies.

acknowledge

Technical User
Apr 22, 2002
5
TH
I would like to know how I can create a timer with 8us interval.
Thank you very much.
 
I am sorry about my carelessness. 8us means 8 microsecond.
Thank you very much
 
I dont think you can go that fast in VB unless you have a 2000G computer and in any case it would be very erratic because of all the various interrupt events happening in the operating system. Even 1ms (1000Hz if repetitive) is erratic if you listen to the audio tone produced by it toggling an output port pin.
You probably need an external one shot hardware multivibrator or send a single wav of a homemade soundfont from a good sound card.
I have had some success using for next loops (for a-1 to 10000:next) but it depends on the processor chip speed.
 
you'll probably have to access a system timer through the win api. the shortest interval in vb is approx 1 ms.
 
even in the system api the smallest interal is 1 millisecond.
 
Even then, it isn't an actual 1ms resolution. Although you can set the interval to 1ms, the actual resolution is generally about 55ms (well actually, under NT it's about 10ms), but no better.

So you can either use the Multimedia timers:


Or the high-performace timers:


Note that neither of these work like the VB timer, so you'd have to write your own callback routine, which is easier to do with the multimedia timers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top