|
基于proteus的Hello MCU 實(shí)驗(yàn)
基本的串口配置及輸出實(shí)驗(yàn).
proteus 8.7以上打開,包括工程及源碼.
HelloMCU.jpg (143.2 KB, 下載次數(shù): 75)
下載附件
2019-3-13 09:31 上傳
單片機(jī)源程序如下:
- #include<reg52.h>
- #include<stdio.h>
- #include <string.h>
- void delay_us(unsigned int x)
- {
- while(x)
- {
- x=x-1;
- }
- }
- //串口通信初始化 現(xiàn)在不需要理解配置原理,能用就行
- void uart(void)
- {
- SCON=0x40; //串口通信工作方式1
- REN=1; //允許接收
- TMOD=0x20; //定時(shí)器1的工作方式2
- TH1=0xfd,TL1=0xfd;
- TI=1; //這里一定要注意
- TR1=1; //打開定時(shí)器
- }
- void main(void)
- {
- uart();
- while(1)
- {
- printf("Hellp MCU!\r\n");
- delay_us(65530);
- printf("Hellp World!\r\n");
- delay_us(65530);
- }
- }
復(fù)制代碼
所有資料51hei提供下載:
proteus_HelloMCU.zip
(49.69 KB, 下載次數(shù): 20)
2019-3-13 09:27 上傳
點(diǎn)擊文件名下載附件
工程及源碼 下載積分: 黑幣 -5
|
評(píng)分
-
查看全部評(píng)分
|