|
回复 沙发 Study_Stellaris 的帖子
请问两个发生器之间的延时是在PWMGenEnable()之间加入延时函数还是在PWMSyncTimeBase在()之间呢?附上我的源码:
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOJ);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOH); SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM);
SysCtlPWMClockSet(SYSCTL_PWMDIV_1) ;
GPIOPinConfigure(GPIO_PJ0_PWM0);
GPIOPinConfigure(GPIO_PJ1_PWM1);
GPIOPinTypePWM(GPIO_PORTJ_BASE, GPIO_PIN_0);
GPIOPinTypePWM(GPIO_PORTJ_BASE, GPIO_PIN_1);
GPIOPinConfigure(GPIO_PH0_PWM2);
GPIOPinConfigure(GPIO_PH1_PWM3);
GPIOPinTypePWM(GPIO_PORTH_BASE, GPIO_PIN_0);
GPIOPinTypePWM(GPIO_PORTH_BASE, GPIO_PIN_1);
PWMGenConfigure(PWM_BASE,PWM_GEN_0,PWM_GEN_MODE_DOWN|PWM_GEN_MODE_NO_SYNC);
PWMGenPeriodSet(PWM_BASE,PWM_GEN_0,320);
PWMPulseWidthSet(PWM_BASE,PWM_OUT_0,159);
PWMPulseWidthSet(PWM_BASE, PWM_OUT_1,159);
PWMGenConfigure(PWM_BASE, PWM_GEN_1, PWM_GEN_MODE_DOWN | PWM_GEN_MODE_NO_SYNC);
PWMGenPeriodSet(PWM_BASE,PWM_GEN_1, 320);
PWMPulseWidthSet(PWM_BASE, PWM_OUT_2,159);
PWMPulseWidthSet(PWM_BASE, PWM_OUT_3,159);
PWMOutputInvert(PWM_BASE,PWM_OUT_1_BIT,true);
PWMOutputInvert(PWM_BASE,PWM_OUT_3_BIT,true);
PWMOutputState(PWM_BASE,PWM_OUT_0_BIT|PWM_OUT_1_BIT|PWM_OUT_2_BIT|PWM_OUT_3_BIT,true);
PWMGenEnable(PWM_BASE,PWM_GEN_0);
PWMGenEnable(PWM_BASE,PWM_GEN_1);
PWMSyncTimeBase(PWM_BASE,PWM_GEN_0_BIT);
PWMSyncTimeBase(PWM_BASE,PWM_GEN_1_BIT);
while(1)
{
} |
|