- IC型号
企业档案
- 相关证件: 
- 会员类型:
- 会员年限:12年
- 阿库IM:
- 地址:杭州市余杭区仁和街道永泰路2号22幢
- E-mail:752574498@qq.com
HGO16016018测试程序
发布时间: 2016/10/20 9:20:01 | 729 次阅读
#include<reg51.h>
#include <string.h>
#include <intrins.h>
#include <math.h>
#define uchar unsigned char
#define uint unsigned int
#define LC 20
#define LF 160
#define DATA P1
sbit SCLK =P3^0;
sbit SDIN =P3^1;
sbit CD =P3^3;
sbit CS =P3^4;
sbit RES =P3^5;
uchar RAM_data[4];
uchar rd_RAM[3];
uchar REV=0;
uchar code table_68[]={
//Q(0) Q(1) :(2) 1(3) 0(4) 4(5) 8(6) 5(7) 8(8) 5(9) 3(10)
0x00,0x00,0x70,0x88,0x88,0xE8,0x70,0x18,/*"Q",0*/
0x00,0x00,0x70,0x88,0x88,0xE8,0x70,0x18,/*"Q",1*/
0x00,0x00,0x00,0x20,0x00,0x00,0x20,0x00,/*":",2*/
0x00,0x00,0x20,0x60,0x20,0x20,0x70,0x00,/*"1",3*/
0x00,0x00,0x70,0x88,0x88,0x88,0x70,0x00,/*"0",4*/
0x00,0x00,0x30,0x50,0x90,0x78,0x10,0x00,/*"4",5*/
0x00,0x00,0xF8,0x88,0x70,0x88,0x78,0x00,/*"8",6*/
0x00,0x00,0xF8,0x80,0xF8,0x88,0x70,0x00,/*"5",7*/
0x00,0x00,0xF8,0x88,0x70,0x88,0x78,0x00,/*"8",8*/
0x00,0x00,0xF8,0x80,0xF8,0x88,0x70,0x00,/*"5",9*/
0x00,0x00,0x78,0xB0,0x08,0x88,0x70,0x00,/*"3",10*/
}; //逐行,宋体,水平字节,顺向;
uchar code table_1216[][32]={
0x00,0x00,0x00,0x00,0x00,0x00,0xF7,0x70,0x66,0x20,0x66,0x40,0x66,0x40,0x37,0x40,0x3F,0x40,0x3B,0x80,0x3B,0x80,0x3B,0x80,0x11,0x00,0x11,0x00,0x00,0x00,0x00,0x00,/*"W",0*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x10,0x60,0x3F,0xE0,0x30,0x00,0x30,0x00,0x18,0x20,0x0F,0xC0,0x00,0x00,0x00,0x00,/*"e",1*/
0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x3F,0xC0,0x00,0x00,0x00,0x00,/*"l",2*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x30,0x40,0x1F,0x80,0x00,0x00,0x00,0x00,/*"c",3*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x30,0xC0,0x60,0x60,0x60,0x60,0x60,0x60,0x30,0xC0,0x1F,0x80,0x00,0x00,0x00,0x00,/*"o",4*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xE0,0x66,0x60,0x66,0x60,0x66,0x60,0x66,0x60,0x66,0x60,0xF7,0x70,0x00,0x00,0x00,0x00,/*"m",5*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x10,0x60,0x3F,0xE0,0x30,0x00,0x30,0x00,0x18,0x20,0x0F,0xC0,0x00,0x00,0x00,0x00,/*"e",6*/
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,/*" ",7*/
0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xE0,0x86,0x10,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x0F,0x00,0x00,0x00,0x00,0x00,/*"T",8*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x30,0xC0,0x60,0x60,0x60,0x60,0x60,0x60,0x30,0xC0,0x1F,0x80,0x00,0x00,0x00,0x00,/*"o",9*/
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,/*" ",10*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF7,0xB0,0x63,0x20,0x77,0x20,0x35,0xC0,0x39,0xC0,0x39,0xC0,0x10,0x80,0x00,0x00,0x00,0x00,/*"w",11*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF7,0xB0,0x63,0x20,0x77,0x20,0x35,0xC0,0x39,0xC0,0x39,0xC0,0x10,0x80,0x00,0x00,0x00,0x00,/*"w",12*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF7,0xB0,0x63,0x20,0x77,0x20,0x35,0xC0,0x39,0xC0,0x39,0xC0,0x10,0x80,0x00,0x00,0x00,0x00,/*"w",13*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0x00,0x00,/*".",14*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x0C,0x00,0x7F,0x80,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x40,0x07,0x80,0x00,0x00,0x00,0x00,/*"t",15*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xE0,0x30,0x20,0x38,0x00,0x0F,0x80,0x00,0xE0,0x20,0x60,0x3F,0xC0,0x00,0x00,0x00,0x00,/*"s",16*/
0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x3F,0xC0,0x00,0x00,0x00,0x00,/*"i",17*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x77,0x80,0x38,0xC0,0x30,0xC0,0x30,0xC0,0x30,0xC0,0x30,0xC0,0x79,0xE0,0x00,0x00,0x00,0x00,/*"n",18*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xF0,0x30,0xC0,0x30,0xC0,0x1F,0x80,0x30,0x00,0x1F,0xC0,0x60,0x60,0x60,0x60,0x3F,0xC0,/*"g",19*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x0C,0x00,0x7F,0x80,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x40,0x07,0x80,0x00,0x00,0x00,0x00,/*"t",20*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x10,0x60,0x3F,0xE0,0x30,0x00,0x30,0x00,0x18,0x20,0x0F,0xC0,0x00,0x00,0x00,0x00,/*"e",21*/
0x00,0x00,0x00,0x00,0x10,0x00,0x70,0x00,0x30,0x00,0x30,0x00,0x30,0x00,0x33,0xC0,0x31,0x00,0x36,0x00,0x3A,0x00,0x31,0x00,0x30,0x80,0x79,0xE0,0x00,0x00,0x00,0x00,/*"k",22*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0x00,0x00,/*".",23*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x30,0x40,0x1F,0x80,0x00,0x00,0x00,0x00,/*"c",24*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x30,0xC0,0x60,0x60,0x60,0x60,0x60,0x60,0x30,0xC0,0x1F,0x80,0x00,0x00,0x00,0x00,/*"o",25*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xE0,0x66,0x60,0x66,0x60,0x66,0x60,0x66,0x60,0x66,0x60,0xF7,0x70,0x00,0x00,0x00,0x00,/*"m",26*/
}; //逐行,宋体,水平字节,顺向;
uchar code table_3624[][120]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,0x1C,0x00,0x00,0x03,0x80,0x1F,0xC0,0x00,0x01,0xE1,0xF8,0x00,0x00,0x00,0x40,
0x08,0x00,0x00,0x00,0x00,0x3F,0x80,0x00,0x00,0x00,0xC8,0x00,0x00,0x1C,0x00,0x08,0xFF,0xC0,0x0E,0x03,0xFF,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x01,0x3F,0xC0,
0x00,0x00,0x21,0xC0,0xC0,0x00,0x00,0x40,0x80,0xC0,0x00,0x00,0x80,0xF8,0xC0,0x00,0x01,0x80,0x80,0xC0,0x00,0x03,0x00,0xBC,0xC0,0x00,0x07,0x01,0xC0,0xC0,0x00,0x0E,
0x01,0x80,0xC0,0x00,0x06,0x01,0x80,0xC0,0x00,0x00,0x01,0x83,0xC0,0x00,0x00,0x00,0x01,0xC0,0x00,0x00,0x00,0x00,0x80,0x00,/*"清",0*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x00,0x0E,0x00,0x00,0x03,0xC0,0x0E,0x00,0x00,0x00,0xE0,0x0C,0x00,0x00,0x00,0x60,
0x0C,0x00,0x00,0x00,0x00,0x0F,0xFC,0x00,0x00,0x03,0xFE,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x03,0xC0,0x18,0x00,0x00,0x0C,0xC0,0x1E,0x00,0x00,0x00,0x80,0x33,0x80,
0x00,0x01,0x00,0x60,0xE0,0x00,0x01,0x80,0xC0,0x70,0x00,0x00,0xC1,0x80,0x38,0x00,0x00,0xC2,0x00,0x10,0x00,0x00,0x4C,0x00,0x00,0x00,0x1F,0xFE,0x00,0x00,0x00,0x00,
0x01,0xFF,0x07,0xE0,0x00,0x00,0x0F,0xFF,0x80,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"达",1*/
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0xC1,0xE0,0x00,0x00,0x70,
0xC3,0x80,0x00,0x00,0x38,0xCC,0x00,0x00,0x00,0x18,0xC0,0x00,0x00,0x00,0x00,0xC0,0x60,0x00,0x00,0x00,0xFF,0xF8,0x00,0x01,0xFF,0x20,0x00,0x00,0x03,0x86,0x38,0x00,
0x00,0x00,0x06,0x38,0x00,0x00,0x00,0x0E,0x30,0x00,0x00,0x00,0x1C,0x30,0x00,0x80,0x00,0x38,0x30,0x00,0xC0,0x00,0x70,0x30,0x00,0xC0,0x00,0xC0,0x30,0x00,0xC0,0x03,
0x80,0x18,0x01,0xE0,0x0C,0x00,0x0F,0xFF,0xC0,0x30,0x00,0x03,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"光",2*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x03,
0x02,0x00,0x00,0x00,0x03,0xFF,0xC0,0x00,0x07,0xFF,0x01,0xC0,0x00,0x03,0x03,0x01,0x80,0x00,0x03,0x03,0x01,0x80,0x00,0x03,0x9F,0xE3,0x80,0x00,0x01,0x83,0x03,0x00,
0x00,0x01,0x83,0x03,0x00,0x00,0x01,0x83,0x3F,0x00,0x00,0x00,0xFF,0xC6,0x00,0x00,0x00,0x83,0x00,0x06,0x00,0x00,0x03,0x00,0x06,0x00,0x00,0x03,0x00,0x06,0x00,0x00,
0x01,0x80,0x1F,0x00,0x00,0x00,0xFF,0xFE,0x00,0x00,0x00,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"电",3*/
};//逐行,楷体,水平字节,顺向;
uchar code BMP[]={
0x00,0x00,0x2D,0xF5,0xFA,0x55,0xE9,0x6B,0x7D,0x59,0xE0,0xB5,0x3A,0x72,0xF0,0x00,
0x00,0x00,0x5B,0xED,0xF4,0xFB,0xFA,0xAD,0x3D,0x4D,0xE1,0x52,0xBD,0x72,0xE8,0x00,
0x00,0x00,0x37,0xF5,0xFD,0x5F,0xED,0xB5,0xBE,0xA4,0xE1,0xDA,0x1F,0x3A,0x68,0x00,
0x00,0x00,0xEE,0xF7,0xEA,0xEE,0xF5,0x56,0xBE,0xB2,0x70,0x21,0x5E,0x50,0x5C,0x00,
0x00,0x00,0xDD,0xDB,0xBD,0x77,0xFF,0x5A,0x9E,0x52,0x73,0x01,0x5B,0x28,0x34,0x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7F,0x80,0x01,
0x00,0x01,0x7F,0x5C,0xFA,0x91,0x00,0x00,0x8F,0x89,0x8C,0x27,0x7F,0xFF,0x00,0x02,
0x00,0x00,0x97,0x3A,0x5B,0xD0,0x00,0x00,0x3F,0xF2,0xA4,0x43,0xFD,0xFF,0x00,0x00,
0x00,0x00,0x9F,0x5A,0x7B,0x48,0x40,0x04,0xFF,0xFB,0xAC,0x93,0xFF,0xEE,0x00,0x05,
0x00,0x01,0x7F,0x7D,0x59,0xCE,0x30,0x00,0xFF,0x9F,0xA8,0x02,0xFF,0xFD,0x00,0x02,
0x40,0x00,0xF7,0x7A,0x7D,0xB0,0x00,0x02,0xDF,0x97,0xAC,0x83,0x3F,0xF5,0x80,0x01,
0x00,0x00,0xFF,0xBD,0x5E,0xE2,0x00,0x02,0x8F,0xD5,0x2D,0x01,0xEB,0xF2,0xC0,0x01,
0x00,0x00,0xFF,0xFD,0x7D,0xD0,0x00,0x00,0xB7,0xDD,0x28,0x00,0xFF,0xFD,0x40,0x00,
0x00,0x00,0x7F,0xFD,0x3E,0xC0,0x00,0x00,0x97,0xB5,0x68,0x80,0xE7,0xFA,0xA0,0x00,
0x00,0x00,0x7F,0xFB,0x2E,0xE1,0xF8,0x00,0x08,0x27,0x48,0x08,0xE7,0xF6,0x80,0x00,
0x00,0x00,0x3B,0xFF,0xBE,0x73,0xFA,0x00,0x06,0xF5,0x68,0x08,0xE7,0x38,0xC0,0x00,
0x00,0x00,0x39,0xFE,0x97,0x37,0xE4,0x00,0x00,0x06,0xC9,0x1E,0xEF,0x72,0x00,0x10,
0x00,0x00,0x0D,0xFB,0xDF,0x9F,0xE4,0x00,0x00,0x06,0xCA,0x2C,0xBE,0x72,0x00,0x54,
0x00,0x00,0x04,0xFD,0xDF,0xDF,0xF4,0x00,0x00,0x05,0xD8,0x07,0x57,0x70,0x01,0x54,
0x00,0x40,0x02,0x7F,0xEB,0xF5,0xFC,0x00,0x00,0x06,0x9A,0x40,0xE6,0x70,0x00,0xAA,
0xA1,0x40,0x01,0x1F,0xF7,0xED,0x08,0x00,0x00,0x07,0xDA,0xC0,0xE6,0xF0,0x00,0xD5,
0x00,0xC0,0x00,0x01,0xFF,0xF4,0xC8,0x00,0x00,0x07,0xD1,0x80,0x62,0xF2,0x00,0x6A,
0x2A,0xA0,0x00,0x03,0xEF,0xF1,0xF0,0x00,0x00,0x05,0x5A,0xC0,0xC7,0xF0,0x00,0x2A,
0x43,0xA0,0x00,0x02,0xF6,0xF8,0x00,0x00,0x00,0x05,0xB6,0xC0,0xC7,0xB0,0x00,0x1A,
0x12,0xC0,0x18,0x02,0x7B,0x78,0x00,0x00,0x00,0x0B,0xDC,0x40,0xC7,0x30,0x02,0x14,
0x09,0xD4,0xD0,0x12,0x7E,0xD8,0x00,0x00,0x00,0x0B,0x5C,0x60,0x47,0x30,0x00,0x00,
0x0A,0x51,0x61,0x63,0x5B,0x7C,0x00,0x00,0x00,0x17,0x58,0x60,0xC6,0x30,0x00,0x00,
0x02,0xB2,0xC1,0x63,0x7B,0xAC,0x00,0x00,0x00,0x15,0xB8,0x20,0x4A,0x31,0x00,0x00,
0x06,0x43,0x03,0x41,0x3B,0xF6,0x00,0x01,0x80,0x27,0x78,0x30,0xDE,0x31,0x00,0x00,
0x41,0xC2,0x83,0xD1,0x3F,0xEE,0x00,0x0D,0x00,0x0B,0x70,0x38,0x58,0x31,0x00,0x00,
0xA2,0xC6,0x85,0x09,0xFB,0xEF,0x00,0x10,0x00,0x0A,0xB0,0x1D,0x72,0x35,0x04,0x01,
0x42,0x46,0x4E,0x30,0xBB,0xFD,0x80,0x00,0x00,0x07,0x70,0x0F,0xC6,0x76,0x85,0x55,
0x82,0xA2,0xB5,0x80,0xDB,0xD5,0xC0,0x03,0x00,0x16,0xF0,0x02,0xC4,0x25,0x82,0x28,
0x00,0xA1,0xD4,0x00,0x7E,0xDE,0xE0,0x00,0x00,0x16,0xF0,0x00,0x46,0xBA,0x81,0xD4,
0x0C,0x56,0x58,0x00,0x37,0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F4,0xF3,0xEB,0x7F,0x00,0xA4,0x7B,0xC8,0x00,0x69,0x24,0x14,0x16,
0x00,0x0F,0x81,0x55,0x5B,0xFB,0x7F,0x01,0x38,0xDB,0xC0,0x00,0x25,0x24,0x04,0x1F,
0x01,0x1B,0x07,0xD9,0xB1,0xF5,0x7F,0x01,0x7E,0xDB,0xC0,0x00,0x21,0x44,0x04,0x0A,
};//128*64 逐行式图片;
/******************************************************************
延时子程序
*****************************************************************/
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=124;y>0;y--);
}
void delay_100us(uchar z)
{
z=z*16;
while(z--);
}
/*********************************************************************
写入指令和数据
************************************************************************/
void wr_data(uchar b) //写数据 ;
{
uchar i;
CS=0;
CD=1;
for(i=0;i<8;i++)
{
b<<=1;
SDIN=CY;
SCLK=0;
SCLK=1;
}
_nop_();
CS=1;
}
void wr_com(uchar com) //写命令;
{
uchar i;
CS=0;
CD=0;
for(i=0;i<8;i++)
{
com<<=1;
SDIN=CY;
SCLK=0;
SCLK=1;
}
_nop_();
CS=1;
}
/*********************************************************************
转换程序 :
一个地址16位,4K模式只写5—6——5的各前4位,即一地址可写3个点;
b-->一字节数据,n-->一字节数据中要转换的位数;
************************************************************************/
void change(uchar b,uchar n)
{
uchar i;
n=n/2;
for(i=0;i<n;i++)
{
switch(b&0xc0)
{
case 0x00: RAM_data[i]=0x00;break;
case 0x40: RAM_data[i]=0x0f;break;
case 0x80: RAM_data[i]=0xf0;break;
case 0xc0: RAM_data[i]=0xff;break;
default: break;
}
b=b<<2;
wr_data(RAM_data[i]);
}
}
/*********************************************************************
地址定位;
col-->列(0~159列,我们从第0列开始);
row-->行地址(一地址3点;从第112个SEG 也即是从 25H开始)
************************************************************************/
void dot(uchar col,uchar row)
{
uchar temp1,temp2;
col=col+0x25;
temp1=col&0x0f;
temp2=col>>4&0x07;
wr_com(temp1|0x00);
wr_com(temp2|0x10);
temp1=row&0x0f;
temp2=row>>4;
wr_com(temp1|0x60);
wr_com(temp2|0x70);
}
/*********************************************************************
窗口设置;
a,b,c,d -->对应 左右上下 窗口,其中 ab是以地址为单位的;
************************************************************************/
void SET_AW(uchar a,uchar b,uchar c,uchar d)
{
a=a+0x25;
b=b+0x25;
wr_com(0xf4);
wr_com(a);
wr_com(0xf5);
wr_com(c);
wr_com(0xf6);
wr_com(b);
wr_com(0xf7);
wr_com(d);
}
/*********************************************************************
隔行 隔列 全屏 隔点 程序;
************************************************************************/
void all_screen(uchar b) //384*160的整个RAM清屏程序;
{
uchar i,j;
wr_com(0xf4);
wr_com(0x00);
wr_com(0xf6);
wr_com(0x7f);
wr_com(0xf5);
wr_com(0x00);
wr_com(0xf7);
wr_com(0xa0);
wr_com(0x00);
wr_com(0x10);
wr_com(0x60);
wr_com(0x70);
for(j=0;j<160;j++)
for(i=0;i<192;i++) wr_data(b);
}
void fill(uchar b) //160*160的显示区域清屏程序;00H=清屏,FFH=全屏,F0H=隔列;
{
uchar i,j,temp1,temp2;
temp1=LC*8/3;
if(LC*8%3) temp1++;
if(temp1%2) temp1++;
temp2=temp1*3/2;
SET_AW(0,temp1-1,0,159);
dot(0,0);
for(j=0;j<LF;j++)
for(i=0;i<temp2;i++) wr_data(b);
}
void fen_row(uchar b) //160*160的显示区域;FFH=隔行,F0H=隔点;
{
uchar i,j,temp1,temp2;
temp1=LC*8/3;
if(LC*8%3) temp1++;
if(temp1%2) temp1++;
temp2=temp1*3/2;
SET_AW(0,temp1-1,0,159);
dot(0,0);
for(j=0;j<LF;j++)
{
for(i=0;i<temp2;i++) wr_data(b);
b=~b;
}
}
/*********************************************************************
写入6*8字符;
x y-->行列地址;n首字符序号,end_n尾字符序号;
************************************************************************/
void word_68(uchar x,uchar y,uchar n) //6*8字符单个写;
{
uchar i;
SET_AW(x,x+1,y,y+7);
dot(x,y);
if(REV) {for(i=0;i<8;i++) change(~table_68[8*n+i],6);}
else {for(i=0;i<8;i++) change(table_68[8*n+i],6);}
}
void show_68(uchar x,uchar y,uchar n,uchar end_n)//写入y一串6*8字符,可自动换行;
{
uchar i;
for(i=n;i<=end_n;i++)
{
if(x>(LC*8-6)/3) {y=y+8;x=0;}
word_68(x,y,i);
x=x+2;
}
}
/*********************************************************************
写入16*12字符;
x y-->行列地址;n首字符序号,end_n尾字符序号;
************************************************************************/
void word_1216(uchar x,uchar y,uchar n) //12*16字符单个写;
{
uchar i;
SET_AW(x,x+3,y,y+15);
dot(x,y);
if(REV) {for(i=0;i<16;i++) {change(~table_1216[n][i*2],8);change(~table_1216[n][i*2+1],4);}}
else {for(i=0;i<16;i++) {change(table_1216[n][i*2],8); change(table_1216[n][i*2+1],4);}}
}
void show_1216(uchar x,uchar y,uchar n,uchar end_n)//写入y一串12*16字符,可自动换行;
{
uchar i;
for(i=n;i<=end_n;i++)
{
if(x>(LC*8-12)/3) {y=y+15;x=0;}
word_1216(x,y,i);
x=x+4;
}
}
/*********************************************************************
写入36*24字符;
x y-->行列地址;n首字符序号,end_n尾字符序号;
************************************************************************/
void word_3624(uchar x,uchar y,uchar n) //36*24字符单个写;
{
uchar i;
SET_AW(x,x+11,y,y+24);
dot(x,y);
for(i=0;i<120;)
{
change(table_3624[n][i++],8);change(table_3624[n][i++],8);
change(table_3624[n][i++],8);change(table_3624[n][i++],8);
change(table_3624[n][i++],4);
}
}
void show_3624(uchar x,uchar y,uchar n,uchar end_n)//写入y一串36*24字符,可自动换行;
{
uchar i;
for(i=n;i<=end_n;i++)
{
if(x>(LC*8-36)/3) {y=y+24;x=0;}
word_3624(x,y,i);
x=x+12;
}
}
/*********************************************************************
初始化函数;
************************************************************************/
void init(void)
{
delay(50);
RES=0;delay(1);
RES=1;delay(1);
delay(160);
//设置温度补偿;
wr_com(0x25); /* -0.05/度 */
//RAM地图设置;
wr_com(0xc4); /* XY正向 LC0=0 */
//设置行周期;
wr_com(0xa1); /*10.4 KLP S 65HZ */
//设置颜色模式;
wr_com(0xd5); /* 4K */
//设置偏压比;
wr_com(0xe9); /* 1/10 */
// 设置对比度;
wr_com(0x81);
wr_com(0xbf); /* BFH */
//VCC来源;
wr_com(0x2b); /* 内部 */
//设置地址增加形式;
wr_com(0x89); /* 先左右;R+1;到窗口右边界时R +1 or -1 */
//占空比;
wr_com(0xf1);
wr_com(0x9f); /* 160 */
//设置波形反显;
wr_com(0xc8);
wr_com(0x10);
//设置颜色形式;
wr_com(0xd1); /* RGB */
//窗口内外部选择;
wr_com(0xf8); /* 窗口内填数据 */
//起始行设置;
wr_com(0x40|0x00);
wr_com(0x50|0x00); /* 起始行为0行 */
all_screen(0x00);
//开显示;
wr_com(0xad); /* 开显示, ON/OFF 模式 ,绿色不加强 */
}
main()
{
init();
while(1)
{
fill(0xF0); delay(1000);
fill(0xff); delay(1000);
fill(0x00); delay(1000);
fen_row(0xff);delay(1000);
fen_row(0xf0);delay(1000);
fill(0x00);
REV=1;
show_68(15,145,0,11);
REV=0;
show_3624(3,12,0,3);
show_1216(15,53,0,26); delay(1000);
}
}
#include <string.h>
#include <intrins.h>
#include <math.h>
#define uchar unsigned char
#define uint unsigned int
#define LC 20
#define LF 160
#define DATA P1
sbit SCLK =P3^0;
sbit SDIN =P3^1;
sbit CD =P3^3;
sbit CS =P3^4;
sbit RES =P3^5;
uchar RAM_data[4];
uchar rd_RAM[3];
uchar REV=0;
uchar code table_68[]={
//Q(0) Q(1) :(2) 1(3) 0(4) 4(5) 8(6) 5(7) 8(8) 5(9) 3(10)
0x00,0x00,0x70,0x88,0x88,0xE8,0x70,0x18,/*"Q",0*/
0x00,0x00,0x70,0x88,0x88,0xE8,0x70,0x18,/*"Q",1*/
0x00,0x00,0x00,0x20,0x00,0x00,0x20,0x00,/*":",2*/
0x00,0x00,0x20,0x60,0x20,0x20,0x70,0x00,/*"1",3*/
0x00,0x00,0x70,0x88,0x88,0x88,0x70,0x00,/*"0",4*/
0x00,0x00,0x30,0x50,0x90,0x78,0x10,0x00,/*"4",5*/
0x00,0x00,0xF8,0x88,0x70,0x88,0x78,0x00,/*"8",6*/
0x00,0x00,0xF8,0x80,0xF8,0x88,0x70,0x00,/*"5",7*/
0x00,0x00,0xF8,0x88,0x70,0x88,0x78,0x00,/*"8",8*/
0x00,0x00,0xF8,0x80,0xF8,0x88,0x70,0x00,/*"5",9*/
0x00,0x00,0x78,0xB0,0x08,0x88,0x70,0x00,/*"3",10*/
}; //逐行,宋体,水平字节,顺向;
uchar code table_1216[][32]={
0x00,0x00,0x00,0x00,0x00,0x00,0xF7,0x70,0x66,0x20,0x66,0x40,0x66,0x40,0x37,0x40,0x3F,0x40,0x3B,0x80,0x3B,0x80,0x3B,0x80,0x11,0x00,0x11,0x00,0x00,0x00,0x00,0x00,/*"W",0*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x10,0x60,0x3F,0xE0,0x30,0x00,0x30,0x00,0x18,0x20,0x0F,0xC0,0x00,0x00,0x00,0x00,/*"e",1*/
0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x3F,0xC0,0x00,0x00,0x00,0x00,/*"l",2*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x30,0x40,0x1F,0x80,0x00,0x00,0x00,0x00,/*"c",3*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x30,0xC0,0x60,0x60,0x60,0x60,0x60,0x60,0x30,0xC0,0x1F,0x80,0x00,0x00,0x00,0x00,/*"o",4*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xE0,0x66,0x60,0x66,0x60,0x66,0x60,0x66,0x60,0x66,0x60,0xF7,0x70,0x00,0x00,0x00,0x00,/*"m",5*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x10,0x60,0x3F,0xE0,0x30,0x00,0x30,0x00,0x18,0x20,0x0F,0xC0,0x00,0x00,0x00,0x00,/*"e",6*/
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,/*" ",7*/
0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xE0,0x86,0x10,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x0F,0x00,0x00,0x00,0x00,0x00,/*"T",8*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x30,0xC0,0x60,0x60,0x60,0x60,0x60,0x60,0x30,0xC0,0x1F,0x80,0x00,0x00,0x00,0x00,/*"o",9*/
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,/*" ",10*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF7,0xB0,0x63,0x20,0x77,0x20,0x35,0xC0,0x39,0xC0,0x39,0xC0,0x10,0x80,0x00,0x00,0x00,0x00,/*"w",11*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF7,0xB0,0x63,0x20,0x77,0x20,0x35,0xC0,0x39,0xC0,0x39,0xC0,0x10,0x80,0x00,0x00,0x00,0x00,/*"w",12*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF7,0xB0,0x63,0x20,0x77,0x20,0x35,0xC0,0x39,0xC0,0x39,0xC0,0x10,0x80,0x00,0x00,0x00,0x00,/*"w",13*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0x00,0x00,/*".",14*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x0C,0x00,0x7F,0x80,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x40,0x07,0x80,0x00,0x00,0x00,0x00,/*"t",15*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xE0,0x30,0x20,0x38,0x00,0x0F,0x80,0x00,0xE0,0x20,0x60,0x3F,0xC0,0x00,0x00,0x00,0x00,/*"s",16*/
0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x3F,0xC0,0x00,0x00,0x00,0x00,/*"i",17*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x77,0x80,0x38,0xC0,0x30,0xC0,0x30,0xC0,0x30,0xC0,0x30,0xC0,0x79,0xE0,0x00,0x00,0x00,0x00,/*"n",18*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xF0,0x30,0xC0,0x30,0xC0,0x1F,0x80,0x30,0x00,0x1F,0xC0,0x60,0x60,0x60,0x60,0x3F,0xC0,/*"g",19*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x0C,0x00,0x7F,0x80,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x40,0x07,0x80,0x00,0x00,0x00,0x00,/*"t",20*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x10,0x60,0x3F,0xE0,0x30,0x00,0x30,0x00,0x18,0x20,0x0F,0xC0,0x00,0x00,0x00,0x00,/*"e",21*/
0x00,0x00,0x00,0x00,0x10,0x00,0x70,0x00,0x30,0x00,0x30,0x00,0x30,0x00,0x33,0xC0,0x31,0x00,0x36,0x00,0x3A,0x00,0x31,0x00,0x30,0x80,0x79,0xE0,0x00,0x00,0x00,0x00,/*"k",22*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0x00,0x00,/*".",23*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x30,0x40,0x1F,0x80,0x00,0x00,0x00,0x00,/*"c",24*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x30,0xC0,0x60,0x60,0x60,0x60,0x60,0x60,0x30,0xC0,0x1F,0x80,0x00,0x00,0x00,0x00,/*"o",25*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xE0,0x66,0x60,0x66,0x60,0x66,0x60,0x66,0x60,0x66,0x60,0xF7,0x70,0x00,0x00,0x00,0x00,/*"m",26*/
}; //逐行,宋体,水平字节,顺向;
uchar code table_3624[][120]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,0x1C,0x00,0x00,0x03,0x80,0x1F,0xC0,0x00,0x01,0xE1,0xF8,0x00,0x00,0x00,0x40,
0x08,0x00,0x00,0x00,0x00,0x3F,0x80,0x00,0x00,0x00,0xC8,0x00,0x00,0x1C,0x00,0x08,0xFF,0xC0,0x0E,0x03,0xFF,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x01,0x3F,0xC0,
0x00,0x00,0x21,0xC0,0xC0,0x00,0x00,0x40,0x80,0xC0,0x00,0x00,0x80,0xF8,0xC0,0x00,0x01,0x80,0x80,0xC0,0x00,0x03,0x00,0xBC,0xC0,0x00,0x07,0x01,0xC0,0xC0,0x00,0x0E,
0x01,0x80,0xC0,0x00,0x06,0x01,0x80,0xC0,0x00,0x00,0x01,0x83,0xC0,0x00,0x00,0x00,0x01,0xC0,0x00,0x00,0x00,0x00,0x80,0x00,/*"清",0*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x00,0x0E,0x00,0x00,0x03,0xC0,0x0E,0x00,0x00,0x00,0xE0,0x0C,0x00,0x00,0x00,0x60,
0x0C,0x00,0x00,0x00,0x00,0x0F,0xFC,0x00,0x00,0x03,0xFE,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x03,0xC0,0x18,0x00,0x00,0x0C,0xC0,0x1E,0x00,0x00,0x00,0x80,0x33,0x80,
0x00,0x01,0x00,0x60,0xE0,0x00,0x01,0x80,0xC0,0x70,0x00,0x00,0xC1,0x80,0x38,0x00,0x00,0xC2,0x00,0x10,0x00,0x00,0x4C,0x00,0x00,0x00,0x1F,0xFE,0x00,0x00,0x00,0x00,
0x01,0xFF,0x07,0xE0,0x00,0x00,0x0F,0xFF,0x80,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"达",1*/
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0xC1,0xE0,0x00,0x00,0x70,
0xC3,0x80,0x00,0x00,0x38,0xCC,0x00,0x00,0x00,0x18,0xC0,0x00,0x00,0x00,0x00,0xC0,0x60,0x00,0x00,0x00,0xFF,0xF8,0x00,0x01,0xFF,0x20,0x00,0x00,0x03,0x86,0x38,0x00,
0x00,0x00,0x06,0x38,0x00,0x00,0x00,0x0E,0x30,0x00,0x00,0x00,0x1C,0x30,0x00,0x80,0x00,0x38,0x30,0x00,0xC0,0x00,0x70,0x30,0x00,0xC0,0x00,0xC0,0x30,0x00,0xC0,0x03,
0x80,0x18,0x01,0xE0,0x0C,0x00,0x0F,0xFF,0xC0,0x30,0x00,0x03,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"光",2*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x03,
0x02,0x00,0x00,0x00,0x03,0xFF,0xC0,0x00,0x07,0xFF,0x01,0xC0,0x00,0x03,0x03,0x01,0x80,0x00,0x03,0x03,0x01,0x80,0x00,0x03,0x9F,0xE3,0x80,0x00,0x01,0x83,0x03,0x00,
0x00,0x01,0x83,0x03,0x00,0x00,0x01,0x83,0x3F,0x00,0x00,0x00,0xFF,0xC6,0x00,0x00,0x00,0x83,0x00,0x06,0x00,0x00,0x03,0x00,0x06,0x00,0x00,0x03,0x00,0x06,0x00,0x00,
0x01,0x80,0x1F,0x00,0x00,0x00,0xFF,0xFE,0x00,0x00,0x00,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"电",3*/
};//逐行,楷体,水平字节,顺向;
uchar code BMP[]={
0x00,0x00,0x2D,0xF5,0xFA,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0xDE,0x77,0xB0,0x00,0x4C,0xD4,0xAD,0x8F,0xEA,0x06,0xDF,0xB8,0x01,
0x00,0x00,0x9B,0x9C,0xB7,0x50,0x00,0x18,0x90,0xA9,0x2F,0xF8,0xBE,0xBF,0xF8,0x00,
0x00,0x01,0x4A,0x9E,0x7B,0x28,0x00,0x18,0x92,0x1C,0x8F,0x8D,0xB5,0xDF,0xB0,0x01,
0x00,0x00,0xFE,0xBA,0xF7,0xA4,0x00,0x20,0x80,0x9D,0x8F,0x04,0x3F,0xBF,0xE0,0x02,
0x00,0x00,0xB3,0x3A,0x7B,0xB2,0x00,0x00,0xA0,0x19,0xA2,0x06,0x7F,0x7F,0x80,0x01,
0x00,0x01,0x7F,0x5C,0xFA,0x91,0x00,0x00,0x8F,0x89,0x8C,0x27,0x7F,0xFF,0x00,0x02,
0x00,0x00,0x97,0x3A,0x5B,0xD0,0x00,0x00,0x3F,0xF2,0xA4,0x43,0xFD,0xFF,0x00,0x00,
0x00,0x00,0x9F,0x5A,0x7B,0x48,0x40,0x04,0xFF,0xFB,0xAC,0x93,0xFF,0xEE,0x00,0x05,
0x00,0x01,0x7F,0x7D,0x59,0xCE,0x30,0x00,0xFF,0x9F,0xA8,0x02,0xFF,0xFD,0x00,0x02,
0x40,0x00,0xF7,0x7A,0x7D,0xB0,0x00,0x02,0xDF,0x97,0xAC,0x83,0x3F,0xF5,0x80,0x01,
0x00,0x00,0xFF,0xBD,0x5E,0xE2,0x00,0x02,0x8F,0xD5,0x2D,0x01,0xEB,0xF2,0xC0,0x01,
0x00,0x00,0xFF,0xFD,0x7D,0xD0,0x00,0x00,0xB7,0xDD,0x28,0x00,0xFF,0xFD,0x40,0x00,
0x00,0x00,0x7F,0xFD,0x3E,0xC0,0x00,0x00,0x97,0xB5,0x68,0x80,0xE7,0xFA,0xA0,0x00,
0x00,0x00,0x7F,0xFB,0x2E,0xE1,0xF8,0x00,0x08,0x27,0x48,0x08,0xE7,0xF6,0x80,0x00,
0x00,0x00,0x3B,0xFF,0xBE,0x73,0xFA,0x00,0x06,0xF5,0x68,0x08,0xE7,0x38,0xC0,0x00,
0x00,0x00,0x39,0xFE,0x97,0x37,0xE4,0x00,0x00,0x06,0xC9,0x1E,0xEF,0x72,0x00,0x10,
0x00,0x00,0x0D,0xFB,0xDF,0x9F,0xE4,0x00,0x00,0x06,0xCA,0x2C,0xBE,0x72,0x00,0x54,
0x00,0x00,0x04,0xFD,0xDF,0xDF,0xF4,0x00,0x00,0x05,0xD8,0x07,0x57,0x70,0x01,0x54,
0x00,0x40,0x02,0x7F,0xEB,0xF5,0xFC,0x00,0x00,0x06,0x9A,0x40,0xE6,0x70,0x00,0xAA,
0xA1,0x40,0x01,0x1F,0xF7,0xED,0x08,0x00,0x00,0x07,0xDA,0xC0,0xE6,0xF0,0x00,0xD5,
0x00,0xC0,0x00,0x01,0xFF,0xF4,0xC8,0x00,0x00,0x07,0xD1,0x80,0x62,0xF2,0x00,0x6A,
0x2A,0xA0,0x00,0x03,0xEF,0xF1,0xF0,0x00,0x00,0x05,0x5A,0xC0,0xC7,0xF0,0x00,0x2A,
0x43,0xA0,0x00,0x02,0xF6,0xF8,0x00,0x00,0x00,0x05,0xB6,0xC0,0xC7,0xB0,0x00,0x1A,
0x12,0xC0,0x18,0x02,0x7B,0x78,0x00,0x00,0x00,0x0B,0xDC,0x40,0xC7,0x30,0x02,0x14,
0x09,0xD4,0xD0,0x12,0x7E,0xD8,0x00,0x00,0x00,0x0B,0x5C,0x60,0x47,0x30,0x00,0x00,
0x0A,0x51,0x61,0x63,0x5B,0x7C,0x00,0x00,0x00,0x17,0x58,0x60,0xC6,0x30,0x00,0x00,
0x02,0xB2,0xC1,0x63,0x7B,0xAC,0x00,0x00,0x00,0x15,0xB8,0x20,0x4A,0x31,0x00,0x00,
0x06,0x43,0x03,0x41,0x3B,0xF6,0x00,0x01,0x80,0x27,0x78,0x30,0xDE,0x31,0x00,0x00,
0x41,0xC2,0x83,0xD1,0x3F,0xEE,0x00,0x0D,0x00,0x0B,0x70,0x38,0x58,0x31,0x00,0x00,
0xA2,0xC6,0x85,0x09,0xFB,0xEF,0x00,0x10,0x00,0x0A,0xB0,0x1D,0x72,0x35,0x04,0x01,
0x42,0x46,0x4E,0x30,0xBB,0xFD,0x80,0x00,0x00,0x07,0x70,0x0F,0xC6,0x76,0x85,0x55,
0x82,0xA2,0xB5,0x80,0xDB,0xD5,0xC0,0x03,0x00,0x16,0xF0,0x02,0xC4,0x25,0x82,0x28,
0x00,0xA1,0xD4,0x00,0x7E,0xDE,0xE0,0x00,0x00,0x16,0xF0,0x00,0x46,0xBA,0x81,0xD4,
0x0C,0x56,0x58,0x00,0x37,0xFB,0xF0,0x00,0x00,0x25,0xE0,0x00,0xC4,0xD6,0x82,0x02,
0x9D,0xAD,0xE1,0x00,0x3B,0xF1,0xFC,0x00,0x00,0x4E,0xF0,0x00,0x46,0xAE,0x41,0x00,
0xA9,0xB3,0x06,0x80,0x2F,0xF0,0xF7,0x00,0x00,0x8D,0x68,0x00,0xD6,0xED,0xC0,0x00,
0xDA,0x64,0x03,0x50,0x2D,0x78,0xFF,0x00,0x01,0x0E,0xEE,0x00,0x57,0xAE,0x40,0x00,
0xB4,0x90,0x0B,0xC1,0x2A,0xF8,0xBE,0x00,0x02,0x0D,0xEF,0x00,0xF9,0xAB,0xA0,0x04,
0x67,0x30,0x3E,0x7F,0x3C,0xF0,0xBE,0x00,0x0C,0x4A,0xEC,0x02,0xDF,0xAF,0x60,0x08,
0xDC,0x40,0x01,0xBE,0x36,0xF8,0xFF,0x00,0x38,0x0D,0xF8,0x03,0x17,0xF8,0xA0,0x0A,
0x31,0x80,0x01,0xFE,0xEA,0xF8,0x6F,0x00,0x59,0x1E,0xE0,0x01,0xBD,0x6A,0x90,0x08,
0x42,0x00,0x0D,0x3B,0x7A,0xE8,0xFF,0x00,0x10,0x39,0xC0,0x80,0xB7,0xC9,0x50,0x00,
0x8C,0x0A,0xFC,0x3F,0xFC,0xE8,0x7F,0x00,0x3D,0xFD,0xE2,0x00,0x6D,0xD6,0x90,0x00,
0x20,0x2F,0xF3,0x1B,0x7B,0xEC,0x7F,0x00,0x3F,0xD5,0xC0,0x00,0x7D,0x89,0x48,0x15,
0x70,0x00,0x71,0x5F,0x78,0x94,0x7F,0x00,0x74,0xDD,0xE4,0x00,0x5D,0x84,0xA8,0x2B,
0xE0,0x00,0x07,0x96,0xB3,0xB6,0xFF,0x00,0xA1,0xDB,0xC0,0x03,0x46,0xAD,0xA8,0x0A,
0x80,0x00,0x1B,0x1E,0xFC,0x2B,0x7F,0x00,0xA7,0x59,0xE0,0x00,0x43,0x42,0x08,0x1E,
0x00,0x09,0x60,0xF4,0xF3,0xEB,0x7F,0x00,0xA4,0x7B,0xC8,0x00,0x69,0x24,0x14,0x16,
0x00,0x0F,0x81,0x55,0x5B,0xFB,0x7F,0x01,0x38,0xDB,0xC0,0x00,0x25,0x24,0x04,0x1F,
0x01,0x1B,0x07,0xD9,0xB1,0xF5,0x7F,0x01,0x7E,0xDB,0xC0,0x00,0x21,0x44,0x04,0x0A,
};//128*64 逐行式图片;
/******************************************************************
延时子程序
*****************************************************************/
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=124;y>0;y--);
}
void delay_100us(uchar z)
{
z=z*16;
while(z--);
}
/*********************************************************************
写入指令和数据
************************************************************************/
void wr_data(uchar b) //写数据 ;
{
uchar i;
CS=0;
CD=1;
for(i=0;i<8;i++)
{
b<<=1;
SDIN=CY;
SCLK=0;
SCLK=1;
}
_nop_();
CS=1;
}
void wr_com(uchar com) //写命令;
{
uchar i;
CS=0;
CD=0;
for(i=0;i<8;i++)
{
com<<=1;
SDIN=CY;
SCLK=0;
SCLK=1;
}
_nop_();
CS=1;
}
/*********************************************************************
转换程序 :
一个地址16位,4K模式只写5—6——5的各前4位,即一地址可写3个点;
b-->一字节数据,n-->一字节数据中要转换的位数;
************************************************************************/
void change(uchar b,uchar n)
{
uchar i;
n=n/2;
for(i=0;i<n;i++)
{
switch(b&0xc0)
{
case 0x00: RAM_data[i]=0x00;break;
case 0x40: RAM_data[i]=0x0f;break;
case 0x80: RAM_data[i]=0xf0;break;
case 0xc0: RAM_data[i]=0xff;break;
default: break;
}
b=b<<2;
wr_data(RAM_data[i]);
}
}
/*********************************************************************
地址定位;
col-->列(0~159列,我们从第0列开始);
row-->行地址(一地址3点;从第112个SEG 也即是从 25H开始)
************************************************************************/
void dot(uchar col,uchar row)
{
uchar temp1,temp2;
col=col+0x25;
temp1=col&0x0f;
temp2=col>>4&0x07;
wr_com(temp1|0x00);
wr_com(temp2|0x10);
temp1=row&0x0f;
temp2=row>>4;
wr_com(temp1|0x60);
wr_com(temp2|0x70);
}
/*********************************************************************
窗口设置;
a,b,c,d -->对应 左右上下 窗口,其中 ab是以地址为单位的;
************************************************************************/
void SET_AW(uchar a,uchar b,uchar c,uchar d)
{
a=a+0x25;
b=b+0x25;
wr_com(0xf4);
wr_com(a);
wr_com(0xf5);
wr_com(c);
wr_com(0xf6);
wr_com(b);
wr_com(0xf7);
wr_com(d);
}
/*********************************************************************
隔行 隔列 全屏 隔点 程序;
************************************************************************/
void all_screen(uchar b) //384*160的整个RAM清屏程序;
{
uchar i,j;
wr_com(0xf4);
wr_com(0x00);
wr_com(0xf6);
wr_com(0x7f);
wr_com(0xf5);
wr_com(0x00);
wr_com(0xf7);
wr_com(0xa0);
wr_com(0x00);
wr_com(0x10);
wr_com(0x60);
wr_com(0x70);
for(j=0;j<160;j++)
for(i=0;i<192;i++) wr_data(b);
}
void fill(uchar b) //160*160的显示区域清屏程序;00H=清屏,FFH=全屏,F0H=隔列;
{
uchar i,j,temp1,temp2;
temp1=LC*8/3;
if(LC*8%3) temp1++;
if(temp1%2) temp1++;
temp2=temp1*3/2;
SET_AW(0,temp1-1,0,159);
dot(0,0);
for(j=0;j<LF;j++)
for(i=0;i<temp2;i++) wr_data(b);
}
void fen_row(uchar b) //160*160的显示区域;FFH=隔行,F0H=隔点;
{
uchar i,j,temp1,temp2;
temp1=LC*8/3;
if(LC*8%3) temp1++;
if(temp1%2) temp1++;
temp2=temp1*3/2;
SET_AW(0,temp1-1,0,159);
dot(0,0);
for(j=0;j<LF;j++)
{
for(i=0;i<temp2;i++) wr_data(b);
b=~b;
}
}
/*********************************************************************
写入6*8字符;
x y-->行列地址;n首字符序号,end_n尾字符序号;
************************************************************************/
void word_68(uchar x,uchar y,uchar n) //6*8字符单个写;
{
uchar i;
SET_AW(x,x+1,y,y+7);
dot(x,y);
if(REV) {for(i=0;i<8;i++) change(~table_68[8*n+i],6);}
else {for(i=0;i<8;i++) change(table_68[8*n+i],6);}
}
void show_68(uchar x,uchar y,uchar n,uchar end_n)//写入y一串6*8字符,可自动换行;
{
uchar i;
for(i=n;i<=end_n;i++)
{
if(x>(LC*8-6)/3) {y=y+8;x=0;}
word_68(x,y,i);
x=x+2;
}
}
/*********************************************************************
写入16*12字符;
x y-->行列地址;n首字符序号,end_n尾字符序号;
************************************************************************/
void word_1216(uchar x,uchar y,uchar n) //12*16字符单个写;
{
uchar i;
SET_AW(x,x+3,y,y+15);
dot(x,y);
if(REV) {for(i=0;i<16;i++) {change(~table_1216[n][i*2],8);change(~table_1216[n][i*2+1],4);}}
else {for(i=0;i<16;i++) {change(table_1216[n][i*2],8); change(table_1216[n][i*2+1],4);}}
}
void show_1216(uchar x,uchar y,uchar n,uchar end_n)//写入y一串12*16字符,可自动换行;
{
uchar i;
for(i=n;i<=end_n;i++)
{
if(x>(LC*8-12)/3) {y=y+15;x=0;}
word_1216(x,y,i);
x=x+4;
}
}
/*********************************************************************
写入36*24字符;
x y-->行列地址;n首字符序号,end_n尾字符序号;
************************************************************************/
void word_3624(uchar x,uchar y,uchar n) //36*24字符单个写;
{
uchar i;
SET_AW(x,x+11,y,y+24);
dot(x,y);
for(i=0;i<120;)
{
change(table_3624[n][i++],8);change(table_3624[n][i++],8);
change(table_3624[n][i++],8);change(table_3624[n][i++],8);
change(table_3624[n][i++],4);
}
}
void show_3624(uchar x,uchar y,uchar n,uchar end_n)//写入y一串36*24字符,可自动换行;
{
uchar i;
for(i=n;i<=end_n;i++)
{
if(x>(LC*8-36)/3) {y=y+24;x=0;}
word_3624(x,y,i);
x=x+12;
}
}
/*********************************************************************
初始化函数;
************************************************************************/
void init(void)
{
delay(50);
RES=0;delay(1);
RES=1;delay(1);
delay(160);
//设置温度补偿;
wr_com(0x25); /* -0.05/度 */
//RAM地图设置;
wr_com(0xc4); /* XY正向 LC0=0 */
//设置行周期;
wr_com(0xa1); /*10.4 KLP S 65HZ */
//设置颜色模式;
wr_com(0xd5); /* 4K */
//设置偏压比;
wr_com(0xe9); /* 1/10 */
// 设置对比度;
wr_com(0x81);
wr_com(0xbf); /* BFH */
//VCC来源;
wr_com(0x2b); /* 内部 */
//设置地址增加形式;
wr_com(0x89); /* 先左右;R+1;到窗口右边界时R +1 or -1 */
//占空比;
wr_com(0xf1);
wr_com(0x9f); /* 160 */
//设置波形反显;
wr_com(0xc8);
wr_com(0x10);
//设置颜色形式;
wr_com(0xd1); /* RGB */
//窗口内外部选择;
wr_com(0xf8); /* 窗口内填数据 */
//起始行设置;
wr_com(0x40|0x00);
wr_com(0x50|0x00); /* 起始行为0行 */
all_screen(0x00);
//开显示;
wr_com(0xad); /* 开显示, ON/OFF 模式 ,绿色不加强 */
}
main()
{
init();
while(1)
{
fill(0xF0); delay(1000);
fill(0xff); delay(1000);
fill(0x00); delay(1000);
fen_row(0xff);delay(1000);
fen_row(0xf0);delay(1000);
fill(0x00);
REV=1;
show_68(15,145,0,11);
REV=0;
show_3624(3,12,0,3);
show_1216(15,53,0,26); delay(1000);
}
}
上一篇:HG1286412B演示程序
下一篇:HG3202407演示程序