Ya está, descubrí el problema, estaba en el puntero.... como funcionaría bien es así:
// Carácter personalizado para grados Celsius
const unsigned char GradosCelsius[8] = {
0b01110,
0b01010,
0b01110,
0b00000,
0b11111,
0b00000,
0b00000,
0b00000
};
// Función para cargar un carácter personalizado en CGRAM
void customcharacter(unsigned char codigo, const unsigned char *caracter) {
unsigned char i;
SetCGRamAddr(0x40 + (codigo * 8)); // Dirección en CGRAM
for (i = 0; i < 8; i++) {
WriteDataXLCD(caracter[i]);
}
}
void main() {
// Inicialización del LCD
OpenXLCD(FOUR_BIT & LINES_5X7);
while(BusyXLCD());
customcharacter(0, &GradosCelsius); // Carga el carácter en CGRAM
SetDDRamAddr(0x00); // Posiciona el cursor
while(BusyXLCD());
// Imprime "Temp: 25°C" de manera eficiente
while( BusyXLCD() ); //wait untill LCD controller is busy
gotoxyXLCD(0,1); //Posición 1 caracter, línea 1
while( BusyXLCD() ); //wait untill LCD controller is busy
putrsXLCD("Temp: 26"); //Texto a mostar en la línea 1
while( BusyXLCD() ); //wait untill LCD controller is busy
gotoxyXLCD(9,1); //Posición 1 caracter, línea 1
while( BusyXLCD() ); //wait untill LCD controller is busy
WriteDataXLCD(0); // Mostrar el símbolo ºC
while( BusyXLCD() ); //wait untill LCD controller is busy
gotoxyXLCD(10,1); //Posición 1 caracter, línea 1
while( BusyXLCD() ); //wait untill LCD controller is busy
putrsXLCD("C");
while(1); // Bucle infinito
}
Y como la función gotoxyXLCD no está en los driver originales de microcip la comparto.
void gotoxyXLCD(unsigned char x, unsigned char y){//Función con la que podemos elegir posición
unsigned char direccion;
if(y != 1)
direccion = 0x40;
else
direccion = 0;
direccion += x-1;
commandXLCD(0x80 | direccion);
while( BusyXLCD() ); //wait untill LCD controller is busy
}
Pues gracias y un saludo, me han ayudado más de lo que piensan.