最完整的12864测试程序

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

以下是RT12864引脚功能定义 引脚号

管脚 说明 1

Vss 电源地(0V)。 2

VDD 电源正(+5V)。 3

V0 LCD 驱动电压,应用时在VEE 与V0之间加一20K 可调电阻。 4 D/I 数据\指令选择:

高电平:数据D0-D7将送入显示RAM

低电平:数据D0-D7将送入指令寄存器执行。

5 R/W 读\写选择:高电平:读数据;低电平:写数据。

6 E 读写使能,高电平有效,下降沿锁定数据。

7 DB0

数据输入输出。 8 DB1 9 DB2 10

DB3 11

DB4 12

DB5 13

DB6 14

DB7 15

CS1 片选择信号,低电平时选择前64列。 16

CS2 片选择信号,低电平时选择后64列。 17

RET 复位信号,低电平有效。 18

VOUT LCD 驱动电源(-10V )。 19

LED+ 背光电源,LED+(+5V)。 20

LED- 背光电源,LED-(0V)。

以下是RT12864引脚功能定义

引脚号

管脚

说明

1

Vss

电源地(0V)。

2

VDD

电源正(+5V)。

3

V0

LCD驱动电压,应用时在VEE与V0之间加一20K可调电阻。4

D/I

数据\指令选择:

高电平:数据D0-D7将送入显示RAM

低电平:数据D0-D7将送入指令寄存器执行。

5

R/W

读\写选择:高电平:读数据;低电平:写数据。6

E

读写使能,高电平有效,下降沿锁定数据。7

DB0

数据输入输出。

8

DB1

9

DB2

10

DB3

11

DB4

12

DB5

13

DB6

14

DB7

15

CS1

片选择信号,低电平时选择前64列。

16

CS2

片选择信号,低电平时选择后64列。

17

RET

复位信号,低电平有效。

18

VOUT

LCD驱动电源(-10V )。

19

LED+

背光电源,LED+(+5V)。

20

LED-

背光电源,LED-(0V)。

/********************************************/ /* 12864系列测试程序*/

/********************************************/ #include

#include

#include

#include

#include

#include

/* LCD寄存器命令代码*/

#define Disp_On 0x3f

#define Disp_Off 0x3e

#define Col_Add 0x40

#define Page_Add 0xb8 //每页是8行

#define Start_Line 0xc0

//LCD和51连接

#define Lcd_Bus P0 //MCU P1<------> LCM

sbit Mcs=P2^6; //Master chip enable

sbit Scs=P2^5; //Slave chip enable

sbit Enable=P3^7; //mode Enable single

sbit Di=P2^4; //Data or Instrument Select

sbit RW=P2^3; //Write or Read

sbit Lcd_Rst=P1^0; //Lcm reset

char code HANZI[7][32]={

{0x00,0x00,0xF8,0x48,0x48,0x48,0x48,0xFF,0x48,0x48,0x48,0x48,0xF8,0x00,0x00,0x00,

0x00,0x00,0x0F,0x04,0x04,0x04,0x04,0x3F,0x44,0x44,0x44,0x44,0x4F,0x40,0x70,0x00},//"电"

{0x10,0x60,0x01,0x86,0x60,0x04,0x44,0x64,0x55,0x4E,0x44,0x64,0xC4,0x04,0x04,0x00,

0x04,0x04,0xFC,0x03,0x40,0x30,0x0F,0x00,0x00,0x7F,0x00,0x3F,0x40,0x40,0x70,0x00},//"流"

{0x00,0x00,0xFE,0x02,0x42,0x42,0x42,0x42,0xFA,0x42,0x42,0x42,0x62,0x42,0x02,0x00,

0x20,0x18,0x27,0x20,0x20,0x20,0x20,0x20,0x3F,0x20,0x21,0x2E,0x24,0x20,0x20,0x00},//"压"

{0x00,0xFF,0x11,0x29,0xC7,0x01,0xFE,0x22,0x22,0x22,0x22,0x22,0xFE,0x00,0x00,0x00,

0x00,0xFF,0x02,0x04,0x43,0x40,0x7F,0x42,0x42,0x42,0x42,0x42,0x7F,0x40,0x40,0x00},//"阻"

{0x10,0x21,0x86,0x70,0x00,0x7E,0x4A,0x4A,0x4A,0x4A,0x4A,0x7E,0x00,0x00,0x00,0x00,

0x02,0xFE,0x01,0x40,0x7F,0x41,0x41,0x7F,0x41,0x41,0x7F,0x41,0x41,0x7F,0x40,0x00},//温

{0x00,0x00,0xFC,0x04,0x24,0x24,0xFC,0xA5,0xA6,0xA4,0xFC,0x24,0x24,0x24,0x04,0x00,

0x80,0x60,0x1F,0x80,0x80,0x42,0x46,0x2A,0x12,0x12,0x2A,0x26,0x42,0xC0,0x40,0x00},//度

{0x00,0x10,0x10,0x10,0x10,0x10,0x10,0xFF,0x10,0x10,0x10,0x10,0x10,0xF0,0x00,0x00,

0x00,0x00,0x80,0x40,0x20,0x18,0x06,0x01,0x00,0x00,0x40,0x80,0x40,0x3F,0x00,0x00} //力

};

char code shu[14][16]={

{0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00},//"0" {0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00},//"1" {0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00},//"2" {0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00},//"3" {0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00},//"4" {0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00},//"5" {0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00},//"6" {0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00},//"7" {0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00},//"8" {0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00},//"9" {0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x1F,0x01,0x01,0x01,0x00},//"+"

相关文档
最新文档