also , sie läuft prima , bei mir,
Fallstricke für den Neuuser könnten sein:
LCD.H
dort ist leider zu ändern:
Zeile 47:
#define XTAL 4000000
!!!!! wichtig die richtige CPU eintragen, obwohl ich bei Problemen auch schon mal mit einer 8MHz CPU 12-16 MHz versucht hatte, verlängert theoretisch die Waits, half bei mir aber nix, weil es nicht an den Waits lag.
Zeile 54:
#define LCD_CONTROLLER_KS0073 0 /**< Use 0 for HD44780 controller, 1 for KS0073 controller */
0 oder 1 das weisst nur du
Zeile 60-67:
#define LCD_LINES 2 /**< number of visible lines of the display */
#define LCD_DISP_LENGTH 16 /**< visibles characters per line of the display */
#define LCD_LINE_LENGTH 0x40 /**< 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 /**< 0: no wrap, 1: wrap at end of visibile line */
siehe LCD Datenblatt
Zeile 60-67:
#define LCD_IO_MODE 1 /**< 0: memory mapped mode, 1: IO port mode */
immer I/O Mode 1 und nur mit 4-bit ansteuern, LCD D7-D3
Zeile 86-100:
#define LCD_PORT PORTA /**< 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 0 /**< pin for 4bit data bit 0 */
#define LCD_DATA1_PIN 1 /**< pin for 4bit data bit 1 */
#define LCD_DATA2_PIN 2 /**< pin for 4bit data bit 2 */
#define LCD_DATA3_PIN 3 /**< pin for 4bit data bit 3 */
#define LCD_RS_PORT LCD_PORT /**< port for RS line */
#define LCD_RS_PIN 4 /**< pin for RS line */
#define LCD_RW_PORT LCD_PORT /**< port for RW line */
#define LCD_RW_PIN 5 /**< pin for RW line */
#define LCD_E_PORT LCD_PORT /**< port for Enable line */
#define LCD_E_PIN 6 /**< pin for Enable line */
vom User nutzbare Befehle ?
lcd_init(uint8_t dispAttr);
lcd_clrscr(void);
lcd_home(void);
lcd_gotoxy(uint8_t x, uint8_t y);
lcd_putc(char c);
lcd_puts(const char *s);
lcd_puts_p(const char *progmem_s);
lcd_command(uint8_t cmd);
lcd_data(uint8_t data);
lcd_puts_P(__s) lcd_puts_p(PSTR(__s))
von mir bis jetzt erfolgreich benutzt:
lcd_init(LCD_DISP_ON); // LCD_DISP_ON_CURSOR_BLINK
lcd_data(pgm_read_byte_near(©RightChar[__i]));
lcd_clrscr();
lcd_gotoxy(19,0);
lcd_putc(5);
lcd_puts(trimm_string('0',itoa(__bi, (char *)s, 10),2));
lcd_command(_BV(LCD_CGRAM)); // set CG RAM start address 0
nutze ich auch, bin aber noch unsicher ob der was tut ? wegen IO Mode
lcd_home(void);
lcd_puts_p(const char *progmem_s);
lcd_puts_P(__s) lcd_puts_p(PSTR(__s))
habe ich noch nie genutzt
in
test_lcd.c
stehen ja die notwendigen includes
noch Fragen ?
prüfe deine #defines und Verdrahtung.
Achtung Falle:
#define LCD_DATA0_PIN 4 /**< pin for 4bit data bit 0 */
#define LCD_DATA1_PIN 5 /**< pin for 4bit data bit 1 */
#define LCD_DATA2_PIN 6 /**< pin for 4bit data bit 2 */
#define LCD_DATA3_PIN 7 /**< pin for 4bit data bit 3 */
im 4-bit Mode diese defines nicht ändern auf der LCD Seite, aber
LCD DATA0 ist LCD_D4
LCD DATA1 ist LCD_D5
LCD DATA2 ist LCD_D6
LCD DATA3 ist LCD_D7
!!!!!
Lesezeichen