企业档案

  • 会员类型:免费会员
  • 工商认证: 【未认证】
  • 最后认证时间:
  • 法人:
  • 注册号:
  • 企业类型:生产商
  • 注册资金:人民币万

联系我们

联系人:刘天伦

点击查看联系方式

技术文章

快速了解12864点阵液晶屏的使用方法(详细)

点击次数:327 发布时间:2020/9/23 8:51:15
 

快速了解12864点阵液晶屏的使用方法(详细)

T12864C002TRUSTYLCD.COM旗下目前使用率的一款COG结构的12864点阵液晶屏,其特点是质量可靠,功耗低,订货方便不停产,尺寸适中,可应用到多种行业设备上。现在就详细介绍这款产品的使用方法,让你能在*短的时间内搞定LCD液晶显屏能正常显示出文字和图片。(产品规格书及申请免费样品可联系18902455007微信同号)

点阵数量: 128(w)*64(h)

显示模式: FSTN正显(白底黑字), STN正显(黄绿底黑字),或STN负显(蓝底白字)。

背光模式: LED白色(或其他色),背光结构有支架背光或平面背光(配套铁框使用)。

控制芯片:ST7565R

通讯接口:FPC-36PIN焊接,可SPI串口或8位并口通讯。

工作电压:3.3V

工作温度: -20~70

外形尺寸: 69.0mm*46.0mm*2.8mm(不含背光时的尺寸)

视域尺寸: 65.5mm*38.0mm

单点大小: 0.45mm*0.49mm

 

 

Pin No.

Pin Name

Function

1224313436

NC

空脚

3

/CS1

Chip selection input                片选

4

/RES

Rester                          复位

5

A0

Data/Command control             选择指令或数据

6

/WR

Write (/WR ) control signal input.      

7

/RD

Read (/RD ) control signal input.      

8~15

DB0-DB7

8bit Date bus                      数据

16

VDD

Power supply voltage (Positive)      电源3~3.3V

17

VSS

Negative power supply,0V          

18

VOUT

positive voltage supply pin of the chip. 升压输出,对地接电容

19~23

C3+,C1-,C1+,C2+,C2-

When internal DC-DC voltage converter is used, external capacitor is connected between these pins.       升压电路接电容

25~29

V1,V2,V3,V4,V0

LCD driving voltages.                      分压电路

30

VR

Output voltage regulator terminal. 外部调对比度接电阻位

32

C86

MPU interface selection pin        选择80806800时序

33

P/S

Parallel data input/serial data input switch terminal 选择并口或串口

35

IRS

This terminal selects the resistors for the V0 voltage level adjustment. 选择内部调对比度或外部调比比度

 

接口定义说明:

了解了显示屏的基本参数及接口定义后,

首先设计硬件电路,这款LCD的硬件部份比较简单,按上图设计好PCB电路图,外围只需外加9颗无极性的1Uf/16V电容即可,这里注意一定要用无极性的,以免方向搞错造成损坏,耐压在16V以上(因为液晶内部升压后会到达13.5V左右,所以要耐压16V的才行),液晶屏的VDD供电电压是3.3V,在2.7V~3.3V之间的电压都可以(电压不同可能对比度需要软件调节一下),如果必需要用5V供电,那VDD可以接一个AMS1117-3.3降压三极管(5V降到3.3V),这仅仅是VDD降压到了3.3V,其他信号线还是5V也是不行的,这里有两种方法可以选用,*简单的是信号线上串一个1K的电阻,这样可以降低一点电压,不过这种信号线电流很小,串了电阻也就对IC起到了一定的保护作用,另一种就是用降压芯片降压到3.3V,这种成本较高一点,但是可靠性也更强。接下来就要确定好是选用8位并口通讯还是SPI串口通讯了,不管用哪一种接口,对于128*64点阵来讲,显示的速度要感受上不是很明显,除非要求很高的产品,一般产品均可以选用SPI串口,这样可以选用IO口较少的单片机,可以减少整体成本。在使用SPI串口时,其他不需要用到的PIN脚统一接到GND上,这样显示会更稳定。

如果觉得自己设计PCB太麻烦,也可以向LCD厂家(www.trustylcd.com)要求提供带PCB板的液晶模组,这样开发样机会更节省时间,质量也可靠。

 

 

 

硬件做好后,那就写程序调试显示了,下面以51单片机为基础介绍一下编写显示程序:

 

