Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 1 > PSoC 1 Frequency Measurment

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



PSoC 1 Frequency Measurment
Moderator:
ARVI

Post Reply
Follow this topic



PSoC 1 Frequency Measurment

cjlutera posted on 23 Mar 2011 11:20 AM PST

1 Forum Post

 Hi everyone. I'm trying to determine the frequency of a incoming signal at roughly 7KHz. This signal is correctly identified using a scope and is at correct logic levels. I am using the 16bit Tachometer digital block which adds a second interrupt. It is basically a 16 bit timer with the added interrupt. I have a 1MHz input clock which should get me enough resolution for this. The incoming frequency is fed into the capture port on the block. Now I'm having trouble getting a frequency measurement. Here is some of my code.

 

void main(void)
{

LCD_1_Start(); 						// Initialize LCD hardware

TachTimer16_1_WritePeriod(0xFFFF);
M8C_DisableGInt;
TachTimer16_1_Stop();
TachTimer16_1_EnableInt();
TachTimer16_1_Start();
M8C_EnableGInt;

	while(1){
	
	
	LCD_1_Position(0,0); 				
	lcd_int(diff,5);

	freq = (0.000001)*(0x10000-diff);
	
	delay();
	TachTimer16_1_WritePeriod(0xFFFF);	
	TachTimer16_1_Start();
	delay();
 
void MyCounterISRLSB(void)		//capture interrupt
{
	to = TachTimer16_1_wReadTimer();
	
	if (to < tf) diff = tf-to;//(0xFFFF-tf)+to;
	else diff = ((0xFFFF-tf)+to);
	tf = to;
	
	
	TachTimer16_1_Stop();
}

 
I am getting the decimal value of 2222 for "diff" which stays consistent with the frequency at 7.3KHz but can't seem to figure out how to get this value in frequency form. I have searched hours for this and haven't gotten much of anywhere. Any help is greatly appreciated.
 




Re: PSoC 1 Frequency Measurment

graa posted on 24 Mar 2011 10:16 PM PST
Cypress Employee
275 Forum Posts

Check out the attached application note.  This is a very old application note that explains how to measure frequency with PSoC.  The project is quite old and you will have to upgrade it to the latest designer version.  While upgrading, if the new ISR files do not have the ISR code, copy them from the old ISR file which will be in the backup folder into the new files.

 

Hope this helps.

 

Best Regards,

Ganesh






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: KXP; Secondary Owner: VWA; Sunset Date: 01/01/20