12864液晶屏串口驱动程序
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
12864液晶屏串口驱动程序代码
12864液晶屏驱动采用4_Wire-SPI串口驱动方式,可有效的减少IO口的占用,方便使用调试,本程序的代码驱动IC为ST7565R,是基于STC89C53RC的12864串行模式的程序,硬件电路连接只需要5根线:RS、 SDA、 SCLK、RES、CS 。
程序已经调试通过,很好用。代码如下:
//----------------------------------------------------------------------
/*hotdisplay CO,.LTD.*/
// Module : HTG12864
// Lanuage : C51 Code
// Create :
// Version : 1.0
// Date : OCT-21-2016
// LCM Drive IC : ST7565R
// INTERFACE : 4_Wire-SPI
// MCU : STC89C53RC
// VDD : 3.3V
//********************************************************* ******************
#include
#define uchar unsigned char
#define uint unsigned int
uchar bdata transdata;
sbit R_S= P3^5;
sbit RES= P3^4;
sbit SCK= P1^6;
sbit SDA= P1^7;
sbit CS1= P3^7;
sbit transbit = transdata^7 ;
#define Page 0xb0
//##########################################//
void Comwrite(unsigned char com); //D′??á?3ìDò//
void Datawrite(unsigned char dat);
void Delay(unsigned int time); //?óê±×ó3ìDò//
char code Hanzi[]={
0xFF,0x01,0x01,0x09,0xF9,0x09,0x01,0x01,0x09,0xF9,0x09,0xE1 ,0x11,0x09,0x09,0x09,
0x11,0xE1,0x01,0x19,0x09,0x09,0xF9,0x09,0x09,0x19,0x01,0x01 ,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x09,0xF9,0x09,0x09,0x09,0x11,0xE1,0x01,0x01 ,0x09,0x09,0xF9,0x09,
0x09,0x01,0x01,0x01,0x71,0x89,0x09,0x09,0x09,0x39,0x01,0x09 ,0xF9,0x09,0x09,0x09,
0x09,0xF1,0x01,0x01,0x01,0xC1,0x39,0xE1,0x01,0x01,0x01,0x09 ,0xF9,0x09,0x01,0x01,
0x01,0x01,0x01,0x09,0x39,0xC9,0x01,0xC9,0x39,0x09,0x01,0x01 ,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x09,0xF9,0x09,0x01,0x01,0x01,0x01,0x01,0xC1 ,0x31,0x09,0x09,0x09,
0x09,0x39,0x01,0x09,0xF9,0x09,0x09,0x09,0x11,0xE1,0x01,0x01 ,0x01,0x01,0x01,0xFF,
0xFF,0x00,0x00,0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20,0x0F ,0x10,0x20,0x20,0x20,
0x10,0x0F,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00,0x00 ,0x20,0x20,0x3F,0x20,
0x20,0x00,0x00,0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00,0x20 ,0x3F,0x21,0x01,0x01,
0x01,0x00,0x00,0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20,0x20 ,0x3F,0x20,0x20,0x20,
0x20,0x30,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0x00,0x07 ,0x18,0x20,0x20,0x20,
0x10,0x08,0x00,0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00,0x00 ,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,0x08,0xF8,0x08,0x00 ,0x00,0x08,0xF8,0x08,
0x18,0x08,0x08,0xF8,0x08,0x08,0x18,0x00,0x08,0xF8,0xF8,0x00 ,0xF8,0xF8,0x08,0x00,
0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x70,0x08,0x08 ,0x08,0x88,0x70,0x00,
0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0xE0,0x10,0x88 ,0x88,0x18,0x00,0x00,
0x00,0x00,0xC0,0x20,0x10,0xF8,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,0x00,0x00,0xFF,
0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,