2 Replies Latest reply on Jan 4, 2013 11:42 AM by user_14586677

    The best approach to measure a time interval

    angelo.cirino

       Hi,

         

      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();
      interactWithI2CPeripherals();
      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?

         

      Thanx,

         

      Angelo