Gast
#983880
Habe folgendes Problem:
Initialisierung des Display (Controller HD44780) funktioniert nicht.
Folgender Code sollte einen blinkenden Cursor ausgeben:
#include <inttypes.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <avr/lcdvorlage.h>
#include <util/delay.h>
#define F_CPU 16000000
int main(void)
{
DDRA = 0xFF;
//Step 1 -Time until the modul has initialized itself internally
_delay_ms(50);
//Step 2 -set 8 bit mode
PORTA |= (1 << PA6); //Enable-Pin High
PORTA = 0b00000011; //8-Bit
PORTA &= ~(1<<PA6); //Enable-Pin Low
_delay_ms(5);
PORTA |= (1 << PA6); //Enable-Pin High
PORTA = 0b00000011; //8-Bit
PORTA &= ~(1<<PA6); //Enable-Pin Low
_delay_us(160);
PORTA |= (1 << PA6); //Enable-Pin High
PORTA = 0b00000011; //8-Bit
PORTA &= ~(1<<PA6); //Enable-Pin Low
_delay_us(160);
//Step3 -set 4 bit mode
PORTA |= (1 << PA6); //Enable-Pin High
PORTA = 0b00000010; //4-Bit Modus - MSB
PORTA &= ~(1<<PA6); //Enable-Pin Low
_delay_ms(5);
PORTA |= (1 << PA6); //Enable-Pin High
PORTA = 0b00000010; //4-Bit Modus - LSB
PORTA &= ~(1<<PA6); //Enable-Pin Low
_delay_ms(5);
//Step4 -select the connected display
PORTA |= (1 << PA6); //Enable-Pin High
PORTA = 0b00101000; //4-Bit Modus . LSB
PORTA &= ~(1<<PA6); //Enable-Pin Low
_delay_ms(5);
//Step5 -Activate the display, turn on the cursor, turn on blinking
PORTA |= (1 << PA6); //Enable-Pin High
PORTA = 0b00001111; //Display AN, Cursor AN - MSB
PORTA &= ~(1<<PA6); //Enable-Pin Low
_delay_ms(5);
PORTA |= (1 << PA6); //Enable-Pin High
PORTA = 0b00001111; //Display AN, Cursor AN - LSB
PORTA &= ~(1<<PA6); //Enable-Pin Low
_delay_ms(5);
while(1);
}
Vielleicht kann mir jemand sagen wo das Problem liegt?! Danke
