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

📄 ra8806.c

📁 320x240驱动程序(网上搜集资料).rar
💻 C
📖 第 1 页 / 共 3 页
字号:
	if(temp < 0x0A)
	{
		temp |= 0x30;
	}
	else temp = temp + 0x37;
	LCD_DataWrite(temp);
	Delay1ms(1);

	temp=buf;
	temp = temp & 0x0F;
	if(temp < 0x0A)
	{
		temp |= 0x30;
	}
	else temp = temp + 0x37;
	LCD_DataWrite(temp);
	Delay1ms(1);
}
//==============================================================================
//Subroutine:	Fill_PNTR_to_DPRAM
//Function:
//==============================================================================
void Fill_PNTR_to_DPRAM(void)
{
	uchar temp;
	
	LCD_CmdWrite(FNCR);	
	temp = LCD_DataRead();
	temp |= cSetb3;
	LCD_CmdWrite(FNCR);
	LCD_DataWrite(temp);

	do{
		Delay2us(1);
	}while(LCD_StatusRead() & 0x80);

}

//==============================================================================
//Subroutine:	Enable_KeyScan_INT
//Function:
//==============================================================================
void Enable_KeyScan_INT(void)
{
	uchar temp;

	LCD_CmdWrite(INTR);	
	temp = LCD_DataRead();
	temp |= cSetb3;
	LCD_CmdWrite(INTR);
	LCD_DataWrite(temp);
}

//==============================================================================
//Subroutine:	Enable_KeyScan
//Function:
//==============================================================================
void Enable_KeyScan(void)
{
	uchar temp;

	LCD_CmdWrite(KSCR1);	
	temp = LCD_DataRead();
	temp |= cSetb7;
	LCD_CmdWrite(KSCR1);
	LCD_DataWrite(temp);
}

//==============================================================================
//Subroutine:	Enable_KeyScan
//Function:
//==============================================================================
void Disable_KeyScan(void)
{
	uchar temp;

	LCD_CmdWrite(KSCR1);	
	temp = LCD_DataRead();
	temp &= cClrb7;
	LCD_CmdWrite(KSCR1);
	LCD_DataWrite(temp);
}

//==============================================================================
//Subroutine:	Enable_KeyScan_WakeUp
//Function:
//==============================================================================
void Enable_KeyScan_WakeUp(void)
{
	uchar temp;

	LCD_CmdWrite(KSCR2);	
	temp = LCD_DataRead();
	temp |= cSetb7;
	LCD_CmdWrite(KSCR2);
	LCD_DataWrite(temp);
}

//==============================================================================
//Subroutine:	Disable_KeyScan_WakeUp
//Function:
//==============================================================================
void Disable_KeyScan_WakeUp(void)
{
	uchar temp;

	LCD_CmdWrite(KSCR2);	
	temp = LCD_DataRead();
	temp &= cClrb7;
	LCD_CmdWrite(KSCR2);
	LCD_DataWrite(temp);
}

//==============================================================================
//Subroutine:	Clr_KeyScan_INT_Flag
//Function:
//==============================================================================
void Clr_KeyScan_INT_Flag(void)
{
	uchar temp;

	LCD_CmdWrite(INTR);	
	temp = LCD_DataRead();
	temp = temp & 0xfd;
	LCD_CmdWrite(INTR);
	LCD_DataWrite(temp);
}

//==============================================================================
//Subroutine:	Clr_Wakeup_INT_Flag
//Function:
//==============================================================================
void Clr_Wakeup_INT_Flag(void)
{
	uchar temp;

	LCD_CmdWrite(INTR);	
	temp = LCD_DataRead();
	temp = temp & 0xfb;
	LCD_CmdWrite(INTR);
	LCD_DataWrite(temp);
}

//==============================================================================
//Subroutine:	Get_Key
//Function:
//==============================================================================
uchar Get_Key(void)
{
	uchar temp;

	LCD_CmdWrite(INTR);	
	temp = LCD_DataRead();
	temp = temp & 0x02;
	if(temp == 0) 
		return 0;
	else		  
		return 1;
}



