Some questions -
1) Given you want to measure 0 - 50 Khz (0 - 50 KRPM ?), what
resolution of the measurement do you want ?
2) Accuracy of measurement ?
3) Do you need to make 4 simultaneous measurments of RPM or could
you use a 4 channel mux and measure them sequentially ? If latter any
restrictions on latency of measurement ?
Regarding the UDBs: you are using a 16-bit counter, which needs 2 UDBs AFAIR. Since all other components don't need to be duplicated,, this means you need 8 UDBs to count for 4 channels - and the PSoC5 has 24. So there should be room to spare.
For the routing error - the FF counter can just count clocks, it works that way (says even so in the data sheet).
Regarding your second question: The code is quite difficult to follow with all these states. Mayb reduce the RPM_Convert_Process function into a simple loop that waits until the counter has captured (FIFO not empty) and then calculates the resulting RPM directly. Having done that you can directly display the value on the LCD.
Even better: use an ISR to read the capture value which is triggered by a capture event.
Thank Dana and Hli for reply.
Dana, I think 16 Bits with 5Hz for Gate frequency will do the work for me and that is what I have tested with my application.
As of now 4 simultaneous measurement is required, so I will use separate counters and as hli said it will consume only 8 UDBs (I have tested with four 32 bit counters previously that is why I was out of UDB I think). But if four 16 bit counter will not serve purpose then I will definitely consider MUX.
Hli, for your confusion, sorry. Now I have taken bob’s example from this thread:
and modified according to my Hardware.
Now see, schematic page “Measure”, I have made RPM_Out (P0) and RPMSig_1 (P0). I have made a wire link between this two pin on kit “CY8CKIT-050”. See on schematic page “Clocks”, Clock_3 = 15KHz. Now if I program kit, it shows 0 Hz on screen. Now if I connect direct wire on schematic page “Measure”, and delete the pins and program on kit it shows 15000 Hz.
Got it? Please help me with that. Thanks in advance
There is confusion regarding the function of HW connection on a pin, hopefully
this will illuminate why your schematic wired connection not working -
Thanks Dana for the reply, and sorry for the confusing posts of mine. I think Hardware connection setting is fine. Here I am attaching a picture, hoping that it will make my issue clearer to you.
RPM frequency is generated 12 KHz, Routed to PIN P0, through a external wire(jumper) connected to PIN P0. Result working fine
RPM frequency is generated 15 KHz, Routed to PIN P0, through a external wire(jumper) connected to PIN P0. Result working not OK.
RPM frequency is generated 15 KHz, directly connected on schematic with Frequency Counter. Result working not OK.
You mentioned you wanted to minimize UDBs, this project measures PW as well
as period (therefore frequency) and uses a fixed function counter.
As I sees that the two issue I facing is different from one another so I think I should create second thread for second issue.
Here is the link for the second issue of "external link" problem.