Count pulses AND Integrate pulse time over specified window of time

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

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.   
0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

   

Bob

View solution in original post

0 Likes
9 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

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.

0 Likes
lock attach
Attachments are accessible only for community members.
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

0 Likes
Anonymous
Not applicable

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.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

   

Bob

0 Likes
Anonymous
Not applicable

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

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

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   
0 Likes
Anonymous
Not applicable

 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

0 Likes