Also ich will die Lib in C schreiben.
In Demo programmen heißt es dann C-Compakt.
Ich habe jetzt auch die Lib auf nur noch 3 Fehler kürzen können.(habe die Fehler gelößt)
So sieht sie jetzt aus:
Code:
/*-------------------------------------------------------------------------------
'I2C zu LCD über Porterweiterung Philips PCF8574T
'Ausgabe von Text als Char und Zahlen wie Word und Float

'Uref ist Versorgung 5Volt, andere Möglichkeiten siehe Hilfe
'Hier sehen Sie, welche PCF 8574 Ports dem LCD zugeordnet sind:
'Port 0  LCD DB4
'Port 1  LCD DB5
'Port 2  LCD DB6
'Port 3  LCD DB7
'Port 4  LCD R/W
'Port 5  LCD RS
'Port 6  LCD EN
------------------------------------------------------------------------------*/

byte Daten;                          //Datenbyte für I²C-Bus- Routinen
byte LCD_Param;                      //Datenbyte für LCD-Routinen
byte LCD_Buffer;                     //zweites Byte für LCD- Routinen
byte Text_Out_LCD;

//---[ LCD INIT ]----------------------------------------------------------------
void I2C_LCD_INIT(void)
{
   I2C_Init(I2C_100kHz); //100kHz

   //alle Ports 0
   Daten = 0;
   I2C_SEND();

   //8-Bit-Modus aktivieren
   I2C_LCD_WRITE_COMMAND &H38;

   //mit 8-Bit-Modus in 4-Bit-Modus wechseln
   Daten = H02;
   I2C_SEND();

   Daten = Daten + H40;
   I2C_SEND();
   AbsDelay(5);

   Daten = Daten - H40;
   I2C_SEND();
   AbsDelay(5);

   //ab jetzt 4-Bit-Modus / Cursor aus
   I2C_LCD_WRITE_COMMAND &H28;
}

//---[ Cursor Blinken ein ]------------------------------------------------------
void BLINK_ON(void)
{
    I2C_LCD_WRITE_COMMAND &H0F;
}

//---[ Cursor Blinken aus ]------------------------------------------------------
void BLINK_OFF(void)
{
    I2C_LCD_WRITE_COMMAND &H0C;
}

//---[ Cursor sichtbar ohne blinken ]--------------------------------------------
void CURSOR_NO_FLASH(void)
{
    I2C_LCD_WRITE_COMMAND &H0E;
}

//---[ Display löschen ]---------------------------------------------------------
void I2C_LCD_CLR(void)
{
    I2C_LCD_WRITE_COMMAND &H02;
    I2C_LCD_WRITE_COMMAND &H01;
}

//---[ Zeilenwechsel ]-----------------------------------------------------------
void I2C_LCD_LOCATE(byte Zeile,byte Pos)
{
    byte Position;
    if(Zeile == 1){
        Position = (Pos - 1);
        I2C_LCD_WRITE_COMMAND(Position &H80);
    }
    if(Zeile == 2){
        Position = (Pos - 1);
        I2C_LCD_WRITE_COMMAND(Position &HC0);
    }
    if(Zeile == 3){
        Position = (Pos - 1);
        I2C_LCD_WRITE_COMMAND(Position &H90);
    }
    if(Zeile == 4){
        Position = (Pos - 1);
        I2C_LCD_WRITE_COMMAND(Position &HD0);
    }
}

//---[ LCD Steuerkommando ]------------------------------------------------------
void I2C_LCD_WRITE_COMMAND(byte com)
{
    LCD_Buffer = H0;
    LCD_Param = com;
    WRITE_TO_LCD();
}

//---[ LCD_Write_Float_Ext ]-----------------------------------------------------
void I2C_LCD_WRITE_FLOAT(float Var,word Len)
{
    char Str_Float(17) ;
    word x;
    x = 0;
     Str_WriteFloat(Var,Len,Str_Float,0);
    while(true){
      Text_Out_LCD = Str_Float(x);
      x = x + 1;
    if(Text_Out_LCD == 0){
       Exit;
    }
        I2C_LCD_WRITE(Text_Out_LCD);
    }
}

//---[ LCD_Write_Word_Ext ]------------------------------------------------------
void I2C_LCD_WRITE_WORD(word Var,word Len)
{
    char Str_Word(21);
    word x;
    x = 0;
     Str_WriteWord(Var,10,Str_Word,0,Len);
    while(true){
      Text_Out_LCD = Str_Word(x);
      x = x + 1;
    if(Text_Out_LCD == 0){
       Exit;
    }
      I2C_LCD_WRITE(Text_Out_LCD);
    }
}

//---[ LCD_Write_Text ]----------------------------------------------------------
void I2C_LCD_WRITE_TEXT(char ByRef text)
{
    word x;
    x = 0;
    while(true){
      Text_Out_LCD = text(x);
      x = x + 1;
    if(Text_Out_LCD == 0){
       Exit;
    }
      I2C_LCD_WRITE(Text_Out_LCD);
    }
}

//---[ LCD_Write_Ext ]-----------------------------------------------------------
void I2C_LCD_WRITE(char Text_Print)
{
    LCD_Buffer = H20;
    LCD_Param = Text_Print;
    WRITE_TO_LCD();
}

//---[ Ausgabe über I2C ]--------------------------------------------------------
void WRITE_TO_LCD(void)
{
    //Hi-Nibble
    Daten = LCD_Buffer (LCD_Param >> 4);
    I2C_SEND();

    Daten = Daten + H40;
    I2C_SEND();
    AbsDelay(1);

    Daten = Daten - H40;
    I2C_SEND();
    AbsDelay(1);

    //Low-Nibble
    Daten = LCD_Buffer (LCD_Param &H0F);
    I2C_SEND();

    Daten = Daten + H40;
    I2C_SEND();
    AbsDelay(1);

    Daten = Daten - H40;
    I2C_SEND();
    AbsDelay(1);
}

//---[ I2C Routine ]-------------------------------------------------------------
void I2C_SEND(void)
{
    I2C_Start();
    I2C_Write(I2C_LCD_ADDR);
    I2C_Write(Daten);
    I2C_Stop();
}
Ich hoffe du kannst mir irrgentwie helfen.

Mfg
bnitram