指令表:

No.

Instrctions

Code

Function

A0

/RD

/WR

D7

D6

D5

D4

D3

D2

D1

D0

1

Display ON/OFF

0

1

0

1

0

1

0

1

1

1

DON

DON=0,display off

DON=1,display on

2

Display start line set

0

1

0

0

1

Display start address

Set the display RAM display start line address

3

Set Page Address

0

1

0

1

0

1

1

Page address

Set the display RAM Page address

4

Ser Column Address

(Upper-4 bits)

0

1

0

0

0

0

1

Col. Add

Set the upper-4-bit of column address counter

Ser Column Address

(Lower-4 bits)

0

1

0

0

0

0

0

Col. Add

Set the low-4-bit of column address counter

5

Read Staus

0

0

1

Status

0

0

0

0

Read the status data

6

Write Display Data

1

1

0

Write Data

Write data into the display RAM

7

Read Display Data

1

0

1

Read Data

Read data from the display RAM

8

ADC Select

0

1

0

1

0

1

0

0

0

0

ADC

Set the display RAM address SEG output

Correspondence

ADC = 0,Normal. ADC = 1,Reverse

9

Normal/Reverse Display

0

1

0

1

0

1

0

0

1

1

REV

REV = 0, Normal

REV = 1, Reverse

10

Entire Display ON/OFF

0

1

0

1

0

1

0

0

1

0

EON

EON = 0, Normal

EON = 1, Entire display ON

11

Set LCD Bias

0

1

0

1

0

1

0

0

0

1

BIAS

Bias = 0, 1/9 Bias

Bias = 1, 1/7 Bias

12

Set Read-Modify-Write

0

1

0

1

1

1

0

0

0

0

0

Enter the “Read-Modify-Write” mode

13

Reset Read-Modify-Write

0

1

0

1

1

1

0

1

1

1

0

Clear the “Read-Modify-Write” mode

14

Reset

0

1

0

1

1

1

0

0

0

1

0

Resets the LCD module

15

SHL S elect

0

1

0

1

1

0

0

SHL

*

*

*

Set the COM scanning direction

SHL = 0, Normal

SHL = 1, Flipped in y-direction

* = don’t care terms

16

Power Control Set

0

1

0

0

0

1

0

1

VC

VR

VF

Set the power circuit operation mode

VF : LCD Supply Voltage Follower

VR : LCD Supply Voltage Regulator

VF : LCD Supply Voltage Converter

(1 = ON, 0 = OFF)

17

Regulator Resistor Select

0

1

0

0

0

1

0

0

Ratio

Set the built-in resistor ratio (Rb/Ra)

18

Electronic volume mode set

0

1

0

1

0

0

0

0

0

0

1

Set reference voltage mode

Electronic volume register set

0

1

0

*

*

Electronic

Control value

Set reference voltage register

19

Power Save

 

-

-

-

-

-

-

-

-

-

-

Compound instruction

Display OFF + Entire Display ON

20

NOP

0

1

0

1

1

1

0

0

0

1

1

Non-operation command

 

 

 

 

实测显示效果

 

下面是具体显示程序(SPI串口,实测可正显示显示)

#Include <reg51.h>

#Include <intrins.h>

#Include <absacc.h>

#define uchar unsigned char

#define uint unsigned int

                                                                                                  

sbit R_S=         P3^5;//指令/数据选择信号

sbit RES=         P3^4;//复位信号

sbit SCK= P1^6;

sbit SDA=P1^7;

sbit CS1=P3^7;//片选

bit Flage1=0;

 

void LcdInit();  

void Clear();    

void Delayms(uint ms);   

void Comwrite(uchar cmd);    

void Datwrite(uchar dat);       

 

void Setadd(uchar xl,uchar yl);

void disp_str(unsigned char *p,unsigned char uCol,uPage); 

unsigned char CurOffset;

#define ASC_CHR_WIDTH       8

#define ASC_CHR_HEIGHT      12

 

typedef struct typFNT_ASC16

{

    char Index[1];

    char Msk[16];

};

 

code struct typFNT_ASC16 ASC_16[] =

{       

"1",0x00,0x00,0x08,0x08,0xFC,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x07,0x04,0x04,0x00,

"2",0x00,0x00,0x08,0x04,0x84,0x44,0x38,0x00,0x00,0x00,0x06,0x05,0x04,0x04,0x04,0x00,

"3",0x00,0x00,0x08,0x04,0x44,0x44,0xB8,0x00,0x00,0x00,0x02,0x04,0x04,0x04,0x03,0x00,

"4",0x00,0x00,0x80,0x60,0x18,0xFC,0x00,0x00,0x00,0x00,0x01,0x01,0x05,0x07,0x05,0x00,

"5",0x00,0x00,0x7C,0x44,0x44,0x44,0x84,0x00,0x00,0x00,0x02,0x04,0x04,0x04,0x03,0x00,

"6",0x00,0x00,0xF0,0x48,0x44,0x44,0x80,0x00,0x00,0x00,0x03,0x04,0x04,0x04,0x03,0x00,

"7",0x00,0x00,0x0C,0x04,0x84,0x64,0x1C,0x00,0x00,0x00,0x00,0x06,0x01,0x00,0x00,0x00,

"8",0x00,0x00,0xB8,0x44,0x44,0x44,0xB8,0x00,0x00,0x00,0x03,0x04,0x04,0x04,0x03,0x00,

"9",0x00,0x00,0x38,0x44,0x44,0x44,0xF8,0x00,0x00,0x00,0x00,0x04,0x04,0x02,0x01,0x00,

"0",0x00,0x00,0xF8,0x04,0x04,0x04,0xF8,0x00,0x00,0x00,0x03,0x04,0x04,0x04,0x03,0x00,

};

 

 

#define ASC_HZ_WIDTH 16

typedef struct typFNT_GB16 

{

         char Index[2];

         char Msk[32];

};

 

