Go to Post a determined team can accomplish miracles. - Wayne C. [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 01-31-2009, 12:31 PM
Joohoo's Avatar
Joohoo Joohoo is offline
Registered User
FRC #0340 (G.R.R.)
Team Role: Mentor
 
Join Date: Jun 2005
Rookie Year: 2005
Location: Rochester
Posts: 241
Joohoo is just really niceJoohoo is just really niceJoohoo is just really niceJoohoo is just really niceJoohoo is just really nice
Send a message via AIM to Joohoo Send a message via Yahoo to Joohoo
Time precision better than seconds??

For a while out team has been looking to use a timer. The timer works well, except we need to have a more precise timer than the one that the documentation says is available. Is there a way to make a timer that is more precise (milliseconds/microseconds)?
Reply With Quote
  #2   Spotlight this post!  
Unread 01-31-2009, 01:20 PM
Eric Finn's Avatar
Eric Finn Eric Finn is offline
Registered User
FRC #0166 (Chop Shop)
Team Role: College Student
 
Join Date: May 2006
Rookie Year: 2005
Location: Merrimack, NH
Posts: 101
Eric Finn has a spectacular aura aboutEric Finn has a spectacular aura about
Send a message via AIM to Eric Finn
Re: Time precision better than seconds??

If I recall correctly, pretty much everything having to do with time is doubles, so that you have millisecond resolution for the time, but it is measured in seconds. That is, 200 ms would be 0.2 seconds.
__________________
It always takes longer than you expect, even when you take into account Hofstadter's Law.
--Hofstadter's Law

Reply With Quote
  #3   Spotlight this post!  
Unread 01-31-2009, 01:24 PM
Shinigami2057 Shinigami2057 is offline
Slackware Is Your New God (Mentor)
AKA: Harry Bock
FRC #1350 (Rambots)
Team Role: Programmer
 
Join Date: Oct 2006
Rookie Year: 2006
Location: Johnston, RI
Posts: 106
Shinigami2057 is just really niceShinigami2057 is just really niceShinigami2057 is just really niceShinigami2057 is just really niceShinigami2057 is just really nice
Re: Time precision better than seconds??

How accurate is the timing using floating-point precision? IEEE floating point representation isn't always 100% accurate; many times floats won't represent your value exactly as entered (e.g., 0.3 might become 0.2999...) so your times may end up slightly misrepresented internally.

Any reason as to why floating-point numbers were used instead of milli or microseconds?
__________________
One of the main causes of the fall of the Roman Empire was that, lacking zero, they had no way to indicate successful termination of their C programs.
Reply With Quote
  #4   Spotlight this post!  
Unread 01-31-2009, 01:28 PM
Uberbots's Avatar
Uberbots Uberbots is offline
Mad Programmer
AKA: Billy Sisson
FRC #1124 (ÜberBots)
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Avon
Posts: 739
Uberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond repute
Re: Time precision better than seconds??

The real-time timer has a precision down to microseconds i believe, but you wont have any luck searching for anything more fine than that (eg processor ticks)
__________________
A few of my favorite numbers:
175 176 177 195 230 558 716 1024 1071 1592 1784 1816
RPI 2012
BREAKAWAY
Reply With Quote
  #5   Spotlight this post!  
Unread 01-31-2009, 08:49 PM
gvarndell's Avatar
gvarndell gvarndell is offline
Software Engineer
AKA: Addi's and Georgie's Dad
FRC #1629 (GaCo)
Team Role: Parent
 
Join Date: Jan 2009
Rookie Year: 2008
Location: Grantsville, Maryland
Posts: 350
gvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond repute
Re: Time precision better than seconds??

Quote:
Originally Posted by Joohoo View Post
For a while out team has been looking to use a timer. The timer works well, except we need to have a more precise timer than the one that the documentation says is available. Is there a way to make a timer that is more precise (milliseconds/microseconds)?
You can call vxTimeBaseGet(), which is a function provided in vxLib.

IMPORT void vxTimeBaseGet (UINT32 * pTbu, UINT32 * pTbl);

This function reads the 64-bit PPC timebase, storing the upper 32 bits at pTbu and the lower 32 bits at pTbl.

The least significant bit should be worth 1/132,000,000 of a second.
It would pay to do a little experimentation with it though, to see if that number is right -- it may actually be 1/133,000,000 seconds.
In any event, it's a very high resolution 64-bit counter.
Precise enough for ya?
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Are six wheels better than four? cziggy343 General Forum 36 01-10-2009 11:13 PM
Better Than Gears? Aaron Lussier Technical Discussion 7 10-14-2003 12:20 PM
My auto is better than yours.. lol randomperson Programming 25 04-07-2003 12:10 PM
Kennedy better than Long Island?... soap108 Regional Competitions 6 03-23-2002 05:50 PM
Chief Delphi 7 Picture -- better than nothing Joe Johnson Robot Showcase 7 03-02-2002 06:55 PM


All times are GMT -5. The time now is 09:13 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi