Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 5 > Frequency conter using Datapath

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



Frequency conter using Datapath
Moderator:
ANCY

Post Reply
Follow this topic



Frequency conter using Datapath

sr posted on 25 Aug 2011 12:02 PM PST

1 Forum Post

Hi
I am trying to evalute if the PSoC 5 chip is the right platform to use.
I wrote a simple verilog state machine that detects if a signal is within
a specified range. The states are:
parameter IDLE  = 2'b00;
parameter COUNT = 2'b01;
parameter JUDGE = 2'b10;
parameter DONE  = 2'b11;

The machine goes from IDLE to COUNT on a rising
edge of the input signal to measure.
From COUNT to JUDGE on a falling edge.
In the JUDGE state it compare the "count" against two constants to see if
the "count" is within range. It then goes to "DONE" and back to "IDLE";
It can go from JUDGE to IDLE since there is nothing being computed at DONE.

The above state machine consumes just about all UDB resources. So after watching the Sensei videos on
Datapath I understood that is much better to use the Datapath for these things.

The input signal to measure is ~100KHz square wave. The input clock the Datapath is 12MHz.
So the intent is to count "Datapath clocks" while the input signal is "high".

So the questions:
1. The video slides says I can compare A0 with D0, but this option is not in the Datapath Config tool.
2. How can the above design be done with the Datapath tool? It should be very simple right? well, I
have not been able to do it.

Thanks,

Saul

 




Re: Frequency conter using Datapath

David Ron posted on 10 Sep 2011 06:38 AM PST
Top Contributor
24 Forum Posts

Saul,

 

A0 can be compared with D1 as is shown in the training video.

there's a video on an 8 bit pwm using datapath. that'll be useful for you to understand the use of comparison of A0 and D1.



Re: Frequency conter using Datapath

tommoxon posted on 10 Sep 2011 04:37 PM PST
Top Contributor
45 Forum Posts

Saul,

Writing new components in verilog is somewhat involved, and rarely necessary for a simple state machine.

I would first use a Lookup Table Component, and do it with schematic capture.

It will accomplish what you want without having to manually code a datapath.

best regards,

Tom Moxon

www.moxon.com

www.westmarkco.com

 






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