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

📄 main1.c

📁 keil打开-51单片机LCD显示程序 LCD控制模块使用深圳剑拓的串口转VGA模块
💻 C
📖 第 1 页 / 共 3 页
字号:
   yy=yy+1;
   mputcharat(xx*hd,yy*wd,'4');
   yy=yy+1; 
   mputwordat(xx*hd,yy*wd,"电");
   yy=yy+2;
   mputwordat(xx*hd,yy*wd,"压");
   yy=yy+2;
   mputcharat(xx*hd,yy*wd,':');
         yy=yy+8;
   mputcharat(xx*hd,yy*wd,'V');
	watchdog();
		//cursor(xx++,yy);		mput("电机 1 电流:");
 	xx++;
	yy=yyy;
   mputwordat(xx*hd,yy*wd,"电");
   yy=yy+2;
   mputwordat(xx*hd,yy*wd,"机");
   yy=yy+2;
   mputcharat(xx*hd,yy*wd,' ');	   	
   yy=yy+1;	   
   mputcharat(xx*hd,yy*wd,'1');
   yy=yy+1;
   mputcharat(xx*hd,yy*wd,' ');
   yy=yy+1; 
   mputwordat(xx*hd,yy*wd,"电");
   yy=yy+2;
   mputwordat(xx*hd,yy*wd,"流");
   yy=yy+2;
   mputcharat(xx*hd,yy*wd,':');
         yy=yy+8;
   mputcharat(xx*hd,yy*wd,'A');
	watchdog();
   		//cursor(xx++,yy);	mput("电机 2 电流:");
 	xx++;
	yy=yyy;
   mputwordat(xx*hd,yy*wd,"电");
   yy=yy+2;
   mputwordat(xx*hd,yy*wd,"机");
   yy=yy+2;
   mputcharat(xx*hd,yy*wd,' ');	   	
   yy=yy+1;	   
   mputcharat(xx*hd,yy*wd,'2');
   yy=yy+1;
   mputcharat(xx*hd,yy*wd,' ');
   yy=yy+1; 
   mputwordat(xx*hd,yy*wd,"电");
   yy=yy+2;
   mputwordat(xx*hd,yy*wd,"流");
   yy=yy+2;
   mputcharat(xx*hd,yy*wd,':');
         yy=yy+8;
   mputcharat(xx*hd,yy*wd,'A');
	watchdog();
		//cursor(xx++,yy); 	mput("电机 3 电流:");

 	xx++;
	yy=yyy;
   mputwordat(xx*hd,yy*wd,"电");
   yy=yy+2;
   mputwordat(xx*hd,yy*wd,"机");
   yy=yy+2;
   mputcharat(xx*hd,yy*wd,' ');	   	
   yy=yy+1;	   
   mputcharat(xx*hd,yy*wd,'3');
   yy=yy+1;
   mputcharat(xx*hd,yy*wd,' ');
   yy=yy+1; 
   mputwordat(xx*hd,yy*wd,"电");
   yy=yy+2;
   mputwordat(xx*hd,yy*wd,"流");
   yy=yy+2;
   mputcharat(xx*hd,yy*wd,':');
         yy=yy+8;
   mputcharat(xx*hd,yy*wd,'A');
	watchdog();
		//cursor(xx++,yy);		mput("电机 4 电流:");
	xx++;
	yy=yyy;
   mputwordat(xx*hd,yy*wd,"电");
   yy=yy+2;
   mputwordat(xx*hd,yy*wd,"机");
   yy=yy+2;
   mputcharat(xx*hd,yy*wd,' ');	   	
   yy=yy+1;	   
   mputcharat(xx*hd,yy*wd,'4');
   yy=yy+1;
   mputcharat(xx*hd,yy*wd,' ');
   yy=yy+1; 
   mputwordat(xx*hd,yy*wd,"电");
   yy=yy+2;
   mputwordat(xx*hd,yy*wd,"流");
   yy=yy+2;
   mputcharat(xx*hd,yy*wd,':');
         yy=yy+8;
   mputcharat(xx*hd,yy*wd,'A');
	watchdog();
		//cursor(xx++,yy);		mput("励 磁 电 流:");
	xx++;
	yy=yyy;
   mputwordat(xx*hd,yy*wd,"励");
   yy=yy+2;
   mputcharat(xx*hd,yy*wd,' ');	   	
   yy=yy+1;
   mputwordat(xx*hd,yy*wd,"磁");
   yy=yy+2;
   mputcharat(xx*hd,yy*wd,' ');
   yy=yy+1; 
   mputwordat(xx*hd,yy*wd,"电");
   yy=yy+2;
   mputcharat(xx*hd,yy*wd,' ');
   yy=yy+1;
   mputwordat(xx*hd,yy*wd,"流");
   yy=yy+2;
   mputcharat(xx*hd,yy*wd,':');
         yy=yy+8;
   mputcharat(xx*hd,yy*wd,'A');
	watchdog();
	yyy=48;
   }*/
	watchdog();
	for(i=0;i<4;i++)
	{
   		cursor(7, 20+i);
		mput(SelfCheckPrefix[i]);
	}
	watchdog();
}

