Edesign
Ранг: Форумен бог
Регистриран на: Сря Авг 31, 2005 12:57 pm Мнения: 1040
|
Re: за LCD с контролер SBN6400G + SBN0064G
справих се! Ето на някой ако му трябва
rom int8 page1_data[64]={0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0 , 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x80,0xc0,0xe0,0xf0,0xf8,0xf8,0xf8,0xfc , 0x7c,0x7c,0xb8,0xf8,0xfe,0xfe,0xfc,0xfc, 0xf8,0xf8,0xfc,0xfc,0xfc,0xfc,0xfc,0xf0, 0xf8,0xf8,0xf8,0xf0,0xf0,0xf0,0xf0,0xe0, 0xe0,0xe0,0xe0,0xc0,0x80,0x80,0x80,0x80, 0x0,0x0,0x0,0x0,0x0,0x0}; rom int8 page2_data[47]={0x24,0x9a,0x7f,0xcf,0x4f,0x7,0x1f,0x93 , 0xf5,0xf0,0xf8,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xdf,0x9f, 0x1f,0x2f,0x17,0x17,0x7,0x7,0x3,0x3, 0x1,0x1,0x1,0x1,0x1,0x2}; rom int8 page3_data[32]={ 0x8,0x1e,0x61,0x80,0x80,0x80,0x80,0x80, 0xf3,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0x3f,0x7,0x7,0x3}; rom int8 page4_data[45]={ 0x1,0x1,0x1,0x0,0x1,0x7,0x7,0xf, 0xff,0x7f,0xff,0xff,0xff,0xff,0x3f,0x3f, 0x1f,0xf,0x3,0x3,0x3,0x7,0xc3,0xf1, 0xe8,0x64,0x62,0x62,0x62,0x62,0x62,0x62, 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x80, 0x40,0x40,0x40,0x40,0x40}; rom int8 page5_data[31]={ 0x80,0x70,0xf,0x0,0x1,0x0,0x0,0x0, 0xc0,0x20,0x10,0xc,0x3,0x0,0x0,0x0, 0x1,0x1,0x1,0x2,0x4,0x18,0x20,0xc0, 0x0,0x0,0x0,0x0,0xc0,0x3c,0x3}; rom int8 page6_data[37]={ 0xe0,0x90,0x90,0x90,0x8e,0x81,0x80,0x40, 0x20,0x18,0x4,0x2,0x1,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x0,0x30,0x50,0x48,0x48,0x47,0x40,0x40, 0x40,0x3f}; rom int8 page2_data2[32]={0x2,0x2,0x2,0x2,0x1,0x1,0x1,0x1, 0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1, 0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1, 0x2,0x2,0x4,0x4,0x8,0x10,0x60,0x80}; rom int8 page3_data3[33]={0x0,0x0,0x0,0x80,0x80,0x80,0x80,0x0, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0xe0,0x18,0x6,0x78,0x80,0x0,0x0,0x3, 0xfc}; rom int8 page4_data4[37]={0x40,0x40,0x20,0x20,0x20,0x10,0x10,0x9, 0x9,0x6,0x6,0x3c,0x40,0x80,0x0,0x0, 0x0,0x0,0x0,0x0,0x0,0xe0,0x5f,0x80, 0x80,0x80,0x0,0x0,0x1f,0xe0,0x0,0x0, 0x7,0x3c,0xd0,0x10,0xe0}; rom int8 page5_data5[49]={ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0,0x1,0x2,0x4, 0x18,0xe0,0x0,0x0,0x0,0x0,0x7f,0x80, 0x0,0x0,0x1,0x1,0x2,0x4,0x7,0x1c, 0xf0,0x10,0x20,0x41,0xc1,0x42,0x2,0x24, 0x24,0x24,0x3c,0x3c,0x3c,0x3e,0x3c,0x3c, 0x1c}; rom int8 page6_data6[41]={ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x20,0x50,0x48,0x48,0x48,0x44, 0x22,0x11,0x10,0x8,0x4,0x2,0x2,0x1, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x0,0x1,0x6,0x18,0x20,0x23,0x24,0x24, 0x1c}; void tran_instruction (int8 data, int8 which) { // output_low(r_w); output_low(rs);
output_b(data); delay_us(10); if (which==1) { output_low(cs1);
}else { output_low(cs2);
} output_low(ee); delay_us(10); output_high(ee); delay_us(10); output_low(ee); delay_us(10); output_high(cs1); output_high(cs2);
delay_us(10); } void tran_data (int8 data, int8 which) { // output_low(r_w); output_high(rs); output_b(data); delay_us(10); if (which==1) { output_low(cs1);
}else { output_low(cs2);
}
output_low(ee); delay_us(10); output_high(ee); delay_us(10); output_low(ee); delay_us(10); output_high(cs1); output_high(cs2); delay_us(10); }
void clear (int8 which) { int8 i; i=70; do { tran_data(0,which);
i--; }while (i!=0); }
void LCD_init () { int8 i;
output_low(ee); output_high(cs1); output_high(cs2); output_high(rst); delay_ms(50); output_low(rst); delay_ms(50); output_high(rst);
tran_instruction(0b00111111,1); // display on tran_instruction(0b11000000,1); // display start // page 0 tran_instruction(0b10111000,1); //set page address tran_instruction(0b01000000,1); //set address
clear(1); // page 1 tran_instruction(0b10111001,1); //set page address tran_instruction(0b01000000,1); //set address
i=0; do { tran_data (page1_data[i],1); i++; }while(i<64); // page 2 tran_instruction(0b10111010,1); //set page address tran_instruction(0b01000000,1); //set address clear(1); tran_instruction(0b01010001,1); //set address i=0; do { tran_data(page2_data[i],1); i++; }while(i<47); // page 3 tran_instruction(0b10111011,1); //set page address tran_instruction(0b01000000,1); //set address clear(1); tran_instruction(0b01010000,1); //set address i=0; do { tran_data (page3_data[i],1); i++; }while(i<32); // page 4 tran_instruction(0b10111100,1); //set page address tran_instruction(0b0100000,1); //set address clear(1); tran_instruction(0b01010011,1); //set address i=0; do { tran_data(page4_data[i],1); i++; }while(i<45); // page 5 tran_instruction(0b10111101,1); //set page address tran_instruction(0b01000000,1); //set address clear(1); tran_instruction(0b01011100,1); //set address i=0; do { tran_data (page5_data[i],1); i++; }while(i<31); // page 6 tran_instruction(0b10111110,1); //set page address tran_instruction(0b01000000,1); //set address clear(1); tran_instruction(0b01010110,1); //set address i=0; do { tran_data (page6_data[i],1); i++; }while(i<37); // page 7 tran_instruction(0b10111111,1); //set page address tran_instruction(0b01000000,1); //set address clear(1);
// begin_display_sec_depart tran_instruction(0b00111111,2); // display on tran_instruction(0b11000000,2); // display start // display_page2_0: tran_instruction(0b10111000,2); //set page address tran_instruction(0b01000000,2); //set address clear(2); // display_page2_1: tran_instruction(0b10111001,2); //set page address tran_instruction(0b01000000,2); //set address clear(2); // display_page2_2: tran_instruction(0b10111010,2); //set page address tran_instruction(0b01000000,2); //set address clear(2); tran_instruction(0b01000000,2); //set address i=0; do { tran_data (page2_data2[i],2); i++; }while(i<32); // display_page2_3: tran_instruction(0b10111011,2); //set page address tran_instruction(0b01000000,2); //set address clear(2); tran_instruction(0b01000000,2); //set address i=0; do { tran_data (page3_data3[i],2); i++; }while(i<33); // display_page2_4: tran_instruction(0b10111100,2); //set page address tran_instruction(0b01000000,2); //set address clear(2); tran_instruction(0b01000000,2); //set address i=0; do { tran_data (page4_data4[i],2); i++; }while(i<37); // display_page2_5: tran_instruction(0b10111101,2); //set page address tran_instruction(0b01000000,2); //set address clear(2); tran_instruction(0b01000000,2); //set address i=0; do { tran_data(page5_data5[i],2); i++; }while(i<49); // display_page2_6: tran_instruction(0b10111110,2); //set page address tran_instruction(0b01000000,2); //set address clear(2); tran_instruction(0b01000000,2); //set address i=0; do { tran_data (page6_data6[i],2); i++; }while(i<41); // display_page2_7 tran_instruction(0b10111111,2); //set page address
tran_instruction(0b01000000,2); //set address clear(2);
delay_ms(500);
delay_ms(500); //*begin display test program*
} void clear_lcd () { int8 i,j; i=0; do { tran_instruction(0b10111000|i,1); //set page address 0-7 X tran_instruction(0b01000000|0,1); //set address 0- 63 Y
tran_instruction(0b10111000|i,2); //set page address 0-7 X tran_instruction(0b01000000|0,2); //set address 0- 63 Y j=0; do {tran_data(0,1);tran_data(0,2); j++; }while(j<64); i++; }while(i<8); }
|