In this case I don't see anything to be gained by accessing the timers directly. I assume your trigger is connected to an ADC pin, so you'd still need to start and stop the timer in software.
Much easier to let the timers run as normal and access the counters via the built-in timing functions. For millisecond-precision timing the
millis() function should be fine.
The applied pressure is always lasting for more than 10ms, so that causes problems in the data.
Can you explain a bit more?
Well, the time the pressure is being applied for is a variable. It could last for, roughly, half a second, or it could last five minute. However, I need (or have been asked to) gather data every 10ms. I have been using the millis() function, with a delay after it, for testing that the system worked ...i.e. pressure 1 is applied at x time ....pressure 2 is applied at y time, y - x = time between pressures, and it works fine with me waiting long enough past the delay before I apply pressure. However, because I cannot know how long a pressure will be applied for, I cannot build in a correct delay which will allow me to get good readings.
So, if I use a timer, and the reading on the analogRead goes above a specific value, I can start a time, and when it goes below a specific value, I can stop the timer, therefore getting the time the pressure is applied for. This can go on in the background while other sensor data is been read at 10ms.
Hope that makes sense :fearful: