- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can someone tell how do I measure frequency of a incoming sine wave using PSoC 1. I'm following the given procedure given by Dana.
At the most basic level you need a gate of known width in time,
and a counter that starts counting when gate is active (high),
from a known value (255 8 bit, 65535 16 bit), and stops counting
when gate goes low. You read the value of the counter, subtract
it from start value, and divide by gate period in seconds.
16 bit example, .1 sec gate period, f = (65535 – count value) / .1
To setup Gate
1) Timer, setup for .1 or 1 sec (resolution would be 10 Hz or 1 Hz
respectively). You set up period to be 2X desired gate period, and
compare value 1/2 period, so that high time of compare output =
gate period, low time = gate period.
2) Route timer compare out to counter enable.
To setup counter
1) Route pin, Fin, to counter clock
2) Route timer compare out to counter enable
Code
1) Load counter with its max allowed value, 255 for 8 bit, 65535 for
16 bit
2) Start counter
3) Enable timer ISR, on terminal count, that means gate is low, counter
not enabled to count
3) Start timer
When ISR occurs set a flag and return
1) If flag true read counter (gate is low so it is not enabling counter)
and compute frequency. Reload counter with its max value.
There are other optimizations that can be done, for example stop and reset
timer when ISR occurs so that gate low period is minimized, and measurement
frequency is increased.
If the frequencies you are measuring are very low, like less than 1 Hz,
use reciprocal counter technique.
But I'm unable to comprehend that how do I write the ISR on terminal count.
Any help would be appreciated
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When you type "frequency measure PSoC1" into the "Keyword Search" field at top of this page, yofind at least this appnote.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am using this code for CY8C28623-24LTXI chip and using CY8CKIT-001 kit. But when I program the kit, I am not able to see any display. Can you please help me with it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This might be useful to you -
Regards, Dana.