Vielleicht kanns ja wer brauchen...

C-Code
(Kritik ausdrücklich erwünscht)

Bisher initialisiere ich nur das LCD, mal das Bild hin und park den µC dann im while(1)

Code:
// Project	: LCD
// Author 	: BiGF00T
// Date   	: 2007-09-02
// AVR	  	: ATMega16 @ 1MHz
//
// Blah	  	:
// - RESET is ACTIVE LOW!!!
/*
CONTROL PORT D:		DATA PORT    B:
===============		===============
	CSA 	PD0			DB0		PB0
	CSB		PD1			DB1		PB1
	DI/RS	PD2			DB2		PB2
	RW		PD3			DB3		PB3
	E		PD4			DB4		PB4
	RST		PD5			DB5		PB5
	-NC-	PD6			DB6		PB6
	-NC-	PD7			DB7		PB7
===============		===============	
*/

#include <avr/io.h>

#define F_CPU 1000000UL  // 1 MHz

// DIRECTIONS
#define RIGHT 0
#define LEFT 1
// PINS 
#define CSA 0x01
#define CSB 0x02
#define DI  0x04
#define RW  0x08
#define E   0x10
#define RST 0x20

unsigned char Data[]= {
 0,0,0,0,0,0,0,0,0,0,240,24,12,14,6,7,7,3,3,3,3,3,3,3,3,3,3,7,6,14,14,28,
 60,120,240,224,192,0,252,6,6,7,15,15,15,14,14,14,14,14,140,252,124,28,4,0,0,0,0,0,192,224,112,56,
 56,48,48,60,126,108,108,204,220,220,152,24,24,24,56,48,48,48,48,48,48,48,48,48,48,48,48,48,48,240,240,48,
 0,0,128,192,32,32,48,48,48,48,48,48,48,48,56,56,24,24,24,24,24,24,24,24,24,28,28,12,12,12,14,254,
 0,0,0,0,0,0,0,0,0,255,193,64,96,48,16,8,140,116,12,0,0,0,240,204,66,98,54,28,0,0,0,0,
 0,128,225,63,31,0,3,126,192,0,0,0,0,0,0,0,240,252,131,1,0,0,128,224,56,12,2,1,0,0,0,0,
 0,128,128,128,128,128,128,0,192,121,15,1,128,224,16,16,16,16,16,24,8,8,8,8,8,8,16,24,15,195,96,176,
 152,134,67,64,64,96,32,32,32,32,32,96,192,0,0,0,0,0,0,0,0,128,128,192,64,64,64,32,32,32,32,63,
 0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,62,3,0,0,0,0,0,0,0,0,0,0,0,48,56,120,246,
 227,129,0,0,0,0,0,0,31,48,48,16,16,16,16,16,55,63,191,224,56,12,3,0,0,0,0,192,112,28,6,3,
 1,0,192,112,14,1,1,3,3,0,32,60,55,56,56,56,24,24,24,248,248,120,24,0,0,0,0,6,3,3,1,1,
 0,0,0,0,0,0,0,0,0,0,128,124,3,0,0,0,0,128,127,1,1,0,0,0,0,0,0,0,0,0,0,0,
 0,0,0,0,0,0,0,0,0,0,0,0,192,124,3,0,0,0,0,0,0,224,16,32,192,128,0,0,0,0,0,0,
 1,7,15,30,248,240,48,12,14,14,14,14,14,14,30,28,60,30,147,112,48,0,0,0,0,240,30,3,240,16,24,24,
 24,31,25,24,24,24,216,120,120,16,192,64,64,64,64,64,128,248,31,29,13,28,60,124,240,224,128,128,64,64,32,48,
 48,120,120,240,224,192,0,0,0,240,31,0,0,0,0,0,240,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 0,0,0,0,0,0,0,0,0,0,192,124,7,0,0,0,0,0,0,128,112,15,0,0,0,1,3,6,12,240,0,0,
 0,0,0,0,0,7,252,0,0,0,0,0,0,0,0,192,56,14,1,0,0,0,0,224,254,129,144,190,99,32,32,0,
 0,0,0,192,56,7,1,224,60,7,1,128,192,112,48,32,96,192,0,0,0,0,0,0,1,15,255,248,64,64,128,128,
 0,0,0,0,3,15,255,252,240,31,0,0,0,0,0,0,255,255,254,0,0,0,0,0,0,0,0,0,0,0,0,0,
 0,0,128,240,112,224,224,192,192,60,3,0,0,0,0,0,0,128,240,255,0,0,0,0,0,0,0,192,112,29,7,0,
 0,0,0,128,224,62,3,0,0,0,0,0,0,0,248,15,0,0,0,0,0,0,0,7,7,7,3,1,0,0,0,0,
 0,224,60,3,128,120,14,1,0,0,124,227,128,128,0,128,128,129,231,56,0,0,0,0,0,224,255,128,0,128,128,129,
 254,0,0,0,0,0,224,63,7,0,0,0,0,0,0,0,15,255,255,248,0,0,0,0,0,0,0,0,0,0,0,0,
 0,0,255,0,0,0,1,3,3,2,0,0,0,0,0,0,6,7,7,7,7,7,7,7,7,7,3,128,128,128,192,96,
 48,24,12,3,0,0,128,128,128,128,128,128,0,0,255,96,32,32,16,16,16,16,16,16,240,32,32,32,64,192,128,0,
 252,7,192,248,143,0,0,0,0,0,0,3,7,7,7,3,3,129,128,128,64,96,56,204,135,0,3,3,3,3,1,1,
 0,0,0,192,112,30,3,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,
 0,0,3,2,2,6,4,4,8,8,8,8,8,8,8,8,4,4,4,4,4,6,2,2,34,49,29,31,11,12,4,6,
 2,2,3,1,1,1,0,0,0,0,0,1,1,3,7,14,0,0,0,0,0,0,16,30,17,16,16,16,16,16,16,19,
 51,120,15,0,1,1,2,6,4,6,2,2,2,2,2,1,1,1,0,0,0,0,0,0,1,1,1,1,1,2,34,58,
 47,19,17,17,16,24,8,8,8,12,4,4,4,4,4,4,4,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0
};

// set a bit of PORT D
inline void set(unsigned char what)
{
	PORTD |= what;
}
// clr a bit of PORT D
inline void clr(unsigned char what)
{
	PORTD &= ~(what);
}

// send an instruction to the LCD
int writeInstruction(unsigned char data)
{
	clr(E);
	clr(DI);
	PORTB = data;
	set(E);
	clr(E);
	return 0;
}

// send data to the LCD
int writeData(unsigned char data)
{
	clr(E);
	set(DI);	
	PORTB = data;	// instruction on port
	set(E);
	clr(E);
	return 0;
}

// select one of the two sides
void selectSide(unsigned char side)
{
	if(side == RIGHT)
	{
		set(CSA);
		clr(CSB);
	}
	else
	{
		set(CSB);
		clr(CSA);
	}
}

// initialize LCD 
int initLCD(void)
{
	writeInstruction(0x3f); // DISPLAY ON
	writeInstruction(0x40); // SET ADDRESS 	Y (0-63)
	writeInstruction(0xb8); // SET PAGE 	X (0-7)
	writeInstruction(0xc0); // DISPLAY START LINE
	return 0;
}


// TEST 0.1 
int main (void)
{
	char pageAdr = 0xb8;

	int col = 0;
	int page = 0;
	
	// set pins
	// Control Pins (Port D)
	PORTD = 0x00;	// All Pins are Low
	DDRD = 0xFF;	// All Pins are Outputs

	// Data Pins (Port B)
	PORTB = 0x00;	// All Pins are Low
	DDRB = 0xFF;		// All Pins are Outputs
	
	set(RST); // <<---- AAAAAAAAAAARGH, F*** Reset ist Active LOW!!!!!11!1one
	selectSide(RIGHT);
	initLCD();	
	selectSide(LEFT);
	initLCD();
	for(page = 0; page < 8; page++)
	{
		pageAdr++;
		// write the first part of the picture inverted "~"
		for (col = 0; col <= 63; col++)
			writeData(~Data[(128*page)+col]); 
			
		writeInstruction(pageAdr);  
		selectSide(RIGHT);
		
		// write the second part of the picture inverted "~"
		for (col = 64; col <= 127; col++)
			writeData(~Data[(128*page)+col]);
			
		writeInstruction(pageAdr);
		selectSide(LEFT);
	}
	while(1)
	{
	}
	return 0;
}