View Single Post
  #7   Spotlight this post!  
Unread 26-04-2010, 12:11
RyanCahoon's Avatar
RyanCahoon RyanCahoon is offline
Disassembling my prior presumptions
FRC #0766 (M-A Bears)
Team Role: Engineer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Mountain View
Posts: 689
RyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond repute
Re: please help in adxl345

Quote:
Originally Posted by mikets View Post
The code I quoted was designed to be independent of sample loss. Since it is determining the time between samples and use it as the interval for each integration, if you lose a sample, it will integrate with double the interval the next time. So it won't throw you off. I wouldn't assume a fixed sampling rate. I would figure out if the system has a hardware timer that you can read that will give you an accurate timestamp.
Good point. That's basically what I was suggesting with using the PIC's timer. AFAIK, there's nothing as convenient as the GetMsecTime() function on the PIC platform, so just reading and resetting one of the timers when each sample is received is as close as you can get. It's probably still beneficial to try to synchronize the PIC reading samples as they're received, because there can still be oversampling problems.

--Ryan
__________________
FRC 2046, 2007-2008, Student member
FRC 1708, 2009-2012, College mentor; 2013-2014, Mentor
FRC 766, 2015-, Mentor
Reply With Quote