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

📄 lcd.c

📁 将模拟温度传感器与数字转换接口电路集成在一起
💻 C
📖 第 1 页 / 共 2 页
字号:
{
	UINT16T usLen;

    if( usY1 < usY0 )
    {
        GUISWAP (usY1, usY0);
    }

    while( (usWidth--) > 0 )
    {
        usLen = usY1 - usY0 + 1;
        while( (usLen--) > 0 )
        {
        	LCD_PutPixel(usX0, usY0 + usLen, ucColor);
        }
        usX0++;
    }
}

/*********************************************************************************************
* name:		lcd_disp_ascii8x16()
* func:		display 8x16 ASCII character string 
* para:		usX0,usY0 -- ASCII character string's start point coordinate
*			ForeColor -- appointed color value
*			pucChar   -- ASCII character string
* ret:		none
* modify:
* comment:		
*********************************************************************************************/
void lcd_disp_ascii8x16(UINT16T x0, UINT16T y0, UINT8T ForeColor, UINT8T * s)
{
	UINT16T i,j,k,x,y,xx;
	UINT8T qm;
	UINT32T ulOffset;
	INT8T ywbuf[16],temp[2];
    
	for( i = 0; i < strlen((const char*)s); i++ )
	{
		if( (UINT8T)*(s+i) >= 161 )
		{
			temp[0] = *(s + i);
			temp[1] = '\0';
			return;
		}
		else
		{
			qm = *(s+i);
			ulOffset = (UINT32T)(qm) * 16;		//Here to be changed tomorrow
			for( j = 0; j < 16; j ++ )
			{
				ywbuf[j] = g_ucAscii8x16[ulOffset + j];
            }

            for( y = 0; y < 16; y++ )
            {
            	for( x = 0; x < 8; x++ ) 
               	{
                	k = x % 8;
			    	if( ywbuf[y]  & (0x80 >> k) )
			       	{
			       		xx = x0 + x + i*8;
			       		LCD_PutPixel(xx, y + y0, (UINT8T)ForeColor);
			       	}
			   	}
            }
		}
	}
}

/*********************************************************************************************
* name:		lcd_disp_ascii6x8()
* func:		display 6x8 ASCII character string 
* para:		usX0,usY0 -- ASCII character string's start point coordinate
*			ForeColor -- appointed color value
*			pucChar   -- ASCII character string
* ret:		none
* modify:
* comment:		
*********************************************************************************************/
void lcd_disp_ascii6x8(UINT16T usX0, UINT16T usY0,UINT8T ForeColor, UINT8T* pucChar)
{
	UINT32T i,j;
	UINT8T  ucTemp;

	while( *pucChar != 0 )
	{
		for( i=0; i < 8; i++ )
		{
  			ucTemp = g_ucAscii6x8[(*pucChar) * 8 + i];
  			for( j = 0; j < 8; j++ )
  			{
  				if( (ucTemp & (0x80 >> j)) != 0 )
  				{
  					LCD_PutPixel(usX0 + i, usY0 + 8 - j, (UINT8T)ForeColor);
  				}  				
  			}
		}
		usX0 += XWIDTH;
		pucChar++;
	}
}

#ifdef CHINESE_VERSION
/*********************************************************************************************
* name:		lcd_disp_hz16()
* func:		display chinese character string in 16x16 dot array
* para:		usX0,usY0 -- ASCII character string's start point coordinate
*			ForeColor -- appointed color value
*			pucChar   -- ASCII character string
* ret:		none
* modify:
* comment:		
*********************************************************************************************/
void lcd_disp_hz16(UINT16T x0, UINT16T y0, UINT8T ForeColor, UINT8T *s)
{
	UINT16T i,j,k,x,y,xx;
	UINT8T qm,wm;
	UINT32T ulOffset;
	INT8T hzbuf[32],temp[2];

	for( i = 0; i < strlen((const char*)s); i++ )
	{
		if( ((UINT8T)(*(s+i))) < 161 )
		{
			temp[0] = *(s+i);
			temp[1] = '\0';
			break;
		}
		else
		{
			qm = *(s+i) - 161;
    		wm = *(s + i + 1) - 161;
       		ulOffset = (UINT32T)(qm * 94 + wm) * 32;
			for( j = 0; j < 32; j ++ )
            {
            	hzbuf[j] = g_ucHZK16[ulOffset + j];
            }
            for( y = 0; y < 16; y++ )
            {
	        	for( x = 0; x < 16; x++ ) 
	            {
                	k = x % 8;
				   	if( hzbuf[y * 2 + x / 8]  & (0x80 >> k) )
				    {
				    	xx = x0 + x + i * 8;
				    	LCD_PutPixel( xx, y + y0, (UINT8T)ForeColor);
				    }
			   	}
           	}
		    i++;
		}
	}
}
#endif


