CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

LCD 16x2 not displaying any image

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
metaldragon



Joined: 08 Mar 2012
Posts: 4

View user's profile Send private message

LCD 16x2 not displaying any image
PostPosted: Wed Apr 04, 2012 12:59 am     Reply with quote

Code:
#include <18F4550.h>
#fuses HS, NOWDT, NOPROTECT, NOLVP
#use delay(clock=20000000)
#include <lcd.c>

#define LCD_E PIN_D0 // PIN E
#define LCD_RS PIN_D1 // PIN RS
#define LCD_RW PIN_D2 // PIN RW
#define LCD_D4 PIN_D4 // PIN D4
#define LCD_D5 PIN_D5 // PIN D5
#define LCD_D6 PIN_D6 // PIN D6
#define LCD_D7 PIN_D7 // PIN D7

void main()
{


lcd_init() ;

while(true)
{
lcd_putc("\fSet Upper Limit");
output_bit(PIN_B6,1);
output_bit(PIN_B7,1);
output_bit(PIN_B5,1);
delay_ms(1000);
output_bit(PIN_B6,0);
output_bit(PIN_B7,0);
output_bit(PIN_B5,0);
delay_ms(1000);
}
}


This is a simple coding to do some testing. The portB is used as led and buzzer. And portD is used for LCD. I am sure i have a correct connections. It runs smoothly on proteus simulation. But after i programmed into my hardware, the only thing i got is the blinking LED and buzzer sound. The LCD only have backlight but without any image on it. I have troubleshooted it for the 2 days straight. Please help. Sad
stoyanoff



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

PostPosted: Wed Apr 04, 2012 1:09 am     Reply with quote

