cancel
Showing results for 
Search instead for 
Did you mean: 

4 PWM ST72C254

marco32
Associate II
Posted on July 09, 2004 at 07:19

4 PWM ST72C254

2 REPLIES 2
marco32
Associate II
Posted on July 02, 2004 at 07:25

I want to generate 4 PWM's with ST72C254 to drive 230V light sources at PA0-PA3. Only one PWM may be active at the same time!

The netsync of the 230V is coming in to the capture interrupt.

After a capture interrupt, i read the alternate counter and add the delay time and write it to the output compare interrupt.

    I get only capture interrupt and no output compare interrupt?

      May the capture and output compare interrupt enabled at the same time?

        Is it an idea to write to the timer counter [it wil be reset after a random write] after a capture interrupt, and then write only the delay time to the output compare interrupt?

        regards Moppie

        [ This message was edited by: Moppie on 02-07-2004 10:56 ]

        [ This message was edited by: Moppie on 02-07-2004 10:57 ]
        rolf
        Associate II
        Posted on July 09, 2004 at 07:19

        Hi!

        1)

        If you are running the 16-bit timer in ''free running'' mode, I would recommend not to read the counter in the IC Interrupt routine but to read the input capture register in order to get the timer value at the exact time of the input capture event without any jitter.

        2)

        It should be no problem to work with IC and OC at the same time. Please check the sequence which you use to write to the OC-higher Byte and lower byte: first write to the HB then write to the LB. Take care also for the second IC and OC chanal which should be disabled if you don't need an interrupt on it: Access first the LB than the HB (reverse order!) => compare also to datasheet for that sequence

        3)

        Make sure that the OC interrupt is enabled!

        Wish you good luck!