我寫了簡單的 Test Code 由 sample code(Smpl_Basic01_PWMDAC)改的 , 但 IO pin (PWM0) 卻一直沒有輸出, 什麼地方錯了 ???
Thanks !!!
main() { SYS_Init();
CLK_SetModuleClock( PWM01_MODULE, CLK_CLKSEL1_PWM01_S_HIRC, 0); CLK_EnableModuleClock( PWM01_MODULE );
SYS->GPA_MFP = SYS_GPA_MFP_PA12_PWM0;
PWM_ConfigOutputChannel( PWMA,0,1000000,50 ); PWM_SET_DIVIDER( PWMA, 0, PWM_CLK_DIV_1 ); PWM_SET_PRESCALER( PWMA, 1, 0 ); PWM_SET_CNR(PWMA, 0, 120); PWM_SET_CMR(PWMA, 0, 60); PWM_Start(PWMA, 0x01);
PWM_EnableOutput(PWMA, 0x01);
GPIO_SetMode(PB, 4, GPIO_PMD_OUTPUT); //LED1 while(1) { PB4 ^= 1; PWM_SET_CMR(PWMA, 0, 60);
};
}
|