⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 51_52评估板自检程序源文件
💻 C
字号:
//======================================================================
//	The information contained herein is the exclusive property of
//	Beijing Bynatec Co., Ltd. And shall not be distributed, reproduced,
//	or disclosed in whole in part without prior written permission.
//	(C) COPYRIGHT 2009 Beijing Bynatec Co., Ltd.
//	ALL RIGHTS RESERVED
//	The entire notice above must be reproduced on all authorized copies.
//======================================================================

//============================================================
//	犀拓开发网 http://www.mcutop.com
//
//	工程名称:	52board_testself.uv2
//	功能描述:	51/52评估板自检程序
//	IDE环境:	keil C uVision3
//	操作系统:	windows xp sp3
//	组成文件:	main.c
//	硬件连接:	默认
//				晶振24MHz
//	维护记录:	2009年3月18日	v1.0
//======================================================================

//======================================================================
//	文件名称:	main.c
//	功能描述:	51/52评估板自检程序
//	维护记录:	2009年3月18日	v1.0
//======================================================================
#include <reg52.h>

sbit P10 = P1^0;
sbit P11 = P1^1;
sbit P12 = P1^2;
sbit P13 = P1^3;

sbit P32 = P3^2;
sbit P33 = P3^3;
sbit P34 = P3^4;
sbit P35 = P3^5;

void _delay_ms(unsigned int time)
{
	unsigned int i, j;
	for(i=0;i<time;i++)
		for(j=0;j<500;j++);
}
int main(void)
{
	while(1)
	{
		_delay_ms(50);
		P13 = 1;
		P10 = 0;
		_delay_ms(50);
		P10 = 1;
		P11 = 0;
		_delay_ms(50);
		P11 = 1;
		P12 = 0;
		_delay_ms(50);
		P12 = 1;
		P13 = 0;
		if((!P32) || (!P33) || (!P34) || (!P35))	// 如果有按键推出跑马灯
			break;
	}
	while(1)
	{
		if(!P32)									// 点亮对应的LED
		{
			P1 = 0xff;
			P10 = 0;
		}
		if(!P33)
		{
			P1 = 0xff;
			P11 = 0;
		}
		if(!P34)
		{
			P1 = 0xff;
			P12 = 0;
		}
		if(!P35)
		{
			P1 = 0xff;
			P13 = 0;
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -