Dear Florian,
Thanks for the reply.
I have downloaded the source from ELEKTOR and seems pretty simple and similar to other examples. But I'm not very good with WINAVR and still could not make the LCD to work.
Also I could not understand the comments since they are in German.
I have written a small demo to blink the LED and accept input for the button and everything works ok with the exception of the LCD.
I have also turn on the backlight via "PORTD = 0x80;"
My lcd_ini function looks like this:
Code:
#define LCD_CTRL 1 // (0 = HD44780, 1= KS0073)
void lcd_ini ()
{
lcd_port_ini();
DDRC = 0x3F; // setze Portrichtung (1 = Ausgang): 0011 1111
DDRD = 0x80;
PORTD = 0x80; // LCD Backlight On
delay_ms(100); // 40ms warten bis LCD wirklich bereit! Wir können nicht BUSY auswerten.
// Es gibt Displays die so lange brauchen (z. B. Optrex DMC20481)
lcd_set4bit(); // ab jetzt 4-Bit-Modus
lcd_write(0x2C,0); // 4x20 Spezial: Function Set (0010 1100): 4-Bit, 2 Line, RE-Bit, Dot Scroll, Normal Mode
lcd_write(0x09,0); // 4x20: Extended Function Set (0000 1001): 5 dot font, Normal Cursor, 4 Line Display
lcd_write(0x28,0); // B 0010 1000 => Function Set: 4Bit (kein 8-Bit Bus), zweizeiliges Display, 5x7 Dots/Zeichen (kein 5x10), RE-Bit aus
// lcd_write(0x0F,0); // B 0000 1000 => Display On/Off: Display ein, Cursor an, Blinken an
lcd_write(0x0C,0); // B 0000 1100 => Display On/Off: Display ein, Cursor aus, Blinken aus
lcd_write(0x06,0); // B 0000 0110 => Entry Mode Set: DD-RAM autom. inkr., Cursor bewegen
lcd_cls(); // Display löschen
}
I'm using the following version of AVR-GCC:
Code:
C:\AVR\050176-81\lcd_4x20>avr-gcc -v
Reading specs from F:/WinAVR/lib/gcc/avr/3.4.6/specs
Configured with: ../gcc-3.4.6/configure --prefix=/c/WinAVR --target=avr --enable
-languages=c,c++ --with-dwarf2 --enable-win32-registry=WinAVR --disable-nls
Thread model: single
gcc version 3.4.6
On the makefile I have changed the following:
Code:
# MCU name
MCU = atmega32
# Processor frequency.
# This will define a symbol, F_CPU, in all source code files equal to the
# processor frequency. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
F_CPU = 8000000
And the ATMEGA32 I'm using is FUSED for "Ext. Crystal/Resonator High Freq.; Start-up time 16CK + 64ms" to work with the crystal installed on your board.
When I put your orignal Atmega644 it works perfectly. But none of my attempts to program the Atmega32 made the LCD to work.
What version of AVR-GCC do you use ?
Best regards,
Max Oliver
[/code]