This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

PWM using CAPCOM

Hi

Does anyone know where to find any example of implementing PWM using CAPCOM especially in XC161 (16 bit microcontroller)?

MJ

Parents Reply Children
  • No problem, the timer T0 is running at a clock frequency of 20MHz/64 = 3.2usec per tick. The CAPCOM timers can ONLY count up. The example uses the CAPCOM channel 0 in Compare Mode 3 and is associated to T0.

    I arbitrarily selected a period of 100mseconds. So 100msec/3.2usec = 31250 or 0x7A12 counts. Since the CAPCOM can only count up you need to subtract this from 0x10000 which gives you 0x10000 – 0x7A12 = 0x85EE.

    Does this answer your question?

    -Chris