?? t6963.h
字號:
return;
}
/****************************************
** 函數名稱: Set_Address_Pointer
** 功能描述: 設置地址指針
** 輸 入 : address_low : 地址指針的低8位
** address_high: 地址指針的高8位
** 輸 出 : 無
** 全局變量:無
** 調用模塊: Write,Command
**
** 作 者:
** 日 期: 2006-1-10
******************************************/
#pragma disable
void Set_Address_Pointer(unsigned char address_low,unsigned char address_high)
{
Write(address_low);
Write(address_high);
Command(0x24);
return;
}
/****************************************
** 函數名稱: Set_Offset_Register
** 功能描述: 設置偏移寄存器,它的低5位為CGRAM地址的高5位
** 輸 入 : datum : 偏移寄存器數值
** 輸 出 : 無
** 全局變量:無
** 調用模塊: Write,Command
**
** 作 者:
** 日 期: 2006-1-10
******************************************/
/* Set address pointer */
#pragma disable
void Set_Offset_Register(unsigned char datum)
{
Write(datum);
Write(0x00);
Command(0x22);
return;
}
/****************************************
** 函數名稱: Cursor_Pattern_Select
** 功能描述: 光標式樣
** 輸 入 : lines: 0~7表示 1~8線
** 輸 出 : 無
** 全局變量:無
** 調用模塊: Command
**
** 作 者:
** 日 期: 2006-1-17
******************************************/
/*
void Cursor_Pattern_Select(unsigned char lines)
{
Command(0xa0+lines);
return;
}
*/
/****************************************
** 函數名稱: Set_Cursor_Address
** 功能描述: 光標式樣
** 輸 入 : x:水平字符位
** y:垂直字符位
** 輸 出 : 無
** 全局變量:無
** 調用模塊: Write,Command
**
** 作 者:
** 日 期: 2006-1-17
******************************************/
/*
void Set_Cursor_Address(unsigned char x,unsigned char y)
{
Write(x);
Write(y);
Command(0x21);
return;
}
*/
/****************************************
** 函數名稱: Text_Attribute_Mode
** 功能描述: 異或模式
** 輸 入 : 無
** 輸 出 : 無
** 全局變量: mode_set
** 調用模塊: Command
**
** 作 者:
** 日 期: 2006-1-17
******************************************/
void Text_Attribute_Mode(void)
{
Command(mode_set+0x04);
return;
}
/****************************************
** 函數名稱: Character
** 功能描述: 字符模式顯示西文字符
** 輸 入 : x: 字符位置x坐標
** y: 字符位置y坐標
** cod: 字符代碼
** attribute: 文本屬性
** 0正向顯示 0x08 閃爍
** 5負向顯示 0x0d 閃爍
** 3禁止顯示(正向) 0x0b 閃爍
** 4禁止顯示(負向) 0x0c 閃爍
** 輸 出 : 無
** 全局變量:無
** 調用模塊: Set_Address_Pointer,Write_Data
**
** 作 者:
** 日 期: 2006-1-10
**-------------------------------------------------------
**
** 修改人:
** 日 期: 2006-1-17
** 描 述: 增加文本屬性參數
******************************************/
void Character(unsigned char x,unsigned char y,unsigned char cod,unsigned char attribute)
{
unsigned char address_low,address_high;
address_high=(y*TEXT_AREA+x)>>8;
address_low=(y*TEXT_AREA+x)%256;
Set_Address_Pointer(address_low,address_high);
Write_Data(cod);
Text_Attribute_Mode();
Set_Address_Pointer(address_low,address_high+GRAPHIC_HOME_ADDRESS_HIGH);
Write_Data(attribute);
return;
}
/****************************************
** 函數名稱: Chinese_Character
** 功能描述: 字符模式顯示中文字符
** 輸 入 : x: 字符位置x坐標
** y: 字符位置y坐標
** cod: 字符代碼
** 輸 出 : 無
** 全局變量:無
** 調用模塊: Character
**
** 作 者:
** 日 期: 2006-1-10
**-------------------------------------------------------
**
** 修改人:
** 日 期: 2006-1-17
** 描 述: 增加文本屬性參數
******************************************/
void Chinese_Character(unsigned char x,unsigned char y,unsigned char cod,unsigned char attribute)
{
Character(x,y,cod,attribute);
Character(x,++y,++cod,attribute);
Character(++x,--y,++cod,attribute);
Character(x,++y,++cod,attribute);
return;
}
/****************************************
** 函數名稱: Chinese_Character_For_Grahic_Mode
** 功能描述: 圖形模式顯示中文字符
** 輸 入 : x: 字符位置x坐標
** y: 字符位置y坐標
** cod: 字符代碼
** mode:字符模式,0普通,1反白
** *font:字符段首地址
** 輸 出 : 無
** 全局變量:無
** 調用模塊: Set_Address_Pointer,Autowrite,Command
**
** 作 者:
** 日 期: 2006-1-10
******************************************/
void Chinese_Character_For_Grahic_Mode(unsigned char x,unsigned char y,unsigned char cod,unsigned char mode,unsigned char *font)
{
unsigned char i,address_low,address_high;
unsigned int temp1,temp2;
temp1=y*TEXT_AREA*8+x;
for(i=0;i<16;i++)
{
temp2=i*TEXT_AREA;
address_high=(temp1+temp2)>>8;
address_low=(temp1+temp2)%256;
Set_Address_Pointer(address_low,address_high+GRAPHIC_HOME_ADDRESS_HIGH);
AUTO_WRITE_ON();
if (mode==0)
{
Autowrite(*(font+(cod<<5)+i));
Autowrite(*(font+(cod<<5)+i+16));
}
else
{
Autowrite(255-*(font+(cod<<5)+i));
Autowrite(255-*(font+(cod<<5)+i+16));
}
AUTO_WRITE_OFF();
}
return;
}
/****************************************
** 函數名稱: Picture
** 功能描述: 顯示圖形
** 輸 入 : *pic:圖形段首地址
** 輸 出 : 無
** 全局變量:無
** 調用模塊: Set_Address_Pointer,Autowrite,Command
**
** 作 者:
** 日 期: 2006-1-10
******************************************/
void Picture(unsigned char x,unsigned char y,unsigned char pic[])
{
unsigned char i,j;
Set_Address_Pointer(GRAPHIC_HOME_ADDRESS_LOW,GRAPHIC_HOME_ADDRESS_HIGH);
AUTO_WRITE_ON();
for(i=0;i<y;i++)
{
for(j=0;j<x;j++)
Autowrite(pic[(i*x+j)]);
}
AUTO_WRITE_OFF();
return;
}
/****************************************
** 函數名稱: Create_CGRAM
** 功能描述: 創建CGRAM
** 輸 入 : *font:字符段首地址
** character_count: 字符數量
** 輸 出 : 無
** 全局變量:無
** 調用模塊: Set_Offset_Register,Set_Address_Pointer,Command
**
** 作 者:
** 日 期: 2006-1-10
**-------------------------------------------
**
** 修改人:
** 日 期: 2006-1-10
** 描 述: 增加了字符數量參數
******************************************/
void Create_CGRAM(unsigned char *font,unsigned char cod,unsigned char character_count)
{
unsigned char i,j;
unsigned char cg_add=CGRAM_ADDRESS;
Set_Offset_Register(OFFSET_REGISTER); //Set offset register
if ((cod&0x80)==0x80)
{
cg_add+=0x04;
}
if ((cod&0x40)==0x40)
{
cg_add+=0x02;
}
if ((cod&0x20)==0x20)
{
cg_add+=0x01;
}
cod=cod<<3;
Set_Address_Pointer(cod,cg_add);
AUTO_WRITE_ON();
for(j=0;j<character_count;j++)
{
for(i=0;i<8;i++)
{
Autowrite(*font);
font++;
}
}
AUTO_WRITE_OFF();
return;
}
/****************************************
** 函數名稱: putpixel
** 功能描述: 點亮一點
** 輸 入 : x:x坐標
** y:y坐標
** 輸 出 : 無
** 全局變量:無
** 調用模塊: Set_Address_Pointer
**
** 作 者:
** 日 期: 2006-1-10
******************************************/
/*
void Put_Pixel(unsigned char x,unsigned char y)
{
unsigned int temp;
unsigned char address_high,address_low;
temp=y*GRAPHIC_AREA+(x>>3);
address_high=temp>>8;
address_low=temp%256;
Set_Address_Pointer(address_low,GRAPHIC_HOME_ADDRESS_HIGH+address_high);
Command(0xf8|(7-x%8));
return;
}
*/
/****************************************
** 函數名稱: Initial_Lcd
** 功能描述: 開光標顯示
** 輸 入 : 無
** 輸 出 : 無
** 全局變量:無
** 調用模塊: Set_Text_Address,Set_Graphic_Address,Command,Set_Address_Pointer
**
** 作 者:
** 日 期: 2006-1-17
******************************************/
void Initial_Lcd(void)
{
unsigned int i;
Set_Text_Address(TEXT_HOME_ADDRESS_LOW,TEXT_HOME_ADDRESS_HIGH,TEXT_AREA); //Text home address and text area
Set_Graphic_Address(GRAPHIC_HOME_ADDRESS_LOW,GRAPHIC_HOME_ADDRESS_HIGH,GRAPHIC_AREA); //Graphic home address and text area
Command(mode_set); // Or mode ,Internal CGRAM mode
Command(display_mode) ; // Text off,Graphic off,Cursor off,Blink off
Set_Address_Pointer(0x00,0x00);
AUTO_WRITE_ON();
for(i=0;i<10000;i++) Autowrite(0x0);
AUTO_WRITE_OFF();
TEXT_ON();
GRAPHIC_ON();
return;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -