ks010712864LCD显示程序(调试通过)

来源:本站
导读:目前正在解读《ks010712864LCD显示程序(调试通过)》的相关信息,《ks010712864LCD显示程序(调试通过)》是由用户自行发布的知识型内容!下面请观看由(电工技术网 - www.9ddd.net)用户发布《ks010712864LCD显示程序(调试通过)》的详细说明。

12864 ks0107 LCD显示程序(调试通过)

#include <reg51.h>
#include <intrins.h>
typedef unsigned char uchar; /*用typedef和下面的#define的定义方法都可以实现所需
要的定义。*/
typedef unsigned int uint;
/*#define uchar unsigned char*/
/*#define uint unsigned int*/
sbit L_DI = P3^7;
sbit L_RW = P3^6;
sbit L_E = P3^5;
sbit L_CS1 = P3^4;
sbit L_CS2 = P3^2;
sbit L_SET = P3^3;
/*sbit TEST = P3^5;*/
float abc;
uchar code X1[] = {
0x30,0x50,0xd0,0x90,0xf0,0x30,0x80,0x60,0x3c,0xe8,0x20,0xa0,0xe0,0x70
,0x00,0x00,
0x04,0x06,0x03,0x11,0x13,0x12,0x18,0x0c,0x07,0x01,0x03,0x06,0x0c,0x1c
,0x18,0x18
}; /*欢*/
uchar code X2[] = {
0x40,0x58,0x58,0xd0,0x10,0xf8,0x98,0x08,0x88,0xf8,0xf0,0x10,0xf8,0x70
,0x00,0x00,
0x0c,0x04,0x04,0x07,0x04,0x05,0x0d,0x0d,0x08,0x1f,0x1b,0x19,0x38,0x38
,0x18,0x18
}; /*迎*/
uchar code X3[] = {
0x30,0x30,0xf8,0xf8,0x08,0x10,0xd0,0x50,0x50,0xfc,0xfc,0x50,0xd0,0xf0
,0x10,0x00,
0x00,0x00,0x1f,0x1f,0x10,0x10,0x13,0x1b,0x0f,0x07,0x05,0x0d,0x09,0x19
,0x38,0x18
}; /*使*/
uchar code X4[] = {
0x00,0x00,0x00,0x00,0xfc,0xf8,0x48,0x48,0x48,0xf8,0xf8,0x48,0x48,0x48
,0xfc,0xf8,
0x10,0x10,0x18,0x1e,0x0f,0x01,0x01,0x01,0x01,0x3f,0x1f,0x01,0x01,0x01
,0x3f,0x3f
}; /*用*/
uchar code X5[] = {
0x18,0xfc,0x08,0x48,0x48,0xb8,0xd8,0x58,0xe8,0xb8,0xb8,0x08,0x08,0xf8
,0xf8,0x00,
0x00,0x1f,0x11,0x11,0x11,0x14,0x15,0x16,0x16,0x10,0x11,0x11,0x11,0x3f
,0x1f,0x00
}; /*图*/
uchar code X6[] = {
0xc0,0xc8,0xc8,0xf8,0xf8,0xc8,0xf8,0xf8,0xc8,0xc8,0x00,0x10,0x90,0xd8
,0x48,0x48,
0x18,0x18,0x0c,0x0f,0x03,0x00,0x1f,0x1f,0x10,0x10,0x11,0x19,0x18,0x0c
,0x04,0x06
}; /*形*/
uchar code X7[] = {
0x00,0x00,0x00,0xe0,0xe0,0x40,0x40,0x7c,0x7c,0x58,0x58,0x58,0xd0,0xd0
,0x00,0x00,
0x10,0x18,0x08,0x0d,0x03,0x19,0x0d,0x01,0x01,0x0d,0x19,0x01,0x07,0x0c
,0x18,0x38
}; /*点*/
uchar code X8[] = {
0x08,0xf8,0xf8,0x48,0xe8,0x98,0x90,0xd8,0xf0,0xbc,0xfc,0xd0,0x90,0x90
,0x90,0x10,
0x00,0x3f,0x1f,0x02,0x03,0x05,0x06,0x07,0x07,0x06,0x3f,0x3f,0x06,0x06
,0x04,0x04
}; /*阵*/
uchar code X9[] = {
0x10,0x08,0x1c,0xfe,0x00,0x00,0x00,0x00,0x00,0x30,0x08,0x04,0x04,0x98
,0xf0,0x00,
0x80,0x80,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0xa0,0xe0,0x90,0x8a,0x83
,0xc1,0x00
}; /*12*/
uchar code X10[] = {
0x00,0x78,0xc8,0x84,0x04,0x84,0xf8,0x00,0x00,0x80,0x80,0x00,0x00,0x00
,0x80,0x80,
0x00,0x78,0x84,0x83,0x83,0x8e,0xfc,0x40,0x00,0x80,0x63,0x17,0x1c,0xf2
,0xc1,0x80
}; /*8x*/
uchar code X11[] = {
0x00,0x80,0xe0,0x10,0x08,0x04,0x04,0x00,0x00,0x00,0x80,0x60,0x10,0xf8
,0x00,0x00,
0x00,0x7f,0xc2,0x81,0x81,0x81,0x7f,0x18,0x00,0x0e,0x09,0x08,0x08,0xff
,0x08,0x08
}; /*64*/
uchar code X12[] = {
0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa
,0x55,0xaa,
0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa
,0x55,0xaa
}; /*....*/
uchar code X13[] = {
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
,0xff,0xff
}; /*全黑*/
uchar code X14[] = {
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
}; /*全白*/
uchar code X15[]={
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01
,0x01,0x01,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00
}; /*上边*/
uchar code X16[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80
,0x80,0x80
}; /*下边*/
uchar code X17[]={
0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,
0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00
}; /*左边*/
uchar code X18[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0xff,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0xff
}; /*右边*/
uchar code X19[]={
0xff,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01
,0x01,0x01,
0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00
}; /*左上*/
uchar code X20[]={
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01
,0x01,0xff,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0xff
}; /*右上*/
uchar code X21[]={
0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,
0xff,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80
,0x80,0x80
}; /*左下*/
uchar code X22[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0xff,
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80
,0x80,0xff
}; /*右下*/
uchar code X23[]={
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
}; /*空白*/
#pragma REGISTERBANK(0)
void initcomm(void)
{
PCON = 0x80;TMOD = 0X21; SCON = 0X50;
TH1 = 0XFa;TL1 = 0XFa; TR1 = 1;ES = 1;
TH0 = 0;TL0 = 0;TR0 = 1; ET0 = 1;
EA =0;
}
void delay(void)
{
uchar i,j;
abc = 0.1*5;
for (i = 0;i != 0xff;i++)
for (j = 0;j != 0xff;j++) ;
}
void LCD_C_D(bit flag,uchar ldata) /*flag=1 con flag=0 data*/
{
uchar data i;
L_DI = !flag; L_E = 0; L_RW = 0; P0 = ldata;
_nop_();
L_E = 1;
_nop_(); _nop_();
L_E = 0; L_RW = 1; L_DI = 1;
for ( i = 0; i < 10 ;i++) ;
}

