PWM using PCA

Hi,
I was trying to configure the CEX3 of Atmel TSC80251G2D( 80C251). Here follows my initialization code. I dont see a PWM output.
Any one has any comments? If so please help.

void pca_configure()
{
CMOD = 0x0; /* Internal Clock */
CCAPM3 = 0x42; /* PWM ON */
CCAP3H = 128; /* Duty cycle value for 50% */
CCAP3L = 128; /* Duty cycle value for 50% */
IPL0 = 0x40; /* Make PCA interrupt the highest priority */
IPH0 = 0x40; /* Make PCA interrupt the highest priority */

CR = 1; /* Start running */
EC = 1; /* PCA interrupt enable */
EA = 1; /* /* Global interrupt enable */
}


Thanks and Regards
Arun

Parents
  • Arun,

    What state do you see on the output pin? Is it constantly high or constantly low? Also, is there anything else in your code that works with the PCA? Keep in mind that the PWM function depends on the PCA counter being allowed to run freely. If you're manipulating CH or CL anywhere in your code, you could be constantly reloading a value that doesn't allow the PWM to change state. Try entering very low, or very high values for CCAP3H, CCAP3L. If you see glitches on the lines, then that might mean that the counter's getting hosed somehow.

Reply
  • Arun,

    What state do you see on the output pin? Is it constantly high or constantly low? Also, is there anything else in your code that works with the PCA? Keep in mind that the PWM function depends on the PCA counter being allowed to run freely. If you're manipulating CH or CL anywhere in your code, you could be constantly reloading a value that doesn't allow the PWM to change state. Try entering very low, or very high values for CCAP3H, CCAP3L. If you see glitches on the lines, then that might mean that the counter's getting hosed somehow.

Children
More questions in this forum