Author Topic: LCD Not Working On Hardware pic18f4520  (Read 4107 times)

jahanzeb

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
LCD Not Working On Hardware pic18f4520
« on: October 16, 2013, 08:01:18 PM »
Hello I am new to MikroC, just started using it. I wrote a code to display string data on LCD and its working properly in proteus but not working on hardware. Code is burnt successfully and i checked all the connections of LCD as well everything is fine. Next i checked that according to Proteus VSS=GND,VDD=5v,VEE=conected to 10k poten,RS=5v,and D6=1 and all other pins are grounded, i confirmed it on hardware and controller is giving response according to above mentioned data but no text is visible on LCD just it lighten up. Code is below plz help.

Code: [Select]
// 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;

void main()
{
     OSCCON.IRCF2=1;               // OSCON<6:4> 111
     OSCCON.IRCF1=1;               // for 8 MHz Internal Oscillator
     OSCCON.IRCF0=1;

     CMCON = 0b00000111;           // make comparators digital I/O

     CCP1CON = 0;                  // turn off CCP 1 module
     CCP2CON = 0;                  // turn off CCP 2 module

     ADCON1=0b00001111;            // make I/O pins digital instead of analog
     ADCON0=0b00000000;            // turn off A/D converter

     RCSTA = 0;                    // turn off USART
     SSPCON1 = 0;                  // turn off MSSP

  //   PORTA=0;
     PORTB=0;
  //   PORTD=0;
   //  PORTE=0;
   //  PORTC=0;


    // TRISA=0x00;
     TRISB=0x00;
    // TRISD=0xFF;
    // TRISC=0x00;
   //  TRISE=0x00;

     
    // I2C1_Init(100000);
   
    Lcd_Init(); // Initialize after port assignmnents (shouldn't matter here but good practice)
    // Initialize LCD connected to PORTB
    Lcd_Cmd(_LCD_CLEAR); // Clear display
    Lcd_Cmd(_LCD_CURSOR_OFF); // Turn cursor off

    // intro();
    // clear_lcd();
    Lcd_Out(1,4,"TEST");
    Lcd_Out(2,4,"TEST");
     
     while(1);
}

Thanks In Advance.:)

 

Sitemap 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71