void dis_one_zi(uchar x_add,uchar y_add,uchar code *po)
{
uchar i,j,w;
j = x_add*2+0xb8;
w = (y_add < 4 ? y_add : y_add-4)*16+0x40;
L_CS1 = (y_add < 4);
L_CS2 = !(y_add < 4);
LCD_C_D(1,j);
LCD_C_D(1,w);
for (i = 0; i < 32;i++)
{
if (i == 16)
{
LCD_C_D(1,j+1);
LCD_C_D(1,w);
}
LCD_C_D(0,*po++);
}
L_CS1 = L_CS2 = 0;
}
void CLRLCD(uchar number)
{
uchar data i,j;
L_CS1 = L_CS2 = 1;
for (i = 0xb8; i < 0xc0;i++)
{
LCD_C_D(1,i);
LCD_C_D(1,0X40);
for (j = 0; j < 0x40; j++)
LCD_C_D(0,number);
}
L_CS1 = L_CS2 = 0;
}

void main(void) using 0
{
uchar data i,j,number;
uchar code *p;
initcomm();
L_SET = 0;
for ( j = 0; j != 0xff; j++);
L_SET = 1;
for ( j = 0; j != 0xff; j++);
LCD_C_D(1,0X3E); /**/
LCD_C_D(1,0XC0); /**/
LCD_C_D(1,0X3F); /**/
CLRLCD(0);
while(1)
{
CLRLCD(0);
LCD_C_D(1,0X3E);
p=X15;/*上下左右*/
for (number=1;number<7;number++)
{ dis_one_zi(0,number,p); }
p=X16;
for (number=1;number<7;number++)
{ dis_one_zi(3,number,p); }
p=X17;
for (number=1;number<3;number++)
{ dis_one_zi(number,0,p); }
p=X18;
for (number=1;number<3;number++)
{ dis_one_zi(number,7,p); }
/*四个角*/
p=X19; dis_one_zi(0,0,p);
p=X20; dis_one_zi(0,7,p);
p=X21; dis_one_zi(3,0,p);
p=X22; dis_one_zi(3,7,p);
/*欢迎使用*/
p=X1; dis_one_zi(1,1,p);
p=X2; dis_one_zi(1,2,p);
p=X3; dis_one_zi(1,3,p);
p=X4; dis_one_zi(1,4,p);
/*图形点阵*/
p=X5; dis_one_zi(2,5,p);
p=X6; dis_one_zi(2,6,p);
p=X7; dis_one_zi(1,5,p);
p=X8; dis_one_zi(1,6,p);
/*128X64*/
p=X9; dis_one_zi(2,1,p);
p=X10; dis_one_zi(2,2,p);
p=X11; dis_one_zi(2,3,p);
p=X23; dis_one_zi(2,4,p);

LCD_C_D(1,0X3F);
delay(); delay();
CLRLCD(0);
LCD_C_D(1,0X3E);
p=X12;
for (number=0;number<4;number++)
{
for (i = 0; i < 8;i++)
{ dis_one_zi(number,i,p); }
}
LCD_C_D(1,0X3F);
delay(); delay();
CLRLCD(0);
LCD_C_D(1,0X3E);
p=X13;
for (number=0;number<4;number++)
{
for (i = 0; i < 8;i++)
{ dis_one_zi(number,i,p); }
}
LCD_C_D(1,0X3F);
delay(); delay();
CLRLCD(0);
}
}

提醒:《ks010712864LCD显示程序(调试通过)》最后刷新时间 2024-03-14 01:23:24,本站为公益型个人网站,仅供个人学习和记录信息,不进行任何商业性质的盈利。如果内容、图片资源失效或内容涉及侵权,请反馈至,我们会及时处理。本站只保证内容的可读性,无法保证真实性,《ks010712864LCD显示程序(调试通过)》该内容的真实性请自行鉴别。