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

📄 test.c

📁 x5045,在P89V51RD2中用的
💻 C
字号:
#include<reg51.h>
#include<sys.h>
#include<x5045.h>


sbit Beep=P3^2;
uint8 N1,Num;
uint8 i;

uint16 Time;


//===========================================
void Led_N(uint16 Led_Num)  	//转换成BCD码
{
L3=Led_Num/1000;
L2=(Led_Num%1000)/100;
L1=(Led_Num%100)/10;
L4=Led_Num%10;
}

void main(void)
{

SP=0x60;

Rst_X45();		//初始化X5045

	N1=X45_Rd(0x100);  		//
	X45_Wr(0x100,N1+1);		// X5045 



while(1)
{

	CCS=0;
	Wait(1);
	CCS=1;

	Led_N(N1*10);

	Wait(400);
	L=Led_Out(L);

	Num++;
	if(Num<100)	Beep=1;
	else if (Num<102) Beep=0;
	else if(Num==102)
	{
	Num=0;
	}


}//while(1);

}

⌨️ 快捷键说明

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