Esempio n. 1
0
void hd44780_init(void)
{
    /* verschiedene Hardware initialisieren */
    hd44780_hw_init();
    _delay_ms(40);

#if HD44780_TYPE == HD44780_KS0066U
    /* Hardware initialisiert -> Standardprozedur KS0066U Datenblatt 4bit Mode */
    output_nibble(0, 0x02);
#else
    /* Hardware initialisiert -> Standardprozedur HD44780 Datenblatt 4bit Mode */
    output_nibble(0, 0x03);

    _delay_ms(4);
    clock_write();

    _delay_ms(1);
    clock_write();

    _delay_ms(1);
    output_nibble(0, 0x02);		//4bit mode
    _delay_ms(1);
    /* init done */
#endif

    /* configure for 4 bit, 2 lines, 5x9 font (datasheet, page 24) */
    output_byte(0, CMD_FUNCTIONSET(0, 1, 0));

    /* turn on display, cursor and blinking */
    hd44780_config(0,0);

    /* clear display */
    hd44780_clear();

    /* set shift and increment */
    output_byte(0, CMD_ENTRY_MODE(1, 0));

    /* set ddram address */
    output_byte(0, CMD_SETDRAMADR(0));

    /* open file descriptor */
    lcd = fdevopen(hd44780_put, NULL);

    /* set current virtual postion */
    current_pos = 0;
}
Esempio n. 2
0
void hd44780_init(void)
{
    /* verschiedene Hardware initialisieren */
    hd44780_hw_init();
    _delay_ms(40);

#if CONF_HD44780_TYPE == HD44780_KS0066U
    /* Hardware initialisiert -> Standardprozedur KS0066U Datenblatt 4bit Mode */
    output_nibble(0, 0x02, 1);
#else
    /* Hardware initialisiert -> Standardprozedur HD44780 Datenblatt 4bit Mode */
    output_nibble(0, 0x03,1);

    _delay_ms(4);
#ifdef HD44780_2WIRE
    output_nibble(0, 0x03,1);
#else
    clock_write(1);
#endif /*HD44780_2WIRE*/

    _delay_ms(1);
#ifdef HD44780_2WIRE
	output_nibble(0, 0x03,1);
#else
    clock_write(1);
#endif /*HD44780_2WIRE*/

    _delay_ms(1);
    output_nibble(0, 0x02,1);		//4bit mode
    _delay_ms(1);
    /* init done */
#endif /*CONF_HD44780_TYPE*/

    /* configure for 4 bit, 2 lines, 5x8 font (datasheet, page 24) */
    output_byte(0, CMD_FUNCTIONSET(0, 1, 0), 1);

    /* turn on display, cursor and blinking */
    hd44780_config(0,0,1);

    /* clear display */
    hd44780_clear(1);
    /* set shift and increment */
    output_byte(0, CMD_ENTRY_MODE(1, 0),1);

    /* set ddram address */
    output_byte(0, CMD_SETDRAMADR(0),1);

/*Configure Controller 2 */
#ifdef HD44780_MULTIENSUPPORT
    /* verschiedene Hardware initialisieren */
    hd44780_hw_init();
    _delay_ms(40);

#if CONF_HD44780_TYPE == HD44780_KS0066U
    /* Hardware initialisiert -> Standardprozedur KS0066U Datenblatt 4bit Mode */
    output_nibble(0, 0x02, 2);
#else
    /* Hardware initialisiert -> Standardprozedur HD44780 Datenblatt 4bit Mode */
    output_nibble(0, 0x03,2);

    _delay_ms(4);
    clock_write(2);

    _delay_ms(1);
    clock_write(2);

    _delay_ms(1);
    output_nibble(0, 0x02,2);		//4bit mode
    _delay_ms(1);
    /* init done */
#endif

    /* configure for 4 bit, 2 lines, 5x9 font (datasheet, page 24) */
    output_byte(0, CMD_FUNCTIONSET(0, 1, 0), 2);

    /* turn on display, cursor and blinking */
    hd44780_config(0,0,2);

    /* clear display */
    hd44780_clear(2);
    /* set shift and increment */
    output_byte(0, CMD_ENTRY_MODE(1, 0),2);

    /* set ddram address */
    output_byte(0, CMD_SETDRAMADR(0),2);
#endif

    /* set current virtual postion */
    current_pos = 0;


}