切换到宽版
爱科技/爱创意/爱折腾;电子/数码爱好者的家!欢迎访问新版数码之家网站
  • 5136阅读
  • 10回复

[C51]点亮了用电查询终端带的US1601S芯片驱动的HYG1286494G-bT62L-VD屏,期待高手改进完善 [复制链接]

上一主题 下一主题
离线桃源客
 

发帖
3459
M币
1312
专家
18
粉丝
229
只看楼主 倒序阅读 我要置顶 楼主  发表于: 2015-08-06
前几天逛下交易区,看到有便宜的LJ货:http://bbs.mydigit.cn/read.php?tid=1307205 忍不住入了两个用电查询终端,但是STM32不会用,只会用点C51,发疯地在网上找个屏的驱动,花了点费用,下载了一个并口的,修修改改成串口的终于可以点亮了,但是只能点亮上半屏,下半屏可有是串并口用的驱动控制命令不一样,可以没有办法点下半屏,发出来期待坛子里的高手完善,或看到坛友辛苦份上,直接上一个能用的C51驱动,最好是能在用电查询终端这直接折腾个万年历什么的,开放源代码或BIN文件给下载!让入了这个的坛友玩得开心,物有所用,不成垃圾!
   期待高手出现。


#include <reg52.h>
#include <math.h>
#define uchar unsigned char
#define uint  unsigned int
/* Define the register command code */
#define Disp_On  0xaf // Display Enable
#define Disp_Off 0xae // Display Disable
#define Page_Add 0xb0 // Page Address Start
#define Row_Add  0x40   // Scroll Line Start
sbit CS0 = P2^7;
sbit RST = P2^6;
sbit CD  = P2^5;
sbit SCK = P2^4;
sbit SDA = P2^3;
sbit KEY = P3^5;

uchar row,col;   // 全局变量
void Putstr(uchar *str,uchar i,uchar col,uchar row);
void Putedot(uchar Order);
void disp8(uchar pag,uchar col, uchar code *k);
void disp9(uchar pag,uchar col, uchar code *hzk);
void dispfull(uchar *p);
uchar code eight[];
uchar code nine[], nine1[];
uchar code Ezk[];
uchar code number[][16]={
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,//"0",0
0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//"1",1
0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,//"2",2
0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00,//"3",3
0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00,//"4",4
0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00,//"5",5
0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00,//"6",6
0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,//"7",7
0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00,//"8",8
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00,//"9",9
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,//"0",10
};
uchar code nine1[]={
0x80,0x80,0x40,0x20,0x10,0x0C,0x03,0x00,0x03,0x0C,0x10,0x20,0x40,0x80,0x80,0x00,
};//"天",0

