Interfacing LCD(16X2) with PIC18F46K80

Status
Not open for further replies.

nacoolp

Newbie level 5
Joined
May 28, 2013
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,357
Hello everyone, I am trying to create a simple program to print "Hello" on LCD using PIC18F46K80 in mikroC. The circuit board on which I am working works perfectly with PIC16F887. But with 46k80, the LCD remains blank only. I guess I have configured everything properly in the hardware. Is LCD interfacing with PIC18F46K80 different with PIC16F887..?? Are there some special instructions that I should follow while using LCD with the former?? Or is there any special provision required to be done in the configuration file?

If so, please guide me the needful as I am going out blank with the current situation.

I am attaching my C file along with this topic for your reference. Do let me know if I am making a mistake. In this file, the outputs L1, L2 and L3 are working perfectly but nothing is occurring with LCD.

Thanks in advance.

Code:
sbit LCD_RS at RA3_bit;
sbit LCD_RW at RA2_bit;
sbit LCD_EN at RB4_bit;
sbit LCD_D4 at RD4_bit;
sbit LCD_D5 at RD5_bit;
sbit LCD_D6 at RE1_bit;
sbit LCD_D7 at RE2_bit;

sbit LCD_RS_Direction at TRISA3_bit;
sbit LCD_RW_Direction at TRISA2_bit;
sbit LCD_EN_Direction at TRISB4_bit;
sbit LCD_D4_Direction at TRISD4_bit;
sbit LCD_D5_Direction at TRISD5_bit;
sbit LCD_D6_Direction at TRISE1_bit;
sbit LCD_D7_Direction at TRISE2_bit;
 
#define L1 PORTC.B3
#define L2 PORTD.B6
#define L3 PORTD.B7
 
  void main()
  {
   OSCCON = 0b01110000;

   ANCON0=0x00;
   ANCON1=0x00;
   ADCON1=0x7F;
   ADCON0.ADON = 0;
   TRISA=0X00;
   TRISB=0X00;
   TRISC=0X00;
   TRISD=0X00;
   TRISE=0X00;

   LCD_Init();                        // Initialize LCD
   Lcd_Cmd(_LCD_CLEAR);               // Clear display
   Lcd_Cmd(_LCD_CURSOR_OFF);
   
   while(1){
            LCD_Out(1,2,"Hello");
            L1 = 1;
            delay_ms(1000);
            L1 = 0;
            L2 = 1;
            delay_ms(1000);
            L2 = 0;
            L3 = 1;
            delay_ms(1000);
            L3 = 0;

            }
   }
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…