The best approach to measure a time interval | Cypress Semiconductor
The best approach to measure a time interval
I am new to PSoC programming and would like to have suggestions for the best approach to the measurement of time intervals. In pseudocode what I intend to do is the following:
start = now();
interval = now() - start;
The time to process the information in the I2C peripherals isn't known at first and I intend to have the time interval measured with a resolution of 1ms.
My first guess is to use a counter with a period of 1KHz and start the counting prior to the I2C interaction and read the counter value when finishing the I2C interface. Is this a good approach or is there a better solution?