void refresh_page3()
{
	uchar i, j;
	char a[6];
	float idata analog[2][10] = {0};
	setwfc(9);
/*	for(i=0;i<10;i++)
	for(j=0;j<2;j++)
	{
		watchdog();
		analog[j][i] = AnalogFactor[j]*(ulong)Analog[j][i]*20/0xfff;
		a[0] = analog[j][i]/1000+0x30;
		a[1] = analog[j][i]/100%10+0x30;
		a[2] = analog[j][i]/10%10+0x30;
		a[3] = analog[j][i]%10+0x30;
		watchdog();
		if(a[0] == 0x30)
		{
			a[0] = ' ';
			if(a[1] == 0x30)
			{
				a[1] = ' ';
				if(a[2] == 0x30)
					a[2] = ' ';
			}
		}
		a[4] = 0;
		cursor(23+j*40, 6+i);
		mput(a);
		watchdog();
	}*/
	for(i=0;i<10;i++)
	for(j=0;j<2;j++)
	{
		watchdog();
		analog[j][i] = AnalogFactor[i]*(float)Analog[j][i]*20/0xfff;
        watchdog();	   
		if(i < 3)
		{
			if(analog[j][i]>14.1)
				analog[j][i] = 15;
			sprintf(a, "%6.2f", analog[j][i]);
		}
		else
		{
			if(analog[j][i]<15)
				analog[j][i] = 0;
			sprintf(a, "%6.1f", analog[j][i]);
		}
        watchdog();
		cursor(22+j*40, 6+i);
		mput(a);
		watchdog();
	}
	if(NewSelfCheck)
	{
		for(i=0;i<4;i++)
		{
			watchdog();
            cursor(35, 20+i);
			if(SelfCheck[i] == 0x00)
				mput("故障!");
			else if(SelfCheck[i] == 0x01)
				mput("正常!");
		}
		NewSelfCheck = 0;
	}
	setwfc(7);
	watchdog();
}

void init_page45()
{
	uchar data i;
	clear_screen();
	CurrentPage = Page4 + Page45Sel;
	cursor(30, 2);
	mput(Menu[3+Page45Sel]+4);
	watchdog();
	for(i=0;i<9;i++)
	{
		cursor(5, 4+i*2);
		mput(CheckItem[i]);
	}
	watchdog();
}

void refresh_page45()
{
	watchdog();
	setwfc(7);
	cursor(5, 4+Page45OldItem[Page45Sel]*2);
	mput(CheckItem[Page45OldItem[Page45Sel]]);
	setwfc(9);
	cursor(5, 4+Page45Item[Page45Sel]*2);
	mput(CheckItem[Page45Item[Page45Sel]]);
	setwfc(7);
	watchdog();
}

