液晶C程序

合集下载

12864液晶显示C语言程序设计实例

12864液晶显示C语言程序设计实例

本文由g_olivebranch贡献 #include <reg51.h> #include sbit RS = P2^5; sbit RW = P2^6; sbit E = P2^7; sbit RES = P3^5; #define Lcd_Bus P0 //MCU P1<> LCM #define FIRST_ADDR 0 //定义字符/汉字显示起始位置 unsigned char code zk[]={ 0x08,0x20,0x1c,0x10,0x1c,0x1c,0xff,0x9e,0x7f,0x1e,0x1c,0x1f,0x3e,0x1f,0x3e,0x1f, 0x77,0x1f,0x41,0x3f,0x00,0x7e,0x00,0xfe,0x83,0xfc,0x7f,0xf8,0x3f,0xf0,0x0f,0xc0, }; unsigned char code BMP1[]={ /*-- 调入了一幅图像:D:\3033B\3033.bmp --*/ /*-- 宽度x高度=128x64 --*/ /*--总共52行数据,每行16个数据--*/ 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, 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x0C,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x08,0x00,0x00,0x00,0x00,0x00,0x07,0xF1,0x00,0x03,0x01,0x00,0xF0,0x00,0x00,0x00, 0x18,0x00,0x00,0x00,0x00,0x00,0x04,0x01,0x00,0x03,0x81,0x08,0x98,0x00,0x00,0x00, 0x10,0x1F,0x07,0x06,0x00,0x00,0x08,0x01,0x00,0x04,0x81,0x11,0x88,0x00,0x00,0x00, 0x10,0x21,0x0D,0x83,0xE3,0xC0,0x0F,0x02,0x00,0x04,0xC1,0x31,0x30,0x00,0x00,0x00, 0x10,0x21,0x18,0x83,0x06,0x40,0x09,0x82,0x00,0x0F,0xC1,0x21,0xE0,0x00,0x00,0x00, 0x10,0x2E,0x11,0x86,0x06,0x40,0x00,0x86,0x00,0x08,0x43,0xC3,0xE0,0x00,0x00,0x00, 0x30,0x30,0x11,0x86,0x04,0x40,0x41,0x84,0x10,0x18,0x63,0x82,0x18,0x00,0x00,0x00, 0x20,0x1E,0x1F,0x84,0x04,0x60,0x7E,0x04,0x08,0x10,0x23,0x04,0x0E,0x00,0x00,0x00, 0x3F,0x83,0x00,0xE0,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,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,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x38,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x6C,0x3C,0x00,0x20,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x42,0x22,0x03,0xFD,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x40,0x62,0x00,0x22,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x46,0x42,0x00,0x22,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x44,0x42,0x00,0x23,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x7C,0x26,0x00,0x2D,0xB0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x0C,0x3C,0x00,0x38,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x04,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x06,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x02,0x30,0x00,0x00,0x00,0x00,0x00,0x01,0xF0,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x01,0xE0,0x00,0x00,0x00,0x00,0x00,0x03,0x18,0x08,0x0C,0x30,0xF1,0x08,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x08,0x08,0x0C,0x31,0x91,0x08,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x08,0x08,0x1A,0x71,0x01,0x08,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x08,0x13,0xD1,0x01,0x08,0x00, 0x00,0x00,0x08,0x11,0x0A,0x00,0x20,0x20,0x04,0x04,0x18,0x11,0x91,0x01,0x08,0x00, 0x00,0x00,0x04,0x11,0x12,0x31,0x22,0x20,0x04,0x04,0x10,0x11,0x13,0x01,0x08,0x00, 0x00,0x00,0x02,0x1B,0x92,0x31,0x26,0x20,0x04,0x04,0x10,0x10,0x12,0x01,0x08,0x00, 0x3F,0xFF,0xFF,0x0A,0x91,0x73,0x25,0x60,0x04,0x44,0x10,0x10,0x12,0x01,0x08,0x00, 0x00,0x00,0x02,0x0A,0xB1,0x4A,0x35,0x40,0x04,0x34,0x30,0x10,0x13,0x01,0x08,0x00, 0x00,0x00,0x04,0x0E,0x61,0xCA,0x19,0x40,0x04,0x1C,0x20,0x10,0x11,0x19,0x98,0x00, 0x00,0x00,0x08,0x04,0x60,0xCC,0x19,0xCC,0x06,0x0E,0x20,0x10,0x11,0xF0,0xFC,0xC0, 0x00,0x00,0x00,0x04,0x60,0x8C,0x18,0x8C,0x03,0xF3,0xBF,0x80,0x00,0x00,0x00,0xC0, 0x00,0x00,0x00,0x00,0x40,0x80,0x10,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,0x0F,0x83,0x80,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x06,0xC3,0xFC,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x08,0x22,0x44,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x08,0x22,0x42,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x08,0x26,0x42,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x08,0x24,0x42,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x48,0x64,0x42,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19,0xC4,0x44,0x42,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x03,0x84,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,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, }; unsigned char code BMP[]={ 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,0x04,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x04,0x20,0x00,0x00 0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x40,0x84,0x00,0x00,0x00,0x00, 0x00,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0xE0,0x04,0x00,0x08,0x80,0x60,0x00,0x00, 0x00,0x1F,0xFF,0xC0,0x00,0x00,0x00,0x01,0x10,0x02,0x1F,0xC1,0x01,0xD0,0x00,0x38, 0x00,0x00,0x00,0x01,0xFC,0x00,0x00,0x00,0x10,0x00,0x70,0x72,0x01,0x0C,0x00,0x68, 0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x06,0x13,0x08,0x40,0x08,0x03,0x06,0x00,0xCC, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x09,0x84,0x80,0x0C,0x1E,0x03,0x89,0x86, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0xC1,0x80,0x04,0x68,0x00,0xFF,0x02, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x41,0x00,0x00,0xC0,0x00,0x60,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x61,0x00,0x00,0x80,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x31,0x00,0x00,0x80,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x0C,0x00,0x00,0x80,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x01,0x80,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x06,0x00,0x01,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x38,0x00,0x00,0x00,0xC0,0x00,0x03,0x00,0x02,0x00,0x00,0x00,0x00, 0x00,0x00,0x01,0xE8,0x00,0x00,0x01,0x80,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x1A,0x08,0x00,0x00,0x03,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x08,0x00,0x00,0x02,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x08,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x10,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x3C,0x18,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x01,0xC0,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x03,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x02,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x02,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 0x00,0x02,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x04,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x04,0x00,0x02,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0xF4,0x00,0x02,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x03,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x02,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x02,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x79,0xF8,0x10,0x20,0x00, 0x02,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x09,0x08,0x10,0x20,0x00, 0x02,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x09,0x08,0x10,0x20,0x00, 0x06,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x79,0xF8,0x10,0x20,0x00, 0x04,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0xFD,0xFE,0x00, 0x04,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x43,0xFC,0x10,0x20,0x00, 0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x03,0xFF,0xF0,0x42,0x44,0x10,0x60,0x00, 0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x7A,0x44,0x38,0x70,0x00, 0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x0B,0xFC,0x74,0xB0,0x00, 0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x08,0x40,0x54,0xA8,0x00, 0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x08,0x48,0x91,0x28,0x00, 0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x44,0x12,0x26,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x7E,0x14,0x24,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2B,0xC4,0x10,0x20,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x20,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,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, }; /*检查忙位*/ void chk_busy() { RS=0; RW=1; E=1; Lcd_Bus=0xff; while((Lcd_Bus&0x80)==0x80); E=0; } /*延时子程序*/ void delay(unsigned int t) { unsigned int i,j; for(i=0;i<t;i++) for(j=0;j<10;j++) ; } /*写命令到LCD*/ void write_com(unsigned char cmdcode) { chk_busy(); RS=0; RW=0; E=1; Lcd_Bus=cmdcode; delay(5);////////////////////在数据写入的时候加入适当的延时 E=0; delay(5); } /*写数据到LCD*/ void write_data(unsigned char Dispdata) { chk_busy(); RS=1; RW=0; E=1; Lcd_Bus=Dispdata; delay(5);///////////////////在数据写入的时候加入适当的延时 E=0; delay(5); } /*初始化LCD屏*/ void lcdreset() { delay(2000); write_com(0x30); delay(10); //选择基本指令集 write_com(0x30); //选择8bit数据流 delay(5); write_com(0x0c); //开显示(无游标、不反白) delay(10); write_com(0x01); //清除显示,并且设定地址指针为00H delay(500); write_com(0x06); //指定在资料的读取及写入时,设定游标的移动方向及指定显示的移位 delay(0); } /*自定义一个字符代码(一个星星和月亮)*/ void CGRAM() { int i; write_com(0x30);  write_com(0x40); for(i=0;i<16;i++) {write_data(zk[i*2]); write_data(zk[i*2+1]); } }  /*显示字符串*/ void hzkdis(unsigned char code *s) { while(*s>0) { write_data(*s); s++; delay(50); } } /*首屏显示*/ void ceshi() {write_com(0x01);//清除显示,并且设定地址指针为00H delay(5); write_com(0x80);//第一行(如果是地址是:80H,即LCD的第一行的第一个位置显示) hzkdis("强林单片机"); write_com(0x90);//第二行(如果是地址是:90H,即LCD的第二行的第一个位置显示) hzkdis("--技术项目交易网"); write_com(0x88);//第三行(如果是地址是:88H,即LCD的第二行的第一个位置显示) hzkdis("LCD12864点阵液晶"); write_com(0x9A);//第四行(如果是地址是:98H,即LCD的第二行的第一个位置显示) hzkdis("测试程序"); } /*显示图片2005.11.14.21:20修改benladn911*/ void Disp_Img(unsigned char code *img) { unsigned int j=0; unsigned char x,y,i; for(i=0;i<9;i+=8) for(y=0;y<32;y++)/*原来 为 y<26 ,上下两个半屏不能正常对接显示,导致显示的图片中间有空隙*/ for(x=0;x<8;x++) { write_com(0x36);//功能设置8BIT控制界面,扩充指令集 write_com(y+0x80); //行地址 write_com(x+0x80+i); //列地址 write_com(0x30); write_data(img[j++]); write_data(img[j++]); }  } /*清整个GDRAM空间*/ void clrgdram() { unsigned char x,y; for(y=0;y<64;y++) for(x=0;x<16;x++) { write_com(0x34); write_com(y+0x80); //行地址 write_com(x+0x80); //列地址 write_com(0x30); write_data(0x00); write_data(0x00); } } /*整屏写入数据:全亮,或者竖条*/ void lcdfill(unsigned char disdata) { unsigned char x,y; for(y=0;y<32;y++) for(x=0;x<16;x++) { write_com(0x36); write_com(y+0x80); //行地址 write_com(x+0x80); //列地址 write_com(0x30); write_data(disdata); write_data(disdata); } write_com(0x34);  write_com(0x36); } /*显示横*/ void Disp_H_Line() { unsigned char x,y; unsigned char k=0x00;  for(y=0;y<32;y++) { k= ̄k; for(x=0;x<16;x++) { write_com(0x36); write_com(y+0x80); //行地址 write_com(x+0x80); //列地址 write_com(0x30); write_data(k); write_data(k); }; } write_com(0x34);  write_com(0x36); } /*显示边框*/ void Frame() {unsigned char x,y; lcdfill(0x00); for(x=0;x<9;x+=8) for(y=0;y<32;y++) { write_com(0x36); write_com(y+0x80); //行地址 write_com(x+0x80); //列地址 write_com(0x30); write_data(0x80); write_data(0x00); write_com(0x36); write_com(y+0x80); //行地址 write_com(x+0x87); //列地址 write_com(0x30); write_data(0x00); write_data(0x01); } for(y=0;y<2;y++) for(x=0;x<8;x++) {write_com(0x36); write_com(y*31+0x80); //行地址 write_com(x+0x80+8*y); //列地址 write_com(0x30); write_data(0xff); write_data(0xff); } write_com(0x34); write_com(0x36); } /*在第7列的位置加入两条竖线*/ void shuxian() { unsigned char x,y; for(x=0;x<9;x+=8)  for(y=0;y<32;y++) { write_com(0x36); write_com(y+0x80); //行地址 write_com(x+0x86); //列地址 write_com(0x30); write_data(0x00); write_data(0x14); }; }  /*清屏命令*/  void clrscreen() {  write_com(0x01); delay(10); } /*唐诗《静夜思》*/ void gushi_display() { write_com(0x30); clrscreen();  write_com(0x80+FIRST_ADDR); hzkdis("床前明月光,"); write_com(0x90+FIRST_ADDR); hzkdis("疑是地上霜。

