LCD12864(KS0107 KS010)示例程序

发布者:数字驿站最新更新时间:2018-01-09 来源: eefocus关键字:LCD12864  KS0107  KS010 手机看文章 扫描二维码
随时随地手机看文章

//LCD12864: KS0107 KS0108
//keilc51

#include <\atmel\AT89x52.H>

#define lcd_reset P3_3
#define lcd_cs1   P3_4
#define lcd_cs2   P3_2
#define lcd_di    P3_7

#define lcd_rw    P3_6
#define lcd_e     P3_5
#define lcd_dp    P0
#define delay_time 0x10
const unsigned char code chr1[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0xC0,0x00,0x07,0x80,0x00,0x00,0x00,0x00,0xE0,0x00,0x0F,0xF0,0x00,
0x00,0x00,0x00,0xF0,0x00,0x0F,0xF0,0x00,0x00,0x00,0x00,0xFC,0x00,0x1F,0xF8,0x00,
0x00,0x10,0x00,0xFC,0x00,0x3F,0xF0,0x00,0x00,0x1C,0x00,0x7E,0x00,0xFF,0xC0,0x00,
0x00,0x1E,0x00,0x7E,0x01,0xFE,0x00,0x00,0x00,0x1F,0x00,0x3E,0x07,0xF8,0x00,0x00,
0x00,0x1F,0x80,0x1C,0x0F,0xE0,0x00,0x00,0x00,0x0F,0xC0,0x00,0x3F,0x00,0x00,0x00,
0x00,0x0F,0xC0,0x00,0x7C,0x00,0x00,0x00,0x00,0x0F,0xC0,0x00,0xF0,0x00,0x0C,0x00,
0x00,0x03,0xC0,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x03,0x00,0x00,0x3E,0x00,0xF0,0x00,
0x00,0x03,0xFF,0xFF,0xFF,0x03,0xE0,0x00,0x00,0x03,0xFF,0xFF,0xFF,0x87,0xC0,0x00,
0x00,0x03,0xFF,0xFF,0xFF,0x1F,0x80,0x00,0x00,0x03,0xC3,0x06,0x07,0xFF,0x00,0x00,
0x00,0x03,0x03,0x06,0x07,0xFE,0x00,0x00,0x00,0x03,0x03,0x06,0x0F,0xFC,0x00,0x00,
0x00,0x03,0x07,0x06,0x0F,0xF8,0x00,0x00,0x00,0x06,0x07,0x0E,0x0E,0xF0,0x00,0x00,
0x00,0x06,0x07,0x0E,0x0E,0xE0,0x00,0x00,0x00,0x06,0x07,0x0E,0x0E,0x00,0x00,0x00,
0x00,0x06,0x0F,0x0E,0x1E,0x30,0x00,0x00,0x00,0x0E,0x0E,0x0E,0x1E,0x38,0x00,0x00,
0x00,0x0F,0xFE,0x0C,0x1E,0x1C,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFF,0x9F,0x00,0x00,
0x00,0x07,0xFF,0xFF,0xFF,0x8F,0x80,0x00,0x00,0x07,0xFF,0xFF,0xFF,0x8F,0xC0,0x00,
0x00,0x03,0xFF,0xFF,0xFE,0x07,0xE0,0x00,0x00,0x03,0x80,0x00,0x00,0x07,0xF0,0x00,
0x00,0x00,0x00,0x00,0x00,0x03,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0x1E,0x00,0x00,0x00,
0x00,0x00,0x0F,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0x80,0x18,0x00,
0x00,0x00,0x0F,0xFF,0xFF,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,
0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xC0,0x03,0xC0,0x00,0x00,0x00,0x00,0x1F,0xE0,
0x03,0xFF,0xF8,0x0F,0xFF,0xFF,0xFF,0xF0,0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,
0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xE0,0x01,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,
0x01,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
const unsigned char code chr2[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x0F,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x0F,0x00,0x00,0xF0,0x00,0x00,
0x00,0x00,0x0E,0x08,0x20,0x7E,0x00,0x00,0x00,0x00,0x1E,0x0C,0x30,0x7F,0xE0,0x00,
0x00,0x00,0x1E,0x0C,0x30,0x7F,0xF8,0x00,0x00,0x60,0x1E,0x1C,0x30,0x67,0xF8,0x00,
0x00,0x78,0x1C,0x1C,0x70,0x60,0x70,0x00,0x00,0x3E,0x1C,0x1C,0x70,0xE0,0x70,0x00,
0x00,0x3F,0xBC,0x38,0x70,0xE0,0x60,0x00,0x00,0x3F,0xFC,0x38,0x70,0xC0,0x60,0x00,
0x00,0x1F,0xF8,0x38,0xE0,0xC0,0xE0,0x00,0x00,0x0F,0xF8,0x78,0xE1,0xC3,0xE0,0x00,
0x00,0x03,0xB8,0x78,0xE1,0xFF,0xE0,0x00,0x00,0x00,0x78,0x38,0xE1,0xFF,0xE0,0x00,
0x00,0x00,0x78,0x30,0x61,0xFF,0x60,0x00,0x00,0x00,0x70,0x00,0x41,0xF8,0x00,0x00,
0x00,0x00,0x70,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x04,0x00,0x00,
0x00,0x00,0x30,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x10,0xC0,0x20,0x07,0x00,0x00,
0x00,0x00,0x00,0xC0,0x30,0x07,0x80,0x00,0x00,0x00,0x00,0xE0,0x30,0x07,0x80,0x00,
0x00,0x00,0x00,0xE0,0x30,0x07,0x80,0x00,0x00,0x00,0x01,0xE0,0x70,0x07,0x80,0x00,
0x00,0x00,0x01,0xE0,0x7C,0x0F,0x00,0x00,0x00,0x00,0x01,0xE0,0x7F,0xFF,0x00,0x00,
0x00,0x00,0x01,0xE0,0x7F,0xFE,0x00,0x00,0x00,0x00,0x01,0xC0,0xFF,0xFE,0x00,0x00,
0x00,0x00,0x03,0xC0,0xEE,0x1C,0x00,0x00,0x00,0x00,0x03,0xC1,0xE0,0x1C,0x00,0x00,
0x03,0x00,0x03,0x81,0xE0,0x38,0x00,0x00,0x03,0xE0,0x03,0x81,0xE0,0x38,0x00,0x00,
0x03,0xFF,0x87,0x80,0xC0,0x38,0x00,0x00,0x03,0xFF,0xFF,0x80,0xC0,0x70,0x00,0x00,
0x01,0xFF,0xFF,0xF8,0x00,0x60,0x00,0x00,0x01,0xFF,0xFF,0xFF,0x80,0x60,0x00,0x00,
0x00,0xFF,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0x80,0x00,0x00,
0x00,0x00,0x0F,0x07,0xFF,0xE0,0x00,0x00,0x00,0x00,0x0F,0x00,0x7F,0xF8,0x00,0x00,
0x00,0x00,0x0F,0x00,0x03,0xFE,0x00,0x00,0x00,0x30,0x0F,0x00,0x00,0xFF,0x00,0x00,
0x00,0x3C,0x1F,0x00,0x00,0x1F,0xE0,0x00,0x00,0x1E,0x1F,0x00,0x00,0x07,0xF0,0x00,
0x00,0x1F,0x8F,0x00,0x00,0x03,0xF8,0x00,0x00,0x1F,0xCF,0x00,0x00,0x00,0xFC,0x00,
0x00,0x1F,0xC7,0x00,0x00,0x00,0x7E,0x00,0x00,0x0F,0xC6,0x00,0x00,0x00,0x3F,0x00,
0x00,0x07,0xC0,0x00,0x00,0x00,0x1F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x80,
0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xC0,
0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xC0,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
const unsigned char code chr3[]=
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x07,0xFF,0xFF,0xFE,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFF,0x00,
0x00,0x00,0x00,0x18,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x18,0x00,0x00,0x01,0x80,
0x00,0x00,0x00,0x18,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x18,0x00,0x00,0x01,0x80,
0x00,0x00,0x00,0x18,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0xF8,0x78,0x78,0x01,0x80,
0x00,0x00,0x07,0xF8,0x78,0x78,0x01,0x80,0x00,0x00,0x1F,0xF8,0x78,0x78,0x01,0x80,
0x00,0x00,0x3F,0xF8,0x78,0x78,0x01,0x80,0x00,0x00,0x7E,0x18,0x07,0x80,0x01,0x80,
0x00,0x00,0xF8,0x18,0x07,0x80,0x01,0x80,0x00,0x00,0xF0,0x18,0x07,0x80,0x01,0x80,
0x00,0x00,0xE0,0x18,0x78,0x79,0xE1,0x80,0x00,0x01,0xE0,0x18,0x78,0x79,0xE1,0x80,
0x00,0x01,0xE0,0x18,0x78,0x79,0xE1,0x80,0x00,0x01,0xE0,0x18,0x78,0x79,0xE1,0x80,
0x00,0x01,0xE0,0x18,0x7F,0xF9,0xE1,0x80,0x00,0x01,0xE0,0x18,0x07,0x81,0xE1,0x80,
0x00,0x00,0xE0,0x18,0x07,0x81,0xE1,0x80,0x00,0x00,0xE0,0x18,0x07,0x81,0xE1,0x80,
0x00,0x00,0xE0,0x18,0x07,0x81,0xE1,0x80,0x00,0x00,0xF0,0x18,0x78,0x79,0xE1,0x80,
0x00,0x00,0xF0,0x18,0x78,0x79,0xE1,0x80,0x00,0x00,0xF0,0x18,0x78,0x79,0xE1,0x80,
0x00,0x00,0x70,0x18,0x78,0x79,0xE1,0x80,0x00,0x00,0x70,0x18,0x07,0x81,0xE1,0x80,
0x00,0x00,0x70,0x18,0x07,0x81,0xE1,0x80,0x00,0x00,0x70,0x18,0x07,0x81,0xE1,0x80,
0x00,0x00,0xF0,0x18,0x07,0x81,0xE1,0x80,0x00,0x00,0xF0,0x18,0x7F,0xF9,0xE1,0x80,
0x00,0x00,0xE0,0x18,0x78,0x79,0xE1,0x80,0x00,0x01,0xE0,0x18,0x78,0x79,0xE1,0x80,
0x00,0x03,0xE0,0x18,0x78,0x79,0xE1,0x80,0x00,0x0F,0xC0,0x18,0x7F,0xF9,0xE1,0x80,
0x00,0x1F,0x80,0x18,0x07,0x81,0xE1,0x80,0x00,0x3F,0x00,0x18,0x07,0x81,0xE1,0x80,
0x00,0x3C,0x00,0x18,0x78,0x79,0xE1,0x80,0x00,0x00,0x00,0x18,0x78,0x79,0xE1,0x80,
0x00,0x00,0x00,0x18,0x78,0x79,0xE1,0x80,0x00,0x00,0x00,0x18,0x78,0x79,0xE1,0x80,
0x00,0x00,0x00,0x18,0x7F,0xF9,0xE1,0x80,0x00,0x00,0x00,0x18,0x07,0x80,0x01,0x80,
0x00,0x00,0x00,0x18,0x07,0x80,0x01,0x80,0x00,0x00,0x00,0x18,0x07,0x80,0x01,0x80,
0x00,0x00,0x00,0x18,0x78,0x78,0x01,0x80,0x00,0x00,0x00,0x18,0x78,0x78,0x01,0x80,
0x00,0x00,0x00,0x18,0x78,0x78,0x01,0x80,0x00,0x00,0x00,0x18,0x00,0x00,0x01,0x80,
0x00,0x00,0x00,0x18,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x18,0x00,0x00,0x01,0x80,
0x00,0x00,0x00,0x18,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x18,0x00,0x00,0x01,0x80,
0x00,0x00,0x00,0x18,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x18,0x00,0x00,0x01,0x80,
0x00,0x00,0x00,0x18,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFF,0x00,
0x00,0x00,0x00,0x03,0xFF,0xFF,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
const unsigned char code chr4[]=
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0x00,0x00,
0x00,0x00,0x00,0x00,0x73,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x60,0x7D,0xF8,0x00,
0x00,0x00,0x00,0x00,0x60,0x1C,0x3C,0x00,0x00,0x00,0x00,0x0F,0xF0,0x06,0x0E,0x00,
0x0F,0x00,0x00,0x0F,0xFC,0x02,0x07,0xF0,0x3F,0xF0,0x00,0x1C,0x3F,0x82,0x01,0xF0,
0x39,0xFE,0x00,0x18,0x03,0xE6,0x00,0x38,0x30,0x7F,0xE0,0x1C,0x01,0xFE,0x00,0x38,
0x30,0x07,0xFF,0x0E,0x00,0x78,0x00,0x18,0x30,0x00,0x7F,0xCF,0x80,0x38,0x00,0x18,
0x38,0x00,0x07,0xFF,0xE0,0x18,0x00,0x18,0x1F,0x00,0x03,0xFF,0xFC,0x18,0x00,0x18,
0x0F,0xF0,0x00,0x1B,0xFF,0xF8,0x00,0x18,0x03,0xFE,0x00,0x18,0xE7,0xF0,0x00,0x18,
0x00,0x1F,0xE0,0x18,0x70,0x00,0x00,0x18,0x00,0x07,0xFE,0x18,0x70,0x00,0x00,0x18,
0x00,0x00,0x3F,0xD8,0x30,0x00,0x00,0x18,0x00,0x00,0x03,0xDC,0x3F,0x00,0x00,0x18,
0x00,0x00,0x01,0xCC,0x3F,0xC0,0x00,0x18,0x00,0x00,0x0F,0xCC,0x00,0xC0,0x00,0x38,
0x00,0x00,0x7F,0x0C,0x00,0x00,0x00,0x30,0x00,0x01,0xF8,0x0F,0x00,0x00,0x07,0xF0,
0x00,0x0F,0xC0,0x07,0x80,0x00,0x1F,0xF0,0x00,0x7F,0x00,0x03,0xE0,0x00,0x7C,0x00,
0x01,0xF8,0x00,0x00,0xFC,0x01,0xF0,0x00,0x03,0xC0,0x00,0x1F,0xFE,0x07,0xC0,0x00,
0x07,0x80,0x03,0xFF,0xFF,0xFF,0x80,0x00,0x06,0x00,0x1F,0xC0,0x03,0xFC,0x00,0x00,
0x06,0x00,0x7E,0x00,0x00,0x70,0x00,0x00,0x06,0x0F,0xC0,0x00,0x00,0x00,0x00,0x00,
0x07,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,0x03,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
int timer0_count;
//==================================================================
void it_timer0(void) interrupt 1 /* interrupt address is 0x000b */
{
TF0 = 0; /* reset interrupt flag (already done by hardware)*/
TH0 = 0;TL0 = 0;
timer0_count++;
}
//==================================================================
void delay(int count)
{
timer0_count=0;
TMOD &= 0xF0;     /* Timer 0 mode 1 counter with SOFtware gate */
TMOD |= 0x05;     /* GATE0=0; C/T0#=1; M10=0; M00=1; */
TH0 = 0;          /* init values */
TL0 = 0;
ET0=1;            /* enable timer0 interrupt */
EA=1;             /* enable interrupts */
TR0=1;            /* timer0 run */
while(timer0_count<=count)
{
TF0=1;
}
TR0=0;TF0=0;
}


//==================================================================
void lcd_write_command(unsigned char cmd)
{
lcd_di=0;
lcd_rw=0;
lcd_dp=cmd;
lcd_e=1;
lcd_e=0;
lcd_di=0;
lcd_rw=1;
lcd_di=0;
lcd_e=1;
while(0x80==(lcd_dp&0x80)){;}
lcd_e=0;
lcd_rw=0;
//delay(0x1f);
}

//===================================================================
void lcd_write_data(unsigned char dat)
{
lcd_di=1;
lcd_rw=0;
lcd_dp=dat;
lcd_e=1;
lcd_e=0;
lcd_rw=1;
lcd_di=0;
lcd_e=1;
while(0x80==(lcd_dp&0x80)){;}
lcd_e=0;
lcd_rw=0;
//delay(0x1f);
}
//===============================================================
/*void lcd_init(void)
{
lcd_reset=0;
delay(0x2f);
lcd_reset=1;
lcd_cs1=1;
lcd_cs2=0;
lcd_cs3=0;
lcd_write_command(0x39);
lcd_write_command(0xc0);
lcd_write_command(0x3b);//up mode
lcd_write_command(0x3e);//start page 0

}*/
//===============================================================
void test1(void)
{
unsigned char county=0;
lcd_cs1=1;
lcd_cs2=1;
//--------------------------------------
lcd_write_command(0xb8);//set y start 0
for(county=0;county<=63;county++)
{
lcd_write_data(0x0);
delay(delay_time);
}
//--------------------------------------
lcd_write_command(0xb9);//set y start 0
for(county=0;county<=63;county++)
{
lcd_write_data(0x0);
delay(delay_time);
}
//--------------------------------------
lcd_write_command(0xba);//set y start 0
for(county=0;county<=63;county++)
{
lcd_write_data(0x0);
delay(delay_time);
}
//--------------------------------------
lcd_write_command(0xbb);//set y start 0
for(county=0;county<=63;county++)
{
lcd_write_data(0x0);
delay(delay_time);
}
//--------------------------------------
lcd_write_command(0xbc);//set y start 0
for(county=0;county<=63;county++)
{
lcd_write_data(0x0);
delay(delay_time);
}
//--------------------------------------
lcd_write_command(0xbd);//set y start 0
for(county=0;county<=63;county++)
{
lcd_write_data(0x0);
delay(delay_time);
}
//--------------------------------------
lcd_write_command(0xbe);//set y start 0
for(county=0;county<=63;county++)
{
lcd_write_data(0x0);
delay(delay_time);
}
//--------------------------------------
lcd_write_command(0xbf);//set y start 0
for(county=0;county<=63;county++)
{
lcd_write_data(0x0);
delay(delay_time);
}
}
//===============================================================
void test2(void)
{
unsigned char county=0;
lcd_cs1=1;
lcd_cs2=1;
//--------------------------------------
lcd_write_command(0xb8);//set y start 0
for(county=0;county<=63;county++)
{
lcd_write_data(0xff);
delay(delay_time);
}
//--------------------------------------
lcd_write_command(0xb9);//set y start 0
for(county=0;county<=63;county++)
{
lcd_write_data(0xff);
delay(delay_time);
}
//--------------------------------------
lcd_write_command(0xba);//set y start 0
for(county=0;county<=63;county++)
{
lcd_write_data(0xff);
delay(delay_time);
}
//--------------------------------------
lcd_write_command(0xbb);//set y start 0
for(county=0;county<=63;county++)
{
lcd_write_data(0xff);
delay(delay_time);
}
//--------------------------------------
lcd_write_command(0xbc);//set y start 0
for(county=0;county<=63;county++)
{
lcd_write_data(0xff);
delay(delay_time);
}
//--------------------------------------
lcd_write_command(0xbd);//set y start 0
for(county=0;county<=63;county++)
{
lcd_write_data(0xff);
delay(delay_time);
}
//--------------------------------------
lcd_write_command(0xbe);//set y start 0
for(county=0;county<=63;county++)
{
lcd_write_data(0xff);
delay(delay_time);
}
//--------------------------------------
lcd_write_command(0xbf);//set y start 0
for(county=0;county<=63;county++)
{
lcd_write_data(0xff);
delay(delay_time);
}
}
//===============================================================
void test3(void)
{
unsigned char row;
unsigned char col;
lcd_cs1=0;
lcd_cs2=1;
for(col=0;col<8;col++)
{
lcd_write_command(0xb8+(7-col));
 for(row=0;row<64;row++)
 {
  lcd_write_data(chr1[col+((63-row)*8)]);
 }
}
}
//===============================================================
void test4(void)
{
unsigned char row;
unsigned char col;
lcd_cs1=1;
lcd_cs2=0;
for(col=0;col<8;col++)
{
lcd_write_command(0xb8+(7-col));
 for(row=0;row<64;row++)
 {
  lcd_write_data(chr2[col+((63-row)*8)]);
 }
}
}
//===============================================================
//===============================================================
void test5(void)
{
unsigned char row;
unsigned char col;
lcd_cs1=1;
lcd_cs2=0;
for(col=0;col<8;col++)
{
lcd_write_command(0xb8+(7-col));
 for(row=0;row<64;row++)
 {
  lcd_write_data(chr3[col+((63-row)*8)]);
 }
}
}
//===============================================================
//===============================================================
void test6(void)
{
unsigned char row;
unsigned char col;
lcd_cs1=0;
lcd_cs2=1;
for(col=0;col<8;col++)
{
lcd_write_command(0xb8+(7-col));
 for(row=0;row<64;row++)
 {
  lcd_write_data(chr4[col+((63-row)*8)]);
 }
}
}
//===============================================================
void main(void)
{
unsigned char count=0;

//unsigned char temp1;


//lcd_init();

lcd_reset=0;
lcd_reset=1;
lcd_write_command(0x3f);//turn lcd
lcd_write_command(0xc0);//set x start 0
//lcd_write_command(0xba);//set y start 0
lcd_write_command(0x40);//set y start page 0
//----------------------------

//lcd_write_command(0x39);//display on
while(1)
{
test1();
delay(0x2000);
test3();
delay(0x2000);
test4();
delay(0x2000);
test2();
delay(0x2000);
test5();
delay(0x2000);
test6();
delay(0x2000);
}
}


关键字:LCD12864  KS0107  KS010 引用地址:LCD12864(KS0107 KS010)示例程序

上一篇:TLC0831示例程序
下一篇:12864液晶显示源程序汇编程序

推荐阅读最新更新时间:2024-03-16 15:52

基于LCD12864显示器的数字示波器设计
  本文针对LCD12864 特性,完成了数字示波器显示必须的绘图驱动程序设计,这个教程定位给初学者使用,我立足从简单到复杂一步一步介绍设计过程,甚至是调试的过程,还包括一些经验总结,特别是提供了完整的keil 工程附件。希望读者立足示波器项目,学到更多软硬件设计经验技巧。   一、简易数字示波器原理   数字示波器基本原理可以简单理解为:数据采集+ 图形显示,该过程循环进行,如图1 所示。 图1 简易数字示波器流程图   LCD 图形显示需要根据LCD 特性设计,不同LCD驱动程序不同,本篇将结合不带字库的LCD12864 设计显示程序。   二、图形液晶LCD12864绘图驱动设计基础   关于LCD 的硬件接
[测试测量]
基于<font color='red'>LCD12864</font>显示器的数字示波器设计
LCD12864程序
希望对第一次接触液晶屏的人有一定帮助 #include reg52.h #include intrins.h // 声明了void _nop_(void) #include zhicu.h #define uchar unsigned char #define uint unsigned int #define DPORT P3 // 命令数据输出端口 sbit RS =P2^7 ; sbit RW =P2^6 ; sbit E =P2^5 ; sbit CS2=P2^4 ; sbit CS1=P2^3 ; #define disp_start 0xc0 //显示起始行设置. #d
[单片机]
单片机LCD12864无限扩展多级菜单源码
单片机源程序如下: #include delay.h #include 12864.h #include fun.h #include key.h #include wakeup.h u8 func_index=0; void (*current_operation_index)(); //执行当前显示函数 typedef struct { u8 current; //当前状态号 u8 up;//向上翻索引号 u8 down;//向下翻索引号 u8 enter;//确认索引号 u8 num_ent;//编码器确认键 void (*current_operat
[单片机]
小广播
添点儿料...
无论热点新闻、行业分析、技术干货……
设计资源 培训 开发板 精华推荐

最新单片机文章
何立民专栏 单片机及嵌入式宝典

北京航空航天大学教授,20余年来致力于单片机与嵌入式系统推广工作。

更多每日新闻
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved