Take the 2-minute tour ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

I am developing a data logger in which I am using 8 MB of flash memory to store the sensor data with date and time. I am using RF interface to transfer that data to PC. I am planning to have PC software that can request sensor data from start date to end date criteria. so when PC request for some interval of data from Data logger how should I search the specific date in the flash memory ? I am using pic microcontroller. It would be very slow to go and search without any algorithm.

share|improve this question
1  
In what format do you save the data? Can you give us an example of the Flash memory? –  Camil Staps Apr 23 '13 at 10:47
    
I am storing at each second ,6 byte of sensor data followed by 3 byte of date and 3 byte of time data. Its sequential that at each 12 byte it stores reading for sensor+date+time. –  Jimit Apr 23 '13 at 12:13
add comment

1 Answer

If identical-sized records are stored sequentially with a constant time interval, you should not need to search at all; you should be able to compute exactly where a particular timestamp can be found after looking at the timestamp of the first record.

If the record size and/or time interval varies, but they are stored sequentially, then you would use a binary search algorithm to find a particular timestamp.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.