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

📄 zong.txt

📁 lcd显示做的不好,还没有编辑完整,我在做试验.想找个更好的源码
💻 TXT
📖 第 1 页 / 共 2 页
字号:
				while(y1<=y2)
				{
					PutPixel(x1,y1,color);
					if(e>0){x1+=1;e-=dy;}	
					y1+=1;
					e+=dx;
				}
			}
		}
		else		   // dy<0
		{
			dy=-dy;   // dy=abs(dy)

			if(dx>=dy) // 8/8 octant
			{
				e=dy-dx/2;
				while(x1<=x2)
				{
					PutPixel(x1,y1,color);
					if(e>0){y1-=1;e-=dx;}	
					x1+=1;
					e+=dy;
				}
			}
			else		// 7/8 octant
			{
				e=dx-dy/2;
				while(y1>=y2)
				{
					PutPixel(x1,y1,color);
					if(e>0){x1+=1;e-=dy;}	
					y1-=1;
					e+=dx;
				}
			}
		}	
	}
	else //dx<0
	{
		dx=-dx;		//dx=abs(dx)
		if(dy >= 0) // dy>=0
		{
			if(dx>=dy) // 4/8 octant
			{
				e=dy-dx/2;
				while(x1>=x2)
				{
					PutPixel(x1,y1,color);
					if(e>0){y1+=1;e-=dx;}	
					x1-=1;
					e+=dy;
				}
			}
			else		// 3/8 octant
			{
				e=dx-dy/2;
				while(y1<=y2)
				{
					PutPixel(x1,y1,color);
					if(e>0){x1-=1;e-=dy;}	
					y1+=1;
					e+=dx;
				}
			}
		}
		else		   // dy<0
		{
			dy=-dy;   // dy=abs(dy)

			if(dx>=dy) // 5/8 octant
			{
				e=dy-dx/2;
				while(x1>=x2)
				{
					PutPixel(x1,y1,color);
					if(e>0){y1-=1;e-=dx;}	
					x1-=1;
					e+=dy;
				}
			}
			else		// 6/8 octant
			{
				e=dx-dy/2;
				while(y1>=y2)
				{
					PutPixel(x1,y1,color);
					if(e>0){x1-=1;e-=dy;}	
					y1-=1;
					e+=dx;
				}
			}
		}	
	}
}

/**************************************************************
在LCD屏幕上画一个矩形
**************************************************************/
static void Glib_Rectangle(int x1,int y1,int x2,int y2,int color)
{
    Glib_Line(x1,y1,x2,y1,color);
    Glib_Line(x2,y1,x2,y2,color);
    Glib_Line(x1,y2,x2,y2,color);
    Glib_Line(x1,y1,x1,y2,color);
}

/**************************************************************
在LCD屏幕上用颜色填充一个矩形
**************************************************************/
static void Glib_FilledRectangle(int x1,int y1,int x2,int y2,int color)
{
    int i;

    for(i=y1;i<=y2;i++)
	Glib_Line(x1,i,x2,i,color);
}

/**************************************************************
在LCD屏幕上写一个汉字
**************************************************************/
void LCDSentChinese(unsigned char * CString,int x,int y, int CType,int bkcolor,int color)
{
   
   int i,j,k,m=0,n;
   int vx,vy;

   int PointNumber;
   unsigned char tmpch,CharLogic;
  
   for(n=0;n<42;n++)
   {
   	if(vx+32<=640)
   	{
   	vx=x;
    vy=y;

  	 PointNumber=CType*CType*8;
  	 for(i=m;i<PointNumber+m;i=i+CType) //显示所有字符
 	  { 
	   	for(j=0;j<CType;j++)//显示每一行内所有字符
		 {
		  	  
		   tmpch=CString[i+j]++;//显示一行内下一个字符(0-CType-1)
		   for(k=0;k<8;k++)   //显示1个字符
	        {
    	      CharLogic=tmpch&0x80;
        	  if(CharLogic==0x80)
        	 PutPixel(vx,vy,color);
	          else
  	           PutPixel(vx,vy,bkcolor);
   	       tmpch=tmpch<<1;
   	       vx=vx+1; //移到下一点显示
   	      }
		 }
		 vx=x;
  	     vy=vy+1;
   
 	    }
 	  x+=16;
 	  vy=y;
  	 m=m+32;
  	 }
  	 else 
  	 {x=0;
  	 y+=24;
  	 vx=x;
     vy=y;

  	 }
   }  
}