Can you post your display type???
When you turn on the power you must see one entire row in dark(every pixel on) and the second row off.
If the function lcd_init() ; works fine the first row must turn off.
But this function works only on displays with phillips core. If you display is some chineese rubish you must write your own inicialisation function.
It`s a good idea to check the light adjustment(the trimer resistor).
Greatings!
metaldragon



Joined: 08 Mar 2012
Posts: 4

View user's profile Send private message

PostPosted: Wed Apr 04, 2012 1:35 am     Reply with quote




Thanks for the fast reply. I not sure what you mean on the display type. I posted the lcd back and the connections. The display goes on blank forever upon powered up. I have 2 new same lcds showing same results too.


Last edited by metaldragon on Wed Apr 04, 2012 2:18 am; edited 2 times in total
Ttelmah



Joined: 11 Mar 2010
Posts: 19538

View user's profile Send private message

PostPosted: Wed Apr 04, 2012 1:56 am     Reply with quote

The model number of the LCD.
There are probably something like 1000 different '16x2' text LCD's on the market. 90% of them emulate the original Hitachi controller (not Phillips...), but a few don't. Also the pin connections vary as well. So, post the actual model number of the unit involved.
It looks like it is probably a QY-1602A. If so, this uses the same pinout as the Sparkfun units here:
<www.sparkfun.com/datasheets/LCD/GDM1602K.pdf>

On your circuit you are not showing any connection to the other end of the pot feeding Vo. Depending on the LCD itself, this needs to go _somewhere_. Typically to a small +ve voltage, but on some older LCD's, this may need a -ve voltage.

Best Wishes
metaldragon



Joined: 08 Mar 2012
Posts: 4

View user's profile Send private message

PostPosted: Wed Apr 04, 2012 2:19 am     Reply with quote

Sorry, i posted the wrong schematic diagram just now. I have edited the previous post to the actual schematic diagram. Thanks for your reply.

Is this LCD model requires a new program initialization?
Ttelmah



Joined: 11 Mar 2010
Posts: 19538

View user's profile Send private message

PostPosted: Wed Apr 04, 2012 3:00 am     Reply with quote

A lot of the older LCD's, will not display anything, if Vo is connected to ground. They _require_ a small -ve voltage (typically -0.4v), before anything appears on the display. More modern designs generally now accept 0v, but again some of these require a small +ve voltage. You need to find out from your supplier, what voltage needs to be on the Vo pin for your particular display. The wrong voltage here, would result in a blank screen - exactly what you have.....

Best Wishes
stoyanoff



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

PostPosted: Wed Apr 04, 2012 3:16 am     Reply with quote

Put pull-down resistors to data and control pins! And connect all data pins to the controller!
Ttelmah



Joined: 11 Mar 2010
Posts: 19538

View user's profile Send private message

PostPosted: Wed Apr 04, 2012 6:54 am     Reply with quote

stoyanoff wrote:
Put pull-down resistors to data and control pins! And connect all data pins to the controller!


Not needed.
The low four data pins are not used. Quote from data sheet for one such unit:
"DB0...DB3 - Four low order bidirectional three-state data bus lines. Used for
data transfer between the MPU and the LCD module. These four lines
are not used during 4-bit operation, and may be left unconnected.".

They internally pull themselves to a safe voltage when not used.

Seriously, the display should show a single solid black line, if you just connect Vss, Vdd, and Vo.

That it doesn't, says that Vo is not set to a legitimate voltage. This depends on the actual chemistry of the liquid crystal itself. I use a dozen different LCD's, all of which have the same part number, except for the last couple of characters - these define the LCD itself, and depending on which one is chosen, need a Vo voltage between -2.3v (on one 3.3v model), through to +1.3v on a couple of units. Most of the standard units (now) do display with Vo=0v, but by no means all....
This is why it is always vital to get the data sheet for the actual display you are using.

Best Wishes
metaldragon



Joined: 08 Mar 2012
Posts: 4

View user's profile Send private message

PostPosted: Wed Apr 04, 2012 11:18 pm     Reply with quote

Guys thanks for your replies and suggestions. I have troubleshooted it the whole day yesterday. And i found the problem actually lies on the microcontroller's port. The ports are actually broken and it doesn't send any signal. I already got a new microcontroller and it works perfectly fine.
Smile
Exfast



Joined: 24 May 2012
Posts: 1

View user's profile Send private message

Re: LCD 16x2 not displaying any image
PostPosted: Thu May 24, 2012 11:28 am     Reply with quote

metaldragon wrote:
Code:
#include <18F4550.h>
#fuses HS, NOWDT, NOPROTECT, NOLVP
#use delay(clock=20000000)
#include <lcd.c>

#define LCD_E PIN_D0 // PIN E
#define LCD_RS PIN_D1 // PIN RS
#define LCD_RW PIN_D2 // PIN RW
#define LCD_D4 PIN_D4 // PIN D4
#define LCD_D5 PIN_D5 // PIN D5
#define LCD_D6 PIN_D6 // PIN D6
#define LCD_D7 PIN_D7 // PIN D7

void main()
{


lcd_init() ;

while(true)
{
lcd_putc("\fSet Upper Limit");
output_bit(PIN_B6,1);
output_bit(PIN_B7,1);
output_bit(PIN_B5,1);
delay_ms(1000);
output_bit(PIN_B6,0);
output_bit(PIN_B7,0);
output_bit(PIN_B5,0);
delay_ms(1000);
}
}


This is a simple coding to do some testing. The portB is used as led and buzzer. And portD is used for LCD. I am sure i have a correct connections. It runs smoothly on proteus simulation. But after i programmed into my hardware, the only thing i got is the blinking LED and buzzer sound. The LCD only have backlight but without any image on it. I have troubleshooted it for the 2 days straight. Please help. Sad



Need help, can you give me the code of <lcd.c>?
jeremiah



Joined: 20 Jul 2010
Posts: 1354

View user's profile Send private message

PostPosted: Thu May 24, 2012 11:46 am     Reply with quote

It's inappropriate to ask for CCS proprietary code on the CCS forums. If you have the compiler installed on your computer, then you have the lcd.c file in your PICC directory under a subfolder.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group