怎么使用PWM模块的的Fault信号禁止六路PWM信号的输出???
uint16_t Fault;
int main(void)
[
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM0);
GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE, GPIO_PIN_2);
IntMasterEnable();
IntEnable(INT_PWM0_FAULT);
GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_2,FALSE);
Fault=GPIOPinRead(GPIO_PORTB_BASE, GPIO_PIN_2);
while(Fault==1)
[
PWM0faul
tintHandler();
]
for(;;) //infinite loop
[]
]
void
PWM0faultIntHandler(void)
[
//清除错误中断
PWMFaultIntClear(PWM0_BASE);
PWMOutputState(PWM0_BASE, PWM_OUT_0_BIT, false);
PWMOutputState(PWM0_BASE, PWM_OUT_1_BIT, false);
PWMOutputState(PWM0_BASE, PWM_OUT_2_BIT, false);
PWMOutputState(PWM0_BASE, PWM_OUT_3_BIT, false);
PWMOutputState(PWM0_BASE, PWM_OUT_4_BIT, false);
PWMOutputState(PWM0_BASE, PWM_OUT_5_BIT, false);
]
这样写为什么不可以呢?
0