Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 5 > Frequency measurement

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



Frequency measurement
Moderator:
ANCY

Post Reply
Follow this topic



Frequency measurement

ProjetSIN posted on 05 Mar 2013 3:27 PM PST

1 Forum Post

Hi i'm a french student in high school with my classroom we work on a robot project using the psoc 5.

With my group we work on the shifting of the robot ,so we need to determinate its speed.We use as sensor a optical shaft encoder of a vex kit (the output waves form is square).

Our frequency range to measure is 0hz -400hz ,we use for test the pwm output

We use a counter and and a isr  as the topic  frequency using a counter.The main problem is we don't know how update the flag variable with the isr.

i will post in several days our program .

I hope you can help us best regards from France.




Re: Frequency measurement

danaaknight posted on 05 Mar 2013 06:50 PM PST
Top Contributor
1773 Forum Posts

Declare a flag variable, global, before main().

 

unsigned char flag = 0;

main(){}

 

ISR file

extern unsigned char flag;

..

..

myisr( ) {

     flag = 1;

}

 

I do not know the typing of "extern" or is it "external", look that up in GNU

 

Regards, Dana.



Re: Frequency measurement

Bob Marlowe posted on 06 Mar 2013 12:39 AM PST
Top Contributor
1768 Forum Posts

You even do not need to modify the external file in PSoC3/5, there are macros to declare and define your own interrupt functions in c with CY_ISR_PROTO(IntFunc) and CY_ISR(IntFunc). Have a look into the "System User Guide" to be found under the "Help" in Creator 2.2.

 

... and: the storage-class-name is "extern" in c and "external" in assembly. Easy to mix up. (If I haven't already)

 

Bob

 

 



Re: Frequency measurement

danaaknight posted on 06 Mar 2013 08:34 AM PST
Top Contributor
1773 Forum Posts

You can always place component and ISR module which will create placeholder

files to put your ISR code into.

 

 

Regards, Dana.



Re: Frequency measurement

YVRAO posted on 10 Mar 2013 08:46 AM PST
Top Contributor
56 Forum Posts

 why are you using cypress psoc for speed measurement and opticalsensor ? so many other techniques are there?



Re: Frequency measurement

Bob Marlowe posted on 10 Mar 2013 10:07 AM PST
Top Contributor
1768 Forum Posts

@YVRAO

maybe because of its universality? Interfaces?? Ease of use???



Re: Frequency measurement

YVRAO posted on 11 Mar 2013 05:56 AM PST
Top Contributor
56 Forum Posts

 projetsin

once attach your program






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