资源简介
SBN0064详细的驱动代码,里面有详细的指令介绍和函数,适用于TG19264和
TG12864点阵的单色屏
代码片段和文件信息
//Project: SBN0064 Dome
//MCU: 8051
//Control IC : SBN0064
//Crystal: 6MHz
//Compose LiQi
//Time:2010-05-31
#include
/***************Delay****************
Function: Delay
Parameter:Time
***********************************/
void Delay(uint Time)
{
uint ab;
for(b=Time;b>0;b--)
for(a=0xff;a>0;a--);
}
void Read_Staus()
{
do
{
Bus = 0xff;
RS = 0;
R_W = 1;
E = 1;
Nop;Nop;Nop;Nop;
E = 0;
}while(Bus&0x90);
}
void Write_Command(uchar Command)
{
Read_Staus();
Bus = Command;
RS = 0;
R_W = 0;
E = 1;
Nop;Nop;Nop;Nop;
E = 0;
}
void Write_Data(uchar Content)
{
Read_Staus();
Bus = Content;
RS = 1;
R_W = 0;
E = 1;
Nop;Nop;Nop;Nop;
E = 0;
}
void initial_lcm()
{
CS_All();
Write_Command(Display_OFF);
Write_Command(Strat_Line_Register);
Write_Command(Strat_Page_Address);
Write_Command(Strat_Column_Address);
Write_Command(Display_ON);
}
/*************Display Piece*********
Function: Write 1 Part random length Display Content to LCM
Parameter:X Y *P
*****************************/
void Display_Piece(uchar Xuchar Yuchar Lengthuchar Highuchar *P)
{
uchar Loop_XLoop_y;
CS_All();
Write_Command(Strat_Line_Register|(Y%8));//Set left start line
for(Loop_y=(Y/8);Loop_y<(High/8+Y/8+((High%8)>0));Loop_y++)
{
for(Loop_X=X;Loop_X<(X+Length);Loop_X++)
{
CS_All();
Write_Command(Strat_Page_Address|Loop_y);//set lift page address
if(Loop_X<64)
{
CS_Lift();
Write_Command(Loop_X+Strat_Column_Address);//set lift column address
Write_Data(*P++);//Disolay content to left
}
else if(Loop_X>=64&&Loop_X<128)
{
CS_Mid();
Write_Command(Loop_X-64+Strat_Column_Address);//set right column address
Write_Data(*P++);//Display content to right
}
else
{
CS_Right();
Write_Command(Loop_X-128+Strat_Column_Address);//set right column address
Write_Data(*P++);//Display content to right
}
}
}
}
/*************Display Character*********
Function: Write a character to LCM
Parameter:X Y typeface table[]
*****************************/
void Display_character (uchar Xuchar Yuchar Typefaceuchar table[])
{
switch(Typeface)
{
case _8x8: Display_Piece(XY88table);break;//display 8x8 typeface
case _8x16: Display_Piece(XY816table);break;//display 8x16 typeface
case _13x16: Display_Piece(XY1316 table);break;//display 13x16 typeface
case _16x16: Display_Piece(XY1616table);break;//display 16x16 typeface
case _16x32: Display_Piece(XY1632table);break;//display 16x32 typeface
case _23x32: Display_Piece(XY2332 table);break;//display 23x32 typeface
case _32x32: Display_Piece(XY3232table);break;//display 32x32 typeface
default: break;
}
}
/*************Displ
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
....... 18567 2010-06-01 16:02 SBN0064\Chinese.h
....... 18886 2010-06-03 09:42 SBN0064\SBN0064.h
....... 45447 2010-06-01 15:29 SBN0064\character.h
....... 6906 2010-08-02 09:37 SBN0064\SBN0064.c
目录 0 2010-08-02 09:34 SBN0064
----------- --------- ---------- ----- ----
89806 5
评论
共有 条评论