What’s easy way to measure duty cycle of and input signal?

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

cross mob
Anonymous
Not applicable

Trying to measure accurately the duty cycle of an input signal.  Does anyone have a eligant way of doing this in Creator?

0 Likes
1 Solution
Anonymous
Not applicable

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.

View solution in original post

0 Likes
11 Replies
LinglingG_46
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 10 questions asked

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

0 Likes

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

0 Likes
Anonymous
Not applicable

I am using currently using a CY8CKIT-043

0 Likes
Anonymous
Not applicable

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.

0 Likes
Anonymous
Not applicable

I was hoping there was a way to use PSoC Creator components to do it.  Is this possible?

0 Likes

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

0 Likes

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

0 Likes
Anonymous
Not applicable

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.

0 Likes
Anonymous
Not applicable

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.

0 Likes
Anonymous
Not applicable

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

0 Likes
Anonymous
Not applicable

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.

0 Likes