void TX_Service()
{
	uchar idata i;
	TransmitMessage[3] = 0x20 + Page45Sel;
	TransmitMessage[5] = CurrentPage - 5;
	watchdog();
	if (TBS == 1)
	{
		CANADR = TBF;
		for( i = 0; i < 10; i++ )
			CANDAT = TransmitMessage[i];
		watchdog();
		CANCON = 0x01;
	}
	else
	{
	}
}

void myput(uchar index)
{
	uchar i, j;
	uchar code * code * code pt[9] = {DiagnosisCode1, DiagnosisCode2, DiagnosisCode3, DiagnosisCode4, DiagnosisCode5, 
		DiagnosisCode6, DiagnosisCode7, DiagnosisCode8, DiagnosisCode9};
	i = index / 8;
	j = index % 8;
	TransmitMessage[6 + i] |= Mask[j];
	watchdog();
	mput(pt[CurrentPage - 6][index]);
}

check_process1()
{
	if(Sw[Page45Sel][3]&Mask[3])
		myput(0);
	else
	{
		setwfc(9);
		myput(1);
		setwfc(7);
	}
	if(Sw[Page45Sel][0]&Mask[1])
		myput(2);
	else
	{
		setwfc(9);
		myput(3);
		setwfc(7);
	}
	if(Sw[Page45Sel][3]&Mask[4])
		myput(4);
	else
	{
		setwfc(9);
		myput(5);
		setwfc(7);
	}
	watchdog();
	if(Sw[Page45Sel][3]&Mask[5])
		myput(6);
	else
	{
		setwfc(9);
		myput(7);
		setwfc(7);
	}
	if(Sw[Page45Sel][3]&Mask[6])
		myput(8);
	else
	{
		setwfc(9);
		myput(9);
		setwfc(7);
	}
	mput(DiagnosisEnd);
}

check_process2()
{
	uchar i;
	if(Sw[Page45Sel][4]&Mask[4])
		myput(0);
	else
	{
		setwfc(9);
		myput(1);
		setwfc(7);
	}
	if(Sw[Page45Sel][4]&Mask[5])
		myput(2);
	else
	{
		setwfc(9);
		myput(3);
		setwfc(7);
	}
	if(Sw[Page45Sel][4]&Mask[3])
		myput(4);
	else
	{
		setwfc(9);
		myput(5);
		setwfc(7);
	}
	watchdog();
	switch((Sw[Page45Sel][6]&(Mask[5]|Mask[4]))>>4)
	{
	case 0:
		setwfc(9);
		myput(9);
		setwfc(7);
		break;
	case 1:
		myput(6);
		break;
	case 2:
		myput(7);
        mput("   还有 5 秒");
		TR0 = 1;
		for(i=4;i!=0xff;i--)
		{
			while(TimingFlag == 0) ;
			TimingFlag = 0;
			mput("\r\t"); mputchar(i+0x30);
			watchdog();
		}
		TR0 = 0;
		Count = 28;
		switch((Sw[Page45Sel][6]&(Mask[5]|Mask[4]))>>4)
		{
		case 0:
			setwfc(9);
			myput(13);
			setwfc(7);
			break;
		case 1:
			myput(10);
		break;
		case 2:
			setwfc(9);
			myput(11);
			setwfc(7);
			break;
		case 3:
			setwfc(9);
			myput(12);
			setwfc(7);
			break;
		default: ;
		}
		break;
	case 3:
		setwfc(9);
		myput(8);
		setwfc(7);
		break;
	default: ;
	}
	mput(DiagnosisEnd);
}

