2014-05-02 12:34 PM
Hello everyone,
I have a PWM signal generated from an external source and I want to create a reference signal from this one. First this signal is of constant duty cycle (I want to create a reference signal here), later on the signal is modulate. (Basically Modulation and Demodulation of a Digital Signal) How would I do this. Thanks #stm2014-05-02 01:40 PM
I have a PWM signal generated from an external source and I want to create a reference signal from this one. First this signal is of constant duty cycle (I want to create a reference signal here), later on the signal is modulate. (Basically Modulation and Demodulation of a Digital Signal)
''First this signal is of constant duty cycle'' which one? The source or the reference? Depending on the frequency, you can count the cycles of the original source, integrating over time, or you can time-stamp the rising/falling edges, and determine frequency/duty. If you know the frequency, you can program a timer within the integer divider limits of the design. There are better ways of generating signals, but ST didn't implement them.
2014-05-02 02:01 PM
thanks clive,
The thing is I can calculate my frequency and Duty cycle to generate a PWM signal, but unfortunately the signal would be out of sync i.e the off time on one may be over the on time of the second though they maybe of the same duty cycle.The intent is get the modulated signal from the carrier frequency.Thanks2014-05-02 02:19 PM
It would take effort to synchronize them, but you can control the phase through the TIMx->CNT and period TIMx->ARR
You can have one channel in PWM Output mode, and others in Input Capture mode, you could measure the relative phase.2014-05-05 01:53 PM
2014-05-05 04:57 PM
I guess you could use EXTI, but you can interrupt off timer pins, they can latch the ''phase'', so are immune from interrupt latency.