Code:
/**
* Initialize the LCD. Always call this before using the LCD!
*
*/
void initLCD(void)
{
uint8_t init[] = {0b00110011,
0b00110011,
0b00110011,
0b00110010,
0b00101001,
0b00101001, // 8/4Bit Interface, Number of lines, Double height, IS2, IS1
0b00011100,
0b01111100, // Contrast C3 C2 C1 C0
0b01011010, // ICON ON, BOOSTER ON, C5, C4
0b01101001,
0b00001100,
0b00000000};
setLCDD(0b0011);
delayCycles(18000);
setLCDD(0b0011);
delayCycles(5500);
setLCDD(0b0011);
delayCycles(5500);
setLCDD(0b0010);
delayCycles(5500);
uint8_t i;
for(i=0; i<12; i++){
writeLCDCommand(init[i]);
delay_us(30);
}
writeLCDCommand(0b00101000); // Set instruction table 0
uint8_t icon0[8] = {0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b11111};
uint8_t icon1[8] = {0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b11111, 0b11111};
uint8_t icon2[8] = {0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b11111, 0b11111, 0b11111};
uint8_t icon3[8] = {0b00000, 0b00000, 0b00000, 0b00000, 0b11111, 0b11111, 0b11111, 0b11111};
uint8_t icon4[8] = {0b00000, 0b00000, 0b00000, 0b11111, 0b11111, 0b11111, 0b11111, 0b11111};
uint8_t icon5[8] = {0b00000, 0b00000, 0b11111, 0b11111, 0b11111, 0b11111, 0b11111, 0b11111};
uint8_t icon6[8] = {0b00000, 0b11111, 0b11111, 0b11111, 0b11111, 0b11111, 0b11111, 0b11111};
uint8_t icon7[8] = {0b11111, 0b11111, 0b11111, 0b11111, 0b11111, 0b11111, 0b11111, 0b11111};
createIcon(icon0, 0);
createIcon(icon1, 1);
createIcon(icon2, 2);
createIcon(icon3, 3);
createIcon(icon4, 4);
createIcon(icon5, 5);
createIcon(icon6, 6);
createIcon(icon7, 7);
}
Lesezeichen