check_process3()
{
uchar i, k=0;
	if(Sw[Page45Sel][3]&Mask[3])  //531
    {			
    	myput(0);
        k++;		
    }
    else
	{
		setwfc(9);		
        myput(1);
		setwfc(7);
	}
    if(Sw[Page45Sel][6]&Mask[3])  //548
    {
      myput(2);
      k++;
    } 
    else
	{
		setwfc(9);		
        myput(3);
		setwfc(7);
	}
    if(Sw[Page45Sel][4]&Mask[5])  //564
    {
	    setwfc(9);
        myput(4);
		setwfc(7);  
    }
    else
	{
		k++;	
        myput(5);		
	} 
    if(Sw[Page45Sel][4]&Mask[1])  //544
    { 
		setwfc(9);
        myput(6);
		setwfc(7);       
    }
    else
	{	
        k++;			
        myput(7);		
	}
	watchdog();

    if(k==4)
    {
        mput("   请在 10 秒内合上主断合开关");
		TR0 = 1;
		for(i=9;i!=0xff;i--)
		{
		    while(TimingFlag == 0)
		    {
		       if(Sw[Page45Sel][3]&Mask[7])  //537;
                       {
                    	    i=0;  
                       	    TimingFlag =1;
                       }
             }
			TimingFlag = 0;
			mput("\r\t"); mputchar(0x30); mputchar(i+0x30);
			watchdog();
		}
		TR0 = 0;
		Count = 28;
		watchdog();
		if(Sw[Page45Sel][3]&Mask[7])  //537;	    
		{ 
        	myput(8);
			if(Sw[Page45Sel][5]&Mask[7])  //538;	    
			{	
        		myput(10);
     		}
			else
			{
				setwfc(9); 
        		myput(11);
				setwfc(7); 
			}
			if(Sw[Page45Sel][6]&Mask[0])  //539;	    
			{ 
        		myput(12);
     		}
			else
			{
				setwfc(9); 
        		myput(13);
				setwfc(7); 
			}
			if(Sw[Page45Sel][6]&Mask[3])  //548;	    
			{ 
				setwfc(9); 
        		myput(14);
				setwfc(7); 				
     		}
			else
			{
				myput(15);
			}
			watchdog();
			if(Sw[Page45Sel][6]&Mask[1])  //540;	    
			{ 
        		if(Sw[Page45Sel][6]&Mask[2])  //543;	    
				{ 
					setwfc(9);
        			myput(16);
					setwfc(7);
     			}
				else
				{
					if(Sw[Page45Sel][4]&Mask[1])  //544	    
					{ 
						setwfc(9);
        				myput(18);
						setwfc(7);
     				}
					else
					{
						 
        				myput(17);
						mput("   等待 5 秒");
						TR0 = 1;
						for(i=4;i!=0xff;i--)
						{
							while(TimingFlag == 0) ;
							TimingFlag = 0;
							mput("\r\t"); mputchar(i+0x30);
							watchdog();
						}
						TR0 = 0;
						Count = 28;
						if(Sw[Page45Sel][6]&Mask[1])  //540;	    
						{ 
							setwfc(9);
        					myput(21);
							setwfc(7);
     					}
						else
						{
							if(Sw[Page45Sel][4]&Mask[1])  //544	    
							{ 
								setwfc(9);
        						myput(22);
								setwfc(7);
     						}
							else
							{
								myput(23);
							}
					 	}


					
				 	}
				}	
     		}
			else
			{

				if(Sw[Page45Sel][4]&Mask[1])  //544	    
				{ 
					setwfc(9);
        			myput(19);
					setwfc(7);
     			}
				else
				{
					myput(20);
						
				}
			}

     	}
		else
		{
        	setwfc(9);
				
        	myput(9);
			setwfc(7);
		}
	}
	mput(DiagnosisEnd);
}

