《jlx12864g-086-p官方例程》由会员分享,可在线阅读,更多相关《jlx12864g-086-p官方例程(6页珍藏版)》请在金锄头文库上搜索。
1、sbit cs1=P11; sbit reset=P10; sbit rs=P30; sbit sclk=P31; sbit sid=P32;/sid 就是 SDA,串行数据信号 void Transfer_data(int data1); void Transfer_command(int data1); unsigned char code graphic1; void Delay(int i); void Delay1(int i); void DisplayGraphic1(); void Initial_Lcd(); void clear_screen(); void Switch(
2、); /=main program= void main(void) int i,j,k; Initial_Lcd(); while(1) clear_screen(); /clear all dots DisplayGraphic1(); /display a picture of 128*64 dots Switch(); /=initial void Initial_Lcd() reset=0; /Reset the chip when reset=0 Delay(50); reset=1; Delay(50); Transfer_command(0xe2); /*软复位*/ Trans
3、fer_command(0x2c); /*升压步聚 1*/ Transfer_command(0x2e); /*升压步聚 2*/ Transfer_command(0x2f); /*升压步聚 3*/ Transfer_command(0x23); /*粗调对比度,可设置范围 2027*/ Transfer_command(0x81); /*微调对比度*/ Transfer_command(0x28); /*微调对比度的值,可设置范围 063*/ Transfer_command(0xa2); /*1/9 偏压比(bias)*/ Transfer_command(0xc8); /*行扫描顺序:从
4、上到下*/ Transfer_command(0xa0); /*列扫描顺序:从左到右*/ Transfer_command(0xaf); /*开显示*/ /=clear all dot martrics= void clear_screen() unsigned char i,j; for(i=0;i9;i+) cs1=0; Transfer_command(0xb0+i); Transfer_command(0x10); Transfer_command(0x00); for(j=0;j132;j+) Transfer_data(0x00); /=display a piture of 12
5、8*64 dots= void DisplayGraphic1() unsigned char *address; /define pointer int i,j; address=graphic1; /data pointer:point to graphic,one-dimensional array for(i=0;i8;i+) char i; cs1=0; rs=0; for(i=0;i8;i+) sclk=0; if(data1 Delay1(2); data1=data1=1; /*-写数据-*/ void Transfer_data(int data1) char i; cs1=
6、0; rs=1; for(i=0;i8;i+) sclk=0; if(data1 data1=data1=1; /*=等按键=*/ void Switch() repeat: if (P2 if (P2&0x01) goto repeat; else; /- unsigned char code graphic1= /*- 调入了一幅图像:d:My DocumentsMy Pictures多字.bmp -*/ /*- 宽度 x 高度=128x64 -*/ 0x00,0x00,0x00,0x00,0x7E,0x2A,0x2A,0x2A,0x2A,0x2A,0x2A,0x7E,0x00,0x00,
7、0x00,0x00, 0x02,0xFE,0x92,0x92,0x92,0xFE,0x12,0x11,0x12,0x1C,0xF0,0x18,0x17,0x12,0x10,0x00, 0x20,0x21,0x2E,0xE4,0x00,0x42,0x42,0xFE,0x42,0x42,0x42,0x02,0xFE,0x00,0x00,0x00, 0x00,0x00,0xF8,0x48,0x48,0x48,0x48,0xFF,0x48,0x48,0x48,0x48,0xF8,0x00,0x00,0x00, 0x00,0x00,0x02,0x02,0x02,0x02,0x02,0xE2,0x12,0
8、x0A,0x06,0x02,0x00,0x80,0x00,0x00, 0x00,0x08,0x08,0x08,0xFF,0x08,0x08,0xF8,0x00,0xF8,0x08,0x08,0x08,0xF8,0x00,0x00, 0x00,0x00,0x02,0x02,0x02,0x02,0x02,0xFE,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00, 0x00,0x00,0xFE,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00, 0x00,0x7F,0x25,0x25,0x
9、25,0x25,0x7F,0x00,0x00,0x7F,0x25,0x25,0x25,0x25,0x7F,0x00, 0x08,0x1F,0x08,0x08,0x04,0xFF,0x05,0x81,0x41,0x31,0x0F,0x11,0x21,0xC1,0x41,0x00, 0x00,0x00,0x00,0x7F,0x20,0x10,0x00,0x7F,0x00,0x00,0x00,0x00,0x3F,0x40,0x38,0x00, 0x00,0x00,0x0F,0x04,0x04,0x04,0x04,0x3F,0x44,0x44,0x44,0x44,0x4F,0x40,0x70,0x00
10、, 0x01,0x01,0x01,0x01,0x01,0x41,0x81,0x7F,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00, 0x40,0x20,0x18,0x07,0x00,0x20,0x40,0x3F,0x00,0x7F,0x10,0x10,0x10,0x3F,0x00,0x00, 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3F,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00, 0x40,0x30,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
11、0x00,0x00,0x00,0x00,0x00, 0x10,0x61,0x06,0xE0,0x18,0x84,0xE4,0x1C,0x84,0x65,0xBE,0x24,0xA4,0x64,0x04,0x00, 0x00,0x00,0x00,0x00,0x7E,0x2A,0x2A,0x2A,0x2A,0x2A,0x2A,0x7E,0x00,0x00,0x00,0x00, 0x00,0x00,0xFF,0x09,0x49,0x59,0xE9,0x49,0x49,0x49,0xE9,0x59,0x49,0x4F,0x00,0x00, 0x10,0x61,0x06,0xE0,0x18,0x84,0
12、xE4,0x1C,0x84,0x65,0xBE,0x24,0xA4,0x64,0x04,0x00, 0x00,0x00,0x00,0x00,0x7E,0x2A,0x2A,0x2A,0x2A,0x2A,0x2A,0x7E,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x3E,0x2A,0xEA,0x2A,0x2A,0x2A,0xEA,0x2A,0x3E,0x00,0x00,0x00,0x00, 0x00,0x20,0x20,0x22,0x22,0x22,0x22,0xE2,0x22,0x22,0x22,0x22,0x22,0x20,0x20,0x00, 0x40,0x
13、40,0x4F,0x49,0x49,0xC9,0xCF,0x70,0xC0,0xCF,0x49,0x59,0x69,0x4F,0x00,0x00, 0x04,0x04,0xFF,0x00,0x01,0x00,0xFF,0x41,0x21,0x12,0x0C,0x1B,0x61,0xC0,0x40,0x00, 0x00,0x7F,0x25,0x25,0x25,0x25,0x7F,0x00,0x00,0x7F,0x25,0x25,0x25,0x25,0x7F,0x00, 0x40,0x30,0x0F,0x82,0x42,0x32,0x0F,0x02,0x02,0x02,0xFF,0x02,0x02
14、,0x02,0x02,0x00, 0x04,0x04,0xFF,0x00,0x01,0x00,0xFF,0x41,0x21,0x12,0x0C,0x1B,0x61,0xC0,0x40,0x00, 0x00,0x7F,0x25,0x25,0x25,0x25,0x7F,0x00,0x00,0x7F,0x25,0x25,0x25,0x25,0x7F,0x00, 0x20,0x21,0x22,0x2C,0x20,0x3F,0x20,0x20,0x20,0x3F,0x28,0x24,0x23,0x20,0x20,0x00, 0x10,0x08,0x04,0x03,0x00,0x40,0x80,0x7F,
15、0x00,0x00,0x01,0x02,0x0C,0x18,0x00,0x00, 0x02,0x02,0x7E,0x45,0x45,0x44,0x7C,0x00,0x7C,0x44,0x45,0x45,0x7E,0x06,0x02,0x00, 0x00,0x80,0x40,0x60,0x50,0x48,0x44,0xC3,0x44,0x48,0x50,0x70,0x60,0x20,0x00,0x00, 0x40,0x44,0x24,0x24,0xF4,0x5C,0x57,0x54,0x54,0x5C,0x54,0x24,0x64,0xC4,0x44,0x00, 0x00,0x00,0xFF,0x91,0x91,0xFF,0x00,0x00,0xFF,0xC1,0x41,0x49,0x51,0xCF,0x00,0x00, 0x20,0x10,0x10,0x88,0x84,0x4F