12864液晶显示程序51驱动

12864液晶显示程序51驱动

#include <reg52.h>#include <intrins.h>sbit LCD_RS =P0^0; //L:COMMAND; H:DATA sbit LCD_RW =P0^1; //L:WRITE; H:READ sbit LCD_E =P0^2; //INPUT ENABLEsbit LCD_CS1 =P0^3; //L有效sbit LCD_RES =P0^4; //L有效#define data_bus P2#define control_bus P0#define uchar unsigned char#define uint unsigned int//=====延时N微秒==============void delay_nus(uint n){while(n--);return;}//=====延时N毫秒==============void delay_nms(uint n){int i;for(i=0;i<n;i++)delay_nus(123);}//=====忙检测=================void check_busy(void){uchar read_data=0xff;data_bus=0xff;LCD_RS=0;LCD_RW=1; //读命令LCD_CS1=0; //片使能while((read_data&0x80)==0x80){LCD_E=1;_nop_();_nop_();read_data=data_bus;LCD_E=0;}LCD_E=0;LCD_CS1=1; //片禁能}//=====写命令到寄存器========= void send_cmd(uchar cmd) small{check_busy();LCD_RS=0; //写的是命令LCD_RW=0; //写命令LCD_CS1=0; //片使能data_bus=cmd;LCD_E=1; //使能_nop_();_nop_();LCD_E=0;_nop_();_nop_();LCD_CS1=1; //片禁能}//=====写数据到DDRAM========= void send_dat(uchar dat) small{check_busy();LCD_RS=1; //写的是数据LCD_RW=0; //写数据LCD_CS1=0; //片使能data_bus=dat;LCD_E=1;_nop_();_nop_();LCD_E=0;_nop_();_nop_();LCD_CS1=1; //片禁能}//=======初始化============== void lcd_initial(void) small{LCD_RES=0;delay_nms(50);LCD_RES=1;LCD_E=0;delay_nms(50);send_cmd(0xA0);send_cmd(0xC8);send_cmd(0xA2);send_cmd(0x2C);send_cmd(0x2E);send_cmd(0x2F);send_cmd(0x25);send_cmd(0x81);send_cmd(0x14);send_cmd(0xAF);send_cmd(0xE0);send_cmd(0x40);}//=======写列地址==============void Set_Colume_Address(unsigned char dat){unsigned char tmp;tmp=dat>>4;send_cmd(0x10|tmp); //送列地址高三位tmp=0x0f&dat;send_cmd(tmp); //送列地址低四位}code unsigned char number[][16] = {/*-- 文字: 0 --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,/*-- 文字: 1 --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,/*-- 文字: 2 --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,/*-- 文字: 3 --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00,/*-- 文字: 4 --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00,/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00,/*-- 文字: 6 --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00,/*-- 文字: 7 --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,/*-- 文字: 8 --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00,/*-- 文字: 9 --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00,/*-- 文字: : --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00, /*-- 文字: - --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01}; code unsigned char Hz[][32] = {/*-- 文字: 中--*//*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/0x00,0x00,0xFC,0x08,0x08,0x08,0x08,0xFF,0x08,0x08,0x08,0x08,0xFC,0x08,0x00,0x00, 0x00,0x00,0x07,0x02,0x02,0x02,0x02,0xFF,0x02,0x02,0x02,0x02,0x07,0x00,0x00,0x00,/*-- 文字: 鼎--*//*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/0x00,0x00,0xF8,0x00,0x00,0x7E,0x52,0x66,0x4A,0x52,0x7E,0x00,0x00,0xF8,0x00,0x00, 0x00,0x84,0x65,0x1D,0x05,0x05,0xFF,0x00,0x00,0xFF,0x05,0x05,0x05,0xFD,0x00,0x00,/*-- 文字: 技--*//*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/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,/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/0x10,0x10,0x10,0x10,0x10,0x90,0x50,0xFF,0x50,0x90,0x12,0x14,0x10,0x10,0x10,0x00, 0x10,0x10,0x08,0x04,0x02,0x01,0x00,0x7F,0x00,0x00,0x01,0x06,0x0C,0x18,0x08,0x00 };/****显示汉字的程序****/void DisplayHz(unsigned int Page,unsigned int Col,unsigned char Hz[],unsigned int zilie) {unsigned int PageCnt,ColCnt;for(PageCnt = Page;PageCnt < Page+2;PageCnt ++){send_cmd(0xb0|PageCnt); //page addressSet_Colume_Address(Col);for(ColCnt = 0;ColCnt < zilie;ColCnt ++){send_dat(Hz[(PageCnt-Page)*zilie + ColCnt]);}}}//=====主程序===================void main (void){unsigned char month=0,nian=10,yue=1,tian=1,shi=0,fen=0,miao=0,i=0,j=0; unsigned char months[12]={31,28,31,30,31,30,31,31,30,31,30,31};lcd_initial();send_cmd(0xa6);for(i=0;i<8;i++) //清屏{send_cmd(0xb0|i);Set_Colume_Address(0);for(j=0;j<128;j++)send_dat(0);}while(1){if(++miao>59){miao=0;if(++fen>59){fen=0;if(++shi>23){shi=0;if(++tian>months[month]){tian=0;if(++yue>11){yue=1;nian++;}}}}}DisplayHz(0,0,number[nian/10],8);DisplayHz(0,16,number[nian%10],8);DisplayHz(0,32,number[11],8);DisplayHz(0,48,number[yue/10],8);DisplayHz(0,64,number[yue%10],8);DisplayHz(0,80,number[11],8);DisplayHz(0,96,number[tian/10],8);DisplayHz(0,112,number[tian%10],8);DisplayHz(3,0,number[shi/10],8);DisplayHz(3,16,number[shi%10],8);DisplayHz(3,32,number[10],8);DisplayHz(3,48,number[fen/10],8);DisplayHz(3,64,number[fen%10],8);DisplayHz(3,80,number[10],8);DisplayHz(3,96,number[miao/10],8);DisplayHz(3,112,number[miao%10],8);DisplayHz(6,14,Hz[0],16);DisplayHz(6,42,Hz[1],16);DisplayHz(6,70,Hz[2],16);DisplayHz(6,98,Hz[3],16);delay_nms(6000);}}。

