|
Re: please help in adxl345
Quote:
Originally Posted by mikets
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
|