PIC16F877A驱动12864液晶
for(j=32;j<64;j++)
{
send_cmd(0x80+j-32) ;
send_cmd(0x88) ;
for(i=0;i<8;i++)
{
send_byte(0x00) ;
send_byte(0x00) ;
}
}
send_cmd(0x36) ;
send_cmd(0x30);
send_cmd(0x0c) ;//close blind cursor
}
void str_disp(const char *data,uchar X,uchar Y)
{
X=X&0x07 ;//dont outweigh the numbers of one line
Y=Y&0x03 ;
switch(Y)
{
case 0:
Y=0x80 ;
break ;
case 1 :
Y=0x90 ;
break ;
case 2 :
Y=0x88 ;
break ;
case 3 :
Y=0x98 ;
break ;
defualt :
break ;
}
send_cmd(Y+X) ;
while(*data!=/0)
{
send_byte(*data++) ;
}
}
void chn_disp(const char *data,uchar X,uchar Y,uchar count)
{
uchar i ;
switch(Y)
{
case 0:
Y=0x80 ;
break ;
case 1 :
Y=0x90 ;
break ;
case 2 :
Y=0x88 ;
break ;
case 3 :
Y=0x98 ;
break ;
defualt :
break ;
}
send_cmd(Y+X) ;
for(i=0;i
}
void locate_xy(uchar X,uchar Y)
{
X=X&0x07 ;
Y=Y&0x03 ;
switch(Y)
{
case 0:
Y=0x80 ;
break ;
case 1 :
Y=0x90 ;
break ;
case 2 :
Y=0x88 ;
break ;
case 3 :
Y=0x98 ;
break ;
defualt :
break ;
}
send_cmd(Y+X) ;
}
void con_disp(uchar x0,uchar y0,uchar x1,uchar y1)
{
;
}
void lcd_rol()
{
uchar i;
send_cmd(0x03) ;
for(i=0;i<64;i++)
{
send_cmd(0xC0+i) ;
DelayMs(200) ;
}
}
void clr_ram()
{
send_cmd(0x01) ;
}
下面是测试程序
#include
#include
#include "main.h"
#include "t232.h"
#include "lcd12864.h"
t232_frame tframe ;
void interrupt main_int()
{
t232_int(&tframe) ;
}
void init_all()
{
asm("clrwdt");
init_232() ;
init_lcd() ;
init_t232_frame(&tframe) ;
}
const uchar tab5[]={
0X00,0X03,0X80,0X00,0X00,0X0F,0XE0,0X00,0X00,0X3F,0XF8,0X00,0X60,0XFF,0XFE,0X00,
0X40,0XFF,0XF8,0X00,0X40,0XCF,0XE0,0X00,0X47,0XFF,0XBC,0X3E,0X44,0X01,0X60,0X60,
0X44,0X00,0X00,0X40,0X44,0X44,0X20,0X44,0X44,0X44,0X60,0X44,0X44,0X44,0X40,0X44,
0X44,0X44,0X04,0X04,0X00,0X40,0X00,0X40,0X06,0X62,0X00,0X70,0X3F,0XFB,0X1F,0XCC,
0XFF,0XFF,0X7F,0XE0,0XFF,0XF8,0X1F,0XF0,0XFF,0XE0,0X7F,0XF0,0XFF,0X80,0XFF,0XC0,
0XCF,0X00,0XCE,0X00,0XC3,0X00,0XC7,0X00,0XF0,0X00,0XC3,0X00,0XFC,0X00,0XC0,0X00,
0XCC,0X00,0XE0,0X00,0XC0,0X00,0X73,0X00,0XC0,0X01,0XFF,0X00,0XC0,0X07,0XFE,0X03,
0XF0,0X1F,0XF8,0X0F,0XFC,0X7F,0XFE,0X3F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
};
void main()
{
const uchar data0[]="山东轻工业学院" ;
const uchar data1[]="欢迎你!" ;
const uchar *data2="Waiting...." ;
const uchar *temp ;
uchar i ,j;
init_all() ;
//str_disp("Waiting.......",0,2) ;
for(j=0;j<2;j++)
{
i=1 ;
send_cmd(0x8A) ;
temp=data2 ;
while(*temp!=/0)
{
send_byte(*temp++) ;
DelayMs(50) ;
}
DelayMs(500) ;
DelayMs(500) ;
clr_ram() ;
DelayMs(10) ;
}
clr_ram() ;
DelayMs(100) ;
chn_disp("山东轻工业学院",0,0,7) ;
chn_disp(data1,2,1,4) ;
//chn_disp("下一步",5,3,3) ;
str_disp("NEXT",5,3) ;
while(1)
{
locate_xy(5,3) ;
send_cmd(0x0E) ;
DelayUs(50) ;
locate_xy(6,3) ;
send_cmd(0x0E) ;
DelayUs(50) ;
}
while(1)
{
;
}
}
PIC16F877A驱动12864液 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)