Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

Windows Media Player makes NI-Motion calls faster (revisited)

Solved!
Go to solution
Solution
Accepted by topic author chvogt

While trying to implement my own throttle, I ran a timing test to check how well my throttle was working. I was surprised to find that I was only getting 100 calls/sec. When I looked into this further I found that the resolution of the timer that I was using was only 10 ms. I am using the 'timeGetTime' function in 'winmm.dll' since it provides a higher resolution than the standard timer used in VB.

 

I found that the resolution of the timer can be controlled using the 'timeBeginPeriod' & 'timeEndPeriod' functions in 'winmm.dll'. I added a check box to my WMPTest program to allow the 1 ms resolution to be selected and left the built-in NI-Motion throttle enabled. I found that this was all that was needed to make the NI-Motion calls work faster. Specifically, I added a 'timeBeginPeriod(1)' call before the timing loop and a 'timeEndPeriod(1)' call after the timing loop is complete. The new WMPTest program is attached.

 

Here are the results:

 

 

      22899i99864727314A4EA7     22895iAE1978078194B598         

 

 

I would need to use the timeBeginPeriod & timeEndPeriod functions to make my own throttle work, but since they also affect the NI-Motion throttle I'll probably just leave the NI-Motion throttle enabled and let NI-Motion do it's own thing. MSDN says that setting a higher resolution can 'reduce overall system performance, because the thread scheduler switches tasks more often' and can 'prevent the CPU power management system from entering power-saving modes'. Neither of these should be an issue for me because the computer is dedicated to running the tests and all power saving is disabled anyway.

 

 

 

 

 

 

Message 11 of 11
(1,443 Views)