定時器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, 下載次數: 181)
2020-5-16 04:30 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
|