LCD library requires that you use LAT registers with PIC18 outputs, like this:
Code:
// LCD module connections
sbit LCD_RS at LATB0_bit;
sbit LCD_EN at LATB1_bit;
sbit LCD_D4 at LATB2_bit;
sbit LCD_D5 at LATB3_bit;
sbit LCD_D6 at LATB4_bit;
sbit LCD_D7 at LATB5_bit;
sbit LCD_RS_Direction at TRISB0_bit;
sbit LCD_EN_Direction at TRISB1_bit;
sbit LCD_D4_Direction at TRISB2_bit;
sbit LCD_D5_Direction at TRISB3_bit;
sbit LCD_D6_Direction at TRISB4_bit;
sbit LCD_D7_Direction at TRISB5_bit;
// End LCD module connections
void main()
{
Lcd_Init();
Lcd_Cmd(_LCD_TURN_ON); // Clear the LCD ? don't think it does - try (_LCD_CLEAR)
//Lcd_Out(1,4,"My Computer");
Lcd_Out_Cp("Here!");
Delay_ms(500);
Lcd_Cmd(_LCD_TURN_OFF); // Clear the LCD
}
// LCD module connections
sbit LCD_RS at LATB0_bit;
sbit LCD_EN at LATB1_bit;
sbit LCD_D4 at LATB2_bit;
sbit LCD_D5 at LATB3_bit;
sbit LCD_D6 at LATB4_bit;
sbit LCD_D7 at LATB5_bit;
sbit LCD_RS_Direction at TRISB0_bit;
sbit LCD_EN_Direction at TRISB1_bit;
sbit LCD_D4_Direction at TRISB2_bit;
sbit LCD_D5_Direction at TRISB3_bit;
sbit LCD_D6_Direction at TRISB4_bit;
sbit LCD_D7_Direction at TRISB5_bit;
// End LCD module connections
void main()
{
Lcd_Init();
Lcd_Cmd(_LCD_TURN_ON); // Clear the LCD ? don't think it does - try (_LCD_CLEAR)
Lcd_Cmd(_LCD_CLEAR);
//Lcd_Out(1,4,"My Computer");
Lcd_Out_Cp("Here!");
Delay_ms(500);
Lcd_Cmd(_LCD_TURN_OFF); // Clear the LCD
}
Here is a version built for 4MHz clock and without turning off the display.
Works on real hardware, but no idea whether it will work with Proteus.
EDIT: ... just noticed .... your original circuit diagram would normally have MCLR connected to a 10K resistor, with the other side of the resistor connected to +5V.
Also LCD2 should have Vee connected to ground, not to +5V, though Proteus probably would not care.
Here is a version built for 4MHz clock and without turning off the display.
Works on real hardware, but no idea whether it will work with Proteus.
EDIT: ... just noticed .... your original circuit diagram would normally have MCLR connected to a 10K resistor, with the other side of the resistor connected to +5V.
Also LCD2 should have Vee connected to ground, not to +5V, though Proteus probably would not care.