Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Interfacing JHD162A LCD Module to micrcontroller

Status
Not open for further replies.

sathish316

Junior Member level 2
Junior Member level 2
Joined
May 5, 2004
Messages
21
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
188
jhd162a

Im trying to interface a JHD162A LCD module to my at89c52 micrcontroller. As far as i find in micrcontroller textbooks LCD modules based on HD44780 are supposed to have 14 pins. but this ones got 16 pins. can anyone pls provide me the pin diagram or datasheet of this LCD. google returned a chinese site and the datasheet was not accessible.
tnx in advance
sathish

Added after 4 minutes:

I forgot to add that The LCD is a standard 16x2 LCD based on Hitachi HD44780 micrcontroller. It`s got 16 pins for interfacing. what are the other 2 pins for while any book on microcontroller suggests 14 pins for standard LCD modules.
 

lcd jhd162a

The last two pins are labelled LED+ and LED-.
That suggests to me they are for backlighting.
 

lcd jhd 162a

hi...
This JHD162A dosent have Hitachi controller but it has KS0070B controller from samsung. it has 16 pins
These are the pis

1 ---> GND
2 ---> VCC
3 ---> Vs (for contrast adjustment)
4 ---> RS
5 ---> RW
6 ---> EN
7 ---> D1
8 ---> D2
9 ---> D3
10 ---> D4
11 ---> D5
12 ---> D6
13 ---> D7
14 ---> D8
15 ---> VCC (Back light)
16 ---> GND (Backlight)

Regards

Sadashiv
 
  • Like
Reactions: trnx geek

    trnx geek

    Points: 2
    Helpful Answer Positive Rating
    V

    Points: 2
    Helpful Answer Positive Rating
jhd162a lcd datasheet

I have this datasheet that i've downloaded from, www.datasheetarchive.com/, at the end of this archive has an example of code with coments in chinese. I hope you find it usefull!
 

jhd 162a lcd

an example of code with coments in Chinese

I translate code comment to English :
Code:
#include <reg51.h>
#include <intrins.h>
sbit dc=0xa0;     /*P2.0 LCD  RS  pin #21*/
sbit rw=0xa1;     /*P2.1 LCD  R/W pin #22*/
sbit cs=0xa4;     /*P2.4 LCD  E   pin #25*/
sfr  lcdbus=0x80; /*p0 LCD data bus D0=P0.0*/
unsigned int sys10mscounter;
unsigned char syslimitcounter;

// Self define font
char path1[8]={0x00,0x1f,0x00,0x1f,0x00,0x1f,0x00,0x1f}; // Horizontal 1
char path2[8]={0x1f,0x00,0x1f,0x00,0x1f,0x00,0x1f,0x00}; // Horizontal 2
char pats1[8]={0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15}; // Vertical 1
char pats2[8]={0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a}; // Vertical 2

void soft_nop(){}

void soft_10ms() // 12MHZ 10MS software delay
{    register int i;
     for(i=0;i<711;i++);
}

void soft_20ms() // 12MHZ 20MS software delay
{    soft_10ms();
     soft_10ms();
}

void hard_10ms(unsigned int delaytime) // delaytime*10MS hardware delay
{    sys10mscounter=delaytime;
     while(sys10mscounter);
}

unsigned char data lcdcounter;
bit lcdusing1,lcdusing2;

bit lcd_checkbusy()  // is LCD busy?
{register lcdstate;
    dc=0; // dc=1 -> data, =0 -> command
    rw=1; // rw=1 -> read, =0 -> write
    cs=1; // cs=1 -> selected
    soft_nop();
    lcdstate=lcdbus;
    cs=0;
    return((bit)(lcdstate&0x80));
}

void lcd_wrcmd(unsigned char lcdcmd) // write a character to LCD
{    lcdusing1=1;
     while(lcd_checkbusy());
     lcdbus=lcdcmd;
     dc=0; // dc=1 -> data, =0 -> command
     rw=0; // rw=1 -> read, =0 -> write
     cs=1; // cs=1 -> selected
     soft_nop();
     cs=0;
     lcdbus=0xff;
     lcdusing1=0;
}

void lcd_moveto(char position) // move cursor to position 0-79
{register cmd=0x80;
     lcdcounter=position;
     if (position > 59)
         position += 0x18;
     else
     {   if (position > 39) position -= 0x14;
         else
         {  if (position > 19) position += 0x2c;
         }
     }
     cmd = cmd | position;
     lcd_wrcmd(cmd);
}

void lcd_wrdata(char lcddata) // at surrent cursor write a character
{char i;
     lcdusing2=1;
     while(lcd_checkbusy());
     if (lcdcounter==20){
        lcd_moveto(20);
        while(lcd_checkbusy());
        }
     if (lcdcounter==40){
        lcd_moveto(40);
        while(lcd_checkbusy());
        }
     if (lcdcounter==60){
        lcd_moveto(60);
        while(lcd_checkbusy());
        }
     if (lcdcounter==80){
        lcd_moveto(0);
        while(lcd_checkbusy());
        lcdcounter=0;
        }
     lcdcounter++;
     lcdbus=lcddata;
     dc=1; // dc=1 -> data, =0 -> command
     rw=0; // rw=1 -> read, =0 -> write
     cs=1; // cs=1 -> selected
     soft_nop();
     cs=0;
     lcdbus=0xff;
     lcdusing2=0;
}

void lcd_string(char *strpoint) // at current cursor write a string
{register i=0;
      while(strpoint[i]!=0){
           lcd_wrdata(strpoint[i]);
           i++;}
}

void lcd_init()  //initialize LCD
{
     lcd_wrcmd(0x38); //8 bit data bus
     lcd_wrcmd(0x0c); //block cursor,non blink
     lcd_wrcmd(0x06); //don't move after display
     lcd_wrcmd(0x01); //Clear display
     lcdcounter=0;
}

void lcd_cls()  // clear LCD
{
     lcd_wrcmd(0x01);
     lcdcounter=0;
}

void timer0(void) interrupt 1 // T0 interrupt service routine
{
     TH0=0xd8; /*12M,10ms*/
     TL0=0xf6;
     TR0=1;
     if(sys10mscounter !=0)sys10mscounter--;  // 10ms timer
     if(syslimitcounter!=0)syslimitcounter--; // 10ms timer
}

main()
{unsigned char j;

     IE=0;P0=0xff;P1=0xff;P2=0xff;P3=0xff; // Initialize
     lcd_init(); soft_20ms();
     TMOD=0x51;
     TH0=0xd8; /*12M,10ms*/
     TL0=0xf6;
     TR0=1;ET0=1;EA=1;
     while(1)
     {
     // Display :
     // All black; horizontal 1; horizontal 2; vertical 1; vertical 2
     // UUUUUU...., QQQQQQQ.... ABCD...
     lcd_init(); // all black
     for(j=0;j<80;j++){lcd_wrdata(0xff);}
     hard_10ms(50);

     lcd_init(); // Horizontal 1 -> check font definition
     lcd_wrcmd(0x40);
     for(j=0;j<8;j++)lcd_wrdata(path1[j]);
     for(j=0;j<100;j++)lcd_wrdata(0);
     hard_10ms(50);

     lcd_init(); // Horizontal 2
     lcd_wrcmd(0x40);
     for(j=0;j<8;j++)lcd_wrdata(path2[j]);
     for(j=0;j<100;j++)lcd_wrdata(0);
     hard_10ms(50);

     lcd_init(); // Vertical 1
     lcd_wrcmd(0x40);
     for(j=0;j<8;j++)lcd_wrdata(pats1[j]);
     for(j=0;j<100;j++)lcd_wrdata(0);
     hard_10ms(50);

     lcd_init(); // Vertical 2
     lcd_wrcmd(0x40);
     for(j=0;j<8;j++)lcd_wrdata(pats2[j]);
     for(j=0;j<100;j++)lcd_wrdata(0);
     hard_10ms(50);

     lcd_init();
     lcd_string("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU");
     hard_10ms(50);

     lcd_init();
     lcd_string("QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ");
     hard_10ms(50);

     lcd_init();
     lcd_string("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz0123456789+-!#$%&?");
     hard_10ms(50);
     }
}
 

hi..

am extremely t hankful to "budhy"
the translated code helped me a lot............

i was working on it for 3 days.......it finally worked..the lcd sprung to lyf....

thanx a lot!!!


jakshay
 

Hi All,

Refering to this code,

lcd_wrcmd(0x38); //8 bit data bus
lcd_wrcmd(0x0c); //block cursor,non blink
lcd_wrcmd(0x06); //don't move after display
lcd_wrcmd(0x01); //Clear display

May i know what is this hex number stand for and why we have to write like this. Is there any reference that i can refer to? I'm still new with this field and need ur expertise to explain it :) thanks :-

(0x38); //8 bit data bus
(0x0c); //block cursor,non blink
(0x06); //don't move after display
(0x01); //Clear display
 

how to interface 89c51 to lcd jhd162a programme my name and circuit
 

I am having same problems with JCM162D.
Googling shows only Chinese forums.
Please help
 

someone of u please help me .........how to interface lcd(jhd 162a) with micro controller p89v51rd2bn
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top