uchar code Hanzi[]={

/*-- 调入了一幅图像:C:\Documents and Settings\Administrator\桌面\12864.bmp --*/

/*-- 宽度x高度=128x64 用取模软件取模,取模方式为:纵向取模,字节倒序--*/

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0xC0,0xC0,0xE0,0xE0,0xE0,0xF0,0xF0,

0xF8,0xF8,0xF8,0xFC,0xFC,0xFE,0xFE,0xFE,0xFC,0xF8,0xE0,0x80,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x03,0x06,0x0C,0x18,0x30,0x60,0xC0,0x80,0x00,

0x00,0x00,0x03,0x1E,0xF8,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x07,0xFE,0xE0,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x80,0x80,0x80,0xC0,0xC0,0xE0,0xE0,0xF0,0xF0,0x78,0xF8,0xF8,0xFC,

0xFC,0xFC,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xF8,0xE0,0x80,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0x61,0x23,

0x3E,0x1C,0x10,0x00,0x00,0x07,0x06,0x06,0x06,0x02,0x02,0x03,0x03,0x03,0x03,0x01,

0x01,0x01,0x01,0x00,0x00,0x00,0x01,0x01,0x01,0x03,0x03,0x03,0x02,0x06,0x06,0x0E,

0x0C,0x1C,0x18,0x18,0x30,0x60,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0x00,0x00,0x01,0x03,

0x03,0x07,0x0F,0x0F,0x1F,0x1F,0x3F,0x3F,0x3F,0x3F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,

0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x3F,0x3F,0x3F,

0x3E,0xF8,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x80,0xE0,0x38,0x1C,0x0E,0x07,0x83,0x01,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x40,0xF0,0xC0,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x07,0x0F,0x3C,0xF0,0xC0,0x00,0x00,0x00,

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0x0F,0x03,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x70,0x30,0x38,0x38,0x18,0x1C,0x1C,

0x1C,0x0E,0x0F,0x3E,0xFE,0x86,0x06,0x07,0x07,0x03,0x02,0x70,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0xFC,0x3F,0x03,0xC0,0x00,0xE0,0x78,0x8E,0xDF,0x6E,0x68,0x6C,0x6C,

0xFC,0x8C,0x84,0x4C,0x24,0x04,0x04,0x07,0x04,0x07,0x07,0x04,0x64,0xC4,0xCC,0x74,

0x34,0x34,0x34,0x34,0x7C,0xE4,0xC4,0x47,0x67,0x0C,0xFC,0xFC,0x00,0x00,0x00,0xFF,

0x00,0x00,0x00,0x00,0x80,0x7E,0x00,0x00,0x00,0x00,0x00,0x87,0xFF,0x7E,0x00,0x00,

0xAF,0xFF,0xFF,0x0F,0x07,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xC0,

0xC0,0xE0,0x70,0x70,0x70,0x38,0x3C,0x1C,0x1C,0x0E,0x0E,0x07,0x07,0x07,0x03,0x03,

0x03,0x0C,0x20,0x00,0x00,0x00,0x00,0x00,0x01,0x1E,0xC0,0x00,0x00,0x00,0x00,0xC0,

0x60,0x20,0x00,0x00,0x07,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x00,

0x00,0x00,0x00,0x3F,0xF8,0x8E,0x78,0x8F,0xFF,0xA0,0x73,0xF0,0x00,0x00,0x00,0x00,

0x00,0x03,0x07,0x00,0x00,0x00,0x00,0x04,0xC4,0x02,0x00,0x00,0x00,0x03,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xAE,0x10,0x00,0xFF,0xFF,0x00,0x00,0xE0,0x3F,

0x00,0x80,0xE0,0x3C,0x07,0x00,0x00,0x80,0x40,0x20,0x18,0x07,0x03,0x00,0x00,0x00,

0xFF,0xFF,0xFF,0xFF,0x78,0xF8,0x38,0x1C,0x1C,0x0E,0x0E,0x07,0x07,0x03,0x03,0x01,

0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x87,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0xA6,0x08,0x30,0x40,0x47,

0x80,0x80,0x00,0x80,0xF0,0x3F,0x03,0x00,0x40,0x20,0x18,0x07,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x03,0x0E,0x1B,0x1C,0x73,0xEC,0xF8,0xF0,0x30,0x60,0x60,

0x40,0xC0,0xC0,0x80,0x80,0x80,0x80,0x88,0x93,0x80,0x90,0x80,0x88,0x84,0x84,0x80,

0x80,0x80,0xC0,0xC0,0x40,0x40,0x60,0x20,0x30,0x30,0x3F,0xF7,0xF0,0xFE,0x5B,0x2C,

0x36,0x11,0x18,0x08,0x04,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x13,0x1F,0x18,0x31,0x26,0x38,0x23,0x2C,0x30,0x60,0xC0,0x80,0x80,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x07,0x00,0x00,0x03,0x0C,0x00,0x80,

0x40,0x30,0x0C,0xC3,0xC0,0xC0,0xC0,0xE0,0x20,0x00,0x00,0x80,0xC0,0xC0,0x60,0x30,

0x18,0x1C,0x0F,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x81,0xF1,0x39,0x1D,0xE5,0x7F,0x7F,0xFF,0xBC,0x58,0x7D,0xD7,

0xFC,0x9C,0xF8,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x86,0x86,

0x84,0x84,0xFC,0xB8,0xF8,0x78,0xF8,0xD8,0x78,0x38,0xFC,0x54,0xCA,0x7A,0xF9,0xF8,

0xF8,0xF8,0xFC,0xFC,0xFD,0x7D,0xFD,0xFE,0xFA,0xDF,0xFF,0xE1,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x7E,0x7F,0x01,0x40,0x4F,0x67,0x33,0x11,0x31,0x38,0x1C,0x34,0x22,

0x65,0x47,0x00,0x1F,0x7E,0x7C,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

};

 

void Display(unsigned char sda,unsigned char sda1)

{

   unsigned char i,j,k=0;

   for(i=0;i<8;i++)  

    {

     Comwrite(0xb0+k);         

         Comwrite(0x10);

          Comwrite(0x01); //设置起始例,0x00=SEG00x01=SEG1      

       for(j=0;j<64;j++)

          { Datwrite(sda);

            Datwrite(sda1);

          }

    k++;

    }

}

 

void Hanzi_Disp(void)

{

   unsigned char i,j,k=0;

   for(i=0;i<8;i++)  

    {

     Comwrite(0xb0+k);         

         Comwrite(0x10);

          Comwrite(0x01);   //0x00=seg0,0x01=seg1 

       for(j=0;j<128;j++)

          {Datwrite(Hanzi[i*128+j]);

          }         

    k++;

    }

}    

 

void main()

{       

   P1M1=0x00;

   P1M0=0xff;

   P3M1=0x00;

   P3M0=0xff;

   CLK_DIV=0x02;

   LcdInit();

   while(1)

         {

          Clear();

      Display(0xff,0xff);

          Delayms(5000);

      Display(0x55,0xaa);

          Delayms(5000);

      Display(0x00,0xff);

          Delayms(5000);

      Display(0xaa,0xaa);

          Delayms(5000);

      Display(0x55,0x55);

          Delayms(5000);    

          Hanzi_Disp();

          Delayms(5000);

          Delayms(5000);

         }       

}

 

