Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 3 > Count pulses AND Integrate pulse time over specified window of time

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



Count pulses AND Integrate pulse time over specified window of time
Moderator:
RKRM

Post Reply
Follow this topic



Count pulses AND Integrate pulse time over specified window of time

NovProg posted on 14 Feb 2012 2:32 PM PST
Member
5 Forum Posts

I am using the "Frequency Measurement" example for the PSoC3 and would like to modify the overall output to be the number of pulse counts (when voltage crosses a threshold) over a specific period of time (e.g. 1 sec). Finally I would like to progress to outputting the total time of these pulses (integrate time when pulse is high) for a defined period of time (e.g. 1 sec). I have attached the file I am working from currently.  The value displayed on the LCD readout of "pulse count/sec" is not providing an accurate reading - based on wave generator/Oscope results.

 Thank you in advance for you help.



Re: Count pulses AND Integrate pulse time over specified window of time

Bob Marlowe posted on 15 Feb 2012 12:40 AM PST
Top Contributor
1768 Forum Posts

When uploading a Creator-project here you should:

1st. Build->Clean Project (That minimizes the number of files)

2nd. File->Create workspace bundle(minimal,zip)

3rd. Upload here.

I cannot open your project and the supplied PDF is a cypress-datasheet.

When a counter doesn't count there are some reasons I can think of:

Poor signal quality. Can be improved with some conditioning within the PSoC device

Frequency out of limit

Sync with wrong frequency

wrong gating / enabling of counter

Intervention / disturbing the counter due to read-out from program

 

As you can see from this, we need a bit more information to help you.

Bob



Re: Count pulses AND Integrate pulse time over specified window of time

NovProg posted on 15 Feb 2012 06:17 AM PST
Member
5 Forum Posts

Sorry about that.  I have re-attached a zip file after following your instructions.  Is there a reason you were not able to open it up and run before?

I eagerly await your response.  Thank you for your help.



Re: Count pulses AND Integrate pulse time over specified window of time

Bob Marlowe posted on 15 Feb 2012 10:04 AM PST
Top Contributor
1768 Forum Posts

As I said before, the first zip didn't contain what you (and me) expected, have a look by yourself.

The second ZIP was O.K!

I took the freedom to change (and comment) a lot. take care not to overwrite your original project after downloading. Had no time and equipment to test, that is up to you. When you really want to use interrupts (I took them out) contact me for some hints.

Happy coding

Bob



Re: Count pulses AND Integrate pulse time over specified window of time

NovProg posted on 15 Feb 2012 11:17 AM PST
Member
5 Forum Posts

Thanks for taking a look.  I built and programmed the files you sent and cannot figure out why the comparator output is not triggering when sine wave voltage is above Vdda/2 (it works correctly in the file I originally sent).  Please advise, thanks.



Re: Count pulses AND Integrate pulse time over specified window of time

Bob Marlowe posted on 15 Feb 2012 12:48 PM PST
Top Contributor
1768 Forum Posts

I don't have the lightest clue. Does the LED - output show any signal?

Bob



Re: Count pulses AND Integrate pulse time over specified window of time

NovProg posted on 15 Feb 2012 12:54 PM PST
Member
5 Forum Posts

Nope.  I have it monitored on an Oscope and it is a flatline. When re-programed with original code - it works OK.



Re: Count pulses AND Integrate pulse time over specified window of time

Bob Marlowe posted on 15 Feb 2012 02:08 PM PST
Top Contributor
1768 Forum Posts

Re-build that part of the schematic until that works again, then connect it to the rest of the circuit. There was a small piece of an analog wire which  removed. I didn't change the comparator at all.

Bob



Re: Count pulses AND Integrate pulse time over specified window of time

NovProg posted on 20 Feb 2012 02:19 PM PST
Member
5 Forum Posts

Here is a list of the items which I am trying to execute.

1.    If newest_reading is < max_value, write to array buffer; Else wait for next reading
2.    Once array is filled with 3 measured values, take the average and make a decision about the output state
3.    Continuously update buffer with latest reading, replacing the oldest reading


Re: Count pulses AND Integrate pulse time over specified window of time

pnielsen3 posted on 18 Oct 2012 09:14 AM PST
Top Contributor
107 Forum Posts

 What was your end code. I am interigating a RH sensor with a frequency over time. The RH is basicaly a variable capacator.

I was looking at using a comparator. Then use a counter. I saw a zip file on your post. I just copied it and I will take a look at your code tonight. Any help?

 

Thanks

Philip Nielsen

 






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