Quote:
Originally Posted by matrix_manshy
in adxl345 i found delay time between samples is 5us between two samples i think this is the time use in the integeration (base) to calculate area under the curve ... is this right or i use some of pic timer as rayan said to know exactly the time between samples ..
|
The datasheet says the maximum output data rate is 3200 Hz, which would put the integration time base at about 312.5us, unless I'm misinterpreting something.
the challenge is synchronizing the PIC and the accelerometer. if you configure one of the interrupt out lines of the accelerometer to assert each time a new sample is ready, and run the SPI at a high enough data rate to be able to transfer each sample and then process it on the PIC in less time than it takes the accelerometer to read one sample, then you can use the accelerometer's timing. If you don't get the timing fast enough, you risk dropping samples, and then your integration will be off. It would be even better to make use of the ADXL345's FIFO buffer, but you still have to make sure you can process the samples fast enough otherwise the buffer will overflow.
My suggestion to use the PIC's timer was in response to your question about using the accelerometer with its registers in their default state, as neither the interrupts or FIFO are enabled by default. So I was assuming that you would just be reading from the accelerometer periodically, and as such you wouldn't have an accurate timing from the accelerometer, so you would have to use timing from the PIC.
--Ryan
__________________
FRC 2046, 2007-2008, Student member
FRC 1708, 2009-2012, College mentor; 2013-2014, Mentor
FRC 766, 2015-, Mentor