/*********************************************************************************************
* name:		lcd_point_4()
* func:		LCD test function
* para:		none
* ret:		none
* modify:
* comment:		
*********************************************************************************************/
void lcd_point_4(UINT16T p_x, UINT8T p_y, UINT8T p_number, UINT8T clor)
{ 
    for(; p_number>0; --p_number)
    {
      LCD_PutPixel(p_x, p_y, clor);
      p_x++;  
    }
}

////////////////////////////////////////////////////////////
//name:lcd_fk
//func:画出一个方框
//PART:其中P_X,P_Y为方框的开始点,另外两个为宽和高,最后一个为颜色
//鼠标大小为num
////////////////////////////////////////////////////////////
void lcd_fk(UINT16T p_x, UINT16T p_y,UINT16T p_w,UINT16T p_h,UINT8T clor)
	{	
		UINT8T i;
		if(p_y>239) p_y=239;
		if(p_x>319) p_x=319;
		for (i=0;i< p_h ; i++ )
		{	
			lcd_point_4(p_x,p_y+i,p_w,clor);	
		}
	}


/*********************************************************************************************
* name:		lcd_logo()
* func:		开机画面
* para:		none
* ret:		none
* modify:
* comment:		
*********************************************************************************************/
void lcd_logo(void)
{
	bitmap_view320x240x256((UINT8T*)(g_ucBitmap[0]));
	lcd_wait();
	bitmap_view320x240x256((UINT8T*)(g_ucBitmap[1]));
}

/*********************************************************************************************
* name:		lcd_wait()
* func:		开机画面
* para:		none
* ret:		none
* modify:
* comment:		
*********************************************************************************************/
void lcd_wait(void)
{	
	unsigned char cnt;
	//unsigned char x,y;
	//uart_printf("\n x=");
	//x=uart_getintnum();
	//uart_printf("\n y=");
	//y=uart_getintnum();
	for(cnt=0;cnt<130;)
	{
		lcd_fk(110+cnt,216,10,10,0xe0);
		lcd_fk(110+cnt,216,3,10,0xff);
		cnt+=13;
		delay(9000);
	}
}
/*********************************************************************************************
* name:		lcd_logo_intro()
* func:		作品介绍
* para:		none
* ret:		none
* modify:
* comment:		
********************************************************************************************
void lcd_logo_intro()
{
	unsigned char audu[]={"我得名字教什么那"};
	unsigned short ptr[1];
	ptr[0]=audu[];
	lcd_disp_hz16(100,200,GREEN,ptr);
}*/
/*********************************************************************************************
* name:		lcd_test_1820()
* func:		作品介绍
* para:		none
* ret:		none
* modify:
* comment:		
********************************************************************************************/
void lcd_test_1820(unsigned char temp_1820)
{	
	//unsigned char x,y;
	unsigned char num_100,num_10,num_1;
	float temp_f;
	//uart_printf("\n x=");
	//x=uart_getintnum();
	//uart_printf("\n y=");
	//y=uart_getintnum();
	temp_f=temp_1820;
	if(temp_1820>=100) {num_100=1,temp_1820-=100;}
		else num_100=0;
	num_1 =temp_1820%10;	
	num_10=temp_1820/10;
	unsigned char *temp[10]={"0","1","2","3","4","5","6","7","8","9"};
	
	lcd_fk(140,80,40,20,0xff);
	lcd_disp_ascii8x16(140,80,RED,temp[num_100]);
	lcd_disp_ascii8x16(152,80,RED,temp[num_10]);
	lcd_disp_ascii8x16(164,80,RED,temp[num_1]);
	
	temp_f=1.8*(temp_f+32);
	temp_1820=temp_f;
		if(temp_1820>=100) {if(temp_1820>=200)num_100=2,temp_1820-=200;else num_100=1,temp_1820-=100;}
		else num_100=0;
	num_1 =temp_1820%10;	
	num_10=temp_1820/10;
	lcd_fk(140,120,40,20,0xff);
	lcd_disp_ascii8x16(140,120,RED,temp[num_100]);
	lcd_disp_ascii8x16(152,120,RED,temp[num_10]);
	lcd_disp_ascii8x16(164,120,RED,temp[num_1]);
	
	
	
}




⌨️ 快捷键说明

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