欢迎来到虫虫下载站 | 资源下载 资源专辑 关于我们
虫虫下载站

display.lst

完成数据的采集
LST
第 1 页 / 共 5 页
字号:
    240          	GPIO_WriteBit(GPIOC,GPIO_Pin_6,(BitAction)(data&0x10));
    241          	GPIO_WriteBit(GPIOC,GPIO_Pin_7,(BitAction)(data&0x20));
    242          	GPIO_WriteBit(GPIOC,GPIO_Pin_8,(BitAction)(data&0x40));
    243          	GPIO_WriteBit(GPIOC,GPIO_Pin_9,(BitAction)(data&0x80));	
    244          #endif
    245          }
    246          //-----------------------------------
    247          // IO Routine
    248          //-----------------------------------
    249          void LCMCmd(Int8U Command)   //send command
    250          {   
    251              LcdDataOut(Command);//LCDBUS = Command;
    252              Clr_bit(RW,B_RW); 
    253              Clr_bit(E,B_E);//E = 0;
    254              Clr_bit(CS,B_CS);//CS = 0;
    255             
    256              delay(18);
    257              Set_bit(E,B_E);//E =1;
    258              delay_nop(9);
    259              Clr_bit(E,B_E);//E =0;
    260              delay_nop(5); //delay_nop(100);
    261          }
    262          
    263          void LCMData(Int8U DData)    //send display data
    264          {   
    265            LcdDataOut(DData);
    266              Clr_bit(RW,B_RW);
    267              Clr_bit(E,B_E);//E = 0;
    268              Set_bit(CS,B_CS);//CS = 1;
    269             
    270              delay(15);
    271              Set_bit(E,B_E);//E =1;
    272              delay(5);
    273              Clr_bit(E,B_E);//E =0; 
    274              delay(5);
    275          }
    276          
    277          void WriteChar(Int8U addr,Int8U length,const Int16U *z)
    278          {
    279          		LCMCmd(0x30);        // 8bit I/F, basic command, graphic off
    280             	LCMCmd(addr);        // fiCSt line  
    281          //   	if(length>0&&length<9)
    282             	for(;length>0;length--)	
    283             	{ 
    284             		LCMData(*z>>8);
    285             		LCMData(*z&0xff); // send low-byte
    286             		z++;
    287              }  
    288          }
    289          void WriteOneChar(Int8U addr,Int16U z,Int8U y)
    290          {	
    291             	LCMCmd(0x30);        // 8bit I/F, basic command, graphic off
    292             	LCMCmd(addr);        // fiCSt line  	 
    293              if(y!=0)
    294              	{
    295              		y=z&0XF;
    296              		z>>=4;
    297              		z&=0xf;
    298              		LCMData(ASCII_TAB[z]);
    299              		LCMData(ASCII_TAB[y]);
    300              	}else
    301              	{
    302             			LCMData(z/256);
    303             			LCMData(z&0xff); // send low-byte 
    304             		}   		     
    305          }
    306          ///////////////////////////////////////
    307          void	WriteASCIIChar(Int8U a,Int8U b,Int8U b1,Int8U c)
    308          {
    309          		LCMCmd(0x30);        
    310             	LCMCmd(a);  
    311             	LCMData(b);
    312             	LCMData(b1);
    313          }
    314          ///////////////////////////////////////
    315          //-----------------------------------
    316          // Init LCD module
    317          //-----------------------------------
    318          void initLCDM(void)
    319          {
    320          	Int8U i,j,TempData;
    321            GPIOB->ODR&=0Xdf;
    322            Clr_bit(E,B_E);//E       = 0;
    323            Clr_bit(RW,B_RW);
    324            Clr_bit(CS,B_CS);//CS      = 0;     
    325            LcdDataOut(0xff);//LCDBUS  = 0xff; // pull up
    326          	delay_nop(100);
    327          	
    328          	LCMCmd(0x30);    // 8bit I/F, basic command, graphic off
    329          	LCMCmd(0x06);    // cuCSor right shift	
    330            LCMCmd(0x1);
    331            LCMCmd(0x80);    // display on
    332            LCMCmd(0x1);
    333            delay_nop(100);
    334            LCMCmd(0x30);
    335            LCMCmd(0xc0);  
    336            WritePicture(&Init_TAB[0]);
    337            delay_nop(1000);
    338            
    339          
    340              
    341          #if	0  
    342             for(i=0;i<0x20;i++)
    343                  {
    344              	LCMCmd(0x34);        // 8bit I/F, extend command
    345              	LCMCmd(0x80|i);      // Y address
    346              	LCMCmd(0x80);        // X address
    347              	LCMCmd(0x36);        // 8bit I/F, basic command, graphic on
    348                	for(j=0;j<0x10;j++)
    349               		{
    350               		TempData=0xf3; // send high-byte
    351               		LCMData(TempData);
    352               		TempData=0x82; // send low-byte
    353               		LCMData(TempData);     		
    354           		    }
    355                  }
    356          	delay_nop(100);
    357          #endif
    358          
    359          }
    360          
    361          
    362          
    363          void Display_mode_setion(_LCD *D,_yt*Ddata)
    364          {
    365          	 Int8U  m;
    366          	if(++D->Timer>=D->Comp)D->Timer=0,D->Mode++,LCMCmd(0x1);
    367          	if(D->Mode>C_LCM_Mode0_1)//)
    368          		{			
    369          			if((Ddata->_AlamcOverTem|Ddata->_AlamcFastTem|Ddata->_AlamcRoomTem|Ddata->_AlamcLowVol|Ddata->_AlamcFaultTem)!=0)D->Mode=C_LCM_ALAMC;
    370          			else                 D->Mode=C_LCM_TEMRH;
    371          		}
    372          /////////////////////////////////////////////////////	
    373          				 m=D->Mode;			 
    374          				 if(D->Mode==C_LCM_Mode0)
    375          					{
    376          						if((Ddata->_Channal&0X70)==0x70)D->Mode=C_LCM_Mode1;//if(Data->_Channal&1)LCM->Mode=C_LCM_Mode1; 
    377          					}
    378          				 if(D->Mode==C_LCM_Mode1)
    379          			  	{
    380          			  		if((Ddata->_Channal&0X380)==0x380)D->Mode=C_LCM_Mode2;//if(Data->_Channal&2)LCM->Mode=C_LCM_Mode2; 
    381          			  	}						
    382          			    if(D->Mode==C_LCM_Mode2)
    383          			  	{
    384          			  		if((Ddata->_Channal&0X1c00)==0x1c00)D->Mode=C_LCM_Mode3;//if(Data->_Channal&4)LCM->Mode=C_LCM_Mode3; 
    385          			  	}
    386          			    if(D->Mode==C_LCM_Mode3)
    387          			  	{
    388          			  		if((Ddata->_Channal&0Xe000)==0xe000)D->Mode=C_LCM_Mode4;//if(Data->_Channal&8)LCM->Mode=C_LCM_Mode4; 
    389          			  	}
    390          			  	if(D->Mode==C_LCM_Mode6||D->Mode==C_LCM_Mode5||D->Mode==C_LCM_Mode4)
    391          					{
    392          						if((Ddata->_Channal&0X70)==0x70)D->Mode=C_LCM_Mode7;//if(Data->_Channal&1)LCM->Mode=C_LCM_Mode7; 
    393          					}	
    394          			  	if(D->Mode==C_LCM_Mode9||D->Mode==C_LCM_Mode8||D->Mode==C_LCM_Mode7)
    395          					{
    396          						if((Ddata->_Channal&0X380)==0x380)D->Mode=C_LCM_Mode10;//if(Data->_Channal&2)LCM->Mode=C_LCM_Mode10; 
    397          					}
    398          			  	if(D->Mode==C_LCM_Mode12||D->Mode==C_LCM_Mode11||D->Mode==C_LCM_Mode10)
    399          					{
    400          						if((Ddata->_Channal&0X1c00)==0x1c00)D->Mode=C_LCM_Mode13;//if(Data->_Channal&4)LCM->Mode=C_LCM_Mode13; 
    401          					}	
    402          			  	if(D->Mode==C_LCM_Mode15||D->Mode==C_LCM_Mode14||D->Mode==C_LCM_Mode13)
    403          					{
    404          						 if((Ddata->_Channal&0Xe000)==0xe000)D->Mode=C_LCM_ALAMC;//if(Data->_Channal&8)LCM->Mode=C_LCM_ALAMC; 
    405          					}	
    406          					if(m!=D->Mode)D->Timer=0,D->FLAG=1;
    407          			
    408          //	CHK_DISP_MODE(Ddata->_Channal,&D->Mode);		
    409          }
    410          /////////////////////////////////////
    411          Int16U	ALAMC_mode_setion(Int16U	m,Int16U n)
    412          {
    413          
    414          	if(n<=(m*3))
    415          	{
    416          		LCMCmd(0x1);
    417          		LCMCmd(0x2);
    418          		return C_LCM_TEMRH;
    419          		
    420          	}
    421          	else    return m;  
    422          }
    423          /////////////////////////////////////////////
    424          void Display_mode_setion_ALAMC(_LCD *D,Int16U c)
    425          {
    426          	Int16U b;
    427          	if(++D->Timer>=D->Comp)
    428          	{
    429          	 D->Timer=0,D->Mode++;
    430          	 D->Mode=ALAMC_mode_setion(D->Mode,c);   	 
    431            }
    432          	 
    433          			
    434          }
    435          ////////////////////////////////
    436          Int16U	BCD(Int16U B)
    437          {
    438          	Int16U a,b;
    439          	a=B/100;
    440          	if(a>=10)a=9;
    441          	a<<=8;
    442          	B=B%100;
    443          	b=B/10;
    444          	b<<=4;
    445          	B=B%10;
    446          	B=a+b+B ;
    447          	return B;
    448          }
    449          
    450          
    451          
    452          
    453          void Disp_Table_Sub(Int16U *p,Int16U addrs,Int16U d)
    454          {
    455          	Int16U a,b,c;
    456          	c=*p;
    457          	a=BCD(*p);
    458          	if(a>=0x100)
    459          	{ 
    460          		if(*p<0xfe)
    461          	  {
    462          			b=a>>4;
    463          			WriteOneChar(addrs,b,1);
    464          	  	b=a&0xf;
    465          	  	b=ASCII_TAB[b];
    466          	    WriteASCIIChar(addrs+1,b,32,0);
    467          	   }else	
    468          			{
    469          				WriteASCIIChar(addrs,'-','-',0);	
    470          				WriteASCIIChar(addrs+1,'-','-',0);	
    471          			}	
    472          	 }else
    473                   {
    474          	        WriteOneChar(addrs,a,1);
    475          	        WriteASCIIChar(addrs+1,32,32,0);	
    476          	       }
    477          	  
    478          	  a=BCD(*++p),addrs+=3;
    479          	  if(a>=0x100||a==0||c>=0xfe)
    480          		{
    481          			if(c<0xfe&&a!=0)
    482          		 {
    483          			 b=a>>4;
    484          			 b=ASCII_TAB[b];
    485          			 WriteASCIIChar(addrs,b,'.',0);
    486          			 b=a&0xf;
    487          	  	 b=ASCII_TAB[b];
    488          	  	 WriteASCIIChar(addrs+1,b,'V',0);
    489          	  	}else  
    490          	  	{
    491          	  		WriteASCIIChar(addrs,'-','-',0);
    492          	  		WriteASCIIChar(addrs+1,'-','-',0);
    493          	  	}
    494          	    
    495          		}else
    496          		{
    497          			if(*p>=21)b=0X28;
    498          	  	else          b=0X10;
    499          			if((a>b)||(d!=0))
    500          			{
    501          				b=a&0xf;
    502          				b=ASCII_TAB[b];
    503          	    	WriteASCIIChar(addrs+1,b,'V',0);
    504          	    	b=a>>4;
    505          	    	b=ASCII_TAB[b];

⌨️ 快捷键说明

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