sjb741
Junior Member level 2
Suppose I have to synchronise multiple PWMs on separate PICs, how would I do that? Assume the two PICs share a common system clock.
Of course, one 'solution' is to side-step the question and find a PIC with enough independent PWM modules which can then somehow be sychroninised... However, I am still interested in techniques for synchronising across separate devices because I feel this could be a useful thing to understand - regardless of whether a single chip solution exists.
For instance: I designed a 'cheap as possible' 2-PWM wave generator using a PIC16F1825. For this particular PIC, I had to synchronise the 2 PWM by adding some assembly code into the C code. Whilst I realise other PICs have good ways to synchronise 2 (or maybe 4) PWM channels, I'd be interested in how to synchronise two 1825 devices.
That way, the two PWM can use independent master clock speeds. At present, the two on-chip PWM must share the same clock source, so I can't have one PWM going at MHz and the other running at a few Hz. Even though that range of PWM is possible, it involves 'clock switching' and that clock is common to both PWM.
BTW: In this particular example, I'm imagining the two PICs sharing one external system clock, like a crystal oscillator module - although I do wonder whether I can make use of a 'clock out' pin on one PIC to drive the other PIC's sytem clock.
Of course, one 'solution' is to side-step the question and find a PIC with enough independent PWM modules which can then somehow be sychroninised... However, I am still interested in techniques for synchronising across separate devices because I feel this could be a useful thing to understand - regardless of whether a single chip solution exists.
For instance: I designed a 'cheap as possible' 2-PWM wave generator using a PIC16F1825. For this particular PIC, I had to synchronise the 2 PWM by adding some assembly code into the C code. Whilst I realise other PICs have good ways to synchronise 2 (or maybe 4) PWM channels, I'd be interested in how to synchronise two 1825 devices.
That way, the two PWM can use independent master clock speeds. At present, the two on-chip PWM must share the same clock source, so I can't have one PWM going at MHz and the other running at a few Hz. Even though that range of PWM is possible, it involves 'clock switching' and that clock is common to both PWM.
BTW: In this particular example, I'm imagining the two PICs sharing one external system clock, like a crystal oscillator module - although I do wonder whether I can make use of a 'clock out' pin on one PIC to drive the other PIC's sytem clock.