// Ansteuerung eines HD44780 kompatiblen LCD im 4-Bit-Interfacemodus // http://www.mikrocontroller.net/articles/AVR-GCC-Tutorial // // Die Pinbelegung ist über defines in lcd-routines.h einstellbar #include #include "lcd-routines.h" #include // sendet ein Datenbyte an das LCD void lcd_data(unsigned char temp1) { unsigned char temp2 = temp1; LCD_PORT |= (1<> 4; temp1 = temp1 & 0x0F; LCD_PORT &= 0xF0; LCD_PORT |= temp1; // setzen lcd_enable(); temp2 = temp2 & 0x0F; LCD_PORT &= 0xF0; LCD_PORT |= temp2; // setzen lcd_enable(); _delay_us(42); } // sendet einen Befehl an das LCD void lcd_command(unsigned char temp1) { unsigned char temp2 = temp1; LCD_PORT &= ~(1<> 4; // oberes Nibble holen temp1 = temp1 & 0x0F; // maskieren LCD_PORT &= 0xF0; LCD_PORT |= temp1; // setzen lcd_enable(); temp2 = temp2 & 0x0F; // unteres Nibble holen und maskieren LCD_PORT &= 0xF0; LCD_PORT |= temp2; // setzen lcd_enable(); _delay_us(42); } // erzeugt den Enable-Puls void lcd_enable(void) { // Bei Problemen ggf. Pause gemäß Datenblatt des LCD Controllers einfügen // http://www.mikrocontroller.net/topic/81974#685882 LCD_PORT |= (1<