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

📄 screen.c

📁 此程序为本人在公司开发的继电器功能测试仪
💻 C
字号:
	#include "variable.h"
	#include "lcd.h"
	void Fun_Screen_Main(void)
    {
		LCD_CmdWrite(0xF1,0x1F);
		GotoXY(0x0D,0x50);
		PrintStr("继电器功能测试仪");
		LCD_CmdWrite(0xF1,0x0F);
		GotoXY(0x0B,0x80);
		PrintStr("深圳泰科电子有限公司");
		GotoXY(0x11,0xA0);
		PrintStr("MICRO-K");
	}

	void Screen_Setting_Key(void)
	{
		//LCD_CmdWrite(0x10,0x0B);//reserv
		GotoXY(0x30,0xC0);
		PrintStr("   >        <       >>       <<");//11BIT, 1
		GotoXY(0x30,0xD0);
		PrintStr("下一位   上一位   下一页   上一页");//11BIT, 1
		//LCD_CmdWrite(0x10,0x2B);		
	}

	void Screen_Setting(unsigned char m)
	{
		LCD_CmdWrite(0x10,0x2B);
		LCD_CmdWrite(0xF0,0xA0);
		switch(m)
		{
			case 0:
			{
				LCD_CmdWrite(0xF1,0x1F);
				//LCD_CmdWrite(0xF0,0xA0);
				GotoXY(0x09,0x00);
				PrintStr("慢 速 测 试 画 面(MICRO-K)");
				LCD_CmdWrite(0xF1,0x0F);
				GotoXY(0x00,0x20);
				PrintStr("线圈电阻(  ):D:   .  U:   .  T:   .     ");//8BIT,4BIT, 0
				GotoXY(0x00,0x30);
				PrintStr("温度变换(  ):D:   .  U:   .  T:  .  C   ");//11BIT, 1
				GotoXY(0x00,0x40);
				PrintStr(" NC 电阻(m ):D:   .  U:   .  T:   .   ");//8BIT,4BIT, 2
				GotoXY(0x00,0x50);
				PrintStr(" NO 电阻(m ):D:   .  U:   .  T:   .   ");//8BIT,4BIT, 3
				GotoXY(0x00,0x60);
				PrintStr("吸合电压( V):D:  .   U:  .   T:  .      ");//8BIT,4BIT, 4
				GotoXY(0x00,0x70);
				PrintStr("吸合压差( V):D:  .   U:  .   T:  .      ");//8BIT,4BIT, 5;衔铁吸合
				GotoXY(0x00,0x80);
				PrintStr("释放压差( V):D:  .   U:  .   T:  .      ");//8BIT,4BIT, 6;释放电压
				GotoXY(0x00,0x90);
				PrintStr("释放电压( V):D:  .   U:  .   T:  .      ");//8BIT,4BIT, 7;衔铁释放;释放压差
				GotoXY(0x00,0xA0);
				PrintStr("吸合时间(ms):D:  .   U:  .   T:  .      ");//6BIT,4BIT, 8
				GotoXY(0x00,0xB0);
				PrintStr("吸合回跳(ms):D:  .   U:  .   T:  .      ");//6BIT,4BIT, 9
				GotoXY(0x00,0xC0);
				PrintStr("释放时间(ms):D:  .   U:  .   T:  .      ");//6BIT,4BIT, 10
				GotoXY(0x00,0xD0);
				PrintStr("释放回跳(ms):D:  .   U:  .   T:  .      ");//6BIT,4BIT, 11
				GotoXY(0x00,0xE0);
				PrintStr("线圈电压:  V; 触点电流: .   A,类型:1    ");//6BIT, 12
				LCD_CmdWrite(0xF0,0xA4);
				GotoXY(0x0A,0x20);
				LCD_DataWrite(0xEA);//ohm
				delay(200);
				GotoXY(0x0A,0x30);
				LCD_DataWrite(0xEA);//ohm
				delay(200);
				GotoXY(0x23,0x30);
				LCD_DataWrite(0xF8);//degree
				delay(200);
				GotoXY(0x0A,0x40);
				LCD_DataWrite(0xEA);//ohm
				delay(200);
				GotoXY(0x0A,0x50);
				LCD_DataWrite(0xEA);//ohm
				delay(200);
				//LCD_CmdWrite(0xF0,0xA0);	
			} break;
			case 1:
			{
				LCD_CmdWrite(0xF1,0x1F);
				GotoXY(0x0A,0x00);
				PrintStr("测 试 设 定 画 面 一");
				LCD_CmdWrite(0xF1,0x0F);
				GotoXY(0x00,0x20);
				PrintStr("线圈电阻( ):下限:   .   上限:   . ");//8BIT,4BIT, 0
				GotoXY(0x00,0x30);
				PrintStr("温度变换( ):下限:   .   上限:   . ");//11BIT, 1
				GotoXY(0x00,0x40);
				PrintStr("实测线圈电阻为( ):    .");//8BIT,4BIT, 0
				GotoXY(0x00,0x50);
				PrintStr("实测温度为:  .  C");//11BIT, 1
				LCD_CmdWrite(0xF0,0xA4);
				GotoXY(0x09,0x20);
				LCD_DataWrite(0xEA);//ohm
				delay(200);
				GotoXY(0x09,0x30);
				LCD_DataWrite(0xEA);//ohm
				delay(200);
				GotoXY(0x0F,0x40);
				LCD_DataWrite(0xEA);//ohm
				delay(200);
				GotoXY(0x0F,0x50);
				LCD_DataWrite(0xF8);//degree
				delay(200);
				LCD_CmdWrite(0xF0,0xA0);
				Screen_Setting_Key();	
			} break;
			case 2:
			{
				LCD_CmdWrite(0xF1,0x1F);
				GotoXY(0x0A,0x00);
				PrintStr("测 试 设 定 画 面 二");
				LCD_CmdWrite(0xF1,0x0F);
				GotoXY(0x00,0x20);
				PrintStr(" NC 电阻(m ):下限:   .   上限:   . ");//8BIT,3BIT, 2
				GotoXY(0x00,0x30);
				PrintStr(" NO 电阻(m ):下限:   .   上限:   . ");//8BIT,3BIT, 3	
				GotoXY(0x00,0x40);
				PrintStr("触点电流:   0mA; 继电器类型:1");//6BIT, 12
				GotoXY(0x00,0x50);
				PrintStr("实测接触电阻1B为(m ):    .");//8BIT,3BIT, 2
				GotoXY(0x00,0x60);
				PrintStr("实测接触电阻1A为(m ):    .");//8BIT,3BIT, 3
				LCD_CmdWrite(0xF0,0xA4);	
				GotoXY(0x0A,0x20);
				LCD_DataWrite(0xEA);//ohm
				delay(200);
				GotoXY(0x0A,0x30);
				LCD_DataWrite(0xEA);//ohm
				GotoXY(0x12,0x50);
				LCD_DataWrite(0xEA);//ohm
				delay(200);
				GotoXY(0x12,0x60);
				LCD_DataWrite(0xEA);//ohm
				delay(200);
				LCD_CmdWrite(0xF0,0xA0);
				Screen_Setting_Key();	
			} break;
			case 3:
			{
				LCD_CmdWrite(0xF1,0x1F);
				GotoXY(0x0A,0x00);
				PrintStr("测 试 设 定 画 面 三");
				LCD_CmdWrite(0xF1,0x0F);
				GotoXY(0x00,0x20);
				PrintStr("吸合电压(V):下限:  .   上限:  .  ");//8BIT,4BIT, 4
				GotoXY(0x00,0x30);
				PrintStr("吸合压差(V):下限:  .   上限:  .  ");//8BIT,4BIT, 5
				GotoXY(0x00,0x40);
				PrintStr("释放压差(V):下限:  .   上限:  .  ");//8BIT,4BIT, 6
				GotoXY(0x00,0x50);
				PrintStr("释放电压(V):下限:  .   上限:  .  ");//8BIT,4BIT, 7
				GotoXY(0x00,0x60);
				PrintStr("线圈电压:  V");//2BIT, 
//				LCD_CmdWrite(0xF0,0xA0);
				GotoXY(0x00,0x70);
				PrintStr("实测吸合电压为(V):   .");//8BIT,4BIT, 4
				GotoXY(0x00,0x80);
				PrintStr("实测衔铁吸合为(V):   .");//8BIT,4BIT, 5
				GotoXY(0x00,0x90);
				PrintStr("实测释放压差为(V):   .");//8BIT,4BIT, 6
				GotoXY(0x00,0xA0);
				PrintStr("实测释放电压为(V):   .");//8BIT,4BIT, 7
				Screen_Setting_Key();	
			} break;
			case 4:
			{
				LCD_CmdWrite(0xF1,0x1F);
				GotoXY(0x0A,0x00);
				PrintStr("测 试 设 定 画 面 四");
				LCD_CmdWrite(0xF1,0x0F);
				GotoXY(0x00,0x20);
				PrintStr("吸合时间(ms):下限:  .   上限:  .  ");//6BIT,3BIT, 8
				GotoXY(0x00,0x30);
				PrintStr("吸合回跳(ms):下限:  .   上限:  .  ");//6BIT,3BIT, 9
				GotoXY(0x00,0x40);
				PrintStr("释放时间(ms):下限:  .   上限:  .  ");//6BIT,3BIT, 10
				GotoXY(0x00,0x50);
				PrintStr("释放回跳(ms):下限:  .   上限:  .  ");//6BIT,3BIT, 11
//				LCD_CmdWrite(0xF0,0xA0);
				GotoXY(0x00,0x60);
				PrintStr("实测吸合时间(ms):   .");//8BIT,4BIT, 4
				GotoXY(0x00,0x70);
				PrintStr("实测吸合回跳(ms):   .");//8BIT,4BIT, 5
				GotoXY(0x00,0x80);
				PrintStr("实测释放时间(ms):   .");//8BIT,4BIT, 6
				GotoXY(0x00,0x90);
				PrintStr("实测释放回跳(ms):   .");//8BIT,4BIT, 7
				Screen_Setting_Key();	
			} break;
			case 5:
			{
				LCD_CmdWrite(0xF1,0x1F);
				//LCD_CmdWrite(0xF0,0xA0);
				GotoXY(0x0C,0x00);
				PrintStr("快 速 测 试 画 面");
				LCD_CmdWrite(0xF1,0x0F);
				GotoXY(0x00,0x20);
				PrintStr("线圈电阻(  ):D:   .  U:   .  T:   .     ");//8BIT,4BIT, 0
				GotoXY(0x00,0x30);
				PrintStr("温度变换(  ):D:   .  U:   .  T:  .  C   ");//11BIT, 1
				GotoXY(0x00,0x40);
				PrintStr(" NC 电阻(m ):D:   .  U:   .  T:   .   ");//8BIT,4BIT, 2
				GotoXY(0x00,0x50);
				PrintStr(" NO 电阻(m ):D:   .  U:   .  T:   .   ");//8BIT,4BIT, 3
				GotoXY(0x00,0x60);
				PrintStr("吸合电压( V):D:  .   U:  .   T:  .      ");//8BIT,4BIT, 4
				GotoXY(0x00,0x70);
				PrintStr("吸合压差( V):D:  .   U:  .   T:  .      ");//8BIT,4BIT, 5;衔铁吸合
				GotoXY(0x00,0x80);
				PrintStr("释放压差( V):D:  .   U:  .   T:  .      ");//8BIT,4BIT, 6;释放电压
				GotoXY(0x00,0x90);
				PrintStr("释放电压( V):D:  .   U:  .   T:  .      ");//8BIT,4BIT, 7;衔铁释放;释放压差
				GotoXY(0x00,0xA0);
				PrintStr("吸合时间(ms):D:  .   U:  .   T:  .      ");//6BIT,4BIT, 8
				GotoXY(0x00,0xB0);
				PrintStr("吸合回跳(ms):D:  .   U:  .   T:  .      ");//6BIT,4BIT, 9
				GotoXY(0x00,0xC0);
				PrintStr("释放时间(ms):D:  .   U:  .   T:  .      ");//6BIT,4BIT, 10
				GotoXY(0x00,0xD0);
				PrintStr("释放回跳(ms):D:  .   U:  .   T:  .      ");//6BIT,4BIT, 11
				GotoXY(0x00,0xE0);
				PrintStr("线圈电压:  V; 触点电流: .   A,类型:1    ");//6BIT, 12
				LCD_CmdWrite(0xF0,0xA4);
				GotoXY(0x0A,0x20);
				LCD_DataWrite(0xEA);//ohm
				delay(200);
				GotoXY(0x0A,0x30);
				LCD_DataWrite(0xEA);//ohm
				delay(200);
				GotoXY(0x23,0x30);
				LCD_DataWrite(0xF8);//degree
				delay(200);
				GotoXY(0x0A,0x40);
				LCD_DataWrite(0xEA);//ohm
				delay(200);
				GotoXY(0x0A,0x50);
				LCD_DataWrite(0xEA);//ohm
				delay(200);
				//LCD_CmdWrite(0xF0,0xA0);	
			} break;
			case 6:
			{
				LCD_CmdWrite(0xF1,0x1F);
				//LCD_CmdWrite(0xF0,0xA0);
				GotoXY(0x0A,0x00);
				PrintStr("慢 速 测 试 画 面(SRF)");
				LCD_CmdWrite(0xF1,0x0F);
				GotoXY(0x00,0x20);
				PrintStr("线圈电阻(  ):D:   .  U:   .  T:   .     ");//8BIT,4BIT, 0
				GotoXY(0x00,0x30);
				PrintStr("温度变换(  ):D:   .  U:   .  T:  .  C   ");//11BIT, 1
				GotoXY(0x00,0x40);
				PrintStr(" NC 电阻(m ):D:   .  U:   .  T:   .   ");//8BIT,4BIT, 2
				GotoXY(0x00,0x50);
				PrintStr(" NO 电阻(m ):D:   .  U:   .  T:   .   ");//8BIT,4BIT, 3
				GotoXY(0x00,0x60);
				PrintStr("吸合电压( V):D:  .   U:  .   T:  .      ");//8BIT,4BIT, 4
				GotoXY(0x00,0x70);
				PrintStr("衔铁吸合( V):D:  .   U:  .   T:  .      ");//8BIT,4BIT, 5;衔铁吸合
				GotoXY(0x00,0x80);
				PrintStr("衔铁释放( V):D:  .   U:  .   T:  .      ");//8BIT,4BIT, 6;释放电压
				GotoXY(0x00,0x90);
				PrintStr("释放电压( V):D:  .   U:  .   T:  .      ");//8BIT,4BIT, 7;衔铁释放;释放压差
				GotoXY(0x00,0xA0);
				PrintStr("吸合时间(ms):D:  .   U:  .   T:  .      ");//6BIT,4BIT, 8
				GotoXY(0x00,0xB0);
				PrintStr("吸合回跳(ms):D:  .   U:  .   T:  .      ");//6BIT,4BIT, 9
				GotoXY(0x00,0xC0);
				PrintStr("释放时间(ms):D:  .   U:  .   T:  .      ");//6BIT,4BIT, 10
				GotoXY(0x00,0xD0);
				PrintStr("释放回跳(ms):D:  .   U:  .   T:  .      ");//6BIT,4BIT, 11
				GotoXY(0x00,0xE0);
				PrintStr("线圈电压:  V; 触点电流: .   A,类型:1    ");//6BIT, 12
				LCD_CmdWrite(0xF0,0xA4);
				GotoXY(0x0A,0x20);
				LCD_DataWrite(0xEA);//ohm
				delay(200);
				GotoXY(0x0A,0x30);
				LCD_DataWrite(0xEA);//ohm
				delay(200);
				GotoXY(0x23,0x30);
				LCD_DataWrite(0xF8);//degree
				delay(200);
				GotoXY(0x0A,0x40);
				LCD_DataWrite(0xEA);//ohm
				delay(200);
				GotoXY(0x0A,0x50);
				LCD_DataWrite(0xEA);//ohm
				delay(200);
				//LCD_CmdWrite(0xF0,0xA0);	
			} break;
			case 7:
			{
				LCD_CmdWrite(0xF1,0x1F);
				GotoXY(0x0A,0x00);
				PrintStr("测 试 调 试 画 面");
				LCD_CmdWrite(0xF1,0x0F);
				GotoXY(0x00,0x20);
				PrintStr("线圈电压输出调整(V):   .  ");//4BIT
				GotoXY(0x00,0x30);
				PrintStr("接触电阻补偿(m ):    . ");//4BIT
				LCD_CmdWrite(0xF0,0xA4);
				GotoXY(0x0E,0x30);
				LCD_DataWrite(0xEA);//ohm
				delay(200);
				LCD_CmdWrite(0xF0,0xA0);
				Screen_Setting_Key();	
			} break;
		}
		LCD_CmdWrite(0xF0,0xA4);
	}

	void Tests_Data(unsigned char *Val,unsigned char Num,unsigned char y)
	{
	    unsigned char i;
		LCD_CmdWrite(0x10,0x2B);	
		for(i=0;i<Num;i++)
		{
			switch(Page_Val)
			{
				case 0:
				case 5:
				case 6: GotoXY(Test_X[y][i],Loc_Y[y]); break;
				case 1: GotoXY(Test_X_1[i],Loc_Y[y]); break;
				case 2: GotoXY(Test_X_2[y-3][i],Loc_Y[y]); break;
				case 3: GotoXY(Test_X_3[y-5][i],Loc_Y[y]); break;
				case 4: GotoXY(Test_X_4[y-4][i],Loc_Y[y]); break;
			}
			LCD_DataWrite(Display_Code[*Val]);
			++Val;
			delay(200);
		}
		//LCD_CmdWrite(0x10,0x2B);
	}

	void Set_Data(unsigned char *Val,unsigned char Num,unsigned char x,unsigned char y)
	{
	    unsigned char i;
		LCD_CmdWrite(0x10,0x2B);
		for(i=x;i<Num;i++)
		{
			switch(Page_Val)
			{
				case 0:
				case 5: 
				case 6:	GotoXY(Loc_X[y][i],Loc_Y[y]); break;
				case 1: GotoXY(Set_X_1[y][i],Loc_Y[y]); break;
				case 2: GotoXY(Set_X_2[y][i],Loc_Y[y]); break;
				case 3: GotoXY(Set_X_3[y][i],Loc_Y[y]); break;
				case 4: GotoXY(Set_X_4[y][i],Loc_Y[y]); break;
				case 7: GotoXY(Adjust[y][i],Loc_Y[y]); break;
			}
			LCD_DataWrite(Display_Code[*Val]);
			++Val;
			delay(200);
		}
	}

	void Set_Data_fast(unsigned char *Val,unsigned char Num,unsigned char x,unsigned char y)
	{
	    unsigned char i;
		LCD_CmdWrite(0x10,0x2B);
		for(i=x;i<Num;i++)
		{
			GotoXY(Test_X[y][i],Loc_Y[y]);
			LCD_DataWrite(Display_Code[*Val]);
			++Val;
			delay(200);
		}
	}


⌨️ 快捷键说明

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