//<LCD>
sbit LCD_RS at LATA6_bit;
sbit LCD_EN at LATA7_bit;
sbit LCD_D4 at LATA0_bit;
sbit LCD_D5 at LATA1_bit;
sbit LCD_D6 at LATA2_bit;
sbit LCD_D7 at LATA3_bit;
sbit LCD_BL at LATA5_bit;

sbit LCD_RS_Direction at TRISA6_bit;
sbit LCD_EN_Direction at TRISA7_bit;
sbit LCD_D4_Direction at TRISA0_bit;
sbit LCD_D5_Direction at TRISA1_bit;
sbit LCD_D6_Direction at TRISA2_bit;
sbit LCD_D7_Direction at TRISA3_bit;
sbit LCD_BL_Direction at TRISA5_bit;
//</LCD>

void main() {
  OSCCON = 0b01110000; //8MHz
  PLLEN_bit = 1; //Enable PLL (48MHz now)
  ANCON0 = 0b11111111; //All digital
  ANCON1 = 0b00011111; //All digital
  
  LCD_BL_Direction = 0;
  LCD_BL = 1;
  Lcd_Init();                     // Initialize Lcd
  Lcd_Cmd(_LCD_CLEAR);            // Clear display
  Lcd_Cmd(_LCD_CURSOR_OFF);       // Cursor off
  Lcd_Out(1,1,"    SimPLCv2    ");              // Write text in first row
  Lcd_Out(2,1,"www.dizzy.co.za ");              // Write text in second row
}