As for your set up code, you never set the PWMCTL register.
It appears you wish to concatenate channels 6&7, so you need to set 0x80 (CON67).
Also you need to write to the 16 bit registers as shown below.
CON67 — Concatenate channels 6 and 7
1 = Channels 6 and 7 are concatenated to create one 16-bit PWM channel. Channel 6 becomes the
high order byte and channel 7 becomes the low order byte. Channel 7 output pin is used as the
output for this 16-bit PWM (bit 7 of port PWMP). Channel 7 clock select control-bit
determines the clock source, channel 7 polarity bit determines the polarity, channel 7 enable
bit enables the output and channel 7 center aligned enable bit determines the output mode.
0 = Channels 6 and 7 are separate 8-bit PWMs.
Code:
void InitPWM7(void ){ // Set up channels 6 & 7 for 16 bit operation. PWMCLK_PCLK7 = 0; // Set channel 7 for clk b. PWMPOL_PPOL7 = 1; // Start with a high. PWMCTL_CON67 = 1; // concat 6&7 PWMPRCLK_PCKB =0; // Set clk b divider to 0 PWMCAE_CAE7 = 0; // set left algn mode. PWMPER67 = 62500; // 50% Duty cycle PWMDTY67 = 31250; PWME_PWME7 = 1; // enable the channel. }
Please note how I have done things here, so as not to change settings on other channels.
After you insert this code and build it, you can use "Got to macro declaration" on the right click menu to see how these work. While it seems unimportant now, later when you have much code it will reduce the possibility of bugs.
Message Edited by JimDon on
2007-12-11 11:48 AM