定时器3产生8000HZ中断,PWM播放WAV音频 出口PA7
基于STM32F103C8T6 keil5编译
单片机源程序如下:
- /***************************************
- * 文件名 :main.c
- * 描述 :定时器3产生8000HZ中断,PWM播放WAV音频 出口PA7
- * 实验平台:MINI STM32开发板 基于STM32F103C8T6
- * 库版本 :ST3.0.0 *
- *********************************************************/
- #include "stm32f10x.h"
- #include "led.h"
- #include "Time_test.h"
- #include "dac.h"
- volatile u32 time; // ms 计时变量
- int main(void)
- {
-
- SystemInit(); /* 配置系统时钟为 72M */
-
- LED_GPIO_Config();/* led 端口配置 */
-
- TIM2_NVIC_Configuration(); /* TIM2 定时配置 */
-
- while(1)
- {
- // if ( time == 500 ) /* 500ms 时间到 */
- {
- // time = 0;
- //GPIO_WriteBit(GPIOC, GPIO_Pin_13, (BitAction)((1-GPIO_ReadOutputDataBit(GPIOC, GPIO_Pin_13)))); /* LED1 取反 */
- }
- }
- }
复制代码
所有资料51hei提供下载:
TIM定时器操作.7z
(261.27 KB, 下载次数: 180)
|