Hola, he estado configurando un lcd 2x16 en mikroc por el PORTB, y no me funcionaba haciendo las mismas conexiones que he hecho siempre con pic 16f---; hasta que he visto un ejemplo en el que lo unico que me variaba era esta linea:
CMCON = 0x07; // Disable comparators
que no entiendo porque hay que ponerle ese valor, si pongo 0 tambien funciona, la cosa es que lo he visto en varios sitios.
// Conexiones del módulo LCD a 4bits por PORTB
sbit LCD_RS at RB7_bit;
sbit LCD_EN at RB6_bit;
sbit LCD_D4 at RB5_bit;
sbit LCD_D5 at RB4_bit;
sbit LCD_D6 at RB3_bit;
sbit LCD_D7 at RB2_bit;
sbit LCD_RS_Direction at TRISB7_bit;
sbit LCD_EN_Direction at TRISB6_bit;
sbit LCD_D4_Direction at TRISB5_bit;
sbit LCD_D5_Direction at TRISB4_bit;
sbit LCD_D6_Direction at TRISB3_bit;
sbit LCD_D7_Direction at TRISB2_bit;
// Final de las conexiones del módulo LCD
void main() {
//oscilador interno a 8 MHz
OSCCON = 0x7F;
//while (OSCCON.IOFS=0){}; //esto no se si es muy necesario en este PIC
CMCON = 0x07; // Disable comparators
ADCON1 = 0x0F;
Lcd_Init(); // Inicialización del visualizador LCD
delay_ms(300);
Lcd_Cmd(_LCD_CURSOR_OFF); // Comando LCD (apagar el cursor)
Lcd_Cmd(_LCD_CLEAR); // Comando LCD (borrar el LCD)
Lcd_Out(1,1,"Hola lcd."); //Lcd_Out(fila,columna)
while(1){}
}