Die Präsentation wird geladen. Bitte warten

Die Präsentation wird geladen. Bitte warten

LCD-Display HD44780 kompatibles Display

Ähnliche Präsentationen


Präsentation zum Thema: "LCD-Display HD44780 kompatibles Display"—  Präsentation transkript:

1 LCD-Display HD44780 kompatibles Display
In verschiedenen Ausführungen erhältlich Sehr gute Dokumentation unter Verwendung der Bibliothek von Peter Fleury Anpassungen in lcd.h vornehmen Pinbelegung Taktfrequenz, hier XTAL Anpassungen im Makefile vornehmen Schönes Tutorial für einfache Routinen unter

2 Pinbelegung

3 Schaltung zum Anschluss des LCD-Displays im 4 Bit-Mode

4 Funktionen aus lcd.h/lcd.c
void lcd_init(uint8_t dispAttr); LCD_DISP_OFF LCD_DISP_ON LCD_DISP_ON_CURSOR LCD_DISP_ON_CURSOR_BLINK void lcd_clrscr(void); void lcd_gotoxy(uint8_t x, uint8_t y); void lcd_putc(char c); void lcd_puts(const char *s);

5 Funktionen aus lcd.h/lcd.c
void lcd_puts_p(const char *progmem_s); void lcd_command(uint8_t cmd); void lcd_data(uint8_t data); Hinweis: In lcd.c ist das Macro _BV häufig verwendet. Es ist in <avr/sfr_defs.h> definiert. #define _BV( bit ) ( 1<<(bit) )

6 Die wichtigsten Anpassungen in lcd.h
#define XTAL F_CPU /* Takt aus Makefile!! */ #define LCD_PORT PORTC /**< port for the LCD lines */ #define LCD_DATA0_PORT LCD_PORT /**< port for 4bit data bit 0 */ #define LCD_DATA1_PORT LCD_PORT /**< port for 4bit data bit 1 */ #define LCD_DATA2_PORT LCD_PORT /**< port for 4bit data bit 2 */ #define LCD_DATA3_PORT LCD_PORT /**< port for 4bit data bit 3 */ #define LCD_DATA0_PIN /**< pin for 4bit data bit 0 */ #define LCD_DATA1_PIN /**< pin for 4bit data bit 1 */ #define LCD_DATA2_PIN /**< pin for 4bit data bit 2 */ #define LCD_DATA3_PIN /**< pin for 4bit data bit 3 */ #define LCD_RS_PORT PORTD /**< port for RS line */ #define LCD_RS_PIN /**< pin for RS line */ #define LCD_RW_PORT PORTD /**< port for RW line */ #define LCD_RW_PIN /**< pin for RW line */ #define LCD_E_PORT PORTD /**< port for Enable line */ #define LCD_E_PIN /**< pin for Enable line */

7 Benutzerdefinierte Zeichen http://www. mugui. de/bin/menu. php
Bis zu 8 benutzerdefinierte Zeichen (5x8 pix) oder zu 4 (5X10 pix) können im Character Generator RAM (CGRAM) abgelegt werden. Sie werden mit P. Fleury dargestellt, in dem man lcd_putc(0..8) aufruft. Die Zeichen werden über lcd_command (senden der Adresse) und lcd_data an das Display übertragen und stehen dann zur Verfügung.

8 Definition © (zusammengestzt aus 2 Zeichen)
static const unsigned char copyRightChar[] PROGMEM= { 0x07, 0x08, 0x13, 0x14, 0x14, 0x13, 0x08, 0x07, 0x00, 0x10, 0x08, 0x08, 0x08, 0x08, 0x10, 0x00 };

9 Übertragen / Anzeigen von ©
lcd_puts("Copyright: "); /* * load two userdefined characters from program memory * into LCD controller CG RAM location 0 and 1 */ /* set CG RAM start address 0 */ lcd_command(_BV(LCD_CGRAM)); for(i=0; i<16; i++) { lcd_data(pgm_read_byte_near(&copyRightChar[i])); } BV(LCD_CGRAM) entspricht 1<<LCD_CGRAM

10 HD44780 Befehlssatz Die LCD-Kommandos sind in lcd.h detailliert ausgeführt

11 Kodierung der Steuerbits

12 2/4 -zeiliges Display #define LCD_LINES /**< number of visible lines of the display */ #define LCD_DISP_LENGTH /**< visibles characters per line of the display */ #define LCD_LINE_LENGTH 0x20 /**< internal line length of the display */ #define LCD_START_LINE1 0x00 /**< DDRAM address of first char of line 1 */ #define LCD_START_LINE2 0x40 /**< DDRAM address of first char of line 2 */ #define LCD_START_LINE3 0x14 /**< DDRAM address of first char of line 3 */ #define LCD_START_LINE4 0x54 /**< DDRAM address of first char of line 4 */ #define LCD_WRAP_LINES /**< 0: no wrap, 1: wrap at end of visibile line */

13 Alternative LCD-Bibliothek


Herunterladen ppt "LCD-Display HD44780 kompatibles Display"

Ähnliche Präsentationen


Google-Anzeigen