lunes, 27 de junio de 2011

LCD en PIC18f4550 con MikroC Pro

[Update: El 4550 ya es un poco viejo. ¿No quieres echarle un ojo al 45K50?]

Circuito en Proteus 7.7

// LCD module connections
sbit LCD_RS at LATB4_bit;
sbit LCD_EN at LATB5_bit;
sbit LCD_D4 at LATB0_bit;
sbit LCD_D5 at LATB1_bit;
sbit LCD_D6 at LATB2_bit;
sbit LCD_D7 at LATB3_bit;

sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
// End LCD module connections

void main() {
ADCON1 |= 0x0F;
CMCON  |= 7;

  Lcd_Init();                // Inicializa LCD
  Lcd_Cmd(_Lcd_CLEAR);       // Limpiar display
  Lcd_Cmd(_Lcd_CURSOR_OFF);  // Desactivar cursor


while(1)
  {
    Lcd_Out(1,1,"Fuck you, World");

    Lcd_Out(2,1,"You too, ASM");

  }
}



NOTA: Si van a utilizar un puerto diferente al PORTB, deben declarar ese puerto como salidas, de lo contrario el LCD no mostrará nada.

4 comentarios:

DIEGO20DAVID dijo...

muchas gracias por tu aporte, este pic da muchos problemas 18f4550 ...... gracias por publicar el manejo del LCD

Unknown dijo...

No puedo creer que acabé en un blog tuyo.
Excelente aporte. ¡Gracias!

wil dijo...

ja este ejemlo en proteus es un pic 16f887 no el pic 18f4550 '''¡¡¡¡¡¡ esta confuso

Anónimo dijo...

gracias muy bueno