51单片机驱动LCD1602程序设计(C语言)

51单片机驱动LCD1602程序设计(C语言)
51 单片机驱动 LCD1602 程序设计(C 语言)
字符液晶绝大多数是基于 HD44780 液晶芯片的,控制原理是完全相同的,因此 HD44780 写 的控制程序可以很方便地应用于市面上大部分的字符型液晶。字符型 LCD 通常有 14 条引脚线或 16 条引脚线的 LCD,多出来的 2 条线是背光电源线 VCC(15 脚)和地线 GND(16 脚),其控制原理 与 14 脚的 LCD 完全一样,定义如下表所示:
for(i=0;i<count;i++) {
if (0 == y) x |= 0x80; //当要显示第一行时地址码+0x80; else x |= 0xC0; //在第二行显示是地址码+0xC0; Write_com(x); //发送地址码 Write_dat(*p); //发送要显示的字符编码 x++; p++; }
01110
○■■■○
10001
■○○○■
10001
■○○○■
10001
■○○○■
11111
■■■■■
10001
■○○○■
10001
■○○○■
上图左边的数据就是字模数据,右边就是将左边数据用“○”代表 0,用“■”代表 1。看出是个“A”
字了吗?在文本文件中“A”字的代码是 41H,PC 收到 41H 的代码后就去字模文件中将代表 A 字的
字符型 LCD 的引脚定义
HD44780 内置了 DDRAM、CGROM 和 CGRAM。DDRAM 就是显示数据 RAM,用来寄存 待显示的字符代码。共 80 个字节,其地址和屏幕的对应关系如下表:
也就是说想要在 LCD1602 屏幕的第一行第一列显示一个"A"字,就要向 DDRAM 的 00H 地址写 入“A”字的代码就行了。但具体的写入是要按 LCD 模块的指令格式来进行的。在 1602 中我们用前 16 个就行了。第二行也一样用前 16 个地址。对应如下:

(整理)单片机液晶屏C程序.

(整理)单片机液晶屏C程序.
lcd_pos(4,3);
for(i=0;i<2;i++)
{
lcd_wdat(DIS41[i]);
}
}
else
{
PORTB&=~(1<<0);
lcd_pos(4,3);
for(i=0;i<2;i++)
{
lcd_wdat(DIS42[i]);
}
}
////////*******“运行”显示**************************
}
DDRC=0xFF;
PORTD&=~(1<<3);
}
//******************************************************************
void lcd_wcmd(uchar cmd)
{
lcd_busy();
DDRD=0xF8;
PORTD&=~(1<<5);
{
lcd_wcmd(0x30); //基本指令操作
lcd_wcmd(0x30);
delay(1);
lcd_wcmd(0x0c); //显示开,关光标
delay(1);
lcd_wcmd(0x01); //清除LCD的显示内容
delay(1);
}
//*****************************************************************
lcd_pos(4,6);
(2)可能造成轻度环境影响的建设项目,编制环境影响报告表,对产生的环境影响进行分析或者专项评价;for(i=0;i<4;i++)

TFT彩色液晶屏.c驱动程序

TFT彩色液晶屏.c驱动程序
TFT.c - Printed on 2020/11/10 19:41:58
1 #include "tft.h"
2
3 #define uchar unsigned char
4 #define uint unsigned int
5 #define ulong unsigned long
6
7 void delayms(uint count)
89
|
10
|
2 pixel*
|
90
|
11
|
3 pixel*
|
91
|————————————————————————————————|
92
*1 pixel = 1RGB
93
94
RCV[1:0] 当调整图片大小时,那么剩余像素数的设定应在垂直方向
95
|————————————————————————————————|
54
55
write_cmd_data(0x0003, 0x5030);
56
//
TRI DFM 0 BGR 0 0 HWM 0 ORG 0 I/D1 I/D0 AM 0 0 0
57
/*
0
0
0 1 00 0 0 0 0 1 1 0000
58
当 AM = “0”, 地址在水平写入方向得以更新。
59
60
AM="0" 且 I/D[1:0]=“11” ,则 更新一个像素时,地址计数器(AC),
104
*1 pixel = 1RGB
|
105
*/
106 //
write_cmd_data(0x0008, 0x0202);

基于51单片机控制的液晶显示屏C程序设计

基于51单片机控制的液晶显示屏C程序设计
_
点 阵式 L C D其 显 示 原理是 控制 L C D点 阵 中点的亮 暗 , 亮 和 暗 的点阵 按一定 规律 可 以组 成汉 字 , 组 成一 幅图形 和 曲线 等 。
1 . 2 T G1 2 8 6 4内部 结构 及相 关指 令
1 . 2 . 1 T G1 2 8 6 4内部 结构
1 T G1 2 8 6 4液 晶原 理
1 . 1 1 . G1 2 8 6 4显 示原 理
2 应 用 程序设 计
#i n c l u de < r e g 5 1 . h > #d e i f n e uc ha r u ns i g n e d c ha r #d e in f e ui n t u n s i g n e d i n t #d e f i n e di s p
s b i t r e s = P2 " 7;
u c h a r c o d e 妇b [ ] = { 青 海工 业职 业 学 校 * / 0 x 0 1 , 0 x O 0 , 0 x 0 1 , 0 x
0 0 , 0 x 3 0 x F 8 , 0 x 0 1 …l ;
_
功能 : 页地址 存储 在 x地 址计 数 器 中 , A 2 ~ A 0 可表示 8 页 , 读 写 数据 对页 地 址 没 有影 响 , 除本 指 令 可改 变 页地 址 外 , 复位
信号 R S T可把 页地 址 计 数器 内容 清 零 。D B 7 ~ D B 0 = O x b 8 , 显 示从 0页开 始 。
功能 : 列 地 址 存 储 在 Y地 址 计 数 器 中 , 读 写 数 据 对 列 地 址 有影响 , 在对 D D R A M 进行 读 写 操 作 后 ,Y地 址 自动 加 一 。

单片机连接串口液晶屏C语言程序

单片机连接串口液晶屏C语言程序

#define #define #define #define #define #define #define #define #define #define
ATPAD_REG_AD3 3 ATPAD_REG_AD4 4 ATPAD_REG_AD5 5 ATPAD_REG_AD6 6 ATPAD_REG_AD7 7 ATPAD_REG_AD8 8 ATPAD_REG_PARAM1 9 ATPAD_REG_PARAM2 10 ATPAD_REG_OUTPUT 11 ATPAD_REG_WAV 20
float IRsin(int angle_value) { int b, c; int angle = angle_value; /* change to cosine by subtracting 90 */ angle = angle - 90; if (angle < 0) { angle = -angle; } b = angle / 90; c = angle - b * 90; /* interpolate switch(b&3) { case 3: c = 90 return case 2: return case 1: c = 90 return default: return } } ///////////////////////////////////////////////////////////////////// // ----------------------------------------------------------------// // CRC16 计算方法 1:使用 2 个 256 长度的校验表 // // ----------------------------------------------------------------// ///////////////////////////////////////////////////////////////////// const unsigned char chCRCHTalbe[] = // CRC 高位字节值表 { 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, according to angle */

51单片机 c语言 12864 st7920 完美液晶示波器

51单片机 c语言 12864 st7920 完美液晶示波器
/*------------------初始化LCD屏--------------------------*/
void lcd_init()
{
delayms(3);
lcd_wcmd(0x30);
delayms(1); //选择基本指令集
lcd_wcmd(0x30); //选择8bit数据流
show_str(" ");
lcd_wcmd(0x98);
show_str(" ");
}
/*------------------清整个GDRAM空间----------------------------*/
void clr_gdram()
{ unsigned char x,y; //1.5s
}
for (i=0;i<8;i++)
{
AD_OUT=1;
AD_CLK=1;
al<<=1;
if (AD_OUT) al|=0x01;
AD_CLK=0;
}
AD_CS=1;
ad=(unsigned int)ah;ad<<=8;ad|=al;
return (ad);
a++;
}
if(a==0)
new_lie[t]=lie[t];
}
}
a=0;
}
void sure_lie() //p=temp
{
uchar a=0;
if(t<8)
{
sure_newlie();
return (0x80+y);

lcd12864c语言编程详解

lcd12864c语言编程详解

12864系列点阵型液晶显示模块使用说明书一、OCM12864液晶显示模块概述1.OCM12864液晶显示模块是128×64点阵型液晶显示模块,可显示各种字符及图形,可与CPU直接接口,具有8位标准数据总线、6条控制线及电源线。

采用KS0107控制IC。

2.外观尺寸:113×65×11mm(ocm12864-1), 93×70×10mm(ocm12864-2)78×70×10mm(ocm12864-3),3.视域尺寸:73.4×38.8mm(ocm12864-1) 70.7×38mm(ocm12864-2),64×44mm(ocm12864-3)4.重量:大约g补充说明:外观尺寸可根据用户的要求进行适度调整。

二、最大工作范围1、逻辑工作电压(Vcc):4.5~5.5V2、电源地(GND):0V3、LCD驱动电压(Vee):0~-10V4、输入电压:Vee~Vdd5、工作温度(Ta):0~55℃(常温) / -20~70℃(宽温)6、保存温度(Tstg):-10~65℃三、电气特性(测试条件 Ta=25,Vdd=5.0+/-0.25V)1、输入高电平(Vih):3.5Vmin2、输入低电平(Vil):0.55Vmax3、输出高电平(Voh):3.75Vmin4、输出低电平(Vol):1.0Vmax5、工作电流:2.0mAmax四、接口说明12864-3A接口说明表五、指令描述1、显示开/关设置CODE:R/W D/I DB7 DB6 DB5 DB4 DB3 DB2DB1 DB0功能:设置屏幕显示开/关。

DB0=H,开显示;DB0=L,关显示。

不影响显示RAM(DD RAM)中的内容。

2、设置显示起始行CODE:R/W D/I DB7 DB6 DB5 DB4 DB3 DB2DB1 DB0功能:执行该命令后,所设置的行将显示在屏幕的第一行。

HD44780 液晶显示板的c语言驱动程序

HD44780 液晶显示板的c语言驱动程序

HD44780 液晶显示板的c语言驱动程序#define _LCD44780_C#include <commdefs.h>#include "main.h"#include "lcd44780.h"#include "1306spi.h"#include "delays.h"#include "serial.h"#include "25cxxspi.h"#include "e2data.h"void lcd_send_byte(unsigned char address, unsigned char chr) {unsigned char rVal;LCDPORTDIR = LCD_READ; // set data/con port directionslcd_select_reg(CMD_REG); ); // select command registerlcd_select_dir(READ_DIR); ); // set lcd to readdo { // wait until lcd is readylcd_set_clk_hi(); (); // toggle data clockrVal = lcd_get_data(); (); // read high nibble from data buslcd_set_clk_lo();delay_500ns();lcd_toggle_clk(); (); // toggle data clock} while(!!(rVal & (HINIBBLE(LCD_BUSY))));LCDPORTDIR = LCD_WRITE; // set data/con port directionslcd_select_reg(address); ); // select desired registerlcd_select_dir(WRITE_DIR); ); // set to writelcd_set_data(HINIBBLE(chr)); )); // send the high nibblelcd_toggle_clk(); (); // toggle data clocklcd_set_data(chr); ); // send the low nibblelcd_toggle_clk(); (); // toggle data clock}// Procedure to initialise the lcd for 4 bit operation.// This procedure implements the "Initialisation by instruction" as described for// Philips PCF2116Xvoid init_lcd() {unsigned char n;LCDPORTDIR = LCD_WRITE; // set data/c on & enable port dir’nslcd_set_clk_lo(); (); // set data clock low (enable pin)lcd_select_reg(CMD_REG); ); // select command registerlcd_select_dir(WRITE_DIR); ); // set to writedelay_ms(15); ); // wait > 15ms Vdd rises above Vporlcd_set_data(HINIBBLE(LCD_FNSET | LCD_8BIT)); )); // put nibble on data bus for (n = 0; n < 3; ++n) { ) // set mode to 8 bit data 3 timeslcd_toggle_clk(); (); // toggle data clockdelay_ms(5); ); // 5ms delay}#ifdef LCD1LINES && (LCDNCHARS > 16)lcd_set_data(HINIBBLE(LCD_FNSET)); )); // set mode to 4 bit data and 1 linelcd_toggle_clk(); (); // toggle data clocklcd_send_byte(LCD_COMMAND, LCD_FNSET);#else#ifdef LCD4LINESlcd_set_data(HINIBBLE(LCD_FNSET | LCD_4LINE)); )); // set mode to 4 bit data and 4 lineslcd_toggle_clk(); (); // toggle data clocklcd_send_byte(LCD_COMMAND, LCD_FNSET | LCD_4LINE);#elselcd_set_data(HINIBBLE(LCD_FNSET | LCD_2LINE)); )); // set mode to 4 bit data and 2 lineslcd_toggle_clk(); (); // toggle data clocklcd_send_byte(LCD_COMMAND, LCD_FNSET | LCD_2LINE); ); // (applies to 16x1 also - odd one!!) #endif#endiflcd_send_byte(LCD_COMMAND, LCD_DISPON | LCD_DISP_ALL); ); // display onlcd_send_byte(LCD_COMMAND, LCD_CLR); ); // clear the displaylcd_send_byte(LCD_COMMAND, LCD_EMSET | LCD_EM_INC); ); // entry mode to increment LCDPORTDIR = LCD_READ; // set data/con port dir’nslinenum = 0; // set line number to first linedisp_blank = false; // flag display as visiblecursor_on = false; // flag the cursor as off}// Moves the cursor to posline. The first character position is 0 and the first line is 0// If the cursor bit is set then a blinking cursor location is shown else the blinking// is removed. The procedure returns the old cursor status.// Definition of posline : bits 0..4 = character position in line (left = 0)// bits 5..6 = line number (top = 0)// bit 7 = cursor status (on = 1)// In the case of single line displays the lower 6 bits are the character position.unsigned char lcd_gotoxy(unsigned char posline) {unsigned char address, cstat;cstat = cursor_on;if(c_status.prt_to_lcd) {#ifdef LCD1LINES // this method is faster than using thelinenum = 0; // modulus operator but more verboseaddress = posline & 0x3f;#elselinepos = posline & 0x1f; // save the line char positionlinenum = (posline >> 5) & 3; // save the line number#ifdef LCD2LINESif(linenum > 1) linenum = 0; // 2 line display ?#elseif(linenum > 3) linenum = 0; // 4 line display ?#endif // LCD2LINESaddress = linepos;if(linenum == 1) address += STRT_LINE2; // set ram address to (pos,line)else if(linenum == 2) address += STRT_LINE3;else if(linenum == 3) address += STRT_LINE4;#endif // LCD1LINESlcd_send_byte(LCD_COMMAND, LCD_DD_SET | address);if(!!(posline & 0x80) != cursor_on) { ) // has the cursor status changed ?cursor_on = !!(posline & 0x80);if(disp_blank) lcd_send_byte(LCD_COMMAND, LCD_DISPON);else if(cursor_on) lcd_send_byte(LCD_COMMAND, LCD_DISPON |LCD_DISP_ALL | LCD_DISP_BLNK);else lcd_send_byte(LCD_COMMAND, LCD_DISPON|LCD_DISP_ALL);}}return cstat;}// Blank or restore the display restoring the cursor status also.void lcd_blank_display(unsigned char blank) {disp_blank = blank;if(disp_blank) lcd_send_byte(LCD_COMMAND, LCD_DISPON);else if(cursor_on) lcd_send_byte(LCD_COMMAND, LCD_DISPON | LCD_DISP_ALL | LCD_DISP_BLNK); else lcd_send_byte(LCD_COMMAND, LCD_DISPON|LCD_DISP_ALL);}// If the print flag is set to lcd then writes a character to the display at cursor. Backspace,// newline and formfeed are recognised. Formfeed clears the display, newline moves the cursor// to the start of the second line. Programmable characters have codes between 0x0f and 0x1f.// They are mapped to cgram, 0x0 to 0xf. This makes all of the cgram available to programmable// characters and also allows string printing without premature termination on 0.// If the print flag is set to serial then the character is sent directly to the serial port.void putch(char chr) {if(c_status.prt_to_lcd) { ) // printing to lcdif(chr == ’\f’) {lcd_send_byte(LCD_COMMAND, LCD_CLR); ); // formfeed clears the displaylinenum = 0; // set line number to first line}// Newline to start of next line.else if(chr == ’\n’) lcd_gotoxy((cursor_on ? 0x80 : 0) | ((linenum + 1) << 5));// Return to start of current line.else if(chr == ’\r’) lcd_gotoxy((cur sor_on ? 0x80 : 0) | (linenum << 5));// Backspace.else if(chr == ’\b’) lcd_send_byte(LCD_COMMAND, LCD_SHIFT);// Other characters.else {if((chr < 0x20)&&(chr > 0x0f)) chr -= 0x10; // translate special characterslcd_send_byte(LCD_DATA, chr); ); // write at current cursor position}}else { // printing to usartif(chr == 0x11) chr = xl_super2; // translate superscript 2putch_ser(chr); ); // send char to serial portif(chr == ’\n’) putch_ser(’\r’); ); // make cr/lf pair if required}}// Clear m characters on the lcd by writing m spaces then m backspaces.void clear_line(unsigned char m) {unsigned char n = m;if(c_status.prt_to_lcd) {while(n--) lcd_send_byte(LCD_DATA, ’ ’);while(m--) lcd_send_byte(LCD_COMMAND, LCD_SHIFT);}}// Shift the screen left or right. npos is the number of character positions to shift,// +ve for right and -ve for left./*void lcd_shift(signed char npos) {unsigned char command command;command = LCD_SHIFT | LCD_DISP_SHFT SHFT;if(npos > 0) command |= LCD_SHFT_RT RT;else npos = -npos npos;while(npos--) lcd_send_byte(LCD_COMMAND, command) command);}*/// Writes a cgram character line pattern to the cgram.void lcd_write_cgram(unsigned char address, unsigned char pattern) {lcd_send_byte(LCD_COMMAND, (address & 0x3f) | LCD_CG_SET); ); // set cgram addr.lcd_send_byte(LCD_DATA, pattern);}理解HD44780兼容型LCD显示屏摘要:这篇文章试图使你能对HD44780兼容型LCD显示屏略知一二。

液晶1602 C语言驱动程序

液晶1602 C语言驱动程序
HC1602WriteCmd(systemtab[i]);
delaytime(10);
}
}
//清屏
void HC1602fullclear()
{
HC1602WriteCmd(0x01);
delaytime(10);
}
/*--------------------------------------------------------------------
{
uint i;
while(n--)
for(i=0;i<200;i++);
}
uint HC1602busy()
{
uchar i;
SysCtlPeripheralEnable(GPIO_PORTA_BASE );
GPIOPinTypeGPIOInput(GPIO_PORTA_BASE , 0xff);
LCD_ESysCtlPeripheralEnable(GPIO_PORTA_BASE );
GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE , 0xff);
return busyflag;
}
void HC1602WriteCmd(uchar uldata) //写命令
函数功能: 在1602液晶显示屏上显示一连串的字符串
输入说明: startline:显示起始行 startrow :显示的起始列
uldata:要显示的字符
返回 值 :
说 明:
--------------------------------------------------------------------*/

2.8吋彩色液晶屏汇编语言实验程序

2.8吋彩色液晶屏汇编语言实验程序

上一次发表的是用C语言编写的2.8 吋彩色液晶屏实验程序,这一次是汇编语言编写的2.8 吋彩色液晶屏实验程序,两个程序的运行结果是完全一样的,只是编程用的编程语言不同而已。

对于初学C51单片机的朋友们学习不同语言编程能有所帮助,本程序是经过本人上机测试完全通过Keil 4 验证的,可以放心的使用。

本程序驱动ILI9341 或RM68090 芯片驱动的2.8 吋彩色液晶屏。

显示点阵数:240RGB(W)×320(H)。

芯片为宏晶科技公司的STC12C5A60S2或STC12LE5A60S2 芯片。

注:RGB 为565 格式的16bit。

$INCLUDE(STC12C5A.INC);===============================================;编程日期:2014年09月25日;===============================================;初始化定义和数据单元;;===============================================RSB BIT P3.3 ;寄存器选择,0:寄存器,1:参数CSB BIT P3.4 ;片选,低电平有效RESET BIT P3.5 ;复位WRB BIT P3.6 ;写数据信号RDB BIT P3.7 ;读数据信号;===============================================;主程序开始;===============================================ORG 0000HLJMP MAIN ;开始ORG 0100HMAIN:MOV R0,#7FHCLR ACLEARED:MOV @R0,ADJNZ R0, CLEAREDMOV SP,#0E0HSETB RESETLCALL DELAY1MSCLR RESETLCALL DELAY10MSSETB RESETLCALL DELAY120MSLCALL REGISTER_SETTINGS ;配置9341;===============================================;循环程序;===============================================CYCLE:MOV R7,#0FFHMOV R6,#0FFHLCALL DISPLAY ;显示白色MOV R7,#00HMOV R6,#00HLCALL DISPLAY ;显示黑色LCALL DELAY1SLCALL PICTURES ;显示图片LCALL DELAY1SMOV R7,#0F8HMOV R6,#00HLCALL DISPLAY ;显示红色ACALL DELAY1SMOV R7,#07HMOV R6,#0E0HLCALL DISPLAY ;显示绿色ACALL DELAY1SMOV R7,#00HMOV R6,#1FHLCALL DISPLAY ;显示蓝色LCALL DELAY1SMOV R7,#0FFHMOV R6,#0E0HLCALL DISPLAY ;显示黄色LCALL DELAY1SMOV R7,#0F8HMOV R5,#1FHLCALL DISPLAY ;显示紫色LCALL DELAY1SMOV R7,#07HMOV R6,#0FFHLCALL DISPLAY ;显示青色LCALL DELAY1SCPL P4.3LJMP CYCLE ;返回循环程序;=============================================== ;显示设置,区域和数据240x320;=============================================== DISPLAY:MOV 22H,R7MOV 23H,R6LCALL SETTINGS_AREA ;设置区域CLR AMOV R3,AMOV R2,ADISPLAY01:MOV R4,#0F0HDISPLAY02:MOV R7,22HLCALL TWO_DATA ;写双字节显示数据DJNZ R4, DISPLAY02 ;240列INC R3CJNE R3,#00H,DISPLAY03INC R2DISPLAY03:CJNE R2,#01H,DISPLAY01CJNE R3,#40H,DISPLAY01 ;320行RET;=============================================== ;显示图片;=============================================== PICTURES:LCALL SETTINGS_AREA ;设置区域MOV R1,#04H ;显示4幅图片PICTURES01:MOV DPTR,#IMAGE_PIXELSMOV R2,#50HPICTURES02:MOV R3,#0F0HPICTURES03:CLR AMOVC A,@A+DPTRMOV R7,AINC DPTRCLR AMOVC A,@A+DPTRMOV R6,AINC DPTRLCALL TWO_DATA ;写DAT文件,双字节DJNZ R3,PICTURES03DJNZ R2,PICTURES02DJNZ R1,PICTURES01RET;=============================================== ;设置区域;=============================================== SETTINGS_AREA:MOV R7,#2AH ;列地址时钟LCALL COMMAND ;写8位命令MOV R7,#00HLCALL WRITE_DATA ;写8位数据参数MOV R7,#00HLCALL WRITE_DATA ;写8位数据参数LCALL WRITE_DATA ;写8位数据参数MOV R7,#0EFHLCALL WRITE_DATA ;写8位数据参数MOV R7,#2BH ;页地址设置LCALL COMMAND ;写8位命令MOV R7,#00HLCALL WRITE_DATA ;写8位数据参数MOV R7,#00HLCALL WRITE_DATA ;写8位数据参数MOV R7,#01HLCALL WRITE_DATA ;写8位数据参数MOV R7,#3FHLCALL WRITE_DATA ;写8位数据参数MOV R7,#2CH ;存储器写LJMP COMMAND ;写8位命令RET;=============================================== ;写寄存器命令;=============================================== COMMAND:CLR RSBSETB RDBCLR CSBMOV P0,R7CLR WRBSETB WRBSETB CSBRET;=============================================== ;写数据参数;=============================================== WRITE_DATA:SETB RSBSETB RDBCLR CSBMOV P0,R7CLR WRBSETB WRBSETB CSBRET;=============================================== ;写双字节显示数据;===============================================SETB RSBSETB RDBCLR CSBMOV P2,R7MOV P0,R6CLR WRBSETB WRBSETB CSBRET;=============================================== ;延时1mS;=============================================== DELAY1MS:MOV R6,#8DHDL0:MOV R5,#39HDJNZ R5,$DJNZ R6,DL0NOPRET;=============================================== ;延时10mS;=============================================== DELAY10MS:MOV R7,#0BDHDL1:MOV R6,#0AEHDL2:MOV R5,#01HDJNZ R5,$DJNZ R6,DL2DJNZ R7,DL1RET;=============================================== ;延时120mS;=============================================== DELAY120MS:MOV R7,#75HDL3:MOV R6,#78HDL4:MOV R5,#45HDJNZ R5,$DJNZ R6,DL4DJNZ R7,DL3DJNZ R5,$RET;=============================================== ;延时1S;=============================================== DELAY1S:MOV R7,#0DFHDL5:MOV R6,#0D4HDL6:MOV R5,#0ADHDJNZ R5,$DJNZ R6,DL6DJNZ R7,DL5MOV R5,#03HDJNZ R5,$NOPRET;=============================================== ;ILI9341寄存器配置;=============================================== REGISTER_SETTINGS:MOV R7,#0CFH ;LCALL COMMAND ;写寄存器命令MOV R7,#00H ;LCALL WRITE_DATA ;写8位数据MOV R7,#0D9HLCALL WRITE_DATAMOV R7,#30HLCALL WRITE_DATAMOV R7,#0EDHLCALL COMMANDMOV R7,#64HLCALL WRITE_DATAMOV R7,#03HLCALL WRITE_DATAMOV R7,#12HLCALL WRITE_DATAMOV R7,#81HLCALL WRITE_DATAMOV R7,#0E8HLCALL COMMANDMOV R7,#85HLCALL WRITE_DATAMOV R7,#10HMOV R7,#78H LCALL WRITE_DATA MOV R7,#0CBH LCALL COMMAND MOV R7,#39H LCALL WRITE_DATA MOV R7,#2CH LCALL WRITE_DATA MOV R7,#00H LCALL WRITE_DATA MOV R7,#34H LCALL WRITE_DATA MOV R7,#02H LCALL WRITE_DATA MOV R7,#0F7H LCALL COMMAND MOV R7,#20H LCALL WRITE_DATA MOV R7,#0EAH LCALL COMMAND MOV R7,#00H LCALL WRITE_DATA MOV R7,#00H LCALL WRITE_DATA MOV R7,#0C0H LCALL COMMAND MOV R7,#21H LCALL WRITE_DATA MOV R7,#0C1H LCALL COMMAND MOV R7,#12H LCALL WRITE_DATA MOV R7,#0C5H LCALL COMMAND MOV R7,#32H LCALL WRITE_DATA MOV R7,#3CH LCALL WRITE_DATA MOV R7,#0C7H LCALL COMMAND MOV R7,#0C1H LCALL WRITE_DATA MOV R7,#36H LCALL COMMAND MOV R7,#08HLCALL COMMAND MOV R7,#55H LCALL WRITE_DATA MOV R7,#0B1H LCALL COMMAND MOV R7,#00H LCALL WRITE_DATA MOV R7,#18H LCALL WRITE_DATA MOV R7,#0B6H LCALL COMMAND MOV R7,#0AH LCALL WRITE_DATA MOV R7,#0A2H LCALL WRITE_DATA MOV R7,#0F2H LCALL COMMAND MOV R7,#00H LCALL WRITE_DATA MOV R7,#26H LCALL COMMAND MOV R7,#01H LCALL WRITE_DATA MOV R7,#0E0H LCALL COMMAND MOV R7,#0FH LCALL WRITE_DATA MOV R7,#20H LCALL WRITE_DATA MOV R7,#1EH LCALL WRITE_DATA MOV R7,#09H LCALL WRITE_DATA MOV R7,#12H LCALL WRITE_DATA MOV R7,#0BH LCALL WRITE_DATA MOV R7,#50H LCALL WRITE_DATA MOV R7,#0BAH LCALL WRITE_DATA MOV R7,#44H LCALL WRITE_DATA MOV R7,#09HLCALL WRITE_DATA MOV R7,#05H LCALL WRITE_DATA MOV R7,#23H LCALL WRITE_DATA MOV R7,#21H LCALL WRITE_DATA MOV R7,#00H LCALL WRITE_DATA MOV R7,#0E1H LCALL COMMAND MOV R7,#00H LCALL WRITE_DATA MOV R7,#19H LCALL WRITE_DATA MOV R7,#19H LCALL WRITE_DATA MOV R7,#00H LCALL WRITE_DATA MOV R7,#12H LCALL WRITE_DATA MOV R7,#07H LCALL WRITE_DATA MOV R7,#2DH LCALL WRITE_DATA MOV R7,#28H LCALL WRITE_DATA MOV R7,#3FH LCALL WRITE_DATA MOV R7,#02H LCALL WRITE_DATA MOV R7,#0AH LCALL WRITE_DATA MOV R7,#08H LCALL WRITE_DATA MOV R7,#25H LCALL WRITE_DATA MOV R7,#2DH LCALL WRITE_DATA MOV R7,#0FH LCALL WRITE_DATA MOV R7,#11H LCALL COMMAND LCALL DELAY120MSLJMP COMMANDRET;===============================================;显示图像38400字节;===============================================IMAGE_PIXELS:DB 0xC4,0x8,0xBC,0x2A,0x8B,0x6A,0x49,0xA8,0x18,0x88,0x31,0x4D,0x41,0xCE,0x31,0x4B DB 0x18,0xA8,0x18,0x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 0xDE,0x1B,0xDE,0x1B,0xD5,0xDA,0xB5,0x99,0x9D,0x77,0xA5,0xD8,0xC6,0x9B,0xE7,0x3E DB 0xEF,0x7E,0xF7,0xDF,0xFF,0xDF,0xFF,0xDF,0xFF,0xFF,0xFF,0xFF,0xF7,0xBF,0xEF,0x9EDB 0xF7,0x9D,0xEE,0x5A,0xBC,0x52,0xA4,0x51,0xC5,0xD7,0xEE,0xFC,0xF7,0x3E,0xD6,0xDC DB 0xD2,0x2B,0xB9,0x89,0xA0,0xC5,0xA0,0xC5,0xB1,0x6,0xB9,0x6,0xC1,0x7,0xD1,0x88DB 0xD9,0xCA,0xE2,0x4D,0xBA,0x6E,0x59,0x8C,0x41,0xCF,0x41,0xB1,0x51,0xF1,0x5A,0x71 DB 0x5A,0x73,0x5A,0x73,0x62,0x93,0x62,0x94,0x62,0x94,0x62,0x94,0x62,0x94,0x62,0x94 DB 0x62,0x93,0x62,0x93,0x62,0x93,0x62,0x94,0x62,0x94,0x62,0x93,0x62,0x73,0x5A,0x73。

