资源简介
中文字库液晶和图形点阵液晶的区别就在于:图形点阵液晶模块的特点是图片像或文字点阵像素连续排列,行和列在排布中均没有空隔。如果要显示一个汉字,需要传送一大批点阵数据;带中文字库的只要发个字库码就可以显示了,也就是想要显示一个汉字,只需要传关两个字节汉字内码,相较之下,速度就要快很多。
代码片段和文件信息
/*
File:ST7920.c
Autor:rgh111
E-mail:rgh111@163.com Provide 8x2 & 7.5x2 Chinese character LCD
moduleoperate either into serial mode or parallel mode.
Date:2003.12.23
Vesion:1.0
Function:
Write data or command into the ST7920 in serial mode.
ST7920 serial clock max frequency 2.5Mhz.
*/
/*
Include files.
*/
//#include
/*
I/O port.
*/
//sbit ST7920_Cs=P1.0;
//sbit ST7920_Clk=P1.1;
//sbit ST7920_Sda=P1.2;
//sbit ST7920_Rst=P1.3;
/*
Definition.
*/
//#ifndef *
//#define * ^
//#endif
//Command Deifne.
//#define C_Clear 0x01
//#define C_ResetAddress 0x02
//#define C_ResetAddress 0x03
//#define C_Location 0x0?
//#define C_DisplayOnOff 0x0?
//#define C_PromptMove 0x0?
//#define C_FunctionSet 0x0?
//#define C_SetCgramAddress 0x0?
//#define C_SetDdramAddress 0x?
//#define C_ReadStatus 0x?
//#define C_WriteDataToRam 0x?
//#define C_ReadDataFromRam 0x?
//#define C_Idle 0x01
//#define C_ReceiveRollAddress 0x0?
//#define C_NagetiveDisplay 0x0?
//#define C_SleepWakeUp 0x0?
//#define C_ExpandFunctionSet 0x0?
//#define C_SetIramAddress 0x0?
//#define C_SetGramAddress 0x0?
/*
void RestSt7920(void)
Function:
*/
void ResetSt7920(void)
{
ST7920_Rst=0;
Delay1ms(10);
ST7920_Rst=1;
Delay1ms(100);
}
/*
void WriteSt7920Instruction(unsigned char x)
Function:
*/
void WriteSt7920Instruction(unsigned char x)
{
unsigned char i=0;
ST7920_Cs=1;
ST7920_Sda=1;
for(i=0;i<5;i++)
{
ST7920_Clk=0;
ST7920_Clk=1;
}
ST7920_Clk=0;
ST7920_Sda=0;
for(i=0;i<3;i++)
{
ST7920_Clk=1;
ST7920_Clk=0;
}
for(i=0;i<4;i++)
{
x<<=1;
ST7920_Sda=CY;
ST7920_Clk=1;
ST7920_Clk=0;
}
ST7920_Sda=0;
for(i=0;i<4;i++)
{
ST7920_Clk=1;
ST7920_Clk=0;
}
for(i=0;i<4;i++)
{
x<<=1;
ST7920_Sda=CY;
ST7920_Clk=1;
ST7920_Clk=0;
}
ST7920_Sda=0;
for(i=0;i<4;i++)
{
ST7920_Clk=1;
ST7920_Clk=0;
}
ST7920_Cs=0;
Delay100us();
}
/*
void WriteSt7920Data(unsigned char x)
Function:
*/
void WriteSt7920Data(unsigned char x)
{
unsigned char i=0;
ST7920_Cs=1;
ST7920_Sda=1;
for(i=0;i<5;i++)
{
ST7920_Clk=0;
ST7920_Clk=1;
}
ST7920_Clk=0;
ST7920_Sda=0;
ST7920_Clk=1;
ST7920_Clk=0;
ST7920_Sda=1;
ST7920_Clk=1;
ST7920_Clk=0;
ST7920_Sda=0;
ST7920_Clk=1;
ST7920_Clk=0;
for(i=0;i<4;i++)
{
x<<=1;
ST7920_Sda=CY;
ST7920_Clk=1;
ST7920_Clk=0;
}
ST7920_Sda=0;
for(i=0;i<4;i++)
{
ST7920_Clk=0;
ST7920_Clk=1;
}
ST7920_Clk=0;
for(i=0;i<4;i++)
{
x<<=1;
ST7920_Sda=CY;
ST7920_Clk=1;
ST7920_Clk=0;
}
ST7920_Sda=0;
for(i=0;i<4;i++)
{
ST7920_Clk=1;
ST7920_Clk=0;
}
ST7920_Cs=0;
Delay100us();
}
/*
void ExpandFucntionEnable(void)
Function:
*/
void ExpandFunctionEnable(void)
{
WriteSt7920Instruction(0x24);
}
/*
void ExpandFunctionDisabl
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4849 2004-03-10 14:27 ST7920.c
评论
共有 条评论