基于STM32单片机定时器主从方式输出可控个数的PWM脉冲的KEIL工程源码,
int main(void)
{
u32 i=0;
NVIC_Config();
GPIO_Config();
TIM2_Master__TIM3_Slave_Configuration(10); // ÅäÖÃTIM2µÄÂö³åÊä³öΪ10Hz
while(1)
{
if(TIM2_Pulse_TIM3_Counter_OK == 0)
Output_Pulse(10);
else if(TIM2_Pulse_TIM3_Counter_OK == 2)
{
for(i=0; i<10000000; i++); // Delay
TIM2_Pulse_TIM3_Counter_OK = 0;
}
}
}