赞
踩
- #include<reg52.h>
- #define uchar unsigned char
- #define uint unsigned int
- uchar tt;
- sbit d1=P1^0;
-
- void main()
- {
- TMOD=0x01; //选择定时器 t0的工作方式为1
- EA=1;
- TH0=(65536-50000)/256;
- TL0=(65536-50000)%256;
- ET0=1;
- TR0=1;
- while(1)
- {
-
- if(tt==20)
- {
- tt=0;
- P1=~P1;
- }
- }
- }
-
-
- void exter() interrupt 1
- {
- TH0=(65536-50000)/256;
- TL0=(65536-50000)%256;
- tt++;
- }

这个程序没有任何问题,主要是了解定时器的应用,在设计自己的电路时其中的电路原理很重要
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。