LCD Interfacing with PIC18F2550

General discussion on mikroC.
Post Reply
Author
Message
07arunsharma
Posts: 46
Joined: 16 Apr 2011 14:37

LCD Interfacing with PIC18F2550

#1 Post by 07arunsharma » 16 Apr 2011 18:05

Hello!! Guys i am new to Embedded System Programming..

I am using a PIC18F2550 uC to interface with JHD162A LCD..
My Connections are as Follow:-
LCD uC
1 GND
2 VCC(5V)
3 VCC
4 RB4
5 GND
6 RB5
7 GND
8 GND
9 GND
10 GND
11 RB0
12 RB1
13 RB2
14 RB3
15 VCC(5V)
16 GND

OSCILLATOR Frequency = 4MHz
My Program is as Follow:-

Code: Select all

// LCD module connections
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_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

char txt1[] = "GOD is Great";
char txt2[] = "-By Arun";

void main() {
   ADCON0  = 0x00;                        // Configure AN pins as digital I/O
   ADCON1 |= 0x0F;                    // Configure AN pins as digital
   CMCON  |= 7;                       // Disable comparators
   Lcd_Init();                        // Initialize LCD

  Lcd_Cmd(_LCD_CLEAR);               // Clear display
  Lcd_Cmd(_LCD_CURSOR_OFF);          // Cursor off
  Lcd_Out(1,2,txt1);                 // Write text in first row
  Delay_ms(2000);
  Lcd_Out(2,4,txt2);                 // Write text in second row
  Lcd_Cmd(_LCD_CLEAR);               // Clear display

}
I am using an ICSP with WinPIC to Burn My HEX CODE..
But I am not getting any Output on LCD..
Can any help me..?

User avatar
tihomir.losic
mikroElektronika team
Posts: 2138
Joined: 02 Dec 2009 14:16
Location: Serbia
Contact:

Re: LCD Interfacing with PIC18F2550

#2 Post by tihomir.losic » 19 Apr 2011 13:17

Hello,

I tested your code on our hardware and programmed chip with mikroProg Suite.
There was no any error on LCD screen, and I can confirm that our compiler didn't cause error.

Best regards,

Losic Tihomir
mikroElektronika [Support team]

07arunsharma
Posts: 46
Joined: 16 Apr 2011 14:37

Re: LCD Interfacing with PIC18F2550

#3 Post by 07arunsharma » 29 May 2011 11:39

But sir,
This code is not working for me.
From your point my code is right.
So, there might be a problem with the hardware.

Sir, Pin-3 of LCD is Contrast Control Power Supply it must be in between 0-5V.
I had connected it with 5V Supply, is it correct or i have to change my reduce the power.

Can you tell me the way how to check the LCD whether it is working or not.

User avatar
tihomir.losic
mikroElektronika team
Posts: 2138
Joined: 02 Dec 2009 14:16
Location: Serbia
Contact:

Re: LCD Interfacing with PIC18F2550

#4 Post by tihomir.losic » 30 May 2011 10:47

Hello,

please, tell me which controller your LCD contains?

Best regards,

Losic Tihomir
mikroElektronika [Support team]

sasa72
Posts: 89
Joined: 21 Apr 2011 05:21

Re: LCD Interfacing with PIC18F2550

#5 Post by sasa72 » 30 May 2011 15:53

Arun,

There is many mislead informations about this LCD that it use HD44780. According to datasheet, it use Samsung controller KS0066 or equivalent. Can you double check pin correctness?

http://www.datasheetarchive.com/pdf-dat ... 175585.htm

This also may be helpful:
http://www.mikroe.com/forum/viewtopic.php?t=4938

This also may help to test LCD:
http://www.edaboard.com/thread31781.html

07arunsharma
Posts: 46
Joined: 16 Apr 2011 14:37

Re: LCD Interfacing with PIC18F2550

#6 Post by 07arunsharma » 31 May 2011 17:13

Thanks alot to all of you...
Actually there was a connection mistake..
Sorry to disturb you all.... :mrgreen:

Post Reply

Return to “mikroC General”