Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 3 > The best approach to measure a time interval

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



The best approach to measure a time interval
Moderator:
RKRM

Post Reply
Follow this topic



The best approach to measure a time interval

aacirino posted on 04 Jan 2013 7:14 AM PST
Member
3 Forum Posts

 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




Re: The best approach to measure a time interval

danaaknight posted on 04 Jan 2013 09:40 AM PST
Top Contributor
1773 Forum Posts

If you are trying to do this in your code base then 1 Khz counter would

suffice, using capture or just polled. Counter in bits X 1 mS should be

> largest I2C communication time, or account for counter rollover in

your code.

 

If your need is to establish the time for design purposes, do a trace when you

are debugging.

 

Regards, Dana.



Re: The best approach to measure a time interval

danaaknight posted on 04 Jan 2013 09:42 AM PST
Top Contributor
1773 Forum Posts

A useful ap note -

 

http://www.cypress.com/?docID=33518

 

Regards, Dana.






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: GRAA; Secondary Owner: RAIK; Sunset Date: 01/01/20