//==============================================================================
//Subroutine:	Blk
//Function:
//==============================================================================
void LCD_Blk(void)
{
	uchar temp;
	
	LCD_CmdWrite(WLCR);
	temp = LCD_DataRead();
	temp |= cSetb1;
	LCD_CmdWrite(WLCR);
	LCD_DataWrite(temp);
}

void LCD_NoBlk(void)
{
	uchar temp;
	
	LCD_CmdWrite(WLCR);
	temp = LCD_DataRead();
	temp &= cClrb1;
	LCD_CmdWrite(WLCR);
	LCD_DataWrite(temp);
}

//==============================================================================
//Subroutine:	Blk Timer
//Function:
//==============================================================================
void LCD_BlkTim(uchar buf)
{
	uchar temp;
	
	LCD_CmdWrite(BTMR);
	temp = LCD_DataRead();
	temp |= buf;
	LCD_CmdWrite(BTMR);
	LCD_DataWrite(temp);
}

//==============================================================================
//Subroutine:	Cursor On
//Function:
//==============================================================================
void LCD_Cur(void)
{
	uchar temp;
	
	LCD_CmdWrite(WCCR);
	temp = LCD_DataRead();
	temp |= cSetb2;
	LCD_CmdWrite(WCCR);
	LCD_DataWrite(temp);
}

void LCD_NoCur(void)
{
	uchar temp;
	
	LCD_CmdWrite(WCCR);
	temp = LCD_DataRead();
	temp &= cClrb2;
	LCD_CmdWrite(WCCR);
	LCD_DataWrite(temp);
}

//==============================================================================
//Subroutine:	Align On
//Function:
//==============================================================================
void LCD_AlignOn(void)
{
	uchar temp;
	
	LCD_CmdWrite(WCCR);
	temp = LCD_DataRead();
	temp |= cSetb6;
	LCD_CmdWrite(WCCR);
	LCD_DataWrite(temp);
}

void LCD_AlignOff(void)
{
	uchar temp;

	LCD_CmdWrite(WCCR);
	temp = LCD_DataRead();
	temp &= cClrb6;
	LCD_CmdWrite(WCCR);
	LCD_DataWrite(temp);
}

//==============================================================================
//Subroutine:	Auto Fill 
//Function:
//==============================================================================
void LCD_FillOn(void)
{
	uchar temp;

	LCD_CmdWrite(FNCR);
	temp = LCD_DataRead();
	temp |= cSetb3;
	LCD_CmdWrite(FNCR);
	LCD_DataWrite(temp);
}
//==============================================================================
//Subroutine:	Cursor Blink On
//Function:
//==============================================================================
void LCD_CurBlk(void)
{
	uchar temp;

	LCD_CmdWrite(WCCR);
	temp = LCD_DataRead();
	temp |= cSetb1;
	LCD_CmdWrite(WCCR);
	LCD_DataWrite(temp);
}

void LCD_NoCurBlk(void)
{
	uchar temp;
	
	LCD_CmdWrite(WCCR);
	temp = LCD_DataRead();
	temp &= cClrb1;
	LCD_CmdWrite(WCCR);
	LCD_DataWrite(temp);
}

//==============================================================================
//Subroutine:	Cursor Height
//Function:
//==============================================================================
void LCD_CurHei(uchar buf)
{
	uchar temp;
	buf = buf << 4;
	buf = buf & 0xF0; 	
	LCD_CmdWrite(CHWI);
	temp = LCD_DataRead();	
	temp = (temp & 0x0F) | buf;		
	LCD_CmdWrite(CHWI);
	LCD_DataWrite(temp);
}

//==============================================================================
//Subroutine:	Line Distance
//Function:
//==============================================================================
void LCD_LineDis(uchar buf)
{
	uchar temp;
	buf = buf & 0x0F; 	
	LCD_CmdWrite(CHWI);
	temp = LCD_DataRead();	
	temp = (temp & 0xF0) | buf;		
	LCD_CmdWrite(CHWI);
	LCD_DataWrite(temp);
}