check_process4()
{
	uchar i;
	if(Sw[Page45Sel][3]&Mask[3])  //531
	{
		myput(0);
	}
	else
	{
		setwfc(9);
		myput(1);
		setwfc(7);
	}
	if(Sw[Page45Sel][3]&Mask[1])  //503
	{
		myput(2);
	}
	else
	{
		setwfc(9);
		myput(3);
		setwfc(7);
		mput("   等待 5 秒");
		TR0 = 1;
		for(i=4;i!=0xff;i--)
		{
			while(TimingFlag == 0) ;
			TimingFlag = 0;
			mput("\r\t"); mputchar(i+0x30);
			watchdog();
		}
		TR0 = 0;
		Count = 28;
		watchdog();
		if(Sw[Page45Sel][3]&Mask[1])  //503
		{
			myput(4);
		}
		else
		{
			if(Sw[Page45Sel][1]&Mask[1])  //415
			{
				setwfc(9);
				myput(5);
				setwfc(7);
			}
			else
			{
				setwfc(9);
				myput(6);
				setwfc(7);
			}	
		}
	}
	if(Sw[Page45Sel][3]&Mask[0])  //501
	{
		myput(7);
	}
	else
	{
		setwfc(9);
		myput(8);
		setwfc(7);
	}
	if(Sw[Page45Sel][2]&Mask[6])  //481
	{
		myput(9);
	}
	else
	{
		setwfc(9);
		myput(10);
		setwfc(7);
	}
	if(Sw[Page45Sel][5]&Mask[3])  //471
	{
		myput(11);
	}
	else
	{
		setwfc(9);
		myput(12);
		setwfc(7);
	}
	watchdog();
	if(Sw[Page45Sel][5]&Mask[4])  //472
	{
		myput(13);
	}
	else
	{
		setwfc(9);
		myput(14);
		setwfc(7);
	}
	if(Sw[Page45Sel][2]&Mask[7])  //485
	{
		myput(15);
	}
	else
	{
		setwfc(9);
		myput(16);
		setwfc(7);
	}
	if(Sw[Page45Sel][5]&Mask[5])  //473
	{
		myput(17);
	}
	else
	{
		setwfc(9);
		myput(18);
		setwfc(7);
	}
	if(Sw[Page45Sel][5]&Mask[6])  //474
	{
		myput(19);
	}
	else
	{
		setwfc(9);
		myput(20);
		setwfc(7);
	}
	watchdog();
	mput(DiagnosisEnd);
}


check_process5()
{
	if(Sw[Page45Sel][0]&Mask[4])//405
		myput(0);
	else
	{
		setwfc(9);
		myput(1);
		setwfc(7);
	}
	if(Sw[Page45Sel][2]&Mask[3])//445
		myput(2);
	else
	{
		setwfc(9);
		myput(3);
		setwfc(7);
	}
	if(Sw[Page45Sel][2]&Mask[4])//447
		myput(4);
	else
	{
		setwfc(9);
		myput(5);
		setwfc(7);
	}
	watchdog();
	if(Sw[Page45Sel][2]&Mask[2])//441
		myput(6);
	else
	{
		setwfc(9);
		myput(7);
		setwfc(7);
	}
	if(Sw[Page45Sel][2]&Mask[1])//439
		myput(8);
	else
	{
		setwfc(9);
		myput(9);
		setwfc(7);
	}
	if(Sw[Page45Sel][2]&Mask[5])//454
		myput(10);
	else
	{
		setwfc(9);
		myput(11);
		setwfc(7);
	}
	mput(DiagnosisEnd);
}

check_process6()
{
bit k=0;
	if(Sw[Page45Sel][0]&Mask[0])  //401
	{
		myput(0);
	}
	else
	{
		setwfc(9);
		myput(1);
		setwfc(7);
	}
	if(Sw[Page45Sel][4]&Mask[5])  //564
	{
		myput(2);
	}
	else
	{
		setwfc(9);
		myput(3);
		setwfc(7);
	}
	if(Sw[Page45Sel][9]&Mask[3])  //704
	{
		setwfc(9);
		myput(4);
		setwfc(7);
	}
	else
	{
		
		myput(5);
		
	}
	watchdog();

⌨️ 快捷键说明

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