Go to Post Engineers crave and demand facts, and won't reach a conclusion without them. - Richard Wallace [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 13-01-2008, 16:16
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,572
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Tracking Elapsed Time

Quote:
Originally Posted by kaszeta View Post
We've found using loop counters to be very inaccurate in the past.
We've found that loop counters are accurate enough for almost all applications. One way to make them better is to account for lost radio packets.

Code:
unsigned int loop_counter;

void timer(void) {

	static unsigned char prev_packet;
	unsigned char packets;

	if (rxdata.packet_num > prev_packet)
	{
		packets = rxdata.packet_num - prev_packet;
	}
	else
	{
		packets = 256 - prev_packet + rxdata.packet_num;
	}
  loop_counter += packets;
}
note: code not guaranteed to compile, done off the top of my head.
Closed Thread


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
Camera locked in "tracking", but not tracking geeknerd99 Programming 1 18-02-2007 22:47
Tracking Ghosty Programming 4 16-01-2007 10:53
Time tracking software scitobor 617 Programming 19 26-08-2005 21:21
It's that time of year again!! (No, not The Championship event) Tax Time!! Elgin Clock Chit-Chat 4 10-04-2005 10:59
IR tracking nzj1 General Forum 3 26-01-2004 22:46


All times are GMT -5. The time now is 15:16.

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