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.
ROWO_285026
Level 1
Level 1
First reply posted First question asked Welcome!

Overview:
The project reads 2 independently separate PWM signals which can vary in BOTH frequency and duty cycle.
 It then converts to the output PWMs with the same duty cycle at 50hz.

Incoming frequency range 45hz to 333hz --incoming duty cycle range 1ms to 2ms, out frequency is 50 hz fixed, out duty cycle is equal to the incoming duty cycle.

The incoming PWMs can both go high on the same clock cycle or on separate clock cycles

NOTE: (operating a standard rc servo 1ms to 2ms duty cycle at 50hz)
chan0_in duty cycle = chan0_out duty cycle in milli seconds
chan1_in duty cycle = chan1_out duty cycle in milli seconds

Clock hz is scaled so that timer count of 1000 = 1ms and timer count of 2000 = 2ms

chan0_in Timer0 and chan0_out PWM0 works as it should varying the out put duty equal to the current input duty cycle at 50hz.

The issue I'm having is...................................
Timer1 count of the duty cycle returns a value less than 1000
and I cannot figure out why

? in the code below means I'm not sure if this is the correct way

See TopDesign for further explanation
CY8CKIT-049-42XX rev*A HARDWARE

My project is attached

Thank you in advance for looking

Ron, 828 447 8775

0 Likes
1 Reply
lock attach
Attachments are accessible only for community members.
Aashita_R
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 250 replies posted

Hi @ROWO_285026 ,

I went through your attached project but the logic is yet not very clear to me through the code. Can you please elaborate more on your application?

However, I have shared a code example where you can measure the frequency and duty cycle using timer/counter and PWM component.  PWM is used as a signal generator and with the help of two timer counter components, wherein the output signal from PWM is fed to one timer counter and its inverted signal is fed to another timer counter. In this project, frequency, duty cycle and period is calculated using different formulas. Please go through it once and let us know in case of further queries.

Best Regards,

Aashita

 

0 Likes