Quantcast
Channel: CSDN博客推荐文章
Viewing all articles
Browse latest Browse all 35570

用定时器T0查询方式P0口8位控制LED闪烁

$
0
0

#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
void main (void)
{   uchar i=0;
	TMOD=0x01;              
	TH0=(65536-50000)/256;
	TL0=(65536-50000)%256;
	TR0=1;
	TF0=0;
	P0=0xff;
	while(1)
	{
		while(TF0==1)
		{  
			i++;			
			if(i==20)
			{
				i=0;

				P0=~P0;

			}
			TF0=0;
			TH0=(65536-50000)/256;
			TL0=(65536-50000)%256;

		}
	}
}

 //用定时器T0查询方式P0口8位控制LED闪烁


作者:u010695380 发表于2013-7-18 13:14:09 原文链接
阅读:39 评论:0 查看评论

Viewing all articles
Browse latest Browse all 35570

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>