|
在用LM4F232板子输出PWM信号时,通过Jlink把代码烧到板子上,反复几次后,板子就烧了,不能用。换了一块新的板子,用了几次也烧了。具体代码如下: SysCtlClockSet(SYSCTL_USE_OSC|SYSCTL_OSC_MAIN |SYSCTL_XTAL_16MHZ|SYSCTL_SYSDIV_4);
SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOH);
GPIOPinTypePWM(GPIO_PORTH_BASE, GPIO_PIN_0);
GPIOPinTypePWM(GPIO_PORTH_BASE, GPIO_PIN_1);
GPIOPinConfigure(GPIO_PH0_M0PWM0);
GPIOPinConfigure(GPIO_PH1_M0PWM1);
SysCtlPWMClockSet(SYSCTL_PWMDIV_1);
PWMGenConfigure(PWM0_BASE,PWM_GEN_0,PWM_GEN_MODE_UP_DOWN| PWM_GEN_MODE_NO_SYNC);
PWMGenPeriodSet(PWM0_BASE, PWM_GEN_0,84763);
PWMPulseWidthSet(PWM0_BASE, PWM_OUT_0, 4060);
PWMPulseWidthSet(PWM0_BASE, PWM_OUT_1, 7800);
PWMOutputState(PWM0_BASE, (PWM_OUT_0_BIT |PWM_OUT_1_BIT), true);
PWMGenEnable(PWM0_BASE, PWM_GEN_0);
SysCtlDelay(40000000/3);//10s
PWMGenDisable(PWM0_BASE, PWM_GEN_0);
|
|