LCD does not show up the characters

Discussion about projects that used PIC Microcontroller, Hardware Interface, Programming Algorithm and etc......

LCD does not show up the characters

Postby mohdismiaswaly » Sat Sep 28, 2013 11:58 pm

Hello,

I am planning to display a string of characters using 16x2 LCD module.
Please see the photo below. I put the compiled code (hex file) into Proteus simulation. It does running normal.

But when I put the code inside my PIC18F4550 connected to all 16 pins of the LCD (TGK model bought from Cytron), there was just a block of black display appeared. I have check all the solder points, there are no short circuit between all 16 pins.

Simulation OK, but real hardware NOT OK.

How????
Attachments
IMG_00000152.jpg
real hardware result
mohdismiaswaly
Apprentice
 
Posts: 39
Joined: Mon Nov 05, 2012 2:51 pm

Re: LCD does not show up the characters

Postby mohdismiaswaly » Sat Sep 28, 2013 11:59 pm

Here is what I got from simulation in Proteus...
Attachments
Untitled.png
mohdismiaswaly
Apprentice
 
Posts: 39
Joined: Mon Nov 05, 2012 2:51 pm

Re: LCD does not show up the characters

Postby mohdismiaswaly » Sun Sep 29, 2013 12:12 am

This is my code,
CODE: SELECT_ALL_CODE
#include<htc.h>

#define   RS         RB4
#define   E            RB5
#define     lcd         PORTD
         
void init_lcd(void);
void MSDelay(unsigned int itime);
void lcdcmd(unsigned char value);
void lcddata(unsigned char data);

void e_pulse(void);
void delay(unsigned short i);
void send_char(unsigned char data);
void send_char_end(unsigned char data);
void send_config(unsigned char data);
void lcd_goto(unsigned char data);
void lcd_clr(void);


void main(void)
{

   while(1)               
   {
      TRISB=0;
      TRISD=0;

      send_config(0b00000001);      //clear display at lcd
      send_config(0b00000010);      //Lcd Return to home
      send_config(0b00000110);      //entry mode-cursor increase 1
      send_config(0b00001100);      //diplay on, cursor off and cursor blink off
      send_config(0b00111000);      //function set
      
      lcd_goto(0);               //cursor start from beginning

      send_char('T');
      send_char('O');
      send_char('T');
      send_char('A');
      send_char('L');
      send_char(' ');
      send_char('P');
      send_char('A');
      send_char('R');
      send_char('K');
      send_char('I');
      send_char('N');
      send_char('G');
      send_char('=');
      send_char('6');
      
      lcd_goto(20);               //cursor go to 2nd line of the LCD
   
      send_char('E');
      send_char('M');
      send_char('P');
      send_char('T');
      send_char('Y');
      send_char('=');
      send_char('?');
      send_char(' ');
      send_char('H');
      send_char('O');
      send_char('V');
      send_char('E');
      send_char('R');
      send_char('=');
      send_char_end('?');      
      }
}

//==================subroutine LCD setting ==========================

void send_config(unsigned char data)
{
    RS=0;
   lcd=data;
   delay(500);
   e_pulse();
}

void e_pulse(void)
{
   E=1;
   delay(500);
   E=0;
   delay(500);
}

void send_char(unsigned char data)
{
    RS=1;
   lcd=data;
   delay(4000);
   e_pulse();
}

void send_char_end(unsigned char data)
{
    RS=1;
   lcd=data;
   delay(10000);
   e_pulse();
}


void lcd_goto(unsigned char data)
{
    if(data<16)
    {
        send_config(0x80+data);
   }
        else
        {
    data=data-20;
   send_config(0xc0+data);
        }
}


void lcd_clr(void)
{
    RS=0;
      send_config(0x01);
    delay(600);   
}


//==================subroutine DELAY==========================
void delay(unsigned short i)
{   
    for(;i>0;i--);
}
mohdismiaswaly
Apprentice
 
Posts: 39
Joined: Mon Nov 05, 2012 2:51 pm

Re: LCD does not show up the characters

Postby robosang » Sun Sep 29, 2013 9:55 pm

I think the contrast is not adjusted correct, looking at 2 rows of black box on LCD.
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: LCD does not show up the characters

Postby mohdismiaswaly » Thu Oct 03, 2013 12:18 am

You mean the connection of pin 15 and 16 on the lcd?

So I need to connect variable resistor in series to that pin?
mohdismiaswaly
Apprentice
 
Posts: 39
Joined: Mon Nov 05, 2012 2:51 pm

Re: LCD does not show up the characters

Postby yonghui » Fri Oct 04, 2013 10:46 am

contrast is the vee pin. adjust the votalge value by changing resistor value.
thanks&regards,
yh
yonghui
Moderator
 
Posts: 732
Joined: Mon Sep 28, 2009 3:27 pm


Return to PIC Microcontroller

Who is online

Users browsing this forum: No registered users and 25 guests