发个我们的历程你看看吧……
/***************************************
*型号:VS12864G-1
*芯片:89S52(11.0592M)
*编写:Nicker
*日期:2008/9/18
*修改:2009/8/23
*
***************************************/
#include <reg52.h>
#define uint unsigned int
#define uchar unsigned char
#define disp_off 0x3e
#define disp_on 0x3f
#define disp_x 0xb8
#define disp_z 0xc0
#define disp_y 0x40
#define comm 0
#define dat 1
#define data_ora P1 //MCU P1<------> LCM
sbit rs =P3^0; //Data or Instrument Select,H:写数据,L:写指令
sbit rw =P3^1; //Write or Read,H:read,L:write
sbit e =P3^2; //读写使能
sbit cs1=P3^3; //cs1=H,选择左半屏
sbit cs2=P3^4; //cs2=H,选择右半屏
sbit rst=P3^5; //Lcm reset,低有效
sbit bf =P1^7;
sbit res=P1^4;
void chk_busy (void);
unsigned char code pic1[]={
0x07,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,0xF0,
0xF8,0x7C,0xFC,0xF8,0xF0,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0xF8,0xF8,0xF8,0xF8,0xF8,
0xF8,0xC0,0x00,0xC0,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0x18,0xDC,0xDC,0xDC,0xDC,
0xDC,0xDC,0x00,0x00,0x00,0x00,0x80,0x80,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,
0xC0,0xC0,0x80,0x80,0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x80,0x00,0x80,0xC0,0xC0,
0xC0,0xC0,0xC0,0x80,0x00,0x40,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x07,
0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,0xF0,0xF8,0x7C,0x3E,0x1F,0x0F,0x07,0x03,0x01,
0x00,0x00,0x00,0x01,0x03,0x07,0x8F,0xDF,0xFF,0xFE,0xFC,0x7C,0x3E,0x1F,0x0F,0x07,
0x0F,0x1E,0x3C,0x78,0xF0,0xE0,0xC0,0x80,0x00,0x00,0x00,0x03,0x0F,0x3F,0x7F,0xFF,
0xFF,0xFF,0xF8,0xFF,0xFF,0xFF,0xFF,0x3F,0x0F,0x03,0x00,0x00,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xCD,0xED,0xED,0xEF,0xEF,
0xEF,0xEF,0xEF,0xEF,0x6F,0x01,0x0F,0x7F,0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,0xFF,0xFF,
0x3F,0xFF,0xFF,0xFF,0xFC,0xFE,0xFF,0xFF,0xFF,0x7F,0x0F,0x01,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x02,0x07,0x0F,0x1F,0x3F,0x7F,0xFC,0xF8,0xF0,0xE0,0xC0,0x80,0x00,0x00,
0x00,0x00,0x00,0x00,0x06,0x8F,0xDF,0xFF,0xFF,0xF9,0xF0,0xE0,0xC0,0x80,0x00,0x00,
0x00,0x80,0xC0,0xE0,0xF0,0x79,0x3F,0x1F,0x0F,0x06,0xE0,0xE0,0xF8,0xF8,0xF8,0xF9,
0xF9,0xB9,0xB9,0xB9,0xB9,0x79,0x78,0x78,0x78,0x70,0x60,0x00,0x01,0x01,0xF9,0xF9,
0xF9,0xF9,0xF8,0xF8,0xC0,0xC0,0xC0,0xC0,0xC1,0xC1,0xC1,0x81,0x01,0x01,0x81,0xC1,
0xC1,0xC1,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC1,0xC1,0xC1,0xC1,0x81,0x81,0x01,0x00,
0x00,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC0,0xC0,0xC0,0x00,0x00,0x00,0xC0,
0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x80,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x07,0x0F,0x1F,0x3F,0x7E,
0xFC,0xF8,0xFC,0x7E,0x3F,0x1F,0x0F,0x07,0x03,0x01,0x01,0x03,0x07,0x0F,0x1F,0x1E,
0x0F,0x07,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0xE3,0xE3,0xE7,0xE7,0xEF,0xEF,
0xEF,0xEF,0xCF,0xCF,0xDF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0x7C,0x00,0x00,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0x03,0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0xF9,0xFD,
0xFD,0xFD,0xFD,0xFD,0xFD,0xCD,0xEF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,
0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0x07,0x07,0x07,0x07,0x07,0x00,0x00,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xF7,0xE3,0xE3,0xF7,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
0x00,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,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x81,0x81,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x01,
0x01,0x01,0x01,0x01,0x00,0x00,0x01,0x01,0x01,0x01,0x81,0x81,0x80,0x00,0x00,0x01,
0x01,0x01,0x41,0xC1,0xC1,0xC1,0x01,0x01,0x00,0x01,0x01,0x01,0x01,0x01,0x00,0x00,
0x00,0x01,0x01,0xC1,0xC1,0xC1,0x81,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0xCF,
0x0F,0x0F,0x0F,0x0F,0x0F,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xE0,0x7C,0x7F,0x7F,0xBF,0xB2,
0xB0,0xB0,0x94,0x9C,0xBC,0xFC,0xF8,0xF0,0xF8,0xEC,0xEF,0xCF,0xC7,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x1E,0xFE,0xFE,0xF2,0xB3,0x9B,0x9B,
0x9B,0x9B,0x8B,0xCB,0xFF,0xFF,0x7F,0x0F,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x80,0x80,0x08,0x8C,0x8C,0xFE,0xFF,0xFF,0xC7,0xE3,0x63,0xC8,0x88,
0x98,0x98,0x98,0x0F,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,
0xC0,0xC0,0xC0,0xE1,0xFF,0xFF,0x6F,0x60,0x20,0x20,0x60,0x60,0xF0,0xFF,0xFF,0x3F,
0x38,0x18,0x18,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x2F,0x37,0x33,0x33,0xFF,0xFF,0x7F,0x19,
0x99,0x09,0x01,0xCF,0xFF,0x7C,0x7C,0x04,0xFE,0xFF,0x07,0x03,0x00,0x00,0x80,0xC0,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x70,0xF0,0xE0,0xE1,0xE5,0xFD,0xFC,0x38,
0x03,0xFB,0xFF,0xFF,0x61,0x71,0x7E,0x3E,0x1C,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x80,0x83,0xC1,0xE3,0x7B,0x3D,0x1F,0xBF,0xFF,0x7E,0x06,0x16,0x1E,0x18,0x18,
0x19,0x19,0x1D,0xFC,0xFF,0xFF,0x06,0x06,0x06,0x06,0x06,0x04,0x00,0x60,0xE0,0x60,
0x60,0x20,0x38,0xF8,0xFF,0xFF,0x06,0x02,0x04,0x1C,0x3C,0x76,0xE6,0xE7,0xFF,0x7F,
0x3F,0x0F,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xE0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x1F,0x1F,0x0F,0x07,0x0B,
0x0D,0x0E,0x07,0x03,0x01,0x00,0x00,0x00,0x07,0x0F,0x1E,0x1C,0x1C,0x1C,0x0F,0x0F,
0x0F,0x04,0x00,0x00,0x08,0x18,0x18,0x1C,0x1C,0x08,0x0D,0x0C,0x0F,0x0F,0x0F,0x0C,
0x0C,0x07,0x07,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x0C,0x00,0x00,0x00,
0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x1F,0x0F,0x0C,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x03,0x3F,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x08,0x1C,0x3F,0x3F,0x1F,0x08,0x0C,0x0C,0x0E,0x06,0x06,0x03,0x03,0x01,0x03,
0x03,0x0F,0x1E,0x1E,0x1C,0x1C,0x1C,0x18,0x08,0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,
};
unsigned char code pic2[]={
0x80,0x60,0xDE,0x48,0x48,0x48,0x00,0xF2,0x14,0x18,0x10,0x18,0x16,0xF0,0x00,0x00,
0x00,0x00,0x00,0x7C,0x54,0xD4,0x54,0x54,0x54,0xD4,0x54,0x7C,0x00,0x00,0x00,0x00,
0x20,0x24,0x24,0xE4,0xFC,0xA2,0x22,0x00,0x44,0x98,0x00,0x00,0xFE,0x00,0x00,0x00,
0x10,0x10,0x10,0xFE,0x90,0x50,0x00,0x90,0x90,0x90,0xFE,0x90,0x90,0x90,0x10,0x00,
0x00,0x08,0x08,0x88,0xC8,0x68,0x58,0x4E,0x48,0x48,0x48,0xC8,0x08,0x08,0x08,0x00,
0xFC,0x04,0x64,0x9C,0x04,0x00,0xFC,0x94,0x94,0x94,0x94,0x94,0xFC,0x00,0x00,0x00,
0x00,0x00,0x00,0x80,0x60,0x1C,0x08,0x00,0x00,0x1C,0x20,0xC0,0x80,0x00,0x00,0x00,
0x00,0x20,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x04,0x04,0xFC,0x00,0x00,
0x02,0x02,0xFF,0x42,0x22,0x92,0x80,0x41,0x31,0x0F,0x01,0x7F,0x81,0x81,0xF0,0x00,
0x40,0x42,0x44,0x58,0x40,0x7F,0x40,0x40,0x40,0x7F,0x50,0x48,0x46,0x40,0x40,0x00,
0x08,0x04,0x03,0x00,0xFF,0x00,0x09,0x08,0x08,0x05,0x04,0x04,0xFF,0x02,0x02,0x00,
0x02,0x82,0x01,0xFF,0x00,0x80,0x80,0x41,0x26,0x18,0x18,0x24,0x43,0xC0,0x40,0x00,
0x04,0x02,0x01,0x00,0xFF,0x12,0x12,0x12,0x52,0x92,0x92,0xFF,0x00,0x00,0x00,0x00,
0xFF,0x00,0x04,0x08,0x07,0x00,0xFF,0x80,0x41,0x06,0x18,0x24,0x42,0xC0,0x40,0x00,
0x00,0x02,0x41,0xE0,0x50,0x48,0x47,0x62,0x20,0x20,0x28,0xF0,0x61,0x03,0x01,0x00,
0x00,0x00,0x3F,0x09,0x09,0x09,0x09,0x09,0x09,0x1F,0x00,0x40,0x80,0x7F,0x00,0x00,
0x10,0xF0,0x10,0x10,0xD0,0x10,0x20,0x00,0x00,0xE0,0x10,0x10,0x10,0x10,0x70,0x00,
0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x10,0x11,0xF0,0x00,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0xF0,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,
0x40,0x7F,0x41,0x41,0x47,0x40,0x30,0x00,0x00,0x70,0x41,0x42,0x42,0x44,0x38,0x00,
0x00,0x00,0x00,0x61,0x61,0x00,0x00,0x00,0x1F,0x61,0x18,0x07,0x18,0x61,0x1F,0x01,
0x1F,0x61,0x18,0x07,0x18,0x61,0x1F,0x01,0x1F,0x61,0x18,0x07,0x18,0x61,0x1F,0x01,
0x00,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x41,0x41,0x7F,0x42,0x41,0x01,0x03,0x00,
0x00,0x41,0x63,0x5C,0x1D,0x63,0x41,0x00,0x00,0x40,0x40,0x7F,0x40,0x40,0x00,0x00,
0x00,0x1C,0x22,0x41,0x41,0x41,0x22,0x00,0x00,0x1C,0x22,0x41,0x41,0x21,0x7F,0x40,
0x00,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x22,0x41,0x41,0x41,0x22,0x00,
0x00,0x3E,0x41,0x41,0x41,0x41,0x3E,0x00,0x41,0x7F,0x41,0x01,0x7F,0x41,0x01,0x7E,
0x00,0xFC,0x84,0x84,0x44,0x3C,0x54,0x94,0x54,0x34,0x14,0x04,0x04,0xFC,0x00,0x00,
0x80,0x84,0x84,0xFC,0x84,0x84,0xFC,0x84,0x84,0x80,0x20,0x10,0xC8,0x8E,0x04,0x00,
0x00,0x00,0x00,0xC0,0x40,0x40,0x40,0x7E,0x48,0x48,0x48,0xE8,0x48,0x00,0x00,0x00,
0xFC,0x04,0x24,0x54,0x8C,0x10,0x90,0x70,0x1E,0xD0,0x10,0x10,0x10,0x10,0x00,0x00,
0x20,0xC2,0x0C,0xC0,0x30,0x08,0xC8,0x38,0x08,0xCA,0x7C,0x48,0x48,0xC8,0x08,0x00,
0x00,0x00,0x00,0x00,0xFC,0x54,0x54,0x54,0x54,0x54,0x54,0xFC,0x00,0x00,0x00,0x00,
0x20,0xA0,0xFE,0xA0,0x20,0x08,0xE8,0xA8,0xBE,0xA8,0xA8,0xBE,0xE8,0x08,0x00,0x00,
0x20,0x20,0xFE,0x20,0x20,0x00,0x10,0x10,0xFE,0x10,0x10,0x10,0xF0,0x00,0x00,0x00,
0x00,0xFF,0x84,0x84,0x82,0x82,0x91,0xE4,0xA9,0x81,0x82,0x86,0x82,0xFF,0x00,0x00,
0x00,0x80,0x60,0x1F,0x00,0x00,0xFF,0x00,0x08,0x84,0x42,0x21,0x11,0x1C,0x08,0x00,
0x00,0x80,0x60,0x0F,0x24,0xC4,0x04,0x14,0x24,0xC4,0x04,0x1F,0x20,0xC0,0x00,0x00,
0xFF,0x00,0x04,0x08,0x07,0x09,0x09,0x09,0x09,0xFF,0x09,0x09,0x09,0x09,0x08,0x00,
0x08,0x08,0xFE,0x01,0x02,0x01,0xFF,0x82,0x43,0x24,0x19,0x36,0xC3,0x80,0x80,0x00,
0x00,0xFE,0x4A,0x4A,0x4A,0x4A,0xFE,0x00,0x00,0xFE,0x4A,0x4A,0x4A,0x4A,0xFE,0x00,
0x06,0x01,0xFF,0x00,0x01,0x08,0x0B,0x8A,0x6A,0x1E,0x2A,0x4A,0xCB,0x88,0x88,0x00,
0x10,0x30,0x1F,0x08,0x0A,0x82,0x62,0x1A,0x07,0x0A,0x12,0x22,0x63,0xC2,0x42,0x00,
0x30,0x11,0x10,0xF0,0x10,0x10,0x30,0x00,0x10,0xF0,0x10,0x10,0xD0,0x11,0x20,0x00,
0x11,0xF0,0x10,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x80,0x80,0x00,0x00,0x00,
0x00,0xC0,0x20,0x10,0x10,0x20,0xC0,0x00,0x00,0xE0,0x10,0x10,0x10,0x10,0xE0,0x00,
0x01,0xC0,0x20,0x10,0x10,0x20,0xC0,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0xC0,0x21,0x10,0x10,0x30,0x01,0x00,0x00,0xE0,0x10,0x10,0x10,0x11,0xE0,0x00,
0x00,0xC0,0x20,0x10,0x10,0x30,0x00,0x00,0x00,0x20,0x20,0xF0,0x00,0x00,0x00,0x00,
0x00,0xC0,0x21,0x10,0x10,0x21,0xC1,0x00,0x00,0x00,0x80,0x40,0x20,0xF1,0x00,0x00,
0x00,0x60,0x10,0x10,0x11,0x90,0x60,0x00,0x00,0x70,0x10,0x10,0x90,0x70,0x10,0x00,
0x00,0x00,0x40,0x7F,0x40,0x00,0x00,0x00,0x40,0x7F,0x41,0x41,0x47,0x40,0x30,0x00,
0x40,0x7F,0x40,0x40,0x40,0x40,0x60,0x00,0x00,0x00,0x00,0x61,0x61,0x00,0x00,0x00,
0x00,0x1F,0x20,0x40,0x40,0x20,0x1F,0x00,0x00,0x60,0x50,0x48,0x44,0x43,0x60,0x00,
0x00,0x1F,0x20,0x40,0x40,0x20,0x1F,0x00,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x02,
0x00,0x1F,0x22,0x41,0x41,0x22,0x1C,0x00,0x00,0x60,0x50,0x48,0x44,0x43,0x60,0x00,
0x00,0x1F,0x22,0x41,0x41,0x22,0x1C,0x00,0x00,0x40,0x40,0x7F,0x40,0x40,0x00,0x00,
0x00,0x01,0x62,0x44,0x44,0x22,0x1F,0x00,0x00,0x0E,0x09,0x48,0x48,0x7F,0x48,0x00,
0x00,0x30,0x40,0x41,0x41,0x22,0x1C,0x00,0x00,0x00,0x00,0x7E,0x01,0x00,0x00,0x00,
};
/*---------------延时子程序----------------*/
void delay (uint us)
{
while(us--);
}
void delay1 (uint ms)
{
uint i,j;
for(i=0;i<ms;i++)
for(j=0;j<1000;j++)
;
}
/*------------写数据或命令到LCD--------------*/
void wr_lcd (uchar dat_comm,uchar content)
{
chk_busy ();
rs=dat_comm;
rw=0;
data_ora=content;
e=1;
;
e=0;
}
/*--------------读LCD数据---------------*/
uchar rd_lcd ()
{
uchar rddata;
chk_busy ();
rs=1;
rw=1;
e=1;
;
rddata=data_ora;
e=0;
return rddata;
}
void chk_busy (void)
{
data_ora=0xff;
rs=0;
rw=1;
;
e=1;
while(bf||res==1);
e=0;
}
/*--------------写点阵------------------*/
void lat_disp (uchar data1,uchar data2)
{
uchar i,j;
cs1=1;cs2=1;
wr_lcd (comm,disp_on);
for(j=0;j<8;j++)
{
wr_lcd (comm,disp_x+j);
wr_lcd (comm,disp_z);
wr_lcd (comm,disp_y);
for(i=0;i<32;i++)
{
wr_lcd (dat,data1);
wr_lcd (dat,data2);
}
}
}
/*--------------显示图片----------------*/
void img_disp (uchar code *img)
{
uchar i,j;
for(j=0;j<8;j++)
{
cs1=1;cs2=0;
wr_lcd (comm,disp_on);
wr_lcd (comm,disp_x+j);
wr_lcd (comm,disp_z);
wr_lcd (comm,disp_y);
for(i=0;i<64;i++)
wr_lcd (dat,img[j*128+i]);
cs1=0;cs2=1;
wr_lcd (comm,disp_on);
wr_lcd (comm,disp_x+j);
wr_lcd (comm,disp_z);
wr_lcd (comm,disp_y);
for(i=64;i<128;i++)
wr_lcd (dat,img[j*128+i]);
}
}
/*---指定位置(x,y)显示row_xl行(每行row_yl个)汉字(大小8xl*yl)---*/
void chn_disp (uchar x,uchar y,uchar xl,uchar yl,uchar row_xl,uchar row_yl,uchar code *chn)
{
uchar i,j,k,l,a;
wr_lcd (comm,disp_on);
for(l=0;l<row_xl;l++)
{
for(k=0;k<row_yl;k++)
{
for(j=0;j<xl;j++)
{
wr_lcd (comm,disp_x+x+l*xl+j);
wr_lcd (comm,disp_z);
wr_lcd (comm,disp_y+y+k*yl);
a=l*xl*yl*row_yl+k*xl*yl+j*yl;
for(i=0;i<yl;i++)
wr_lcd (dat,chn[a+i]);
}
}
}
}
/*------------------初始化-----------------*/
void init_lcd (void)
{
rst=0;
delay(50);
rst=1;
cs1=1;cs2=1;
wr_lcd (comm,disp_off);
wr_lcd (comm,disp_on);
}
/*------------------主程序--------------------*/
void main ()
{
init_lcd ();
while (1)
{
img_disp(pic1);
delay1 (400);
lat_disp (0xff,0x00);
delay1(400);
lat_disp (0x33,0x33);
delay1 (400);
img_disp(pic2);
delay1 (400);
}
}
|