How to get sensor data at fixed time intervals
An idea is to make use of timer interrupts. The "Mode" will reset the timer and decide the initial value loaded to timer. The loaded value depends on time interval you want. On each timer interrupt, the control will shift to its ISR, where you read the sensor value. 

Pseudocode will look something like:

Timer_ISR()    
{
x = readSensor();
}