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

📄 sys.h

📁 x5045,在P89V51RD2中用的
💻 H
字号:

//------------------------------------------------------------------------------------
// 定义全局常量和变量
//------------------------------------------------------------------------------------
#define SYSCLK 11059200                     // 定义系统时钟(Hz)
#define uint8   unsigned char 
#define uint16  unsigned int 
#define uint32  unsigned long 



sbit Led_Bit1	=	P1^0;
sbit Led_Bit2	=	P1^1;
sbit Led_Bit3	=	P1^2;
sbit Led_Bit4	=	P1^3;

sfr  Led_Data	=	0x80;

uint8 xdata L,L1,L2,L3,L4;

uint8 xdata Led8[10]={0x09,0xdb,0x07,0x25,0xe1,0x31,0x11,0xad,0x01,0x21};//0-9


/*
******************************************************************
*																 *
*	函数功能:  短延时程序	                                     *
*																 *
******************************************************************
*/
void Wait(unsigned int Us1)
{

 unsigned int U1=0;
 while(U1<Us1) {U1++;U1++;U1--;}
}



/*
******************************************************************
*																 *
*	函数功能:  LED输出程序	  							    	 *
*																 *
******************************************************************
*/

uint8 Led_Out(uint8 Led)
{


if(Led==1)
{
Led_Bit4=1;
P0=Led8[L1];
Led_Bit1=0;
}
else if(Led==2)
{
Led_Bit1=1;
P0=Led8[L2];
Led_Bit2=0;
}
else if(Led==3)
{
Led_Bit2=1;
P0=Led8[L3]; 
Led_Bit3=0;
}
else if(Led==4)
{
Led_Bit3=1;
P0=Led8[L4]; 
Led_Bit4=0;
}

Led=Led++;
if(Led==5) Led=1;

return Led;

}

⌨️ 快捷键说明

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