单片机期末考试编程题
时间:2026-01-18
时间:2026-01-18
/***************************************
实验题目要求:
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()