/*------------------延时子程序1----------------------------*/
void delay(uint i)
{
while (i--);
}
/*------------------延时子程序2----------------------------*/
void delay1s(uint t)
{
uint i,j;
for (i=0;i<t;i++)
  for (j=0;j<10000;j++)
   ;
}
/*------------------写命令到LCD-----------------------------*/
void write_com(uchar cmdcode)
{
int i;
CS0=0;
CD=0;
for (i=0;i<8;i++)
{
  SCK=0;
  if (cmdcode&0x80)
   SDA=1;
  else
   SDA=0;
  cmdcode=cmdcode<<1;
  SCK=1;
}
CS0=1;
}
/*-------------------写数据到LCD----------------------------*/
void write_data(uchar Dispdata)
{
int i;
CS0=0;
CD=1;
for (i=0;i<8;i++)
{
  SCK=0;
  if (Dispdata&0x80)
   SDA=1;
  else
   SDA=0;
  Dispdata=Dispdata<<1;
  SCK=1;
}
CS0=1;
}
/*-------------------清屏-----------------------------------*/
void Clr_Scr()
{
uchar j,k;
for (k=0;k<4;k++)
{
  write_com(Page_Add+k);
  write_com(0x10);
  write_com(0x00);
  for (j=0;j<132;j++)
   write_data(0x00);
}
}
/*------------------显示测试----------------------------------*/
void Disptest(uchar data1,data2)
{
uchar i,j;
for (j=0;j<4;j++)
{
  write_com(Page_Add+j);
  write_com(0x10);
  write_com(0x00);
  for (i=0;i<66;i++)
  {
   write_data(data1);
   write_data(data2);
  }
}
}
/*------------------初始化LCD屏-----------------------------*/
void Init_lcd()
{  /*  
delay(200);
RST=0;
delay(2000);
RST=1;
delay(2000);
write_com(0xE2);//system reset
delay(200);
write_com(0x23);//set duty 1/65
write_com(0x24);//set t.c
write_com(0x2f);//set pump    2f/internal vlcd    29/external vlcd
write_com(0x81);//set vop
write_com(130);
write_com(0x8d);//set ram address control
write_com(0xeb);//set bias=1/9
write_com(0xc0);
write_com(0xAF);//set display enable
   */
delay(6000);
RST=0;
delay(6000);
RST=1;
delay(6000);
write_com(0xe2);   // Set System Reset
delay(6000);
write_com(0x2f);   // Set Power Control  loading 15-24nF
  write_com(0x24);   // Set T.C
  write_com(0x23);//set duty 1/65
//write_com(0xa7);   // Set Inverse Display 设置反显
write_com(0xc4);   // Set Mapping Control
write_com(0xa0);   // Set Frame Rate
write_com(0x89);   // Set RAM Address Control
write_com(0xe8);     // Set Bias Ratio : 1/6
write_com(0x81);
write_com(0xe8);   // Set Vbias : 7.99V设置偏压
write_com(0xf1);  
write_com(0x3f);   // Set COM End (63)
write_com(0xf2);
write_com(0x20);   // Set Partial Display Start (0)
write_com(0xf3);
write_com(0x3f);   // Set Partial Display End (63)
write_com(0x85);   // Set Partial Display Control
write_com(Disp_On);      // Set Display Enable        
}
void waitkey(void)
{delay(400);
while(KEY)
delay(3000);
}
void main()
{
uchar i,A=1;
uchar code str[ ]="12345678901234567890"; // 定义任意字符串数组
Clr_Scr();
   Init_lcd();
while (1)
{
Init_lcd();
    disp8(0,0,eight);   // 指定位置显示8*8点阵字符
    disp8(0,8,eight);   // 指定位置显示8*8点阵字符
    disp8(0,16,eight);   // 指定位置显示8*8点阵字符
    disp8(0,24,eight);   // 指定位置显示8*8点阵字符
    disp8(0,32,eight);   // 指定位置显示8*8点阵字符
    disp8(0,40,eight);   // 指定位置显示8*8点阵字符
    disp8(0,48,eight);   // 指定位置显示8*8点阵字符
    disp8(0,56,eight);   // 指定位置显示8*8点阵字符

  disp9(0,64,number[1]);  // 指定位置显示8*16点阵字符
  disp9(0,72,number[0]);  // 指定位置显示8*16点阵字符
// disp9(0,72,nine+16);  // 指定位置显示8*16点阵字符
  Putstr(str,16,2,0);  // 从ACSII表中读字符,指定位置显示8*16点阵字符串
  waitkey() ;
  Disptest(0x55,0x55);
        waitkey() ;
   Disptest(0xaa,0xaa);
        waitkey() ;
  Disptest(0x55,0xaa);
        waitkey() ;
  Disptest(0xaa,0x55);
        waitkey() ;
  Disptest(0xff,0x00);
        waitkey() ;
  Disptest(0x00,0xff);
        waitkey() ;
  Disptest(0xff,0xff);
        waitkey() ;
  Disptest(0x00,0x00);
        waitkey() ;
  dispfull(eight);   // 全屏显示8*8点阵字符
        waitkey() ;
  for(i=32;i<=63;i++)
  {
   dispfull(eight);  
   write_com(0x40+i);   // Set Scroll Line
  }
  for(i=63;i>=32;i--)
  {
   dispfull(eight);  
   write_com(0x40+i);   // Set Scroll Line
  }
          waitkey() ;
}
}
/*-------------半角字符8×8点阵码----------------*/
void disp8(uchar pag,uchar col, uchar code *k)
{
uchar j=0,i=0;
uchar lie;
lie=col&0xf0;
lie>>=4;
write_com(Page_Add+pag);
write_com(0x10+lie);
write_com(0x00+col&0x0f);
for (i=0;i<8;i++)
{
  write_data(k);
}
}
/*-------------半角字符8×16点阵码(汉字)----------------*/
void disp9(uchar pag,uchar col, uchar code *hzk)
{
uchar j=0,i=0;
uchar lie;
for (j=0;j<2;j++)    // 整个字符分上下半部分字符
{
  lie=col&0xf0;
  lie>>=4;
  write_com(Page_Add+pag+j);
  write_com(0x10+lie);
  write_com(0x00+col&0x0f);
  for (i=0;i<8;i++)
  {
   write_data(hzk[8*j+i]);
  }
}
}
void dispfull(uchar *p)
{
uint i,j,k;
uchar *q;
for (i=0;i<8;i++)
{
  write_com(i+0xb0);   //SET PAGE ADDRESS
  write_com(0x10);   //SET Column Address MSB
  write_com(0x00);   //SET Column Address LSB
  for (j=0;j<16;j++)
  {
   q=p;
   for (k=0;k<8;k++)
    write_data(*q++);
  }
}
}
/*----------------------一个字符串的输出------------------*/
void Putstr(uchar *str,uchar i,uchar page,uchar lie)
{
uchar j,X;
for (j=0;j<i;j++)
{
  col = lie+8*j;    // 换列
  row = page;
  X = str[j];
  Putedot(X-0x20);   // ascii码表从0x20开始
}
}
/*-------------半角字符8×16点阵码数据输出----------------*/
void Putedot(uchar Order)
{
uchar j=0,i=0;
uchar lie,cbyte;
int x;
x = Order * 0x10;       // 如字符!,在Ezk[]中的位置为1,对应Order=1,但其第1个点阵字节在Ezk[16]中,将Order乘以0x10的值x作为该字符在Ezk[]中的第一个点阵码的下标
for (j=0;j<2;j++)    // 整个字符分上下半部分字符
{
  lie=col&0xf0;
  lie>>=4;
  write_com(Page_Add+row+j);
  write_com(0x10+lie);
  write_com(0x00+col&0x0f);
  for (i=0;i<8;i++)
  {
   cbyte = Ezk[x];
   write_data(cbyte);  // 输出一字节
   x++;
  }
}
}
uchar code eight[]={0x00,0x00,0x00,0x36,0x49,0x49,0x49,0x36};
//uchar code nine[]={0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00};
//汉字符取码方式:阴码,列行,逆向。
uchar code Ezk[]={
/*-文字:(space)--0x20*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*-文字:!--0x21*/
0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x27,0x00,0x00,0x00,0x00,
/*-文字:"--0x22*/
0x00,0x08,0x04,0x02,0x08,0x04,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*-文字:#--0x23*/
0x40,0x40,0xF8,0x40,0x40,0xF8,0x40,0x00,0x04,0x3F,0x04,0x04,0x3F,0x04,0x04,0x00,
/*-文字:$--0x24*/
0x00,0x70,0x88,0xFC,0x08,0x08,0x30,0x00,0x00,0x1C,0x20,0xFF,0x21,0x22,0x1C,0x00,
/*-文字:%--0x25*/
0xF0,0x08,0xF0,0x80,0x70,0x08,0x00,0x00,0x00,0x31,0x0E,0x01,0x1E,0x21,0x1E,0x00,
/*-文字:&--0x26*/
0x00,0xF0,0x08,0x88,0x70,0x00,0x00,0x00,0x1E,0x21,0x23,0x24,0x18,0x16,0x20,0x00,
/*-文字:'--0x27*/
0x20,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*-文字:(--0x28*/
0x00,0x00,0x00,0x00,0xC0,0x30,0x08,0x04,0x00,0x00,0x00,0x00,0x03,0x0C,0x10,0x20,
/*-文字:)--0x29*/
0x04,0x08,0x30,0xC0,0x00,0x00,0x00,0x00,0x20,0x10,0x0C,0x03,0x00,0x00,0x00,0x00,
/*-文字:*--0x2a*/
0x40,0x40,0x80,0xF0,0x80,0x40,0x40,0x00,0x02,0x02,0x01,0x0F,0x01,0x02,0x02,0x00,
/*-文字:+--0x2b*/
0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x0F,0x01,0x01,0x01,0x00,
/*-文字:,--0x2c*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x00,0x00,0x00,0x00,0x00,0x00,
/*-文字:---0x2d*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,
/*-文字:.--0x2e*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,
/*-文字:/--ox2f*/
0x00,0x00,0x00,0x00,0x00,0xE0,0x18,0x04,0x00,0x40,0x30,0x0C,0x03,0x00,0x00,0x00,
/*-文字:0--0x30*/
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,
/*-文字:1--0x31*/
0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,
/*-文字:2--0x32*/
0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,
/*-文字:3--0x33*/
0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00,
/*-文字:4--0x34*/
0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00,
/*-文字:5--0x35*/
0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00,
/*-文字:6--0x36*/
0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00,
/*-文字:7--0x37*/
0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,
/*-文字:8--0x38*/
0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00,
/*-文字:9--0x39*/
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00,
/*-文字::--*/
0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,
/*-文字:/--*/
0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x00,0x00,0x00,0x00,
/*-文字:<--*/
0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00,
/*-文字:=--*/
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00,
/*-文字:>--*/
0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x01,0x00,
/*-文字:?--*/
0x00,0x30,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x00,0x00,0x26,0x01,0x00,0x00,0x00,
/*-文字:@--*/
0xC0,0x30,0xC8,0x28,0xE8,0x10,0xE0,0x00,0x07,0x18,0x27,0x28,0x27,0x28,0x07,0x00,
/*-文字:A--*/
0x00,0x00,0xE0,0x18,0x18,0xE0,0x00,0x00,0x30,0x0F,0x04,0x04,0x04,0x04,0x0F,0x30,
/*-文字:B--*/
0xF8,0x08,0x08,0x08,0x08,0x90,0x60,0x00,0x3F,0x21,0x21,0x21,0x21,0x12,0x0C,0x00,
/*-文字:C--*/
0xE0,0x10,0x08,0x08,0x08,0x10,0x60,0x00,0x0F,0x10,0x20,0x20,0x20,0x10,0x0C,0x00,
/*-文字:D--*/
0xF8,0x08,0x08,0x08,0x08,0x10,0xE0,0x00,0x3F,0x20,0x20,0x20,0x20,0x10,0x0F,0x00,
/*-文字:E--*/
0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0x00,0x00,0x3F,0x21,0x21,0x21,0x21,0x20,0x00,
/*-文字:F-- */
0xF8,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x3F,0x01,0x01,0x01,0x01,0x01,0x00,0x00,
/*-文字:G--*/
0xE0,0x10,0x08,0x08,0x08,0x10,0x60,0x00,0x0F,0x10,0x20,0x20,0x21,0x11,0x3F,0x00,
/*-文字:H--*/
0x00,0xF8,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x3F,0x01,0x01,0x01,0x01,0x3F,0x00,
/*-文字:I--*/
0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,
/*-文字:J--*/
0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x1C,0x20,0x20,0x20,0x20,0x1F,0x00,
/*-文字:K--*/
0x00,0xF8,0x00,0x80,0x40,0x20,0x10,0x08,0x00,0x3F,0x01,0x00,0x03,0x04,0x18,0x20,
/*-文字:L--*/
0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x20,0x20,0x20,0x20,0x20,0x20,0x00,
/*-文字:M--*/
0xF8,0xE0,0x00,0x00,0x00,0xE0,0xF8,0x00,0x3F,0x00,0x0F,0x30,0x0F,0x00,0x3F,0x00,
/*-文字:N--*/
0x00,0xF8,0x30,0xC0,0x00,0x00,0xF8,0x00,0x00,0x3F,0x00,0x01,0x06,0x18,0x3F,0x00,
/*-文字:O--*/
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,
/*-文字:P-- */
0xF8,0x08,0x08,0x08,0x08,0x10,0xE0,0x00,0x3F,0x02,0x02,0x02,0x02,0x01,0x00,0x00,
/*-文字:Q--*/
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x2C,0x10,0x2F,0x00,
/*-文字:R--*/
0xF8,0x08,0x08,0x08,0x08,0x90,0x60,0x00,0x3F,0x01,0x01,0x01,0x07,0x18,0x20,0x00,
/*-文字:S--*/
0x60,0x90,0x88,0x08,0x08,0x10,0x20,0x00,0x0C,0x10,0x20,0x21,0x21,0x12,0x0C,0x00,
/*-文字:T--*/
0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,
/*-文字:U--*/
0xF8,0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0x0F,0x10,0x20,0x20,0x20,0x10,0x0F,0x00,
/*-文字:V--*/
0x18,0xE0,0x00,0x00,0x00,0xE0,0x18,0x00,0x00,0x01,0x0E,0x30,0x0E,0x01,0x00,0x00,
/*-文字:W--*/
0xF8,0x00,0xC0,0x38,0xC0,0x00,0xF8,0x00,0x03,0x3C,0x03,0x00,0x03,0x3C,0x03,0x00,
/*-文字:X--*/
0x08,0x30,0xC0,0x00,0xC0,0x30,0x08,0x00,0x20,0x18,0x06,0x01,0x06,0x18,0x20,0x00,
/*-文字:Y--*/
0x08,0x30,0xC0,0x00,0xC0,0x30,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,
/*-文字:Z--*/
0x08,0x08,0x08,0x08,0xC8,0x28,0x18,0x00,0x30,0x2C,0x22,0x21,0x20,0x20,0x20,0x00,
/*-文字:{--*/
0x00,0x00,0x00,0x80,0x7E,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x20,0x00,0x00,
/*-文字:\--*/
0x00,0x08,0x70,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x0E,0x30,0xC0,0x00,
/*-文字:}--*/
0x00,0x02,0x7E,0x80,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x00,0x00,0x00,0x00,0x00,
/*-文字:^--*/
0x00,0x08,0x04,0x02,0x02,0x04,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*-文字:_--*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
/*-文字:`--*/
0x00,0x00,0x02,0x06,0x04,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*-文字:a--*/
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x19,0x24,0x24,0x24,0x14,0x3F,0x00,
/*-文字:b--*/
0x00,0xF8,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x3F,0x11,0x20,0x20,0x20,0x1F,0x00,
/*-文字:c--*/
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x0E,0x11,0x20,0x20,0x20,0x20,0x11,0x00,
/*-文字:d--*/
0x00,0x00,0x80,0x80,0x80,0x00,0xF8,0x00,0x00,0x1F,0x20,0x20,0x20,0x11,0x3F,0x00,
/*-文字:e--*/
0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x0E,0x15,0x24,0x24,0x24,0x25,0x16,0x00,
/*-文字:f--*/
0x00,0x80,0x80,0xF0,0x88,0x88,0x88,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,
/*-文字:g--*/
0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x40,0xB7,0xA8,0xA8,0xA8,0xA7,0x40,0x00,
/*-文字:h--*/
0x00,0xF8,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x3F,0x01,0x00,0x00,0x00,0x3F,0x00,
/*-文字:i--*/
0x00,0x00,0x00,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,
/*-文字:j--*/
0x00,0x00,0x00,0x00,0x98,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x7F,0x00,0x00,0x00,
/*-文字:k--*/
0x00,0xF8,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x3F,0x04,0x02,0x0D,0x10,0x20,0x00,
/*-文字:l--*/
0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,
/*-文字:m--*/
0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x3F,0x00,0x00,0x3F,0x00,0x00,0x3F,0x00,
/*-文字:n--*/
0x00,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x3F,0x01,0x00,0x00,0x00,0x3F,0x00,
/*-文字:o--*/
0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x0E,0x00,
/*-文字:p--*/
0x00,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0xFF,0x11,0x20,0x20,0x20,0x1F,0x00,
/*-文字:q--*/
0x00,0x00,0x80,0x80,0x80,0x00,0x80,0x00,0x00,0x1F,0x20,0x20,0x20,0x11,0xFF,0x00,
/*-文字:r--*/
0x00,0x00,0x80,0x00,0x00,0x80,0x80,0x00,0x00,0x00,0x3F,0x01,0x01,0x00,0x00,0x00,
/*-文字:s--*/
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x13,0x24,0x24,0x24,0x24,0x19,0x00,
/*-文字:t--*/
0x00,0x80,0x80,0xE0,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x1F,0x20,0x20,0x20,0x00,
/*-文字:u--*/
0x00,0x80,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x00,
/*-文字:v--*/
0x80,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x07,0x18,0x20,0x18,0x07,0x00,0x00,
/*-文字:w--*/
0x80,0x00,0x00,0x80,0x00,0x00,0x80,0x00,0x0F,0x30,0x0E,0x01,0x0E,0x30,0x0F,0x00,
/*-文字:x--*/
0x80,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x20,0x11,0x0A,0x04,0x0A,0x11,0x20,0x00,
/*-文字:y--*/
0x80,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x87,0x98,0x60,0x18,0x07,0x00,0x00,
/*-文字:z--*/
0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x20,0x00,
/*-文字:{--*/
0x00,0x00,0x00,0x80,0x7E,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x20,0x00,0x00,
/*-文字:|--*/
0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,
/*-文字:}--*/
0x00,0x02,0x7E,0x80,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x00,0x00,0x00,0x00,0x00,
/*-文字:~--*/
0x00,0x06,0x01,0x01,0x06,0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};





本文内容包含图片或附件,获取更多资讯,请 登录 后查看;或者 注册 成为会员获得更多权限
本帖最近打赏记录:共6条打赏M币+82专家+1
M币换购:工善必利器,您的拆机好伴侣~数码之家X22精密型螺丝刀套装(拆客必备系列)
 
离线a2633063

发帖
613
M币
2648
专家
14
粉丝
33060
只看该作者 1楼 发表于: 2015-08-06
Re:点亮了用电终端带的US1601S芯片驱动的HYG1286494G-bT62L-VD屏,期待高手改进完 ..
51都搞定了  stm32就搞定不了了??
就照着51的代码改啊
离线txf1984
发帖
22
M币
49
专家
2
粉丝
2
只看该作者 2楼 发表于: 2015-08-06
Re:点亮了用电终端带的US1601S芯片驱动的HYG1286494G-bT62L-VD屏,期待高手改进完 ..
应该其他的都没问题.    

就是LCD初始化代码的问题.

    wr_cmd(0xAE); // Display OFF
    wr_cmd(0xA0); // Set The DDRAM Address SEG output Correspondence (ADC=0)SEG1--SEG128
    wr_cmd(0xC4); // Set LCD Mapping Control
    wr_cmd(0x88); // Set RAM Address Control
    wr_cmd(0xA6); // Set The LCD Display(Normal)
    wr_cmd(0xA4); // Sets Display all points 0: normal display
    wr_cmd(0xA1); // Set Frame Rate 1=100fps
    wr_cmd(0x2F); // Set Power Control : Internal VLCD
    wr_cmd(0x26); // Set Temperature Compensation : 10b=-0.15%, 00b=0%
    wr_cmd(0x81); // Set VBIAS Potentiometer
    wr_cmd(0xC0);
    
    wr_cmd(Scroll_Line);
    wr_cmd(0xAF); // Display ON

我用的厂家手册上的  初始化代码.


====================
还有你下面这2个函数,   怎么都只用了4个PAGE, 下面当然不显示
/*-------------------清屏-----------------------------------*/
void Clr_Scr()
{
uchar j,k;
for (k=0;k<4;k++)
{
  write_com(Page_Add+k);
  write_com(0x10);
  write_com(0x00);
  for (j=0;j<132;j++)
   write_data(0x00);
}
}
/*------------------显示测试----------------------------------*/
void Disptest(uchar data1,data2)
{
uchar i,j;
for (j=0;j<4;j++)
{
  write_com(Page_Add+j);
  write_com(0x10);
  write_com(0x00);
  for (i=0;i<66;i++)
  {
   write_data(data1);
   write_data(data2);
  }
}
}
本帖最近打赏记录:共4条打赏M币+19专家+1
离线桃源客

发帖
3459
M币
1312
专家
18
粉丝
229
只看该作者 3楼 发表于: 2015-08-06
经过楼上楼下高人的指点,终于搞定了全屏显示英文字符数字的驱动,中文和图型有待进一步研究。
之所以只显示上半屏,是因为我下载原来的驱动是12832的,初始化成12832,现用楼下的初始化函数,终于可以全屏显示了。有这个屏的坛友,请帮下忙,一起把中文显示出来!
[ 此帖被桃源客在2015-08-06 21:59重新编辑 ]
本文内容包含图片或附件,获取更多资讯,请 登录 后查看;或者 注册 成为会员获得更多权限
离线txf1984
发帖
22
M币
49
专家
2
粉丝
2
只看该作者 4楼 发表于: 2015-08-06
Re:点亮了用电终端带的US1601S芯片驱动的HYG1286494G-bT62L-VD屏,期待高手改进完 ..
12864  都是8个页面的 8*8=64

没有中文的PDF.

我的程序还没完善,  只测试的上面的3个图片.

过几天完善下  再发吧.
下面是厂家的手册,  (淘宝店家挺搞笑的, 12864的资料上的厂家名称还去掉了)

本文内容包含图片或附件,获取更多资讯,请 登录 后查看;或者 注册 成为会员获得更多权限
本帖最近打赏记录:共2条打赏M币+58
离线ccma1000

发帖
283
M币
3198
专家
3
粉丝
20
只看该作者 5楼 发表于: 2015-08-06
Re:点亮了用电终端带的US1601S芯片驱动的HYG1286494G-bT62L-VD屏,期待高手改进完 ..
厂商的代码Initialization Code
//Send 8-bit data to UC1601s
#pragma disable
void SendBit(uchar uc_dat)
{
uchar uc_BitCnt;
LCD_SCK = 1;
for(uc_BitCnt=0;uc_BitCnt<8;uc_BitCnt++)
{
if ( uc_dat & 0x80 )
LCD_SDA = 1;
else
LCD_SDA = 0;
LCD_SCK = 0;
LCD_SCK = 1;
uc_dat =uc_dat <<1;
}
}
//Write Diaply data
#pragma disable
void wr_dat(uchar uc_dat)
{
LCD_CS = 0;
LCD_CD = 1;
SendBit(uc_dat);
LCD_CS = 1;
}
//Write Instruction Data
#pragma disable
void wr_cmd(uchar uc_cmd)
{
LCD_CS = 0;
LCD_CD = 0;
SendBit(uc_cmd);
LCD_CS = 1;
#pragma disable
void Initial()
{
wr_cmd(0xE2); // Internal Reset
delay(250);

wr_cmd(0xAE); // Display OFF

wr_cmd(0xA0); // Set The DDRAM Address SEG output Correspondence (ADC=0)SEG1--SEG128

wr_cmd(0xC4); // Set LCD Mapping Control
wr_cmd(0x88); // Set RAM Address Control

wr_cmd(0xA6); // Set The LCD Display(Normal)
wr_cmd(0xA4); // Sets Display all points 0: normal display
wr_cmd(0xA1); // Set Frame Rate 1=100fps

wr_cmd(0x2F); // Set Power Control : Internal VLCD
wr_cmd(0x26); // Set Temperature Compensation : 10b=-0.15%, 00b=0%
wr_cmd(0x81); // Set VBIAS Potentiometer
wr_cmd(0xC0);

wr_cmd(0xAF); // Display ON
}

本帖最近打赏记录:共1条打赏专家+1
离线ccma1000

发帖
283
M币
3198
专家
3
粉丝
20
只看该作者 6楼 发表于: 2015-08-06
Re:点亮了用电终端带的US1601S芯片驱动的HYG1286494G-bT62L-VD屏,期待高手改进完 ..
运行以下函数一次,就能看到8page的显示
void Test_Scr()
{
uchar j,k;
for (k=0;k<8;k++)
{
  write_com(Page_Add+k);
  write_com(0x14);
  write_com(0x00);
  //for (j=0;j<132;j++)
   write_data(0xff);
}
}
本帖最近打赏记录:共2条打赏M币+8
离线benli

发帖
33704
M币
6633
专家
91
粉丝
484
只看该作者 7楼 发表于: 2015-08-06
Re:点亮了用电终端带的US1601S芯片驱动的HYG1286494G-bT62L-VD屏,期待高手改进完 ..
厉害,不喜欢蓝底白字,始终要背光,太耗电
离线benli

发帖
33704
M币
6633
专家
91
粉丝
484
只看该作者 8楼 发表于: 2015-08-06
回 桃源客 的帖子
桃源客:总共有几个PAGE啊,你手上有完整的厂家驱动代码吗?能放出来吗? (2015-08-06 09:53) 回 桃源客 的帖子

12864应当是8页啊!除非是上下分开控制的
离线桃源客

发帖
3459
M币
1312
专家
18
粉丝
229
只看该作者 9楼 发表于: 2015-08-06
多谢分享,用了这个初始化后,终于可以显示12864了,这个屏我折腾了3天了。
又花了几个小时,终于可以显示中文了!哈哈,有点点成就感!
  10楼有完整的中文驱动程序。

[ 此帖被桃源客在2015-08-06 23:55重新编辑 ]
本文内容包含图片或附件,获取更多资讯,请 登录 后查看;或者 注册 成为会员获得更多权限
快速回复
限80 字节
温馨提示:所有技术区严禁灌水,“沙发”“顶”字样;禁止广告贴;以免被删除
 
上一个 下一个