谢谢版主,我下载到了文档。
SCI已经做好了,使用的是PE生成的代码。
用PE在做PWMMC的时候总是不能出波形,下面是生成的初始化函数。
/*
** ===================================================================
** Method : PWMC1_Init (bean PWMMC)
**
** Description :
** This method is internal. It is used by Processor Expert
** only.
** ===================================================================
*/
void PWMC1_Init(void)
{
/* PWMA_PMICCR: ??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,ICC3=0,ICC2=0,ICC0=0 */
setReg(PWMA_PMICCR,0); /* Set up Internal Correction Control Register */
/* PWMA_PMCTL: LDFQ=0,HALF=0,IPOL2=0,IPOL1=0,IPOL0=0,PRSC=0,PWMRIE=1,PWMF=0,ISENS=0,LDOK=0,PWMEN=0 */
setReg(PWMA_PMCTL,32); /* Set up PWM control register */
/* PWMA_PMFCTL: FIE3=0,FMODE3=1,FIE2=1,FMODE2=1,FIE1=1,FMODE1=1,FIE0=1,FMODE0=1 */
setReg(PWMA_PMFCTL,127); /* Set up Fault Control Register*/
/* PWMA_PMDISMAP1: DISMAP=0 */
setReg(PWMA_PMDISMAP1,0); /* Set up PWM Disable Mapping Register 1 */
/* PWMA_PMDISMAP2: DISMAP7=0,DISMAP6=0,DISMAP5=0,DISMAP4=0,DISMAP3=0,DISMAP2=0,DISMAP1=0,DISMAP0=0 */
setReg(PWMA_PMDISMAP2,0); /* Set up PWM Disable Mapping Register 2 */
/* PWMA_PMOUT: PAD_EN=0,??=0,OUTCTL=0,??=0,??=0,OUT=0 */
setReg(PWMA_PMOUT,0x00CF); /* Set up Output Control Register */
/* PWMA_PMCCR: ENHA=0,nBX=0,MSK=0,??=0,??=0,VLMODE=0,??=0,SWP45=0,SWP23=0,SWP01=0 */
setReg(PWMA_PMCCR,0x0000); /* Set up PWM Channel Control Register */
/* PWMA_PMCFG: ??=0,DBG_EN=0,WAIT_EN=0,EDG=0,??=0,TOPNEG45=0,TOPNEG23=0,TOPNEG01=0,??=0,BOTNEG45=0,BOTNEG23=0,BOTNEG01=0,INDEP45=0,INDEP23=0,INDEP01=0,WP=0 */
setReg(PWMA_PMCFG,0); /* Set up PWM configure register */
setReg(PWMA_PMDEADTM,60); /* Set up Dead-Time Register */
setReg(PWMA_PWMVAL0,3000); /* Store initial value to the duty-compare register */
setReg(PWMA_PWMVAL1,3000); /* Store initial value to the duty-compare register */
setReg(PWMA_PWMVAL2,3000); /* Store initial value to the duty-compare register */
setReg(PWMA_PWMVAL3,3000); /* Store initial value to the duty-compare register */
setReg(PWMA_PWMVAL4,3000); /* Store initial value to the duty-compare register */
setReg(PWMA_PWMVAL5,3000); /* Store initial value to the duty-compare register */
setReg(PWMA_PWMCM,6000); /* and to the period-modulo register */
setRegBits(PWMA_PMCTL,3); /* Load counter and modulo registers into buffers and run counter */
}
请版主赐教~~~ |