#include<reg51.h> #include<absacc.h> #define LLCD_CMD_WR PBYTE[0x10] #define LLCD_CMD_RD PBYTE[0x11] #define LLCD_DATA_WR PBYTE[0x12] #define LLCD_DATA_RD PBYTE[0x13] #define RLCD_CMD_WR PBYTE[0x20] #define RLCD_CMD_RD PBYTE[0x21] #define RLCD_DATA_WR PBYTE[0x22] #define RLCD_DATA_RD PBYTE[0x23] sbit busy=P0^1;
uchar code hz0[]= { 0x00, 0x00, 0xf8, 0x88, 0x99, 0xea, 0x8c, 0xf8, 0x88, 0xcc, 0xab, 0x99, 0x88, 0xf8, 0x00, 0x00,? 0x00, 0x00, 0x00, 0x00, 0xfe, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x20, 0x30, 0xac, 0x63, 0x10, 0x00, 0x40, 0x42, 0x22, 0x22, 0x12, 0x1a, 0x26, 0x42, 0xc0, 0x00,? 0x22, 0x23, 0x22, 0x12, 0x12, 0x00, 0x20, 0x21, 0x21, 0x21, 0x3f, 0x21, 0x21, 0x21, 0x20, 0x00,
0x10, 0x60, 0x01, 0x86, 0x60, 0x20, 0xd0, 0x48, 0x44, 0x43, 0x44, 0xc8, 0x30, 0x60, 0x20, 0x00,? 0x04, 0x04, 0xfe, 0x01, 0x00, 0x00, 0x7f, 0x80, 0x80, 0x84, 0x88, 0x87, 0x80, 0xe0, 0x00, 0x00,?
0x10, 0x60, 0x01, 0xf6, 0x00, 0x10, 0xf8, 0x17, 0x34, 0x54, 0x14, 0x14, 0xf4, 0x04, 0x04, 0x00,? 0x04, 0x04, 0xff, 0x00, 0x01, 0x01, 0x1f, 0x11, 0x13, 0x15, 0x51, 0x91, 0x7f, 0x11, 0x11, 0x00,?
0x14, 0x24, 0x44, 0x84, 0x7c, 0x40, 0x30, 0xfc, 0x4b, 0x48, 0xf9, 0x4e, 0x48, 0x48, 0x08, 0x00,? 0x10, 0x08, 0x06, 0x01, 0x03, 0x0c, 0x00, 0xff, 0x22, 0x22, 0x3f, 0x22, 0x22, 0x22, 0x20, 0x00,?
0x00, 0x10, 0x10, 0x12, 0x14, 0x1c, 0x10, 0xf0, 0x9f, 0x10, 0x10, 0x10, 0x10, 0xf8, 0x10, 0x00,? 0x00, 0x00, 0x40, 0x20, 0x10, 0x08, 0x06, 0x01, 0x00, 0x11, 0x26, 0x40, 0x20, 0x1f, 0x00, 0x00,?
0x00, 0x10, 0x10, 0x10, 0x90, 0x70, 0x00, 0xff, 0x20, 0x60, 0x90, 0x08, 0x04, 0x00, 0x00, 0x00,? 0x10, 0x10, 0x08, 0x06, 0x01, 0x40, 0x80, 0x7f, 0x00, 0x00, 0x01, 0x06, 0x0c, 0x18, 0x08, 0x00,?
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,? 0x00, 0x00, 0x58, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
uchar code hz1[]= { 0xfe, 0x02, 0x32, 0xca, 0x46, 0x20, 0x30, 0x2c, 0xe3, 0x24, 0x28, 0x10, 0x20, 0x20, 0x00, 0x00,? 0xff, 0x02, 0x04, 0x43, 0x20, 0x11, 0x4d, 0x81, 0x7f, 0x01, 0x05, 0x09, 0x11, 0x30, 0x00, 0x00,?
0x80, 0x88, 0x88, 0x88, 0xff, 0x88, 0x88, 0x88, 0x00, 0xfe, 0x02, 0x02, 0x02, 0xfe, 0x00, 0x00,? 0x00, 0x10, 0x3c, 0x13, 0x10, 0x08, 0x0a, 0x1c, 0x08, 0xff, 0x00, 0x08, 0x10, 0x0f, 0x00, 0x00,?
0x00, 0x02, 0x82, 0x7a, 0x92, 0x02, 0x02, 0xfe, 0x02, 0x02, 0x02, 0xfa, 0x02, 0x02, 0x00, 0x00,? 0x48, 0x46, 0x41, 0x40, 0x41, 0x46, 0x40, 0x7f, 0x48, 0x44, 0x43, 0x40, 0x41, 0x4e, 0x44, 0x00,?
0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00,? 0x00, 0x20, 0x7f, 0x20, 0x20, 0x20, 0x20, 0x3f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7f, 0x00, 0x00,?
0x00, 0x02, 0x02, 0x02, 0x02, 0x82, 0x42, 0xfe, 0x06, 0x42, 0xc2, 0x82, 0x02, 0x03, 0x02, 0x00,? 0x00, 0x08, 0x04, 0x02, 0x01, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x01, 0x07, 0x02, 0x00, 0x00,?
0x80, 0x80, 0x80, 0x80, 0xbe, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xbe, 0x80, 0x80, 0x80, 0x00,? 0x00, 0x40, 0x20, 0x10, 0x0e, 0x10, 0x20, 0x3f, 0x44, 0x44, 0x44, 0x44, 0x44, 0x40, 0x40, 0x00,?
0x40, 0x40, 0x44, 0x44, 0x44, 0x44, 0xc4, 0xc4, 0x44, 0x44, 0x46, 0x46, 0x64, 0x60, 0x40, 0x00,? 0x00, 0x20, 0x70, 0x38, 0x2c, 0x27, 0x23, 0x31, 0x10, 0x12, 0x14, 0x18, 0x70, 0x20, 0x00, 0x00,?
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,? 0x00, 0x00, 0x5b, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
uchar code hz2[]= { 0x02, 0x02, 0xfe, 0x92, 0x92, 0x92, 0xfe, 0x02, 0x02, 0x7c, 0x84, 0x04, 0x84, 0x7c, 0x04, 0x00,? 0x10, 0x10, 0x0f, 0x08, 0x08, 0x04, 0xff, 0x04, 0x22, 0x10, 0x09, 0x06, 0x09, 0x30, 0x10, 0x00,?
0x00, 0x02, 0x1c, 0xc0, 0x30, 0x4c, 0x30, 0x0f, 0x08, 0xf8, 0x08, 0x08, 0x28, 0x18, 0x08, 0x00,? 0x02, 0x5e, 0x43, 0x20, 0x20, 0x10, 0x08, 0x04, 0x03, 0x01, 0x06, 0x08, 0x30, 0x60, 0x20, 0x00,?
0x04, 0x04, 0x04, 0x84, 0xf4, 0x2f, 0x04, 0x04, 0xe4, 0x0f, 0x04, 0xc4, 0x84, 0x04, 0x04, 0x00,? 0x00, 0x02, 0x01, 0x00, 0xff, 0x00, 0x08, 0x04, 0x3f, 0x42, 0x41, 0x40, 0x40, 0x78, 0x20, 0x00,?
0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,? 0x20, 0x30, 0x2c, 0x23, 0x20, 0x21, 0x36, 0x2c, 0x23, 0x20, 0x20, 0x23, 0x26, 0x3c, 0x28, 0x00,?
0xe0, 0x00, 0xff, 0x10, 0xf4, 0x94, 0xff, 0x94, 0xf4, 0x08, 0xf4, 0x13, 0x92, 0x1a, 0xf6, 0x00,? 0x00, 0x00, 0xff, 0x10, 0x08, 0x06, 0xff, 0x02, 0x04, 0x80, 0x4f, 0x20, 0x1f, 0x20, 0xcf, 0x00,?
0x00, 0xfe, 0x02, 0x02, 0xf2, 0x12, 0x12, 0x12, 0x12, 0x12, 0xf2, 0x02, 0x02, 0xfe, 0x00, 0x00,? 0x00, 0x7f, 0x40, 0x40, 0x47, 0x44, 0x44, 0x44, 0x44, 0x44, 0x47, 0x40, 0x40, 0x7f, 0x00, 0x00,?
0x00, 0xfe, 0x02, 0xf2, 0x12, 0x12, 0xf2, 0x00, 0xf2, 0x12, 0x1a, 0xd6, 0x12, 0xf2, 0x02, 0x00,? 0x20, 0x1f, 0x00, 0x3f, 0x10, 0x09, 0x45, 0x40, 0x2f, 0x20, 0x10, 0x0f, 0x10, 0x2f, 0x60, 0x00,?
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,? 0x00, 0x00, 0x58, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00? };
uchar code hz3[]= { 0x00, 0x00, 0x42, 0x44, 0x5c, 0x48, 0x40, 0xff, 0x40, 0x50, 0x48, 0x46, 0x64, 0x40, 0x00, 0x00,? 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0xff, 0x04, 0x04, 0x04, 0x04, 0x04, 0x06, 0x04, 0x00,?
0x20, 0x38, 0xa7, 0x62, 0x10, 0x20, 0xa0, 0x6c, 0x6b, 0xaa, 0x2a, 0x3a, 0x26, 0xa0, 0x20, 0x00,? 0x12, 0x13, 0x12, 0x0a, 0x29, 0x25, 0x12, 0x12, 0x49, 0x85, 0x7f, 0x02, 0x0d, 0x18, 0x08, 0x00,?
0x20, 0x10, 0xfc, 0x07, 0xf2, 0x20, 0x98, 0x8f, 0x54, 0xa4, 0x24, 0x54, 0xcc, 0x80, 0x80, 0x00,? 0x00, 0x00, 0x7f, 0x00, 0x03, 0x54, 0x54, 0x4a, 0x2b, 0x25, 0x15, 0x12, 0x0a, 0x09, 0x00, 0x00,?
0x40, 0x42, 0xcc, 0x00, 0x04, 0x04, 0xe5, 0xb6, 0xac, 0xa4, 0xa6, 0xe5, 0x04, 0x04, 0x00, 0x00,? 0x40, 0x20, 0x1f, 0x20, 0x40, 0x40, 0x5f, 0x4a, 0x4a, 0x4a, 0x4a, 0x5f, 0x40, 0x40, 0x40, 0x00,?
0x00, 0x00, 0x42, 0x44, 0x5c, 0x48, 0x40, 0xff, 0x40, 0x50, 0x48, 0x46, 0x64, 0x40, 0x00, 0x00,? 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0xff, 0x04, 0x04, 0x04, 0x04, 0x04, 0x06, 0x04, 0x00,?
0x20, 0x38, 0xa7, 0x62, 0x10, 0x20, 0xa0, 0x6c, 0x6b, 0xaa, 0x2a, 0x3a, 0x26, 0xa0, 0x20, 0x00,? 0x12, 0x13, 0x12, 0x0a, 0x29, 0x25, 0x12, 0x12, 0x49, 0x85, 0x7f, 0x02, 0x0d, 0x18, 0x08, 0x00,?
0x10, 0x10, 0x92, 0x92, 0x92, 0xf2, 0x9e, 0x92, 0x92, 0x92, 0x92, 0x92, 0xfe, 0x10, 0x10, 0x00,? 0x40, 0x20, 0x10, 0x0c, 0xfe, 0x45, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0xfd, 0x00, 0x00, 0x00,?
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,? 0x00, 0x18, 0x24, 0x24, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
uchar code hz4[]= {
0x00,0x00,0x00,0x00,0x00,0x10,0x10,0xF0,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x3F,0x3F,0x20,0x20,0x20,0x20,0x00,0x00,0x00,/*"1",0*/ 0x00,0x00,0x30,0x70,0x28,0x08,0x08,0x08,0x08,0x08,0x08,0xD8,0xF0,0x20,0x00,0x00, 0x00,0x00,0x30,0x30,0x28,0x24,0x24,0x22,0x22,0x21,0x21,0x20,0x30,0x18,0x00,0x00,/*"2",1*/ 0x00,0x00,0x30,0x30,0x28,0x08,0x08,0x08,0x08,0x88,0x88,0x70,0x70,0x00,0x00,0x00, 0x00,0x00,0x18,0x18,0x28,0x20,0x20,0x21,0x21,0x21,0x21,0x13,0x1E,0x0C,0x00,0x00,/*"3",2*/ 0x00,0x00,0x00,0x00,0x80,0x80,0x40,0x20,0x10,0xF0,0xF8,0xF8,0x00,0x00,0x00,0x00, 0x00,0x04,0x06,0x05,0x04,0x04,0x24,0x24,0x24,0x3F,0x3F,0x3F,0x24,0x24,0x24,0x00,/*"4",3*/ 0x00,0x00,0x00,0xF8,0x08,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x08,0x00,0x00,0x00, 0x00,0x00,0x18,0x19,0x29,0x20,0x20,0x20,0x20,0x20,0x20,0x11,0x1F,0x0E,0x00,0x00,/*"5",4*/ 0x00,0x00,0xC0,0xE0,0x10,0x88,0x88,0x88,0x88,0x88,0x88,0x98,0x10,0x00,0x00,0x00, 0x00,0x00,0x0F,0x1F,0x11,0x20,0x20,0x20,0x20,0x20,0x20,0x10,0x1F,0x0F,0x00,0x00,/*"6",5*/ 0x00,0x00,0x30,0x18,0x08,0x08,0x08,0x08,0x08,0x88,0x48,0x28,0x18,0x08,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x3E,0x13,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"7",6*/
}; uchar code hz5[]= { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,? 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ?0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,? 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,? 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,? 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,? 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,? 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,? 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,? 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,?? ? };
uchar code hz6[]= { 0x00,0x00,0x00,0x00,0x00,0xC0,0x30,0x08,0x38,0xF0,0xC0,0x00,0x00,0x00,0x00,0x00, 0x20,0x20,0x30,0x2C,0x23,0x02,0x02,0x02,0x02,0x02,0x27,0x3E,0x38,0x20,0x20,0x00,/*"A",10*/ 0x00,0x00,0x08,0xF8,0xF8,0x08,0x08,0x08,0x08,0x88,0x88,0xD8,0x70,0x70,0x00,0x00, 0x20,0x20,0x20,0x3F,0x3F,0x21,0x21,0x21,0x21,0x20,0x21,0x21,0x1F,0x1E,0x0C,0x00,/*"B",11*/ 0x00,0xC0,0xE0,0x70,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x18,0x20,0x00, 0x00,0x07,0x0F,0x1C,0x10,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x10,0x10,0x08,0x00,/*"C",12*/ 0x00,0x00,0x08,0xF8,0xF8,0x08,0x08,0x08,0x08,0x08,0x08,0x10,0xF0,0xE0,0xC0,0x00, 0x00,0x20,0x20,0x3F,0x3F,0x20,0x20,0x20,0x20,0x20,0x10,0x10,0x0F,0x0F,0x03,0x00,/*"D",13*/ 0x00,0x00,0x08,0xF8,0xF8,0x08,0x08,0x08,0x08,0x08,0x88,0xC8,0x08,0x18,0x00,0x00, 0x00,0x20,0x20,0x3F,0x3F,0x21,0x21,0x21,0x21,0x21,0x21,0x23,0x20,0x30,0x08,0x00,/*"E",14*/ 0x00,0x00,0x08,0xF8,0xF8,0x08,0x08,0x08,0x08,0x08,0x08,0xC8,0x08,0x08,0x10,0x00, 0x00,0x20,0x20,0x3F,0x3F,0x21,0x21,0x01,0x01,0x01,0x01,0x03,0x00,0x00,0x00,0x00,/*"F",15*/ 0x00,0xC0,0xE0,0x30,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x38,0x00,0x00,0x00, 0x00,0x07,0x0F,0x1C,0x10,0x20,0x20,0x20,0x20,0x20,0x22,0x1E,0x1E,0x02,0x00,0x00,/*"G",16*/ 0x00,0x00,0xF8,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0xF8,0xF8,0x00,0x00, 0x20,0x20,0x3F,0x3F,0x21,0x21,0x01,0x01,0x01,0x01,0x21,0x21,0x3F,0x3F,0x20,0x00,/*"H",17*/ 0x00,0x00,0x00,0x00,0x08,0x08,0x08,0xF8,0xF8,0x08,0x08,0x08,0x00,0x00,0x00,0x00, }; void lcd_cmd_wr(unsigned char cmdcode,unsigned char f); void lcd_data_wr(unsigned char ldata,unsigned char f); void chech_busy(unsigned char f); void lcd_hz_wr(unsigned char posx,unsigned char posy,unsigned char *hz); void lcd_str_wr(unsigned char row,unsigned char col,unsigned char n,unsigned char *str); void lcd_rol(); void lcd_init(); void delay(uint n);
void main() { ?? ?unsigned int i; ? while(1) ? { ? ?lcd_init(); ?? ??? ? ? lcd_str_wr(1,0,8,hz4); ?? ??? ?lcd_str_wr(2,0,8,hz6); ? ?delay(100); ? ?lcd_str_wr(0,0,8,hz0); ? ?delay(100);
?? ??? ? ? ?lcd_str_wr(1,0,8,hz1); ? ?delay(100);
? ?lcd_str_wr(2,0,8,hz2); ? ?delay(100);
? ?lcd_str_wr(3,0,8,hz3); ? ?delay(100); ?? ??? ? ? ?lcd_rol(); ? ?delay(1000); ? ?lcd_rol(); ? ?delay(1000); ?? ? lcd_str_wr(0,0,8,hz5); ?? ??? ?lcd_str_wr(1,0,8,hz5); ?? ??? ??? ??? ?lcd_str_wr(2,0,8,hz5); ?? ??? ??? ??? ??? ? lcd_str_wr(3,0,8,hz5); ? } }
void lcd_init() { ? unsigned int i; ? lcd_cmd_wr(0x3f,0); ? lcd_cmd_wr(0xc0,0); ? lcd_cmd_wr(0xb8,0); ? lcd_cmd_wr(0x40,0); ? lcd_cmd_wr(0x3f,1); ? lcd_cmd_wr(0xc0,1); ? lcd_cmd_wr(0xb8,1); ? lcd_cmd_wr(0x40,1); ? for(i=0;i<256;i++) ? { ? ? lcd_data_wr(0x00,0); ?? ?lcd_data_wr(0x00,1); ? } ? lcd_cmd_wr(0xb8+4,0); ? lcd_cmd_wr(0xb8+4,1); ? for(i=0;i<256;i++) ? { ? ?lcd_data_wr(0x00,0); ?? ?lcd_data_wr(0x00,1); ? } }
void lcd_cmd_wr(unsigned char cmdcode,unsigned char f) { ? chech_busy(f); ? if(f==0) LLCD_CMD_WR=cmdcode; ? else RLCD_CMD_WR=cmdcode; }
void chech_busy(unsigned char f) { ? if(f==0) LLCD_CMD_RD; ? else RLCD_CMD_RD; ? while(busy); }
void lcd_str_wr(unsigned char row,unsigned char col,unsigned char n,unsigned char *str) { ? unsigned char i; ? for(i=0;i<n;i++) ? { ? ? lcd_hz_wr(row,col,str+i*32); ?? ?delay(50); ?? ?col++; ? } }
void lcd_hz_wr(unsigned char posx,unsigned char posy,unsigned char *hz) { ? unsigned char i; ? if(posy<4) ? { ? ? lcd_cmd_wr(0xb8+2*posx,0); ?? ?lcd_cmd_wr(0x40+16*posy,0); ?? ?for(i=0;i<16;i++) lcd_data_wr(~hz[i],0); ?? ?lcd_cmd_wr(0xb8+2*posx+1,0); ?? ?lcd_cmd_wr(0x40+16*posy,0); ?? ?for(i=16;i<32;i++) lcd_data_wr(hz[i],0); ? } ? else ? { ? lcd_cmd_wr(0xb8+2*posx,1); ?? ?lcd_cmd_wr(0x40+16*(posy-4),1); ?? ?for(i=0;i<16;i++) lcd_data_wr(~hz[i],1); ?? ?lcd_cmd_wr(0xb8+2*posx+1,1); ?? ?lcd_cmd_wr(0x40+16*(posy-4),1); ?? ?for(i=16;i<32;i++) lcd_data_wr(hz[i],1);? ? } }
void lcd_data_wr(unsigned char ldata,unsigned char f) { ? chech_busy(f); ? if(f==0) LLCD_DATA_WR=ldata; ? else RLCD_DATA_WR=ldata; }
void lcd_rol() { ? uchar i; ? for(i=0;i<64;i++) ? { ? ? lcd_cmd_wr(0xc0+i,0); ?? ?lcd_cmd_wr(0xc0+i,1); ?? ?delay(10); ? } }
void delay(uint n) { ? uint i; ? for(;n>0;n--) ?? ? ?for(i=500;i>0;i--); }
功能是实现在LCD12864上显示数字,字母,汉字,实现翻屏功能
|