/**************************************************************
**************************************************************/
void Lcd_Tft_LQ080V3DG1_Init(void)
{
    Lcd_Init();
	LcdBkLtSet( 70 ) ;
	Lcd_PowerEnable(0, 1);
    Lcd_EnvidOnOff(1);		//turn on vedio

	Lcd_ClearScr(0xffff);		//fill all screen with some color*/
	//#define LCD_BLANK		12
	//#define C_UP		( LCD_XSIZE_TFT_640480 - LCD_BLANK*2 )
	//#define C_RIGHT		( LCD_XSIZE_TFT_640480 - LCD_BLANK*2 )
	//#define V_BLACK		( ( LCD_YSIZE_TFT_640480 - LCD_BLANK*4 ) / 6 )
	//Glib_FilledRectangle( LCD_BLANK, LCD_BLANK, ( LCD_XSIZE_TFT_640480 - LCD_BLANK ), ( LCD_YSIZE_TFT_640480 - LCD_BLANK ),0x0000);		//fill a Rectangle with some color

	/*Glib_FilledRectangle( (LCD_BLANK*2), (LCD_BLANK*2 + V_BLACK*0), (C_RIGHT), (LCD_BLANK*2 + V_BLACK*1),0x001f);		//fill a Rectangle with some color
	Glib_FilledRectangle( (LCD_BLANK*2), (LCD_BLANK*2 + V_BLACK*1), (C_RIGHT), (LCD_BLANK*2 + V_BLACK*2),0x07e0);		//fill a Rectangle with some color
	Glib_FilledRectangle( (LCD_BLANK*2), (LCD_BLANK*2 + V_BLACK*2), (C_RIGHT), (LCD_BLANK*2 + V_BLACK*3),0xf800);		//fill a Rectangle with some color
	Glib_FilledRectangle( (LCD_BLANK*2), (LCD_BLANK*2 + V_BLACK*3), (C_RIGHT), (LCD_BLANK*2 + V_BLACK*4),0xffe0);		//fill a Rectangle with some color
	Glib_FilledRectangle( (LCD_BLANK*2), (LCD_BLANK*2 + V_BLACK*4), (C_RIGHT), (LCD_BLANK*2 + V_BLACK*5),0xf81f);		//fill a Rectangle with some color
	Glib_FilledRectangle( (LCD_BLANK*2), (LCD_BLANK*2 + V_BLACK*5), (C_RIGHT), (LCD_BLANK*2 + V_BLACK*6),0x07ff);		//fill a Rectangle with some color

	Glib_Line( LCD_BLANK,LCD_BLANK, (LCD_XSIZE_TFT_640480-LCD_BLANK), (LCD_YSIZE_TFT_640480-LCD_BLANK), 0x0000 ) ;
	Glib_Line( LCD_BLANK,(LCD_YSIZE_TFT_640480-LCD_BLANK), (LCD_XSIZE_TFT_640480-LCD_BLANK), LCD_BLANK, 0x0000 )*/ ;
	
	//Paint_Bmp( 0, 0, 240, 320, xyx_240_320 ) ;
}

void Lcd_Tft_LQ080V3DG1_Test( void ) 
{
   	Uart_Printf("\nTest LQ080V3DG1 (TFT LCD)!\n");

	//Lcd_ClearScr( (0x00<<11) | (0x00<<5) | (0x00)  )  ;		//clear screen
	//Uart_Printf( "\nLCD clear screen is finished! press any key to continue!\n" );
   // Uart_Getch() ;		//wait uart input

	/*Lcd_ClearScr( (0x1f<<11) | (0x3f<<5) | (0x1f)  )  ;		//clear screen
	Uart_Printf( "LCD clear screen is finished! press any key to continue!\n" );
    Uart_Getch() ;		//wait uart input

	Lcd_ClearScr( (0x00<<11) | (0x00<<5) | (0x1f)  )  ;		//clear screen
	Uart_Printf( "LCD clear screen is finished! press any key to continue!\n" );
    Uart_Getch() ;		//wait uart input

	Lcd_ClearScr( (0x00<<11) | (0x3f<<5) | (0x00)  )  ;		//clear screen
	Uart_Printf( "LCD clear screen is finished! press any key to continue!\n" );
    Uart_Getch() ;		//wait uart input

	Lcd_ClearScr( (0x1f<<11) | (0x00<<5) | (0x00)  )  ;		//clear screen
	Uart_Printf( "LCD clear screen is finished! press any key to continue!\n" );
    Uart_Getch() ;		//wait uart input

	Lcd_ClearScr( (0x00<<11) | (0x3f<<5) | (0x1f)  )  ;		//clear screen
	Uart_Printf( "LCD clear screen is finished! press any key to continue!\n" );
    Uart_Getch() ;		//wait uart input

	Lcd_ClearScr( (0x1f<<11) | (0x00<<5) | (0x1f)  )  ;		//clear screen
	Uart_Printf( "LCD clear screen is finished! press any key to continue!\n" );
    Uart_Getch() ;		//wait uart input

	Lcd_ClearScr( (0x1f<<11) | (0x3f<<5) | (0x00)  )  ;		//clear screen
	Uart_Printf( "LCD clear screen is finished! press any key to continue!\n" );
    Uart_Getch() ;		//wait uart input*/

	/*Lcd_ClearScr(0xffff);		//fill all screen with some color
	#define LCD_BLANK		12
	#define C_UP		( LCD_XSIZE_TFT_640480 - LCD_BLANK*2 )
	#define C_RIGHT		( LCD_XSIZE_TFT_640480 - LCD_BLANK*2 )
	#define V_BLACK		( ( LCD_YSIZE_TFT_640480 - LCD_BLANK*4 ) / 6 )
	/*Glib_FilledRectangle( LCD_BLANK, LCD_BLANK, ( LCD_XSIZE_TFT_640480 - LCD_BLANK ), ( LCD_YSIZE_TFT_640480 - LCD_BLANK ),0x0000);		//fill a Rectangle with some color

	Glib_FilledRectangle( (LCD_BLANK*2), (LCD_BLANK*2 + V_BLACK*0), (C_RIGHT), (LCD_BLANK*2 + V_BLACK*1),0x001f);		//fill a Rectangle with some color
	Glib_FilledRectangle( (LCD_BLANK*2), (LCD_BLANK*2 + V_BLACK*1), (C_RIGHT), (LCD_BLANK*2 + V_BLACK*2),0x07e0);		//fill a Rectangle with some color
	Glib_FilledRectangle( (LCD_BLANK*2), (LCD_BLANK*2 + V_BLACK*2), (C_RIGHT), (LCD_BLANK*2 + V_BLACK*3),0xf800);		//fill a Rectangle with some color
	Glib_FilledRectangle( (LCD_BLANK*2), (LCD_BLANK*2 + V_BLACK*3), (C_RIGHT), (LCD_BLANK*2 + V_BLACK*4),0xffe0);		//fill a Rectangle with some color
	Glib_FilledRectangle( (LCD_BLANK*2), (LCD_BLANK*2 + V_BLACK*4), (C_RIGHT), (LCD_BLANK*2 + V_BLACK*5),0xf81f);		//fill a Rectangle with some color
	Glib_FilledRectangle( (LCD_BLANK*2), (LCD_BLANK*2 + V_BLACK*5), (C_RIGHT), (LCD_BLANK*2 + V_BLACK*6),0x07ff);	//fill a Rectangle with some color

	Glib_Line( LCD_BLANK,LCD_BLANK, (LCD_XSIZE_TFT_640480-LCD_BLANK), (LCD_YSIZE_TFT_640480-LCD_BLANK), 0x0000 ) ;
	Glib_Line( LCD_BLANK,(LCD_YSIZE_TFT_640480-LCD_BLANK), (LCD_XSIZE_TFT_640480-LCD_BLANK), LCD_BLANK, 0x0000 ) ;
	Uart_Printf("Any Key To Next!\n") ;  Uart_Getch() ;	*/	//Any Key To Next
/*

    Paint_Bmp(0,0,640,480, girl0_640_480);		//paint a bmp
   	Uart_Printf( "LCD paint a bmp, please look! press any key to continue! \n" );
    Uart_Getch() ;		//wait uart input

    Paint_Bmp(0,0,640,480, girl1_640_480);		//paint a bmp
   	Uart_Printf( "LCD paint a bmp, please look! press any key to continue! \n" );
    Uart_Getch() ;		//wait uart input
    
    Paint_Bmp(0,0,640,480, flower1_640_480);		//paint a bmp
   	Uart_Printf( "LCD paint a bmp, please look! press any key to continue! \n" );
    Uart_Getch() ;		//wait uart input

    Paint_Bmp(0,0,640,480, girl2_640_480);		//paint a bmp
   	Uart_Printf( "LCD paint a bmp, please look! press any key to continue! \n" );
    Uart_Getch() ;		//wait uart input**/


    LCDSentChinese(HANZI,0,220,2,5000,0X001f) ;  //paint a bmp
   	Uart_Printf( "LCD paint a bmp, please look! press any key to continue! \n" );
    Uart_Getch() ;		//wait uart input


}
//*************************************************************

⌨️ 快捷键说明

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