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
Hi , Thanks a lot for the respose.What I see is a constant low. I have a pca_isr() which reloads the value for 50% duty cycle. void pca_isr(void) interrupt 6 using 2 { CCF3 = 0; CCAP3H = 128; /*Value for 50% duty cycle*/ CCAP3L = 128; /*Value for 50% duty cycle*/ } I am expecting 50%duty cycle with this. But unfortunately I dont see any signal. Do you think any part of my configuration is wrong? Thanks and Regards Arun
Arun, While I've never tried this myself, I know that you're generally not supposed to modify the register CCAP3L manually when you're using the PWM mode. Basically, you load the value you want into CCAP3H and then when the CL portion of the PCA counter rolls over, the hardware loads the value from CCAP3H into CCAP3L for you. What it would do if you were constantly reloading it, I'm not sure. Did you try setting the PWM to other values? Try replacing the 128 reload with 5 or 250, for example and then see how the signal changes or if anything is different.
Hi Jay, Thanks for the help. It is working now. I stopped enabling the PCA interrupt and the reloading. Thanks again Arun