- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Trying to measure accurately the duty cycle of an input signal. Does anyone have a eligant way of doing this in Creator?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A good thread to read and check into is this one: http://origin-www.cypress.com/forum/psoc-5-device-programming/pulse-width-meassurement
Someone else had the same question/intent for a 250 Hz signal, but there are multiple ways to approach the issue as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Sott Clifford,
Can you tell us which device do you use?
At the same time, you need to offer us which signal you want to test.
Thanks,
Lingling
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Principially the problem can be broken down to measuring the time which can be easily done with PSoC4 downto a precision of 100µs.
There are timer components for that job, you just need to configure them accordingly.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using currently using a CY8CKIT-043
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Either measure the times between edges of the waveform, or measure "counts" based on if the waveform is "on" or "off" to get the duty cycle. As bob.marlowe mentioned, it is quite simple using the timers to accomplish it. There are multiple ways to do so as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was hoping there was a way to use PSoC Creator components to do it. Is this possible?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is no off-the-shelf component to calculate the duty cycle but implementation with TCPWM timers is not complicated.
Start calculating high-time. When that runs, use another timer and calculate low time. To do both with a single timer is possible but tricky.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
e.pratt was not trying to be evasive when he answered your question... he was just expressing the fundamental truth that one of the reasons that PSoC is beautiful is that it gives you many many many ways of solving problems... and a question like yours could literally be solved a dozen different ways.
The TCPWMs are able to do this.
You could use UDB implementations
You could write software and interrupts
It all depends on the accuracy and timescale of your duty cycle measurement that is required for your system.
Alan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As arh (Alan) mentioned, without having more specifics on what requirements you have, there are quite a few methods that will work "well enough" to achieve your goal with varying degrees of simplicity, efficiency, and accuracy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You will need to use some CPU code to at least read the values from the timers, but you might be able to implement a hysteresis trigger from the waveform to trigger the timer to capture/reset to start counting the new duty-cycle. This would reduce your code to be only grabbing the timed positive voltage and compare with the maximum timed positive voltage for the % duty cycle.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am new to using timers ... i will read up on them so i can ask at least some intelligent questions on what you have suggest.
Thanks you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A good thread to read and check into is this one: http://origin-www.cypress.com/forum/psoc-5-device-programming/pulse-width-meassurement
Someone else had the same question/intent for a 250 Hz signal, but there are multiple ways to approach the issue as well.