用定时器实现

This commit is contained in:
fengbh 2024-07-15 03:14:43 +08:00
parent f82554f500
commit 27b4a51317

View File

@ -12,6 +12,7 @@
#include "uart.h" #include "uart.h"
#include "stdio.h" #include "stdio.h"
#include "led.h" #include "led.h"
#include "time0.h"
/******************************************************************************* /*******************************************************************************
* : main * : main
@ -23,6 +24,7 @@ void main(void)
{ {
uart_init(0XFA);//波特率为9600 uart_init(0XFA);//波特率为9600
time0_init();
u8 i = 0x01; u8 i = 0x01;
while(1) while(1)
@ -38,7 +40,8 @@ void main(void)
// delay_ms(1000); // delay_ms(1000);
// 实验三:蜂鸣器 // 实验三:蜂鸣器
BEEP=!BEEP; BEEP=!BEEP;
delay_10us(100); // delay_10us(100);
time0_delay1ms(1);
// printf("Hello,world!\r\n"); // printf("Hello,world!\r\n");
} }