//==============================================================================
//Subroutine:	Font Size
//Function:
//==============================================================================
void LCD_FontSize(uchar buf)
{
	uchar temp;
	buf = buf << 4;
	temp = (buf & 0xF0) | (0x0F);  	
	LCD_CmdWrite(FVHT);
	LCD_DataWrite(temp);
}

//==============================================================================
//Subroutine:	Font Size
//Function:
//==============================================================================
void LCD_LineDist_Adjust(uchar dis)
{
	uchar temp;
	LCD_CmdWrite(CHWI);	// Line Distance
	temp = LCD_DataRead();
	temp &= 0xf0;
	temp |= (dis & 0x0f);
	LCD_CmdWrite(CHWI);	// Line Distance
	LCD_DataWrite(temp);
}

//==============================================================================
//Subroutine:	Software Reset
//Function:
//==============================================================================
void LCD_SWRst(void)
{
	uchar temp;
	
	LCD_CmdWrite(WLCR);
	temp = LCD_DataRead();
	temp |= cSetb5;
	LCD_CmdWrite(WLCR);
	LCD_DataWrite(temp);
}

//==============================================================================
//Subroutine:	LCD_Clear
//Function:		Clear LCD DDRAM
//==============================================================================
void LCD_Clear(void)
{
	LCD_Graphic();
	Access_2Page();
	
	LCD_CmdWrite(PNTR);
	LCD_DataWrite(0x00);
	
	Fill_PNTR_to_DPRAM();
//	Delay100ms(2);
}

//==============================================================================
//Subroutine:	No_Snow_Mode
//Function:		Clear LCD DDRAM
//==============================================================================
void No_Snow_Mode(void)
{
	uchar temp;

	LCD_CmdWrite(MISC);
	temp = LCD_DataRead();
	temp |= cSetb3;
	LCD_CmdWrite(MISC);
	LCD_DataWrite(temp);
}

//==============================================================================
//Subroutine:	No_Snow_Mode
//Function:		Clear LCD DDRAM
//==============================================================================
void Snow_Mode(void)
{
	uchar temp;

	LCD_CmdWrite(MISC);
	temp = LCD_DataRead();
	temp &= cClrb3;
	LCD_CmdWrite(MISC);
	LCD_DataWrite(temp);
}

//==============================================================================
//Subroutine:	LCD_Rotate90
//Function:		
//==============================================================================
void LCD_Rotate90(void)
{
	uchar temp;

	LCD_CmdWrite(WCCR);
	temp = LCD_DataRead();
	temp |= cSetb3;
	LCD_CmdWrite(WCCR);
	LCD_DataWrite(temp);
}

//==============================================================================
//Subroutine:	LCD_Rotate90_Disable
//Function:		
//==============================================================================
void LCD_Rotate90_Disable(void)
{
	uchar temp;

	LCD_CmdWrite(WCCR);
	temp = LCD_DataRead();
	temp &= cClrb3;
	LCD_CmdWrite(WCCR);
	LCD_DataWrite(temp);
}

//==============================================================================
//Subroutine:	ASCII_Block_0
//Function:		
//==============================================================================
void ASCII_Block_0(void)
{
	uchar temp;

	LCD_CmdWrite(FNCR);
	temp = LCD_DataRead();
	temp &= cClrb1;
	temp &= cClrb0;
	LCD_CmdWrite(FNCR);
	LCD_DataWrite(temp);
}

//==============================================================================
//Subroutine:	ASCII_Block_1
//Function:		
//==============================================================================
void ASCII_Block_1(void)
{
	uchar temp;

	LCD_CmdWrite(FNCR);
	temp = LCD_DataRead();
	temp &= cClrb1;
	temp |= cSetb0;
	LCD_CmdWrite(FNCR);
	LCD_DataWrite(temp);
}

//==============================================================================
//Subroutine:	ASCII_Block_2
//Function:		
//==============================================================================
void ASCII_Block_2(void)
{
	uchar temp;

	LCD_CmdWrite(FNCR);
	temp = LCD_DataRead();
	temp |= cSetb1;
	temp &= cClrb0;
	LCD_CmdWrite(FNCR);
	LCD_DataWrite(temp);
}