多个18B20测温度1602液晶显示C语言程序

多个18B20测温度1602液晶显示C语言程序

/*-----------------------------------------------名称:DS18b20 温度检测液晶显示论坛:编写:shifang日期:2009.5修改:无内容:------------------------------------------------*/#include<reg52.h> //包含头文件,一般情况不需要改动,头文件包含特殊功能寄存器的定义#include<stdio.h>#include "18b20.h"#include "18b20a.h"#include "1602.h"#include "delay.h"bit ReadTempFlag;//定义读时间标志void Init_Timer0(void);//定时器初始化/*------------------------------------------------串口通讯初始化------------------------------------------------*/void UART_Init(void){SCON = 0x50; // SCON: 模式1, 8-bit UART, 使能接收TMOD |= 0x20; // TMOD: timer 1, mode 2, 8-bit 重装TH1 = 0xFD; // TH1: 重装值9600 波特率晶振11.0592MHzTR1 = 1; // TR1: timer 1 打开//EA = 1; //打开总中断//ES = 1; //打开串口中断TI=1;}/*------------------------------------------------主函数------------------------------------------------*/void main (void){int temp;float temperature;char displaytemp[16];//定义显示区域临时存储数组LCD_Init(); //初始化液晶DelayMs(20); //延时有助于稳定LCD_Clear(); //清屏Init_Timer0();UART_Init();Lcd_User_Chr(); //写入自定义字符LCD_Write_Char(13,0,0x01);//写入温度右上角点LCD_Write_Char(14,0,'C'); //写入字符CLCD_Write_Char(13,1,0x01);//写入温度右上角点LCD_Write_Char(14,1,'C'); //写入字符Cwhile (1) //主循环{if(ReadTempFlag==1){ReadTempFlag=0;temp=ReadTemperature();temperature=(float)temp*0.0625;sprintf(displaytemp,"Temp1 %7.3f",temperature);//打印温度值LCD_Write_String(0,0,displaytemp);//显示第二行temp=ReadTemperature_a();temperature=(float)temp*0.0625;sprintf(displaytemp,"Temp2 %7.3f",temperature);//打印温度值LCD_Write_String(0,1,displaytemp);//显示第二行}}}/*------------------------------------------------定时器初始化子程序------------------------------------------------*/void Init_Timer0(void){TMOD |= 0x01; //使用模式1,16位定时器,使用"|"符号可以在使用多个定时器时不受影响//TH0=0x00; //给定初值//TL0=0x00;EA=1; //总中断打开ET0=1; //定时器中断打开TR0=1; //定时器开关打开}/*------------------------------------------------定时器中断子程序------------------------------------------------*/void Timer0_isr(void) interrupt 1{static unsigned int num;TH0=(65536-2000)/256; //重新赋值2ms TL0=(65536-2000)%256;num++;if(num==600) //{num=0;ReadTempFlag=1; //读标志位置1}}/*------------------------------------------------读取一个字节------------------------------------------------*/unsigned char ReadOneChar(void){unsigned char i=0;unsigned char dat = 0;for (i=8;i>0;i--){DQ = 0; // 给脉冲信号dat>>=1;DQ = 1; // 给脉冲信号if(DQ)dat|=0x80;DelayUs2x(25);}return(dat);}/*------------------------------------------------写入一个字节------------------------------------------------*/void WriteOneChar(unsigned char dat){unsigned char i=0;for (i=8; i>0; i--){DQ = 0;DQ = dat&0x01;DelayUs2x(25);DQ = 1;dat>>=1;}DelayUs2x(25);}/*------------------------------------------------读取温度------------------------------------------------*/unsigned int ReadTemperature(void){unsigned char a=0;unsigned int b=0;unsigned int t=0;Init_DS18B20();WriteOneChar(0xCC); // 跳过读序号列号的操作WriteOneChar(0x44); // 启动温度转换DelayMs(10);Init_DS18B20();WriteOneChar(0xCC); //跳过读序号列号的操作WriteOneChar(0xBE); //读取温度寄存器等(共可读9个寄存器)前两个就是温度a=ReadOneChar(); //低位b=ReadOneChar(); //高位b<<=8;t=a+b;return(t);}/*-----------------------------------------------名称:18B20温度传感器网站:编写:shifang日期:2009.5修改:无内容:18B20单线温度检测的应用样例程序------------------------------------------------*/#include"delay.h"#include"18b20a.h"/*------------------------------------------------18b20初始化------------------------------------------------*/bit Init_DS18B20_a(void){bit dat=0;DQ1 = 1; //DQ1复位DelayUs2x(5); //稍做延时DQ1 = 0; //单片机将DQ1拉低DelayUs2x(200); //精确延时大于480us 小于960us DelayUs2x(200);DQ1 = 1; //拉高总线DelayUs2x(50); //15~60us 后接收60-240us的存在脉冲dat=DQ1; //如果x=0则初始化成功, x=1则初始化失败DelayUs2x(25); //稍作延时返回return dat;}/*------------------------------------------------读取一个字节------------------------------------------------*/unsigned char ReadOneChar_a(void){unsigned char i=0;unsigned char dat = 0;for (i=8;i>0;i--){DQ1 = 0; // 给脉冲信号dat>>=1;DQ1 = 1; // 给脉冲信号if(DQ1)dat|=0x80;DelayUs2x(25);}return(dat);}/*------------------------------------------------写入一个字节------------------------------------------------*/void WriteOneChar_a(unsigned char dat){unsigned char i=0;for (i=8; i>0; i--)DQ1 = 0;DQ1 = dat&0x01;DelayUs2x(25);DQ1 = 1;dat>>=1;}DelayUs2x(25);}/*------------------------------------------------读取温度------------------------------------------------*/unsigned int ReadTemperature_a(void){unsigned char a=0;unsigned int b=0;unsigned int t=0;Init_DS18B20_a();WriteOneChar_a(0xCC); // 跳过读序号列号的操作WriteOneChar_a(0x44); // 启动温度转换DelayMs(10);Init_DS18B20_a();WriteOneChar_a(0xCC); //跳过读序号列号的操作WriteOneChar_a(0xBE); //读取温度寄存器等(共可读9个寄存器)前两个就是温度a=ReadOneChar_a(); //低位b=ReadOneChar_a(); //高位b<<=8;t=a+b;return(t);}#include "delay.h"/*------------------------------------------------uS延时函数,含有输入参数unsigned char t,无返回值unsigned char 是定义无符号字符变量,其值的范围是0~255 这里使用晶振12M,精确延时请使用汇编,大致延时长度如下T=tx2+5 uS------------------------------------------------*/void DelayUs2x(unsigned char t)while(--t);}/*------------------------------------------------mS延时函数,含有输入参数unsigned char t,无返回值unsigned char 是定义无符号字符变量,其值的范围是0~255 这里使用晶振12M,精确延时请使用汇编------------------------------------------------*/void DelayMs(unsigned char t){while(t--){//大致延时1mSDelayUs2x(245);DelayUs2x(245);}}#define EN_CLR EN=0#define EN_SET EN=1#define DataPort P0/*------------------------------------------------判忙函数------------------------------------------------*/bit LCD_Check_Busy(void){DataPort= 0xFF;RS_CLR;RW_SET;EN_CLR;_nop_();EN_SET;return (bit)(DataPort & 0x80);}/*------------------------------------------------写入命令函数------------------------------------------------*/void LCD_Write_Com(unsigned char com)while(LCD_Check_Busy()); //忙则等待RS_CLR;RW_CLR;EN_SET;DataPort= com;_nop_();EN_CLR;}/*------------------------------------------------写入数据函数------------------------------------------------*/void LCD_Write_Data(unsigned char Data){while(LCD_Check_Busy()); //忙则等待RS_SET;RW_CLR;EN_SET;DataPort= Data;_nop_();EN_CLR;}/*------------------------------------------------清屏函数------------------------------------------------*/void LCD_Clear(void){LCD_Write_Com(0x01);DelayMs(5);}/*------------------------------------------------写入字符串函数------------------------------------------------*/void LCD_Write_String(unsigned char x,unsigned char y,unsigned char *s) {if (y == 0){LCD_Write_Com(0x80 + x); //表示第一行}else{LCD_Write_Com(0xC0 + x); //表示第二行}while (*s){LCD_Write_Data( *s);s ++;}}/*------------------------------------------------写入字符函数------------------------------------------------*/void LCD_Write_Char(unsigned char x,unsigned char y,unsigned char Data) {if (y == 0){LCD_Write_Com(0x80 + x);}else{LCD_Write_Com(0xC0 + x);}LCD_Write_Data( Data);}/*------------------------------------------------初始化函数------------------------------------------------*/void LCD_Init(void){LCD_Write_Com(0x38); /*显示模式设置*/DelayMs(5);LCD_Write_Com(0x38);DelayMs(5);LCD_Write_Com(0x38);DelayMs(5);LCD_Write_Com(0x38);LCD_Write_Com(0x08); /*显示关闭*/LCD_Write_Com(0x01); /*显示清屏*/LCD_Write_Com(0x06); /*显示光标移动设置*/DelayMs(5);LCD_Write_Com(0x0C); /*显示开及光标设置*/}/*------------------------------------------------设定二个自定义字符,LCD1602中自定义字符的地址为0x00--0x07,即可定义8个字符这里我们设定把一个自定义字符放在0x00位置(000),另一个放在0x01位子(001)------------------------------------------------*/void Lcd_User_Chr(void){ //第一个自定义字符LCD_Write_Com(0x40); //"01 000 000" 第1行地址(D7D6为地址设定命令形式 D5D4D3为字符存放位置(0--7),D2D1D0为字符行地址(0--7))LCD_Write_Data(0x00); //"XXX 11111" 第1行数据(D7D6D5为XXX,表示为任意数(一般用000),D4D3D2D1D0为字符行数据(1-点亮,0-熄灭)LCD_Write_Com(0x41); //"01 000 001" 第2行地址LCD_Write_Data(0x04); //"XXX 10001" 第2行数据LCD_Write_Com(0x42); //"01 000 010" 第3行地址LCD_Write_Data(0x0e); //"XXX 10101" 第3行数据LCD_Write_Com(0x43); //"01 000 011" 第4行地址LCD_Write_Data(0x0e); //"XXX 10001" 第4行数据LCD_Write_Com(0x44); //"01 000 100" 第5行地址LCD_Write_Data(0x0e); //"XXX 11111" 第5行数据LCD_Write_Com(0x45); //"01 000 101" 第6行地址LCD_Write_Data(0x1f); //"XXX 01010" 第6行数据LCD_Write_Com(0x46); //"01 000 110" 第7行地址LCD_Write_Data(0x04); //"XXX 11111" 第7行数据LCD_Write_Com(0x47); //"01 000 111" 第8行地址LCD_Write_Data(0x00); //"XXX 00000" 第8行数据//第二个自定义字符LCD_Write_Com(0x48); //"01 001 000" 第1行地址LCD_Write_Data(0x03); //"XXX 00001" 第1行数据LCD_Write_Com(0x49); //"01 001 001" 第2行地址LCD_Write_Data(0x03); //"XXX 11011" 第2行数据LCD_Write_Com(0x4a); //"01 001 010" 第3行地址LCD_Write_Data(0x00); //"XXX 11101" 第3行数据LCD_Write_Com(0x4b); //"01 001 011" 第4行地址LCD_Write_Data(0x00); //"XXX 11001" 第4行数据LCD_Write_Com(0x4c); //"01 001 100" 第5行地址LCD_Write_Data(0x00); //"XXX 11101" 第5行数据LCD_Write_Com(0x4d); //"01 001 101" 第6行地址LCD_Write_Data(0x00); //"XXX 11011" 第6行数据LCD_Write_Com(0x4e); //"01 001 110" 第7行地址LCD_Write_Data(0x00); //"XXX 00001" 第7行数据LCD_Write_Com(0x4f); //"01 001 111" 第8行地址LCD_Write_Data(0x00); //"XXX 00000" 第8行数据}。

