View Single Post
  #3   Spotlight this post!  
Unread 02-13-2010, 03:28 PM
taichichuan's Avatar
taichichuan taichichuan is offline
Software Mentor
AKA: Mike Anderson
FRC #0116 (Epsilon Delta)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2010
Location: Herndon, VA
Posts: 328
taichichuan has much to be proud oftaichichuan has much to be proud oftaichichuan has much to be proud oftaichichuan has much to be proud oftaichichuan has much to be proud oftaichichuan has much to be proud oftaichichuan has much to be proud oftaichichuan has much to be proud oftaichichuan has much to be proud oftaichichuan has much to be proud of
Send a message via AIM to taichichuan
Re: Time in Milliseconds

Hmm... Well, I'm sure that there's something buried in the WPILib that can do it for you like using the time() function. But, from a VxWorks perspective, you can issue a:

-> sysClkRateGet()

This will tell you the interrupt rate of the system clock. And, sysClkRateSet(100) would set the interrupt rate to 100 Hz (10 ms clock resolution).

With that, tickGet() will return the current clock tick count with subsequent calls allowing you to measure elapsed time to the resolution of the system clock.

And, taskDelay(1) is a delay of 1 clock tick (10 ms at 100 Hz). You can also create watchdog timers that will attach your code to the system clock interrupt service routine and run it at a specified delay. Again, I'm sure that there's something buried in the WPILib that can provide what you're looking for, but I know VxWorks a lot better than I know the WPILib.

HTH,

Mike
Reply With Quote