Hallo,
Ne so wird das nix 
Du musst ja das LCD initialisieren usw.... da schau Dir doch lieber mal die RP6Control Library an (also die für das Erweiterungsmodul)
Auszug:
Code:
char lcd_tmp_buffer[17];
/**
* Sets the LCD ports without affecting the LEDs and also pulses the
* enable line of the LCD to 'inform' the LCD about the new data.
*
*/
void setLCDD(uint8_t lcdd)
{
externalPort.LCDD = lcdd;
outputExt();
PORTB |= LCD_EN;
delayCycles(50);
PORTB &= ~LCD_EN;
}
/**
* Initialize the LCD. Always call this before using the LCD!
*
*/
void initLCD(void)
{
//delayCycles(34000); No need for Power ON delay as usually the
// Bootloader should have been executed before...
setLCDD(0b0011);
delayCycles(18000);
setLCDD(0b0011);
delayCycles(5500);
setLCDD(0b0011);
delayCycles(5500);
setLCDD(0b0010);
delayCycles(5500);
writeLCDCommand(0b00101000);
delayCycles(5500);
writeLCDCommand(0b00001000);
delayCycles(5500);
writeLCDCommand(0b00000001);
delayCycles(5500);
writeLCDCommand(0b00000010);
delayCycles(5500);
writeLCDCommand(0b00001100);
delayCycles(5500);
}
/**
* Write a 8bit-byte in two nibbles of 4bit to the LCD.
*/
void write4BitLCDData(uint8_t data)
{
setLCDD(data >> 4);
setLCDD(data);
delayCycles(150);
}
/**
* Write a command to the LCD.
*/
void writeLCDCommand(uint8_t cmd)
{
PORTB &= ~LCD_RS;
write4BitLCDData(cmd);
delayCycles(150);
}
/**
* Clears the whole LCD!
*/
void clearLCD(void)
{
writeLCDCommand(0b00000001);
delayCycles(5500);
}
/**
* Write a single character to the LCD.
*
* Example:
*
* writeCharLCD('R');
* writeCharLCD('P');
* writeCharLCD('6');
* writeCharLCD(' ');
* writeCharLCD('0');
* writeCharLCD(48); // 48 is ASCII code for '0'
* writeCharLCD(49); // '1'
* writeCharLCD(50); // '2'
* writeCharLCD(51); // '3'
* //...
*
* would output:
* RP6 00123
* at the current cursor position!
* use setCursorPos function to move the cursor to a
* different location!
*/
void writeCharLCD(uint8_t ch)
{
PORTB |= LCD_RS;
write4BitLCDData(ch);
delayCycles(50);
}
Es gibt da noch mehr Funktionen und Makros für das LCD (s. Erweiterungsmodul Anleitung und Quellcode) - um besser Text ausgeben zu können usw... ich poste das nur hier damit Du weisst welche Funktionen ich generell meine.
Diese Funktionen musst Du komplett so wie sie sind übernehmen - ABER - Du musst natürlich die Ausgabe auf das LCD über den I2C Bus umleiten.
Du musst dazu im Prinzip nur die Funktion setLCDD() abändern und da auch zusätzlich noch das setzen der RS Leitung vom LCD einbauen - also damit das LCD weiss ob es gerade ein Kommando oder Daten erhält...
(das sind die beiden Zeilen PORTB &= ~LCD_RS; und PORTB |= LCD_RS
Am besten in einer LCD Port Variable die Du Dir anlegst ein Bit dafür verwenden... das kann genauso gesetzt und gelöscht werden wie die Port Bits...
Lösungen werde ich hier aber nicht präsentieren - etwas präzisere Fragen wenn etwas nicht klar ist würde ich aber schon beantworten ^^
MfG,
SlyD
Lesezeichen