ATmega16 (non Ardui) code to Duemilanove ATmega328

Hi
I have driverfiles (LCD with M50530 chip) from a ATmega16 (not Arduino).
m50530.c

#include "m50530.h"
#include <util/delay.h>
#include <avr/pgmspace.h>

void LCDToggleEX(void)
{
  //_delay_us(5);

  LCDCTRLPORT |= _BV(LCDPIN_EX);
  
  _delay_us(2);  // 10

  LCDCTRLPORT &= ~_BV(LCDPIN_EX);

  //_delay_us(5);
}

int LCDIsBusy(void)
{
  unsigned char lInpData = 0;
  int lBusyFlag = 0;
  int l4BitFlag = 0;

    // data port set up to input
  LCDDATADIR &= 0xf0;
  
    // set RW signal
  LCDCTRLPORT |= _BV(LCDPIN_RW);

    // delay?
  //_delay_us(5);  

    // set EX signal
  LCDCTRLPORT |= _BV(LCDPIN_EX);

    // delay?
  //_delay_us(2); // 10

    // read 1st nibble
  lInpData = LCDDATAPIN;

    // clear EX signal
  LCDCTRLPORT &= ~_BV(LCDPIN_EX);

  lBusyFlag =  ( lInpData & (1 << 3) );
  l4BitFlag = !( lInpData & (1 << 2) );

    // delay?
  //_delay_us(5);  

    // read 2nd nibble
  if ( l4BitFlag )
  {
      // set EX signal
    LCDCTRLPORT |= _BV(LCDPIN_EX);

      // delay?
    //_delay_us(2);  // 10

      // read 2nd nibble
    LCDDATAPIN;

      // clear EX signal
    LCDCTRLPORT &= ~_BV(LCDPIN_EX);
  }

  //_delay_us(10);

    // clear RW signal
  LCDCTRLPORT &= ~_BV(LCDPIN_RW);

    // set data port back to output
  LCDDATADIR |= 0x0f;
    // clear data outputs
  LCDDATAPORT &= 0xf0;

  return lBusyFlag;
}

void LCDSend(unsigned char AControl, unsigned char AData)
{
  unsigned char lHN = ( AData & 0xf0 ) >> 4;
  unsigned char lLN = ( AData & 0x0f );
  
  while ( LCDIsBusy() ) 
    ;

  LCDCTRLPORT &= ~(_BV(LCDPIN_RW) | _BV(LCDPIN_IOC1) | _BV(LCDPIN_IOC2) | _BV(LCDPIN_EX));
  LCDCTRLPORT |= AControl;

  LCDDATAPORT &= 0xf0;
  LCDDATAPORT |= lHN;

  LCDToggleEX();

  LCDDATAPORT &= 0xf0;
  LCDDATAPORT |= lLN;
  
  LCDToggleEX();

  LCDDATAPORT &= 0xf0;
  LCDCTRLPORT &= ~AControl;

  //_delay_us(20);
}

void LCDInit(void)
{
    // port setup
  LCDDATADIR |= 0x0f;
  LCDCTRLDIR |= _BV(LCDPIN_RW) | _BV(LCDPIN_IOC1) | _BV(LCDPIN_IOC2) | _BV(LCDPIN_EX);
  
    // SF - Set Function Mode
      //  >> 4 Bit I/O, 5x8 Font, 1/32 duty
      //      >> 4 lines x 40 words, 96 words CG RAM
  LCDSend( 0, LCD_CMD_SETFUNCTIONMODE | sfIO4BIT | sfFont5x8 | 0x0B );

    // SE - Set Entry Mode
  LCDSend( 0, LCD_CMD_SETENTRYMODE | emCursorIncWrite );

    // SU - Set Underline Mode
  LCDSend( 0, LCD_CMD_SETUNDERLINEMODE | suNoUnderline );

    // SB - Set Blinking Frequency
  LCDSend( 0, LCD_CMD_SETBLINKINGFREQUENCY | sbNormal );

    // SD - Set Display Mode
  LCDSend( 0, LCD_CMD_SETDISPLAYMODE | dmDisplayOn /*| dmCursorOn*/ | dmCursorBlink);

    // CH - Clear Cursor of DD RAM display data home & display start address home
  LCDSend( 0, LCD_CMD_CLEARCURSORDATAADDRHOME ); 

  _delay_ms(2);
}

  // setzt den Cursor an die angegebene Position (y = Zeile, x = Spalte)
void LCDSetCursorPos(const unsigned char y, const unsigned char x)
{
    // Adresse aus x und y berechnen
    // Adressen sind wie folgt: Zeile 0 = 0; Zeile 1 = 40; Zeile 2 = 80; Zeile 3 = 120; Zeile 4 = 160; Zeile 5 = 64+24; Zeile 6 = 128+24; Zeile 7 = 192+24
  unsigned char address = x + (y*40);

  LCDSend(_BV(LCDPIN_IOC1)|_BV(LCDPIN_IOC2), address);
}

  // schreibt die übergebene Zeichenkette an die aktuelle Cursor-Position
void LCDWrite(const char * c)
{
  while (*c) 
    LCDWriteChar(*c++);
}

  // schreibt die übergebene Zeichenkette aus dem Programmspeicher 
  // an die aktuelle Cursor-Position
void LCDWritePGM(const char * c)
{
  uint8_t b;

  while ( (b = pgm_read_byte(c++)) )
        LCDWriteChar(b);
}

m50530.h

#ifndef M50530_H
#define M50530_H
#include <avr/io.h>

  // Data and Control signals can be connected to different ports!

  // data port, LCD signals DB4-DB7 have to be connected to P0-P3
#define LCDDATAPORT PORTC
#define LCDDATADIR  DDRC
#define LCDDATAPIN  PINC

  // control port, LCD signals RW, EX, I/OC1, I/OC2
#define LCDCTRLPORT PORTD
#define LCDCTRLDIR  DDRD
//#define LCDCTRLPIN  PIND
#define LCDPIN_RW   PD2
#define LCDPIN_IOC1 PD4
#define LCDPIN_IOC2 PD5
#define LCDPIN_EX   PD3


  // display commands
#define LCD_CMD_SETFUNCTIONMODE          0xc0  // SF
#define LCD_CMD_SETENTRYMODE             0x40  // SE
#define LCD_CMD_SETDISPLAYMODE           0x20  // SD
#define LCD_CMD_SHIFTCURDISPADDRESS      0x10  // MA
#define LCD_CMD_SETUNDERLINEMODE         0x0C  // SU
#define LCD_CMD_WRITERAMUNDERLINEBIT     0x08  // WU
#define LCD_CMD_SETBLINKINGFREQUENCY     0x04  // SB
#define LCD_CMD_CURSORHOMESTARTADDR      0x03  // MH
#define LCD_CMD_CLEARCURSORDATAADDRHOME  0x01  // CH
#define LCD_CMD_NOOPERATION              0x00  // NOP


  // SF - Set Function Mode constants
#define sfIO8BIT         0x20  // bit 5
#define sfIO4BIT         0x00
#define sfFont5x8        0x10  // bit 4
#define sfFont5x12       0x00
  
  // SD - Set Display Mode constants
#define dmDisplayOn      0x10
#define dmCursorOn       0x08
#define dmUnderline      0x04
#define dmCursorBlink    0x02
#define dmCharacterBlink 0x01

  // SU - Set Underline Mode constants
#define suSetUnderline   0x03
#define suResetUnderline 0x02
#define suNoUnderline    0x00

  // SB - Set Blinking Frequency constants
#define sbSlow           0x00
#define sbNormal         0x01
#define sbFast           0x02
#define sbFastest        0x03

  // SE - Set Entry Mode constants

  // base definitions cursor
#define LCD_EM_CursorRead 0x08
#define LCD_EM_CursorWrite 0x10 
#define LCD_EM_CursorIncrement 0x00
#define LCD_EM_CursorDecrement 0x20

  // base definitions display
#define LCD_EM_DisplayRead 0x01
#define LCD_EM_DisplayWrite 0x02 
#define LCD_EM_DisplayIncrement 0x00
#define LCD_EM_DisplayDecrement 0x04

  // constants for cursor
#define emCursorNoChange       0x00
#define emCursorIncRead        LCD_EM_CursorIncrement | LCD_EM_CursorRead
#define emCursorIncWrite       LCD_EM_CursorIncrement | LCD_EM_CursorWrite
#define emCursorIncReadWrite   LCD_EM_CursorIncrement | LCD_EM_CursorRead | LCD_EM_CursorWrite
#define emCursorDecRead        LCD_EM_CursorDecrement | LCD_EM_CursorRead
#define emCursorDecWrite       LCD_EM_CursorDecrement | LCD_EM_CursorWrite
#define emCursorDecReadWrite   LCD_EM_CursorDecrement | LCD_EM_CursorRead | LCD_EM_CursorWrite

  // constants for display start address                                                
#define emDisplayNoChange      0x00
#define emDisplayIncRead       LCD_EM_DisplayIncrement | LCD_EM_DisplayRead
#define emDisplayIncWrite      LCD_EM_DisplayIncrement | LCD_EM_DisplayWrite
#define emDisplayIncReadWrite  LCD_EM_DisplayIncrement | LCD_EM_DisplayRead | LCD_EM_DisplayWrite
#define emDisplayDecRead       LCD_EM_DisplayDecrement | LCD_EM_DisplayRead
#define emDisplayDecWrite      LCD_EM_DisplayDecrement | LCD_EM_DisplayWrite
#define emDisplayDecReadWrite  LCD_EM_DisplayDecrement | LCD_EM_DisplayRead | LCD_EM_DisplayWrite


//extern int LCDIsBusy(void);
extern void LCDSend(unsigned char AControl, unsigned char AData);
extern void LCDInit(void);
extern void LCDSetCursorPos(const unsigned char y, const unsigned char x);
extern void LCDWrite(const char * c);
extern void LCDWritePGM(const char * c);

  // schreibt das übergebene Zeichen an die aktuelle Cursor-Position
#define LCDWriteChar(c)            LCDSend(_BV(LCDPIN_IOC2), c)

  // setzt den Display-Modus
  // man verwende die oben deklarierten Konstanten ;)
//#define LCDSetDisplayMode(mode)    LCDSend(0, mode | 32)

  // setzt den Cursor an die angegebene Adresse
//#define LCDSetCursorAddress(address)   LCDSend((1<<LCDPIN_IOC1) | (1<<LCDPIN_IOC2), address)

#define cls(void)      LCDSend(0, LCD_CMD_CLEARCURSORDATAADDRHOME);
#endif

I modivied the Ports in the Headerfile to:
// data port, LCD signals DB4-DB7 have to be connected to P0-P3
#define LCDDATAPORT PORTD
#define LCDDATADIR DDRD
#define LCDDATAPIN PIND

// control port, LCD signals RW, EX, I/OC1, I/OC2
#define LCDCTRLPORT PORTD
#define LCDCTRLDIR DDRD
//#define LCDCTRLPIN PIND
#define LCDPIN_RW 7 // not in use
#define LCDPIN_IOC1 6
#define LCDPIN_IOC2 4
#define LCDPIN_EX 5

What else do I need to change??
Lib is included in the folder: …\libraries\m50530 (m50530.h and m50530.c)

Sketch:

#include <m50530.h>
#include <m50530.c>

void setup()
{
// wait for power up
      delay(5000);
  LCDInit();
  LCDSend( 0, LCD_CMD_SETDISPLAYMODE | dmDisplayOn | dmCursorOn | dmCursorBlink);
  LCDWrite("TEST");

}

void loop()
{

}

LCD is not working… what eels does need to be changed???