开发工具:
文件大小: 20kb
下载次数: 0
上传时间: 2013-12-03
详细说明: #include #include #define uchar unsigned char #define uint unsigned int /************* 12864LCD引脚定义 *************/ #define LCD_data P0 //数据口 sbit LCD_RS = P2^0; //寄存器选择输入 sbit LCD_RW = P2^1; //液晶读/写控制 sbit LCD_EN = P2^2; //液晶使能控制 sbit LCD_PSB = P2^3; //串/并方式控制 sbit LCD_RST = P2^5; //液晶复位端口 #define delayNOP(); {_nop_();_nop_();_nop_();_nop_();}; /*********************************************************/ uchar code DIS1[] = {" 伟纳电子 &quo t;}; uchar code DIS2[] = {" ME500开发系统 "}; uchar code DIS3[] = {" www.willar.com "}; uchar code DIS4[] = {"TEL:077584867757"}; /*********************************************************/ uchar code Photo1[] ={ //伟纳电子 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x80,0x00,0x00,0x40,0x00,0x00,0x00,0x08,0x10,0x00,0x00,0x02,0x00,0x02,0x00,0x01, 0x80,0x00,0x3F,0x87,0xE2,0x04,0x80,0x88,0x11,0xE1,0xFF,0x1A,0x41,0xFC,0x10,0x41, 0x88,0xBE,0x05,0x01,0x0A,0x1F,0xE0,0x88,0x11,0x20,0x48,0x12,0x40,0x28,0x13,0xF1, 0x88,0xA0,0x09,0x81,0x0A,0x12,0x20,0x88,0x3D,0x20,0x48,0x3F,0xF0,0x4C,0x2C,0x81, 0x8D,0xA0,0x1E,0x02,0xCA,0x1F,0xE0,0xF6,0x11,0x20,0x48,0x04,0x00,0xF0,0x39,0x21, 0x8D,0xBC,0x08,0xC2,0x4A,0x12,0x20,0x80,0x19,0x23,0xFF,0x07,0xE0,0x46,0x13,0xF1, 0x8A,0xA0,0x3F,0xE5,0x4A,0x1F,0xE0,0xFC,0x35,0x20,0x48,0x0A,0x41,0xFF,0x21,0x41, 0x8A,0xA0,0x02,0x40,0xCA,0x02,0x00,0x84,0x31,0x20,0x48,0x1A,0x40,0x12,0x39,0x41, 0x8A,0xA0,0x12,0xC0,0x82,0x3F,0xF1,0x04,0x12,0x20,0x88,0x31,0x80,0x96,0x01,0x41, 0x8A,0xBE,0x62,0x61,0x02,0x02,0x01,0x04,0x12,0x31,0x88,0x23,0xC3,0x13,0x3D,0x51, 0x80,0x00,0x06,0x02,0x06,0x02,0x03,0x04,0x16,0x31,0x08,0x1C,0x30,0x30,0x06,0x71, 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x01, 0x80,0x1F,0x87,0xE0,0xFC,0x00,0x18,0x60,0x00,0x83,0x00,0x02,0x00,0x01,0xFF,0x81, 0x80,0x1F,0x87,0xE0,0xFC,0x00,0x77,0xFE,0x01,0x83,0x00,0xFF,0xF8,0x03,0x83,0x81, 0x80,0x1F,0x87,0xE0,0xFC,0x01,0xF4,0x60,0x02,0x3F,0xF0,0xE6,0x18,0x00,0x1E,0x01, 0x80,0x1F,0xC3,0xE0,0xFC,0x01,0xB3,0xFE,0x0C,0xDB,0x30,0xC6,0x18,0x00,0x0C,0x01, 0x80,0x1F,0xC3,0xE0,0xFF,0x80,0x34,0x60,0x0F,0x93,0x30,0xFF,0xF8,0x1F,0xFF,0xF9, 0x80,0x1F,0xC3,0xE7,0xFF,0xE0,0x37,0xFF,0x82,0x13,0x30,0xC6,0x18,0x1E,0x0C,0xF9, 0x80,0x1F,0xC3,0xFF,0xFF,0xE0,0x3E,0x61,0x87,0x97,0xB0,0x7F,0xF8,0x00,0x0C,0x01, 0x80,0x0F,0xC3,0xF8,0x78,0x70,0x30,0x63,0x06,0x1C,0xF0,0x7A,0x10,0x00,0x0C,0x01, 0x80,0x0F,0xCF,0xF0,0x78,0x70,0x30,0x6E,0x01,0xF8,0x30,0x03,0x00,0x80,0x0C,0x01, 0x80,0x0F,0xFF,0xF0,0x78,0x60,0x30,0x70,0x3E,0x30,0x30,0x03,0xFF,0x80,0x1C,0x01, 0x80,0x0F,0xFD,0xF0,0x38,0xE0,0x30,0x60,0x10,0xE0,0x30,0x01,0xFF,0x01,0xF8,0x01, 0x80,0x07,0xF1,0xF0,0x39,0xE0,0x20,0x60,0x00,0x00,0x00,0x00,0x3E,0x00,0x70,0x01, 0x80,0x07,0xE1,0xF0,0x3B,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x80,0x0F,0xE1,0xF8,0x3B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x80,0x1F,0xE0,0xF8,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x80,0x3F,0xF0,0xF8,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x80,0x77,0xF0,0xF8,0x3C,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF1, 0x81,0xC7,0xF0,0xF8,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x81,0xC3,0xF0,0xF9,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x83,0x83,0xF0,0xFF,0xD0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x87,0x03,0xF0,0xFF,0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x8E,0x03,0xF0,0xFE,0x10,0x00,0x00,0x00,0x00,0x01,0x24,0x00,0x00,0x00,0x00,0x01, 0x8E,0x01,0xF0,0xFC,0x10,0x00,0x00,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x00,0x01, 0x8C,0x01,0xF3,0xFC,0x00,0x11,0x88,0xC4,0x44,0x45,0x24,0x71,0x43,0x0E,0x2C,0xC1, 0x9C,0x01,0xFF,0xFC,0x00,0x11,0x88,0xC4,0x44,0x45,0x24,0x89,0x84,0x91,0x33,0x21, 0x9E,0x01,0xFF,0xFC,0x00,0x0A,0x55,0x2A,0x82,0xA9,0x24,0x09,0x04,0x11,0x22,0x21, 0x8F,0xFF,0xF8,0x7C,0x00,0x0A,0x55,0x2A,0x82,0xA9,0x24,0x79,0x04,0x11,0x22,0x21, 0x83,0xFF,0xF8,0x7E,0x00,0x0A,0x55,0x2A,0x82,0xA9,0x24,0x89,0x04,0x11,0x22,0x21, 0x80,0x01,0xFC,0x7E,0x00,0x04,0x22,0x11,0x01,0x11,0x24,0x99,0x04,0x91,0x22,0x21, 0x80,0x00,0xFC,0x7E,0x00,0x04,0x22,0x11,0x11,0x11,0x24,0x69,0x23,0x0E,0x22,0x21, 0x80,0x00,0xFC,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x80,0x00,0xFC,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, }; /******************************************************************************/ uchar code Photo2[] ={ //海豚戏水 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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x7F,0x00,0x00,0x00,0x03,0xFE,0x00,0x00,0x00,0x00,0x02,0x00,0x76,0x00,0x00, 0x00,0xC3,0xFF,0x00,0x00,0x3F,0xE7,0xE0,0x00,0x00,0x00,0x03,0x00,0xFF,0x80,0x00, 0x00,0x81,0xFF,0xFE,0x00,0x7C,0x03,0xF0,0x00,0x00,0x00,0x01,0xF7,0xCB,0xF8,0x00, 0x01,0x83,0xF8,0x7B,0x00,0x40,0x00,0x30,0x00,0x00,0x00,0x00,0x3F,0xC0,0xF8,0x00, 0x03,0x1E,0x3C,0x01,0x80,0x60,0x00,0x30,0x00,0x00,0x00,0x00,0x01,0x40,0x18,0x00, 0x03,0x30,0x0C,0x01,0xE0,0x6C,0x00,0x70,0x00,0x00,0x00,0x00,0x01,0x7C,0xCC,0x00, 0x03,0x24,0x6F,0x31,0x20,0x7C,0x40,0x60,0x00,0x00,0x00,0x00,0x01,0x97,0xFC,0x00, 0x01,0xBF,0xFB,0xF3,0xE0,0x3F,0xE7,0xC0,0x00,0x00,0x00,0x00,0x01,0xFB,0x1C,0x00, 0x00,0x9B,0xC2,0x1F,0x00,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x0C,0xFE,0x00, 0x00,0xCC,0x36,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xB8,0x00, 0x00,0x7E,0x7E,0x00,0x00,0x00,0x00,0x00,0x1F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x07,0xE0,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0x80,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0xE0,0x03,0xFF,0xE0,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x1F,0x00,0x00,0x78,0x01,0xC0,0x00,0x00,0x70,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x20,0x80,0x00,0xF8,0x01,0x80,0x00,0x00,0x30,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x2E,0x80,0x00,0xD8,0x03,0x60,0x00,0x01,0xF8,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x2A,0x80,0x00,0x98,0x02,0x60,0x00,0x00,0xC0,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x2E,0x80,0x01,0x98,0x03,0xE0,0xC0,0x00,0x60,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x20,0x83,0xFF,0x8C,0x07,0xE1,0xC8,0x00,0x30,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x1F,0x7F,0x07,0x8C,0x0F,0xFF,0x8C,0x00,0x18,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0xB8,0x0F,0xCC,0x1F,0x83,0x8F,0x00,0x18,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x39,0xC0,0x38,0xFE,0x1E,0x00,0x8F,0xC0,0x0C,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x3B,0x80,0x70,0x1E,0x00,0x00,0xCC,0xF0,0x0C,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x76,0x00,0xC0,0x00,0x00,0x00,0x6E,0x3C,0x06,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x7E,0x01,0x80,0x00,0x00,0x00,0x3F,0x0E,0x06,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0xDC,0x03,0x00,0x00,0x00,0x00,0x1F,0x03,0x82,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0xD8,0x06,0x00,0x00,0x00,0x00,0x00,0x01,0xC2,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0xC0,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0xC2,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x80,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x62,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0xC0,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0xC0,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x26,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x80,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x6C,0x00,0x00,0x00,0x00, 0xFF,0xFF,0xFF,0x80,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xEF,0xFF,0xFF,0xFE,0x00, 0x00,0x00,0x01,0x80,0x30,0x00,0x00,0x00,0x00,0x00,0x3F,0xD8,0x00,0x00,0x00,0x00, 0x3E,0x00,0x01,0x80,0x60,0x00,0x00,0x00,0x07,0xE0,0x3D,0xF0,0x01,0xF0,0x0C,0x00, 0xFF,0x80,0x01,0x80,0x6C,0x00,0x00,0x00,0x3E,0xF0,0x2C,0x60,0x07,0xFF,0xFC,0x00, 0x81,0xF8,0x71,0x01,0xDC,0x03,0xFC,0x00,0xF3,0xFF,0x87,0xE0,0x06,0x07,0xE0,0x00, 0x00,0x3F,0xE1,0x03,0xFC,0x0F,0x1F,0x87,0xC2,0x00,0x04,0xE0,0x00,0x00,0x00,0x00, 0x00,0x00,0x03,0x00,0x0C,0x1C,0x03,0xFF,0x00,0x00,0x01,0xE0,0x7F,0x03,0xF0,0x00, 0x00,0x00,0x03,0x00,0x18,0x10,0x00,0x00,0x00,0x00,0x01,0xC1,0xF3,0xF7,0x3C,0x00, 0xFF,0xC0,0x0F,0x02,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x7E,0x0E,0x00, 0xE1,0xFF,0xFF,0x03,0xF0,0x00,0x00,0x00,0x00,0x03,0xF8,0x7C,0x00,0x00,0x02,0x00, 0x00,0x01,0xE3,0x03,0xC0,0x00,0x03,0xFF,0x00,0x0F,0x1F,0xE0,0x00,0x00,0x00,0x00, 0x00,0x00,0x03,0x01,0x00,0x00,0x0F,0x03,0xF0,0x3C,0x00,0x00,0x00,0x00,0x00,0x00, 0x03,0xFC,0x03,0x01,0x0F,0x00,0x0C,0x00,0x7F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00, 0x0F,0x0F,0x8D,0x01,0x3F,0xE0,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x1C,0x01,0xFD,0x81,0x30,0x7C,0x03,0xC0,0xFE,0x00,0x00,0x00,0x04,0x00,0x00,0x00, 0x18,0x00,0x01,0xBF,0x00,0x0F,0xFF,0x07,0xC7,0xE0,0x00,0x00,0x1C,0x00,0x00,0x00, 0x00,0x00,0x00,0xFF,0x80,0x01,0xF8,0x3E,0x00,0x78,0x0F,0xF0,0x78,0x00,0x00,0x00, 0x00,0x0F,0x00,0x7F,0x83,0x80,0x3F,0xF1,0xF8,0x1E,0x1C,0x7F,0xE0,0x07,0xE0,0x00, 0x00,0x1F,0xE0,0x3F,0xDF,0xFE,0x00,0x07,0x9F,0x83,0xF0,0x00,0x00,0x1C,0x7C,0x00, 0x00,0x78,0x70,0x1F,0xD0,0x07,0xC0,0x3C,0x01,0xF8,0x03,0xC0,0x00,0x18,0x00,0x00, 0xFF,0xE0,0x1F,0x73,0xE0,0x00,0xFF,0xE0,0x00,0x1F,0xFF,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x07,0xE1,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x0F,0x80,0x00,0xE1,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x7F,0xE0,0x00,0x07,0x9E,0x00,0x7F,0xC0,0x60,0x0F,0xC0,0x0F,0x00,0x00,0x00, 0x00,0xE0,0x7C,0x00,0x03,0xF7,0xC7,0xE0,0xFF,0xE0,0x3F,0xFF,0xFC,0x00,0x00,0x00, 0x01,0xC0,0x0F,0x00,0x03,0xBD,0xFE,0xFC,0x00,0x00,0xF0,0x1F,0xF0,0x00,0xC6,0x00, }; /*******************************************************************/ /* */ /* 延时函数 */ /* */ /*******************************************************************/ void delay(int ms) { while(ms--) { uchar i; for(i=0;i<250;i++) { _nop_(); _nop_(); _nop_(); _nop_(); } } } /*******************************************************************/ /* */ /* 延时函数 */ /* */ /*******************************************************************/ void delay1(int ms) { while(ms--) { uchar y; for(y=0;y<100;y++) ; } } /*******************************************************************/ /* */ /*检查LCD忙状态 */ /*lcd_busy为1时,忙,等待。lcd-busy为0时,闲,可写指令与数据。 */ /* */ /*******************************************************************/ bit lcd_busy() { bit result; LCD_RS = 0; LCD_RW = 1; LCD_EN = 1; delayNOP(); result = (bit)(P0&0x80); LCD_EN = 0; return(result); } /*******************************************************************/ /* */ /*写指令数据到LCD */ /*RS=L,RW=L,E=高脉冲,D0-D7=指令码。 */ /* */ /*******************************************************************/ void lcd_wcmd(uchar cmd) { while(lcd_busy()); LCD_RS = 0; LCD_RW = 0; LCD_EN = 0; _nop_(); _nop_(); P0 = cmd; delayNOP(); LCD_EN = 1; delayNOP(); LCD_EN = 0; } /*******************************************************************/ /* */ /*写显示数据到LCD */ /*RS=H,RW=L,E=高脉冲,D0-D7=数据。 */ /* */ /*******************************************************************/ void lcd_wdat(uchar dat) { while(lcd_busy()); LCD_RS = 1; LCD_RW = 0; LCD_EN = 0; P0 = dat; delayNOP(); LCD_EN = 1; delayNOP(); LCD_EN = 0; } /*******************************************************************/ /* */ /* LCD初始化设定 */ /* */ /*******************************************************************/ void lcd_init() { LCD_PSB = 1; //并口方式 LCD_RST = 0; //液晶复位 delay(3); LCD_RST = 1; delay(3); lcd_wcmd(0x34); //扩充指令操作 delay(5); lcd_wcmd(0x30); //基本指令操作 delay(5); lcd_wcmd(0x0C); //显示开,关光标 delay(5); lcd_wcmd(0x01); //清除LCD的显示内容 delay(5); } /*********************************************************/ /* */ /* 设定显示位置 */ /* */ /*********************************************************/ void lcd_pos(uchar X,uchar Y) { uchar pos; if (X==1) {X=0x80;} else if (X==2) {X=0x90;} else if (X==3) {X=0x88;} else if (X==4) {X=0x98;} pos = X+Y ; lcd_wcmd(pos); //显示地址 } /********************************************************* * * * 闪烁函数 * * * *********************************************************/ void lcdflag() { lcd_wcmd(0x08); delay(400); lcd_wcmd(0x0c); delay(400); lcd_wcmd(0x08); delay(400); lcd_wcmd(0x0c); delay(400); lcd_wcmd(0x08); delay(200); lcd_wcmd(0x0c); delay(5); lcd_wcmd(0x01); delay(5); } /********************************************************* * * * 图形显示 * * * *********************************************************/ void photodisplay(uchar *bmp) { uchar i,j; lcd_wcmd(0x34); //写数据时,关闭图形显示 for(i=0;i<32;i++) { lcd_wcmd(0x80+i); //先写入水平坐标值 lcd_wcmd(0x80); //写入垂直坐标值 for(j=0;j<16;j++) //再写入两个8位元的数据 lcd_wdat(*bmp++); delay1(1); } for(i=0;i<32;i++) { lcd_wcmd(0x80+i); lcd_wcmd(0x88); for(j=0;j<16;j++) lcd_wdat(*bmp++); delay1(1); } lcd_wcmd(0x36); //写完数据,开图形显示 } /********************************************************* * * * 清屏函数 * * * *********************************************************/ void clr_screen() { lcd_wcmd(0x34); //扩充指令操作 delay(5); lcd_wcmd(0x30); //基本指令操作 delay(5); lcd_wcmd(0x01); //清屏 delay(5); } /********************************************************** ; 显示字符表代码 **********************************************************/ void bytecode() { uchar s; clr_screen(); //清屏 lcd_wcmd(0x80); //设置显示位置为第一行 for(s=0;s<16;s++) { lcd_wdat(0x30+s); } lcd_wcmd(0x90); //设置显示位置为第二行 for(s=0;s<16;s++) { lcd_wdat(0x40+s); } lcd_wcmd(0x88); //设置显示位置为第三行 for(s=0;s<16;s++) { lcd_wdat(0x50+s); } lcd_wcmd(0x98); //设置显示位置为第四行 for(s=0;s<16;s++) { lcd_wdat(0x60+s); } } /********************************************************* * * * 主函数 * * * *********************************************************/ void main() { uchar i; delay(100); //上电,等待稳定 lcd_init(); //初始化LCD while(1) { lcd_pos(1,0); //设置显示位置为第一行 for(i=0;i<16;i++) { lcd_wdat(DIS1[i]); delay(30); } lcd_pos(2,0); //设置显示位置为第二行 for(i=0;i<16;i++) { lcd_wdat(DIS2[i]); delay(30); } lcd_pos(3,0); //设置显示位置为第三行 for(i=0;i<16;i++) { lcd_wdat(DIS3[i]); delay(30); } lcd_pos(4,0); //设置显示位置为第四行 for(i=0;i<16;i++) { lcd_wdat(DIS4[i]); delay(30); } delay(1000); lcdflag(); clr_screen(); //清屏 photodisplay(Photo1); //显示图片1 delay(2000); clr_screen(); //清屏 photodisplay(Photo2); //显示图片2 delay(2000); bytecode(); //显示字符表代码 delay(2000); clr_screen(); } } /*********************************************************/ ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.