/****************************************************************************** * Initializes the display in 4x booster for 2.4-3.3V supply voltage * scheme according to datasheet * Suitable for all DOGS, DOGM, DOGL and DOGXL displays * in both bottom or top-view orientation. */ void lcd_init() { LCD_SET_PIN_DIRECTIONS(); //set outputs LCD_INIT_SPI(); //Initialize SPI Interface LCD_RESET(); //Apply Reset to the Display Controller //Load settings #if DISPLAY_TYPE == 240 //LCD_SYSTEM_RESET; // software reset //_delay_ms(5); // Gib dem Display ein bisschen Zeit für den Reset LCD_SET_COM_END(127); // set last COM electrode LCD_SET_PARTIAL_DISPLAY(0, 127); // set partial display start and end LCD_SET_POTI(0x8F); // set Contrast to mid range lvl LCD_SET_MAPPING_CTRL(2); // set mapping control to "bottom view" LCD_SET_LINE_RATE(11); // set line rate to 9.4 kilo lines per second LCD_SET_TEMP_COMP(1); // set tmep compensation to -0.10% LCD_SWITCH_ON(); // set display enable (0xA9) LCD_SET_DISPLAY_PATTERN(1); // set display pattern (0xD1) LCD_SET_RAM_ADDR_CTRL(1); // set auto-increment #endif #if DISPLAY_TYPE == 160 LCD_SET_COM_END(103); //set last COM electrode #if ORIENTATION_UPSIDEDOWN = 0 LCD_SET_BOTTOM_VIEW(); //6 o'clock mode, normal orientation #else LCD_SET_TOP_VIEW(); //12 o'clock mode, reversed orientation #endif LCD_SET_START_LINE(0); //set scrolling to 0 LCD_SET_PANEL_LOAD(3); //set panel loading to 28-38nF LCD_SET_BIAS_RATIO(3); //set bias ratio LCD_SET_VOLTAGE_BIAS(0x5F); //set Vbias potentiometer for contrast LCD_SET_RAM_ADDR_CTRL(1); //set auto-increment #endif #if DISPLAY_TYPE == 132 LCD_SET_FIRST_LINE(0); //first bit in RAM is on the first line of the LCD #if ORIENTATION_UPSIDEDOWN == 0 LCD_SET_BOTTOM_VIEW(); //6 o'clock mode, normal orientation LCD_ORIENTATION_NORMAL(); #else LCD_SET_TOP_VIEW(); //12 o'clock mode, reversed orientation LCD_ORIENTATION_UPSIDEDOWN(); #endif LCD_SHOW_ALL_PIXELS_OFF(); //Normal Pixel mode LCD_SET_MODE_POSITIVE(); //positive display LCD_SET_BIAS_RATIO_1_9(); //bias 1/9 LCD_SET_POWER_CONTROL(7); //power control mode: all features on LCD_SET_BIAS_VOLTAGE(3); //set voltage regulator R/R LCD_SET_VOLUME_MODE(0x1F); //volume mode set LCD_SET_INDICATOR_OFF(); //switch indicator off, no blinking #endif #if DISPLAY_TYPE == 128 LCD_SET_FIRST_LINE(0); //first bit in RAM is on the first line of the LCD #if ORIENTATION_UPSIDEDOWN == 0 LCD_SET_BOTTOM_VIEW(); //6 o'clock mode, normal orientation LCD_ORIENTATION_NORMAL(); #else LCD_SET_TOP_VIEW(); //12 o'clock mode, reversed orientation LCD_ORIENTATION_UPSIDEDOWN(); #endif LCD_SHOW_ALL_PIXELS_OFF(); //Normal Pixel mode LCD_SET_MODE_POSITIVE(); //positive display LCD_SET_BIAS_RATIO_1_7(); //bias 1/7 LCD_SET_POWER_CONTROL(7); //power control mode: all features on LCD_SET_BIAS_VOLTAGE(7); //set voltage regulator R/R LCD_SET_VOLUME_MODE(0x06); //volume mode set LCD_SET_INDICATOR_OFF(); //switch indicator off, no blinking #endif #if DISPLAY_TYPE == 102 LCD_SET_FIRST_LINE(0); //first bit in RAM is on the first line of the LCD #if ORIENTATION_UPSIDEDOWN == 0 LCD_SET_BOTTOM_VIEW(); //6 o'clock mode, normal orientation LCD_ORIENTATION_NORMAL(); #else LCD_SET_TOP_VIEW(); //12 o'clock mode, reversed orientation LCD_ORIENTATION_UPSIDEDOWN(); #endif LCD_SHOW_ALL_PIXELS_OFF(); //Normal Pixel mode LCD_SET_MODE_POSITIVE(); //positive display LCD_SET_BIAS_RATIO_1_9(); //bias 1/9 LCD_SET_POWER_CONTROL(7); //power control mode: all features on LCD_SET_BIAS_VOLTAGE(7); //set voltage regulator R/R LCD_SET_VOLUME_MODE(0x9); //volume mode set LCD_SET_ADV_PROG_CTRL(LCD_TEMPCOMP_HIGH); #endif lcd_clear_area_xy(LCD_RAM_PAGES,LCD_WIDTH,NORMAL,0,0); //clear display content LCD_SWITCH_ON(); //Switch display on return; }
/****************************************************************************** * Initializes the display in 6 o'clock mode, 4x booster for 2.4-3.3V supply voltage * scheme according to datasheet * Suitable for all DOGS, DOGM and DOGL displays. */ void lcd_init() { //for better understanding -> write macros in clear text //set outputs //LCD_SET_PIN_DIRECTIONS(); DDR_A0 |= (1<<PIN_A0); DDR_RST |= (1<<PIN_RST); DDR_CS |= (1<<PIN_CS); //Initialize SPI Interface //LCD_INIT_SPI(); init_spi_lcd(); //Apply Reset to the Display Controller //LCD_RESET(); PORT_RST &= ~(1<<PIN_RST); _delay_ms(1); PORT_RST |= (1<<PIN_RST); //Load settings //(2) LCD_SET_FIRST_LINE(0); //first bit in RAM is on the first line of the LCD // | // --> lcd_command(LCD_START_LINE | ((i) & 0x3F)) // -> LCD_START_LINE = display start line 0 //without this delay the content is displayed mirror inverted _delay_ms(1); //(8) LCD_SET_BOTTOM_VIEW(); //6 o'clock mode, normal orientation // | // --> lcd_command(LCD_BOTTOMVIEW) // -> LCD_BOTTOMVIEW = ADC reverse //_delay_ms(1); //(15) LCD_ORIENTATION_NORMAL(); // | // --> lcd_command(LCD_SCAN_DIR_NORMAL) // -> LCD_SCAN_DIR_NORMAL = Normal COM0 - COM31 //without this delay the content is displayed mirror inverted _delay_ms(1); //(10) //LCD_SHOW_ALL_PIXELS_OFF(); //Normal Pixel mode // | // --> lcd_command(LCD_SHOW_NORMAL) // -> LCD_SHOW_NORMAL = display all points, normal display (10) //(9) LCD_SET_MODE_POSITIVE(); //positive display // | // --> lcd_command(LCD_DISPLAY_POSITIVE) // -> LCD_DISPLAY_POSITIVE = sets display normal (9) #if DISPLAY_TYPE == 132 //(11) LCD_SET_BIAS_RATIO_1_9(); //bias 1/9 // | // --> lcd_command(LCD_BIAS_1_9) //(16) LCD_SET_POWER_CONTROL(7); //power control mode: all features on // | // --> lcd_command(LCD_POWER_CONTROL | ((i) & 0x07)) // -> command 16 with operating mode = 0b111 //(20) -> selbst eingefügtes macro LCD_SET_BOOSTER_RATIO(); //(17) LCD_SET_BIAS_VOLTAGE(3); //set voltage regulator R/R // | // --> lcd_command(LCD_VOLTAGE | ((i) & 0x07)) // -> command 17 with resistor ration 0b011 //(18) LCD_SET_VOLUME_MODE(0x1F); //volume mode set // | // --> lcd_command(LCD_VOLUME_MODE_1) // -> standard command 18 // --> lcd_command(LCD_VOLUME_MODE_2 | ((i) & 0x3F)) // -> command 18 with electronic volume value 0b011111 //(19) LCD_SET_INDICATOR_OFF(); //switch indicator off, no blinking // | // --> passt scho #endif #if DISPLAY_TYPE == 128 LCD_SET_BIAS_RATIO_1_7(); //bias 1/7 LCD_SET_POWER_CONTROL(7); //power control mode: all features on LCD_SET_BIAS_VOLTAGE(7); //set voltage regulator R/R LCD_SET_VOLUME_MODE(0x06); //volume mode set LCD_SET_INDICATOR_OFF(); //switch indicator off, no blinking #endif #if DISPLAY_TYPE == 102 LCD_SET_BIAS_RATIO_1_9(); //bias 1/9 LCD_SET_POWER_CONTROL(7); //power control mode: all features on LCD_SET_BIAS_VOLTAGE(3); //set voltage regulator R/R LCD_SET_VOLUME_MODE(0x1F); //volume mode set LCD_SET_ADV_PROG_CTRL(LCD_TEMPCOMP_HIGH); #endif uint8_t i,j; //clear display content for(j=0;j<LCD_RAM_PAGES;j++) { lcd_moveto_xy(j,0); // array (uint8_t page, uint8_t column) for (i=0;i<LCD_WIDTH;i++) lcd_data(0); } lcd_moveto_xy(0,0); //Set write pointer LCD_SWITCH_ON(); //Switch display on (1) return; }