图文详情
产品属性
相关推荐
型号:SGX-12864-KGM0151
尺寸:46mmX29mm
显示尺寸:43.6mmX25mm
/*******************************
间接方式接线,采用6800时序写法
************************************/
#include <reg52.h>
#include <stdlib.h>
#include <intrins.h>
#include <stdio.h>
#define uchar unsigned char
#define uint unsigned int
sbit A0 =P3^3; //L 命令 H 数据
sbit CS =P3^7; //片选 低有效
sbit SCK=P3^5; //使能信号(E) 到高有效
sbit SID=P3^4; // 数据信号
sbit RST =P3^6; //复位
sbit anjian=P3^2;
#define Display 0xAF //显示开启
#define Power 0x2F //电源全开
#define VO 0x24 //对比度调节
#define AllPoint 0xA4 //非全屏显示
#define ADCset 0xA1 //负向,131-4
#define COMset 0xc0 //com0-com63
#define ELECTVO 0x81 //亮度调节 调节颜色 不同的模块需要不同的 ELECTSET
#define ELECTSET 0x2a //亮度数值 调节颜色 不同的模块需要不同的 数值
#define BIASSET 0xA2 //占空比1/9
uchar yemiancount=0; //页面计数
uchar i=0,j=0;
uchar code zifu8x16[]=
{
0x00,0x70,0x88,0x08,0x08,0x08,0x38,0x00,0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00,/*"S",0*/
0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20,/*"H",1*/
0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00,/*"E",2*/
0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00,/*"N",3*/
0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00,/*"G",4*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,/*"-",5*/
0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00,/*"G",6*/
0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,/*"U",7*/
0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20,/*"A",8*/
0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00,/*"N",9*/
0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00,/*"G",10*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,/*"-",11*/
0x08,0x18,0x68,0x80,0x80,0x68,0x18,0x08,0x20,0x30,0x2C,0x03,0x03,0x2C,0x30,0x20,/*"X",12*/
0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,/*"I",13*/
0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20,/*"A",14*/
0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00,/*"N",15*/
};
uchar code zifu16x16[]=
{
0x10,0x61,0x06,0xE0,0x00,0x26,0x22,0x1A,0x02,0xC2,0x0A,0x12,0x32,0x06,0x02,0x00,
0x04,0xFC,0x03,0x20,0x20,0x11,0x11,0x09,0x05,0xFF,0x05,0x09,0x19,0x31,0x10,0x00,/*"深",0*/
0x10,0x10,0x10,0xFE,0x10,0x10,0xFE,0x00,0x00,0xFC,0x00,0x00,0x00,0xFE,0x00,0x00,
0x08,0x08,0x04,0x47,0x24,0x18,0x07,0x00,0x00,0x1F,0x00,0x00,0x00,0x7F,0x00,0x00,/*"圳",1*/
0x04,0x04,0x04,0xE4,0x24,0x24,0x25,0xFE,0x24,0x24,0x24,0x24,0xE4,0x04,0x04,0x00,
0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0xFF,0x00,0x00,0x10,0x20,0x1F,0x00,0x00,0x00,/*"市",2*/
0x00,0x00,0xFC,0x24,0x24,0x24,0xE4,0x04,0x1F,0x64,0x85,0x46,0x24,0x04,0x84,0x00,
0x44,0x43,0x40,0x7C,0x45,0x46,0x7D,0x46,0x45,0x7D,0x44,0x45,0x7E,0x42,0x43,0x00,/*"盛",3*/
0x00,0x40,0x42,0x44,0x5C,0xC8,0x40,0x7F,0x40,0xC0,0x50,0x4E,0x44,0x60,0x40,0x00,
0x00,0x80,0x40,0x20,0x18,0x07,0x00,0x00,0x00,0x3F,0x40,0x40,0x40,0x40,0x78,0x00,/*"光",4*/
0x00,0x00,0x00,0x3E,0x2A,0xEA,0x2A,0x2A,0x2A,0xEA,0x2A,0x3E,0x00,0x00,0x00,0x00,
0x20,0x21,0x22,0x2C,0x20,0x3F,0x20,0x20,0x20,0x3F,0x28,0x24,0x23,0x20,0x20,0x00,/*"显",5*/
0x10,0x12,0x92,0x72,0xFE,0x51,0x91,0x00,0x22,0xCC,0x00,0x00,0xFF,0x00,0x00,0x00,
0x04,0x02,0x01,0x00,0xFF,0x00,0x04,0x04,0x04,0x02,0x02,0x02,0xFF,0x01,0x01,0x00,/*"科",6*/
0x08,0x08,0x88,0xFF,0x48,0x28,0x00,0xC8,0x48,0x48,0x7F,0x48,0xC8,0x48,0x08,0x00,
0x01,0x41,0x80,0x7F,0x00,0x40,0x40,0x20,0x13,0x0C,0x0C,0x12,0x21,0x60,0x20,0x00,/*"技",7*/
};
uchar code bmp1[]=
{
0x00,0x00,0x00,0x00,0xE0,0xF0,0x10,0x10,0x10,0xF0,0xE0,0x00,0x00,0xC0,0xE0,0x30,
0x10,0x30,0xE0,0xC0,0x00,0x00,0x20,0x20,0xF0,0xF0,0x00,0x00,0x00,0x00,0x00,0xC0,
0xE0,0x30,0x10,0x30,0xE0,0xC0,0x00,0x80,0xC0,0x60,0x38,0xDE,0xC6,0x44,0x44,0xFC,
0xFC,0x44,0x44,0x44,0x44,0x04,0x00,0x00,0x00,0x20,0x20,0xF0,0xF0,0x00,0x00,0x00,
0x00,0x00,0xC0,0xE0,0x30,0x10,0x30,0xE0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,
0xFE,0x22,0x22,0x22,0x22,0xFE,0xFE,0x00,0x00,0x00,0x00,0x00,0xC0,0xE0,0x30,0x10,
0x30,0xE0,0xC0,0x00,0x00,0x20,0x20,0xF0,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xFC,0xFC,0x84,0x84,0x84,0x84,0x84,0x84,0xFC,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x60,0x70,0x58,0x4C,0x47,0x63,0x60,0x00,0x00,0x1F,0x3F,0x60,
0x40,0x60,0x3F,0x1F,0x00,0x00,0x40,0x40,0x7F,0x7F,0x40,0x40,0x00,0x00,0x00,0x1F,
0x3F,0x60,0x40,0x60,0x3F,0x1F,0x00,0x08,0x08,0x08,0x08,0x0F,0x0F,0x08,0x08,0xFF,
0xFF,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00,0x40,0x40,0x7F,0x7F,0x40,0x40,0x00,
0x00,0x00,0x1F,0x3F,0x60,0x40,0x60,0x3F,0x1F,0x00,0x00,0x80,0xC0,0x60,0x38,0x1F,
0x07,0x02,0x02,0x42,0xC2,0xFF,0x7F,0x00,0x00,0x00,0x00,0x00,0x1F,0x3F,0x60,0x40,
0x60,0x3F,0x1F,0x00,0x00,0x40,0x40,0x7F,0x7F,0x40,0x40,0x00,0x00,0x00,0x00,0x00,
0x7F,0x7F,0x20,0x20,0x20,0x20,0x20,0x20,0x7F,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xC0,0xC0,0xE0,0x70,
0x30,0x38,0x18,0x18,0x18,0x1C,0x0C,0x0C,0x7C,0xFE,0xFE,0xFE,0x7C,0x0C,0x0C,0x0C,
0x1C,0x18,0x18,0x18,0x38,0x30,0x70,0xE0,0xC0,0xC0,0x80,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,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x80,0xC0,0xF0,0x38,0x1C,0x0F,0x03,0x01,0xC1,0xC0,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,0x80,0x80,0xC1,0x71,0x33,0x0F,0x1C,0x38,0xF0,
0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,
0xC0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xC0,0xE0,0xE0,0x60,
0x60,0x60,0x60,0xE0,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,
0xE0,0xE0,0x60,0xE0,0xE0,0xE0,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xC0,0xE0,0x60,
0xE0,0xE0,0xE0,0xE0,0xC0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x80,0xF0,0xFF,0xCF,0xC0,0xC0,0x80,0x00,0x00,0x00,0x00,0x01,0x01,0x03,
0x06,0x06,0x0C,0x18,0x18,0x30,0x60,0x60,0xC0,0xC0,0xC0,0xC0,0x80,0xC0,0x60,0x60,
0x30,0x18,0x18,0x0C,0x06,0x06,0x03,0x01,0x01,0x00,0x00,0x00,0x80,0xC0,0xC0,0xC0,
0xC7,0xFF,0xF8,0x00,0x00,0x00,0x03,0x07,0x07,0x01,0x00,0x00,0x00,0x00,0x00,0x01,
0xE7,0xFF,0xFF,0xFF,0x1C,0x00,0x00,0x00,0x00,0x1E,0x7F,0x7F,0xFF,0xE1,0xC0,0x80,
0x80,0x80,0xC0,0xE0,0xFB,0x7F,0x3F,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x1F,
0x1F,0x18,0x1E,0x0F,0x07,0x01,0xC0,0xF0,0xFC,0xFE,0xFF,0x7F,0x0F,0x03,0x00,0x00,
0x00,0x00,0x01,0x03,0x03,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x03,0x0F,0xFF,0xF7,0x07,0x07,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x07,0x07,0x07,0x03,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x07,0x07,0x07,
0xE7,0xFF,0x1F,0x00,0x00,0x00,0x00,0x80,0xC0,0xC0,0xE0,0xF0,0xF8,0x7C,0x3E,0x1F,
0x0F,0x07,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFC,0xFE,0xFE,0x07,0x03,0x03,
0x03,0x03,0x07,0x07,0xDF,0xFE,0xFC,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x3C,0xFF,0xFF,0xFF,0xFF,0xE7,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0x03,0x0F,0x1C,0x38,0xF0,0xC0,0x80,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xC0,0xC0,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xC0,0xF0,0x38,0x1C,0x0F,
0x03,0x01,0x00,0x00,0x00,0x0E,0x0F,0x0F,0x0F,0x0F,0x0D,0x0C,0x0C,0x0C,0x0C,0x0C,
0x0C,0x0E,0x0E,0x0E,0x04,0x00,0x00,0x00,0x00,0x01,0x03,0x07,0x07,0x0E,0x0E,0x0C,
0x0C,0x0C,0x0E,0x0E,0x07,0x07,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x07,0x0F,0x0F,0x0F,0x0F,0x0E,0x06,0x06,
0x03,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,0x01,0x01,0x03,0x03,0x07,0x0E,
0x0C,0x1C,0x18,0x18,0x18,0x38,0x30,0x30,0x37,0x3F,0x3F,0x3F,0x37,0x30,0x30,0x30,
0x38,0x18,0x18,0x18,0x1C,0x0C,0x0E,0x07,0x03,0x03,0x01,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,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};
/***************
延时1*MS MS
*****************/
void delay(uint ms)
{ uint k;
for(k=0;k<ms;k )
for(j=0;j<12;j );
}
/********************
数据移位 最高位存入,
********************/
void SendByte(uchar Dbyte)
{
uchar i,TEMP;
TEMP=Dbyte;
for(i=0;i<8;i )
{
SCK = 0;
_nop_(); _nop_();
TEMP=TEMP<<1;
SID = CY;
SCK = 1;
_nop_(); _nop_();
}
}
/****************
写指令
**************/
void write_cmd( uchar Cbyte )
{
CS = 0;
A0 = 0;
SendByte(Cbyte);
}
/***************
写数据
******************/
void write_data( uchar Dbyte )
{
CS = 0;
A0=1;
SendByte(Dbyte);
}
/*************************
8*8字符,取模顺序是列行式,
从上到下,高位在前,从左到右;
先选择页地址0-7,再选择列0-130
页码是直接读取8位数据作为地址;
列是先读取高四位,后读取低四位;
**********************/
void PUTchar8x8(uchar row,uchar col,uchar count,uchar code *put)
{ uint X=0;
write_cmd(0xb0 row);
write_cmd(0x10 (8*col/16));
write_cmd(0x00 (8*col));
for(j=0;j<count;j )
for(i=0;i<8;i ) write_data(put[X ]);
}
/*****************
8*16字符,取模顺序是列行式,
从上到下,高位在前,从左到右;
先选择页地址0-7,再选择列0-127
页码是直接读取8位数据作为地址;
列是先读取高四位,后读取低四位;
是
sgx
SGX-12864-KGM0151
LCD液晶屏
2(英寸)
可选
高
清楚
128*64
128*64
见规格书(mm)
见规格书(ms)
见规格书(°)