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

📄 userfunction.c

📁 关于SPLC501C的液晶编程
💻 C
📖 第 1 页 / 共 2 页
字号:
	LCD501_Bitmap(56,48,(unsigned int*)encoding_33);	//阳
	Delay_User(100);			//延时
	LCD501_Bitmap(72,48,(unsigned int*)encoding_34);	//科
	Delay_User(100);			//延时
	LCD501_Bitmap(88,48,(unsigned int*)encoding_35);	//技
	LCD501_SetPaintMode(uiPaint_M);	//恢复设置
	while(1)
	{
		uiKey = SP_GetCh();
		if(uiKey==0x0001)		//如有Key1按下则返回
		{
			return;
		}
		F_Key_Scan_ServiceLoop();	//键盘循环服务程序
		Clear_Watchdog();			//清看门狗
	}
}
//=====================================================================//
//函数:void BMP_Show(unsigned int *BMP_Point)
//描述:BMP图像显示演示函数
//参数:unsigned int *BMP_Point  图像数据的首地址
//返回:无
//注意:无
//=====================================================================//
void BMP_Show(unsigned int *BMP_Point)
{
	unsigned int uiKey,uiPaint_M;
	uiPaint_M = LCD501_GetPaintMode();
	LCD501_ClrScreen(1);		//清屏
	LCD501_SetPaintMode(4);		//设置LCD显示模式
	LCD501_Bitmap(10,10,BMP_Point);	//显示BMP图像
	LCD501_SetPaintMode(uiPaint_M);	//恢复设置
	while(1)
	{
		uiKey = SP_GetCh();
		if(uiKey==0x0001)		//如有Key1按下则返回
		{
			return;
		}
		F_Key_Scan_ServiceLoop();	//键盘循环服务程序
		Clear_Watchdog();			//清看门狗
	}
}
//=====================================================================//
//函数:void BMP_Show_Mode(void)
//描述:BMP图像显示演示函数,演示显示的模式
//参数:无
//返回:无
//注意:无
//=====================================================================//
void BMP_Show_Mode(void)
{
	unsigned int uiKey,uiPaint_M;
	uiPaint_M = LCD501_GetPaintMode();
	LCD501_ClrScreen(0);		//清屏
	Delay_User(200);
	LCD501_SetPaintMode(4);		//设置LCD显示模式
	LCD501_Bitmap(10,10,(unsigned int *)encoding_36);	//
	Delay_User(600);
	LCD501_ClrScreen(1);		//清屏
	Delay_User(200);
	LCD501_SetPaintMode(2);		//设置LCD显示模式
	LCD501_Bitmap(10,10,(unsigned int *)encoding_36);	//
	Delay_User(600);
	LCD501_ClrScreen(0);		//清屏
	LCD501_SetPaintMode(0);		//设置LCD显示模式
	LCD501_Rectangle(64,0,127,63,1);	//显示半屏黑色
	Delay_User(200);
	LCD501_SetPaintMode(3);		//设置LCD显示模式
	LCD501_Bitmap(10,10,(unsigned int *)encoding_36);	//
	Delay_User(600);
	LCD501_ClrScreen(0);		//清屏
	LCD501_Rectangle(64,0,127,63,1);	//显示半屏黑色
	Delay_User(200);
	LCD501_SetPaintMode(0);		//设置LCD显示模式
	LCD501_Bitmap(10,10,(unsigned int *)encoding_36);	//
	LCD501_SetPaintMode(uiPaint_M);	//恢复设置
	while(1)
	{
		uiKey = SP_GetCh();
		if(uiKey==0x0001)		//如有Key1按下则返回
		{
			return;
		}
		F_Key_Scan_ServiceLoop();	//键盘循环服务程序
		Clear_Watchdog();			//清看门狗
	}
}
//=====================================================================//
//函数:void BMP_Play_Show(unsigned int x,unsigned int y,unsigned int Delay_Timers,
//						unsigned int * BMP_List,unsigned int Play_Timer)
//描述:BMP动画显示函数,显示连续帧的动画
//参数:x  要显示的X轴坐标    y  要显示的Y轴坐标
//		Delay_Timers  帧之前的时间间隔,以ms为单位
//		BMP_List      BMP帧图像的数据数组的首地址
//		Play_Timer    播放动画的次数
//返回:无
//注意:无
//=====================================================================//
unsigned int IRQ1KHz_Couter=0;
void BMP_Play_IRQ_Service(void)
{//动画显示程序中,在1KHz中断需要调用的子函数,作为计数用
	IRQ1KHz_Couter++;
}
void BMP_Play_Show(unsigned int x,unsigned int y,unsigned int Delay_Timers,
unsigned int * BMP_List,unsigned int Play_Timer)
{
	unsigned int uiKey,uiPaint_M,i=2,BMP_Index;
	uiPaint_M = LCD501_GetPaintMode();
	LCD501_ClrScreen(0);		//清屏
	LCD501_SetPaintMode(4);		//设置LCD显示模式
	uiKey = *P_INT_Ctrl_New;	//...
	uiKey = uiKey|0x0010;
	*P_INT_Ctrl_New = uiKey;	//打开1KHz中断
	__asm("IRQ ON");			//打开IRQ中断
	BMP_Index = (unsigned int)BMP_List[0];			//获取动画的帧数
	LCD501_Bitmap(x,y,(unsigned int *)BMP_List[1]);	//先显示第一帧
	IRQ1KHz_Couter=0;			//计数器清零
	while(1)
	{
		if(IRQ1KHz_Couter>=Delay_Timers)			//到达预定时延时
		{
			IRQ1KHz_Couter=0;						//清Counter
			LCD501_Bitmap(x,y,(unsigned int *)BMP_List[i]);	//显示第i帧图像
			i++;									//自加
			if(i>BMP_Index)							//索引归一
			{
				i=1;
				Play_Timer--;						//播放次数减一
			}
		}
		uiKey = SP_GetCh();
		if(uiKey==0x0001||Play_Timer==0)		//如有Key1按下则返回
		{
			LCD501_SetPaintMode(uiPaint_M);	//恢复设置
			__asm("IRQ OFF");
			return;
		}
		F_Key_Scan_ServiceLoop();	//键盘循环服务程序
		Clear_Watchdog();			//清看门狗
	}
}
//=====================================================================//
//函数:void LCD_Show_Auto(void)
//描述:LCD自身功能演示,自动演示
//参数:无
//返回:无
//注意:无
//=====================================================================//
void LCD_Show_Auto(void)
{
	unsigned int uiKey,uiPaint_M,dd;
	uiPaint_M = LCD501_GetPaintMode();	//获取当前的叠加模式,以便恢复
	LCD501_Init(0x0f);					//初始化显示
	Delay_User(200);
	LCD501_Rectangle(0,0,30,30,1);		//画实心矩形
	Delay_User(200);
	LCD501_SetPaintMode(2);				//改变显示叠加模式
	LCD501_Rectangle(40,0,70,30,1);		//画实心矩形
	Delay_User(200);		
	LCD501_SetPaintMode(3);				//
	LCD501_Rectangle(80,0,110,30,1);	//	
	Delay_User(200);
	LCD501_ClrScreen(0);				//Clear Screen
	LCD501_SetPaintMode(1);				//Set the paint mode = 1 COVER 
	Delay_User(100);
	LCD501_PutPixel(0,0);				//画点
	Delay_User(100);	
	LCD501_PutPixel(0,1);
	Delay_User(100);
	LCD501_PutPixel(0,2);
	Delay_User(100);
	LCD501_PutPixel(0,3);
	Delay_User(100);
	LCD501_PutPixel(0,4);
	Delay_User(100);
	LCD501_PutPixel(1,4);
	Delay_User(100);
	LCD501_PutPixel(2,4);
	Delay_User(100);
	LCD501_PutPixel(3,4);
	Delay_User(100);
	LCD501_PutPixel(4,4);
	Delay_User(200);
	LCD501_ClrScreen(0);				//Clear Screen
	LCD501_PutChar(0,8,'A');			//显示ASCII字符A
	Delay_User(100);
	LCD501_PutChar(8,0,'A');
	Delay_User(100);
	LCD501_PutChar(16,1,'A');
	Delay_User(100);
	LCD501_PutChar(24,5,'A');
	Delay_User(200);
	LCD501_ClrScreen(0);				//Clear Screen
	LCD501_Rectangle(0,0,60,60,0);		//画矩形框
	Delay_User(200);
	LCD501_Rectangle(2,2,58,58,1);		//画实心矩形
	Delay_User(200);
	LCD501_SetPaintMode(3);				//	
	LCD501_PutChar(0,8,'A');
	Delay_User(100);
	LCD501_PutChar(8,0,'A');
	Delay_User(100);
	LCD501_PutChar(16,1,'A');
	Delay_User(100);
	LCD501_PutChar(24,5,'A');
	Delay_User(400);
	LCD501_ClrScreen(1);
	Delay_User(400);
	LCD501_ClrScreen(0);
	Delay_User(200);
	LCD501_PutString(8,50,(unsigned int *)"abcdefgdgfgshgjfkjhlkgl");//显示ASCII字符串
	Delay_User(400);
	LCD501_ClrScreen(0);
	LCD501_Circle(30,30,30,1);			//画实心圆
	Delay_User(400);
	LCD501_SetPaintMode(3);				//
	LCD501_Line(1,30,127,30);			//画直线
	Delay_User(400);
	LCD501_Bitmap(0,15,(unsigned int *)encoding_32);	//凌
	LCD501_Bitmap(16,15,(unsigned int *)encoding_33);	//阳
	LCD501_Bitmap(32,15,(unsigned int *)encoding_34);	//科
	LCD501_Bitmap(48,15,(unsigned int *)encoding_35);	//技
	for(uiKey=0;uiKey<4;uiKey++)
	{						//向上滚屏!!
		Clear_Watchdog();			//清看门狗
		for(dd=0;dd<64;dd++)
		{
			LCD501_ScrollUp(1);
			Delay_User(30);
		}
	}
	LCD501_SetPaintMode(uiPaint_M);	//恢复设置
	while(1)
	{
		uiKey = SP_GetCh();
		if(uiKey==0x0001)		//如有Key1按下则返回
		{
			return;
		}
		F_Key_Scan_ServiceLoop();	//键盘循环服务程序
		Clear_Watchdog();			//清看门狗
	}
}
//=====================================================================//
//函数:void PowerON_Show(unsigned int Play_Timer)
//描述:开机界面显示,Logo动画加上文字显示
//参数:Play_Timer  动画显示次数,如次数到时仍没有键按下,则自动进入下一层
//返回:无
//注意:无
//=====================================================================//
void PowerON_Show(unsigned int Play_Timer)
{
	unsigned int uiKey,uiPaint_M;
	int i=1,m=1;
	uiPaint_M = LCD501_GetPaintMode();
	LCD501_ClrScreen(0);		//清屏
	LCD501_Bitmap(0,32,(unsigned int*)encoding_32);		//凌
	LCD501_Bitmap(16,32,(unsigned int*)encoding_33);	//阳
	LCD501_Bitmap(32,32,(unsigned int*)encoding_34);	//科
	LCD501_Bitmap(48,32,(unsigned int*)encoding_35);	//技
	LCD501_FontSet(0);			//设置字型  ASCII码显示为8X6的字型
	LCD501_PutString(16,50,(unsigned int *)"Press any Key...");
	LCD501_SetPaintMode(4);		//设置LCD显示模式
	uiKey = *P_INT_Ctrl_New;	//...
	uiKey = uiKey|0x0010;
	*P_INT_Ctrl_New = uiKey;	//打开1KHz中断
	__asm("IRQ ON");			//打开IRQ中断
	LCD501_Bitmap(16,0,(unsigned int *)BMP_Cartoon4[1]);	//先显示第一帧
	IRQ1KHz_Couter=0;			//计数器清零
	while(1)
	{
		if(IRQ1KHz_Couter>=200)			//到达预定时延时
		{
			IRQ1KHz_Couter=0;						//清Counter
			LCD501_Bitmap(16,0,(unsigned int *)BMP_Cartoon4[i]);	//显示第i帧图像
			i=i+m;									//自加
			if(i==1)								//到达底限,则m为正数
			{
				m=1;
				Play_Timer--;						//播放次数减一
			}
			if(i==9)								//到达上限,则m变为负数
			{
				m=-1;
				Play_Timer--;						//播放次数减一
			}
		}
		uiKey = SP_GetCh();
		if(uiKey||Play_Timer==0)		//如有Key1按下则返回
		{
			LCD501_SetPaintMode(uiPaint_M);	//恢复设置
			__asm("IRQ OFF");
			return;
		}
		F_Key_Scan_ServiceLoop();	//键盘循环服务程序
		Clear_Watchdog();			//清看门狗
	}
}

⌨️ 快捷键说明

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