//==============================================================================
//Subroutine:	ASCII_Block_3
//Function:		
//==============================================================================
void ASCII_Block_3(void)
{
	uchar temp;

	LCD_CmdWrite(FNCR);
	temp = LCD_DataRead();
	temp |= cSetb1;
	temp |= cSetb0;
	LCD_CmdWrite(FNCR);
	LCD_DataWrite(temp);
}

//==============================================================================
//Subroutine:	ASCII_All_Code
//Function:		
//==============================================================================
void ASCII_All_Code(void)
{
	uchar temp;

	LCD_CmdWrite(FNCR);
	temp = LCD_DataRead();
	temp |= cSetb2;
	LCD_CmdWrite(FNCR);
	LCD_DataWrite(temp);
}

//==============================================================================
//Subroutine:	ASCII_Half_Code
//Function:		
//==============================================================================
void ASCII_Half_Code(void)
{
	uchar temp;

	LCD_CmdWrite(FNCR);
	temp = LCD_DataRead();
	temp &= cClrb2;
	LCD_CmdWrite(FNCR);
	LCD_DataWrite(temp);
}

//==============================================================================
//Subroutine:	Set_Active_Window_Size
//Function:
//==============================================================================
void Set_Active_Window_Size(uchar top_pos, uchar Bot_pos, uchar Left_pos, uchar Right_pos)
{
	LCD_CmdWrite(AWTR);
	LCD_DataWrite(top_pos);
	Delay2us(20);
	LCD_CmdWrite(AWBR);
	LCD_DataWrite(Bot_pos);
	Delay2us(20);
	LCD_CmdWrite(AWLR);
	LCD_DataWrite(Left_pos);
	Delay2us(20);
	LCD_CmdWrite(AWRR);
	LCD_DataWrite(Right_pos);
	Delay2us(20);
}

//==============================================================================
//Subroutine:	Set_Display_Window_Size
//Function:
//==============================================================================
void Set_Display_Window_Size(uchar DW_Width, uchar DW_Height)
{
	LCD_CmdWrite(DWWR);
	LCD_DataWrite(DW_Width);
	Delay2us(20);
	LCD_CmdWrite(DWHR);
	LCD_DataWrite(DW_Height);
	Delay2us(20);
}

//==============================================================================
//Subroutine:	Set_Scroll_Window_Size
//Function:
//==============================================================================
void Set_Scroll_Window_Size(uchar seg_start, uchar seg_end, uchar com_start, uchar com_end)
{
	LCD_CmdWrite(0x61);			//SEG Start Position of Scrolling Mode
	LCD_DataWrite(seg_start);
	LCD_CmdWrite(0x62);			//SEG End Position of Scrolling Mode
	LCD_DataWrite(seg_end);

	LCD_CmdWrite(0x71);			//COM Start Position of Scrolling Mode
	LCD_DataWrite(com_start);
	LCD_CmdWrite(0x72);			//COM End Position of Scrolling Mode
	LCD_DataWrite(com_end);
}

//==============================================================================
//Subroutine:	LCD_Rotate90_Disable
//Function:		Frame Freq(max) = 416 Hz
//==============================================================================
void Set_Frame_Freq(int Frame_freq)
{
	int ITCR_num;

	ITCR_num = ((33333/Frame_freq) - 80);
	LCD_CmdWrite(ITCR);
	LCD_DataWrite(ITCR_num);
	Delay2us(20);
}

//==============================================================================
//Subroutine:	LCD_ShowStr
//Function:		
//==============================================================================
void LCD_ShowStr(unsigned char *text,unsigned int t)
{ 
	LCD_CmdWrite(0xB0);
    while(*text != '\0')          
	{
    	LCD_DataWrite(*text);
    	++text; 

	    Delay1ms(t);
    }
}

//==============================================================================
//Subroutine:	Clear_Head_Line
//Function:		
//==============================================================================
void Clear_Head_Line(void)
{
	int i;

	Access_Page1();
	Only_Show_Page1();
	LCD_Graphic();
	LCD_GotoXY(0,104);
	LCD_CmdWrite(0xb0);
	for(i=0;i<1280;i++)
		LCD_DataWrite(0x00);
}

⌨️ 快捷键说明

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