/***************************************
实验题目要求:
P23- P26口做输出口,接发光二极管,编写并调试程序,使其闪烁。
时间:2012年12月21日
程序撰写者:邹康
*****************************************/
#include<reg52.h>
void delay(unsigned int t) //软延时大致时间为1ms
{
unsigned int a,b;
for(a=0;a<t;a++)
for(b=0;b<120;b++);
}
void main()
{
while(1)
{
P2=~P2;
delay(1000); //延时1s
}
} /*********************************************************
实验题目要求:
P23- P26口做输出口,接发光二极管,编写并调试跑马灯程序。
时间:2012年12月21日
程序撰写者:邹康
***********************************************************/
#include<reg52.h>
void delay(unsigned int t) //延时1ms左右
{
unsigned int a,b;
for(a=0;a<t;a++)
for(b=0;b<120;b++);
}
void main()
搜索“diyifanwen.net”或“第一范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,第一范文网,提供最新工程科技单片机期末考试编程题全文阅读和word下载服务。
相关推荐: