en lo mas recóndito de el disco duro encontre una libreria que usaba cuando usaba micros de motorola.
cuando uso el lcd con este micro si puedo usar la segunda linea.
voy a ver si la puedo adaptar.
de todas formas la pongo (sin creditos) por si la quiere modificar.
y tmb ak esta
http://pastebin.es/1494#include <MC68HC908GP32.h> /* include peripheral declarations */
#include "TIMERAPI.h"
#include "lcddrv.h" /* LCD driver function prototypes
#define LcdPort PTB /* LCD to HC12B32 inteconnection */
#define LcdDDRPort DDRB /* LCD port Data Direction Register */
#define REG_SEL PTB_PTB4 /* replace it for others processors */
#define ENABLE PTB_PTB5
#define LCD_CLEAR 0x01 /* Command to clear LCD module */
#define LCD_CLEAR_DELAY 3 /* miliseconds delay to clear LCD module */
#define ROW_0 0x80 /* first ROW direction */
#define ROW_1 0xC0 /* second ROW direction */
#define LCD_INIT_COM 0x38 /* LCD init command */
#define LCD_INIT_DRV4 0x03 /* LCD init command */
#define LCD_4_BIT_MODE 0x02 /* Set 4 bit data interface */
#define LCD_FUNC_SET_COM 0x38 /* 8 data bits, 2 display lines, 5x7 dots */
#define LCD_FUNC_SET_4 0x28 /* 4 data bits, 2 display lines, 5x7 dots */
#define LCD_DISPCTRL_COM 0x0F /* Display ON, Cursor ON, cursor blinking */
#define LCD_DISP_CUR_ON 0x0E /* Display ON, Cursor ON, no blinking */
#define LCD_ENTRYMODE_COM 0x06 /* Increment, no display shift */
#define LCD_CUR_SHIFT_COM 0x14 /* Cursor move, shift right */
void LcdSendData(const byte data){
byte datanibble = 0;
ENABLE = 1;
datanibble = (LcdPort & 0xF0); /* Preserve last lcd port state */
datanibble |= (data >> 4); /* Take most significant part of byte */
LcdPort = datanibble; /* Send most significant nibble */
Delayus(80);
ENABLE = 0;
Delayus(20);
ENABLE = 1;
datanibble = (LcdPort & 0xF0);
datanibble |= (data & 0x0F); /* Take most significant part of byte */
LcdPort = datanibble; /* Send most significant nibble */
Delayus(80);
ENABLE = 0;
}
void LcdCommand(const byte command){
REG_SEL = 0;
LcdSendData(command);
Delayus(100);
}
void LcdCommand8(const byte command) {
byte temp;
REG_SEL = 0;
ENABLE = 1;
temp = (LcdPort & 0xF0);
LcdPort = temp | command;
ENABLE = 0;
Delayus(100);
}
void LcdPutChar(const char c){
REG_SEL = 1;
LcdSendData(c);
}
void LcdPuts(const char *s){
while(*s){
LcdPutChar(*s++);
}
}
void LcdClr(void){
LcdCommand(LCD_CLEAR);
Delayms(LCD_CLEAR_DELAY);
}
void LcdGotoxy(const byte row,const byte col){
byte GotoInst;
switch(row){
case 0:
GotoInst = ROW_0 + col;
break;
case 1:
GotoInst = ROW_1 + col;
break;
default:
GotoInst = ROW_0;
break;
}
LcdCommand(GotoInst);
}
void LcdInit(void){
LcdPort = 0; /* Clear LCD Port */
LcdDDRPort = 0xFF; /* LCD Port as output*/
Delayms(25); /* Wait for 25ms after Vcc raises to 4.5v */
LcdCommand8(LCD_INIT_DRV4); /* Send Init Command */
Delayms(4);
LcdCommand8(LCD_INIT_DRV4); /* Send Init Command + 100 us delay */
LcdCommand8(LCD_INIT_DRV4); /* Send Init Command */
Delayms(4);
LcdCommand8(LCD_4_BIT_MODE); /* Set 4 data bits interface: */
LcdCommand(LCD_FUNC_SET_4); /* 4 data bits, 2 display lines, 5x7 dots */
LcdCommand(LCD_DISP_CUR_ON); /* Display ON, Cursor ON, no blinking */
LcdCommand(LCD_ENTRYMODE_COM); /* Increment, no display shift */
LcdCommand(LCD_CUR_SHIFT_COM); /* Cursor move, shift right */
LcdClr(); /* Clear Display Command */
}