液晶控制器T6963的C语言驱动程序

液晶控制器T6963的C语言驱动程序
unsigned int StartAddr;
StartAddr=lin*LineChar*16 +column; //定位起始行
for(i=0;i<35;i++)
{
OutPortCom3( (unsigned char)(StartAddr), (unsigned char)(StartAddr>>8), 0x24); //定位当前操作位置
//显示一个汉字(16*16点阵)
//lin:行(0-7), column: 列(0-7)
//hzcode: 汉字代码(自定义的)
void ShowHZD(unsigned char lin,unsigned char column,unsigned int hzcode)
{
unsigned char i,j;
/*------输入/出函数,与T6963通讯------------------------------------------------*/
/*------------------------------------------------------------------------*/
#include "menu.h" //汉字点阵库(自做)
//set following data by user according to LCD
#define ComPort 0xB101
#define DataPort 0xB000
#define GraphAddr 0x0000 //head of graph
unsigned char InPortData() { RWCheck(); return(XBYTE[DataPort]); }

基于单片机液晶的c语言数字显示

基于单片机液晶的c语言数字显示

LCD_write_char('.');//加上小数点
y =x*1000000; //此句可以修改,来扩大显示位数到 20 位
//一位一位的补 0
if(y <100000) LCD_write_char('0');//防止小数点后边第 1 位是 0
if(y<10000) LCD_write_char('0');//防止小数点后边第 2 位是 0
基于单片机液晶的 c 语言数字显示
前言:
编者之前遇到的问题(所有存在的问题均在小数部分) 1、显示“123.01235”时,取出整数部分后,小数部分如果放大 100000 倍,变成 1235,再 去显示 1235,就会发现小数点后第一位的 0 丢失了。 2、显示“1.23100”时如果直接放大 100000 倍,那么显示的是“1.23099”;但是如果里边没 有 0 是可以正常显示的。 3、如果取出整数部分,然后一位一位的放大 10 倍再去显示,会发现从小数点后左边第一个 0 开始以后全是 0。例如:显示“1.23052”,实际显示的是“1.23000”。
结语:以上的程序可以直接调用,只需要修改 LCD_write_char('0')为你所用的显示函数
显示字符'0'即可。
if(y<1000) LCD_write_char('0');//防止小数点后边第 3 位是 0
if(y<100)
LCD_write_char('0');//防止小数点后边第 4 位是 0
if(y<10)
LCD_write_char('0');//防止小数点后边第 5 位是 0

1602LCD简单时钟显示实验C语言

1602LCD简单时钟显示实验C语言
lcd_wmd(tmp);
tmp=dispbuf[1];
tmp=word[tmp];
lcd_wmd(tmp);
tmp=dispbuf[0];
tmp=word[tmp];
lcd_wmd(tmp);
}
/*********************键盘子程序***********************/
uchar keypro(void)
{
uchar scanl,scanh;
P1=0xf0;
if((P3&0xf0)!=0xf0)
{
delay();
if((P1&0xf0)!=0xf0)
{
scanl=0xfe;
while((scanl&0x10)!=0)
{
P1=scanl;
if((P3&0xf0)!=0xf0)
{
scanh=(P1&0xf0)|0x0f;
return (~scanh)+(~scanl);
}
else scanl=(scanl<<1)|0x01;
}
/*******写命令**********/
void lcd_wmc(uchar i)
{
P0=i;
RS=0;
RW=0;
E=0;
delay();
E=1;
}
/*******写数据***********/
void lcd_wmd(uchar i)
dispbuf[5]=11;
}
//更新显示缓冲区及调用显示程序
if(counter==0)

可以直接显示汉字的19264液晶驱动C语言程序

可以直接显示汉字的19264液晶驱动C语言程序

注:本程序是经过KEIL编译通过,并通过实验板测试通过的,直接按硬件电路连接好显示屏然后将程序代码烧写入单片机即可点亮,将显示武汉2 字,并且随意设置坐标,就可以在不同的位置显示,使用很方便。

如果不能显示请将软件中的接口定义按照本电路图中的定义修改一下即可。

19264液晶显示屏的硬件连接图本人修改过的19264液晶驱动程序C51 示例.//***********硬件的连接*******************//RS=P3.0 R/W=P3.1 E=P3.2 CS1=P3.3 CS2=P3.4 CS3=P3.5 HZ=12M DB0-D7=P1.0-P1.7 Reset=InBosrd//***********************************************#include <REGX51.H>#include <stdlib.H>#include <intrins.H>#include <stdio.H>//****************引脚定义***********************sbit RS=P2^0;sbit RW=P2^1;sbit E=P2^2;sbit CSL=P2^3;sbit CSM=P2^4;sbit CSR=P2^5;sbit LED=P2^6;#define Col_Add 0x40 ///Y地址#define Page_Add 0xb8char code wu[]={/*-- 文字: 武--*//*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/0x10,0x10,0x14,0x14,0x14,0xD4,0x14,0x14,0x10,0x7F,0x90,0x12,0x14,0x10,0x10,0x00, 0x40,0x40,0x7F,0x20,0x20,0x1F,0x11,0x11,0x01,0x00,0x07,0x18,0x20,0x40,0xF0,0x00 };char code han[]={/*-- 文字: 汉--*//*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/0x10,0x60,0x01,0x86,0x60,0x04,0x1C,0xE4,0x04,0x04,0x04,0xE4,0x1C,0x04,0x00,0x00, 0x04,0x04,0x7E,0x01,0x40,0x20,0x20,0x10,0x0B,0x04,0x0B,0x10,0x30,0x60,0x20,0x00 };//********声明函数**********************************void Delay(unsigned int MS);void wtcom(void);//********检查Busy 测忙****************************void BusyL(void){CSL=1;CSM=0;CSR=0;wtcom();}void BusyM(void){CSL=0;CSM=1;CSR=0;wtcom();}void BusyR(void){CSL=0;CSM=0;CSR=1;wtcom();}void wtcom(void){RS=0;RW=1;P1=0xFF;E=1;_nop_();while(P1&0x80);E=0;_nop_();}//***********写指令************************************** void WriteCommangL(unsigned char CommandByte) //写左屏程序{void wtcom(); ///侧忙程序。

12864-液晶显示-c语言程序

12864-液晶显示-c语言程序
delay(100); //大于100uS的延时程序
TransferData(0x36,0); //Extended Function Set:RE=1: extended instruction set
delay(37); ////大于37uS的延时程序
TransferData(0x3E,0); //EXFUNCTION(DL=8BITS,RE=1,G=1)
uchar code IC_DAT[]={
" HOT-51 "
" "
"单片机开发板"
"东流电子"
};
uchar code IC_DAT2[]={
"白日依山尽,"//0x80
"欲穷千里目,"//0x90
"黄河入海流。"//0x88
"更上一层楼。"//0x98
};
/********************************************************************
delay(37); ////大于37uS的延时程序
TransferData(0x08,0); //Display on Control
delay(100); //大于100uS的延时程序
TransferData(0x10,0); //Cursor Display Control光标设置
delay(100); //大于100uS的延时程序
void display_grapic(void);
void delayms(uint n);
void DisplayLine(uchar line1,uchar line2);
相关主题
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
相关文档
最新文档