void Delayms(uint ms)

{       

         uchar j;

         while(ms--)

          for(j=0;j<=20;j++);                      

}                

        

void Comwrite(uchar cmd)

{

    uchar data i,j;

             CS1=0;

             R_S=0; 

        SCK=1;

         for(i=0;i<8;i++)

             {

                    j=cmd;

                    SCK=0;

                    SDA=cmd&0x80;

         SCK=1;       

                    cmd=j<<1;

                   }

             CS1=1;

                   R_S=1;

}

 

void Datwrite(uchar dat)         

{                                                               

    uchar data i,j;

             CS1=0;

             R_S=1; 

        SCK=1;

         for(i=0;i<8;i++)

             {

                    j=dat;

                    SCK=0;

                    SDA=dat&0x80;

         SCK=1;       

                    dat=j<<1;

                   }

             CS1=1;

                   R_S=0;

}

 

void Clear()

{

   unsigned char i,j,m=0;

   for(i=0;i<8;i++)  

    {

     Setadd(0,i);           

     for(j=0;j<128;j++)

          Datwrite(0x00);

     }

}

 

void Setadd(uchar xl,uchar yl)

{    uchar i;

     i=(xl+4)&0x0f;    //i=(xl+0)&0x0f;SEG0~SEG127 // i=(xl+4)&0x0f;SEG4~SEG131

     xl=(xl>>4)+0x10;

 

     Comwrite(0xb0+yl);        

          Comwrite(xl);

         Comwrite(i); 

}

 

void LcdInit()

{

     RES=1;

     Delayms(50);

     RES=0;

     Delayms(50);

     RES=1;

     Delayms(50);

 

    Comwrite(0xE2);          //Software Reset

     Delayms(50);

     Comwrite(0xA2);          //Set Bias     0xA3 1/7bias, 0xA2 1/9 bias

     Comwrite(0xA0);          //Segment Direction Select       bit0=0,normal ,=1,reverse

     Comwrite(0xC8);          //Common Direction Select        bit3=0,normal ,=1,revese

     Comwrite(0xA8);

     Comwrite(0xA6);

     Comwrite(0xA4);

     Comwrite(0x25);          //调电压 对比度 Set internal rb/ra   0x24

     Comwrite(0x81);          //Set Contrast    

     Comwrite(0x1a);          //调电压 对比度 1a>1f

     Comwrite(0x2F);          //Power Control Set

     Delayms(5000);                    //delay 40mS

  

     Comwrite(0x60);          //Set Display Start Line   

     Comwrite(0xAF);          //Display ON

 

}       

 

void disp_ch(unsigned char c,uCol,uPage)

{

         unsigned char k,j,ch_w;

         unsigned char width;

         unsigned char len;

 

         len=sizeof(ASC_16)/sizeof(ASC_16[0]);

         for(k=0;k<len;k++)

         {

                   if(c == ASC_16[k].Index[0] ) break;

         }

         if(k<len)

         {

                  

                   if(c=='-'||c==':')

                            width=ASC_CHR_WIDTH-2;

                   else if(c=='|')

                            width=ASC_HZ_WIDTH-ASC_CHR_WIDTH;

                   else

                            width=ASC_CHR_WIDTH;

                  

                      Setadd(uCol,uPage);

                            for(j=0;j<width;j++)

                            {

                                     ch_w=ASC_16[k].Msk[j];                            

                                     Datwrite(ch_w);

                            }

 

                            Setadd(uCol,uPage+1);

                            for(j=0;j<width;j++)

                            {

                                     ch_w=ASC_16[k].Msk[ASC_CHR_WIDTH+j];

                                     Datwrite(ch_w);

                            }                

         }

}

 

void disp_str(unsigned char *p,unsigned char uCol,uPage)

{

         unsigned char i=0;

         while(p[i]>0)

         {

                   if(p[i] < 128)

                   {       

                            disp_ch(p[i],uCol,uPage);

            uCol+=8;

                   }

                   if(Flage1==1) Delayms(200);

                   i++;

         }

}

 

//如有不明可联系

原创作者:深圳市乾思迪电子科技有限公司

相关产品

script>