Hi, so i manage to output 4 PWMs from TA0.x: extern Timer_A_PWMConfig pwmConfig = { TIMER_A_CLOCKSOURCE_SMCLK, TIMER_A_CLOCKSOURCE_DIVIDER_1, 24000, TIMER_A_CAPTURECOMPARE_REGISTER_1, TIMER_A_OUTPUTMODE_RESET_SET, 12000 }; extern Timer_A_PWMConfig pwmConfig2 = { TIMER_A_CLOCKSOURCE_SMCLK, TIMER_A_CLOCKSOURCE_DIVIDER_1, 24000, TIMER_A_CAPTURECOMPARE_REGISTER_2, TIMER_A_OUTPUTMODE_RESET_SET, 12000 }; extern Timer_A_PWMConfig pwmConfig3 = { TIMER_A_CLOCKSOURCE_SMCLK, TIMER_A_CLOCKSOURCE_DIVIDER_1, 24000, TIMER_A_CAPTURECOMPARE_REGISTER_3, TIMER_A_OUTPUTMODE_RESET_SET, 12000 }; extern Timer_A_PWMConfig pwmConfig4 = { TIMER_A_CLOCKSOURCE_SMCLK, TIMER_A_CLOCKSOURCE_DIVIDER_1, 24000, TIMER_A_CAPTURECOMPARE_REGISTER_4, TIMER_A_OUTPUTMODE_RESET_SET, 12000 }; MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P2, GPIO_PIN4,GPIO_PRIMARY_MODULE_FUNCTION); MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P2, GPIO_PIN5,GPIO_PRIMARY_MODULE_FUNCTION); MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P2, GPIO_PIN6,GPIO_PRIMARY_MODULE_FUNCTION); MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P2, GPIO_PIN7,GPIO_PRIMARY_MODULE_FUNCTION); MAP_Timer_A_generatePWM(TIMER_A0_BASE, &pwmConfig); MAP_Timer_A_generatePWM(TIMER_A0_BASE, &pwmConfig2); MAP_Timer_A_generatePWM(TIMER_A0_BASE, &pwmConfig3); MAP_Timer_A_generatePWM(TIMER_A0_BASE, &pwmConfig4);
↧