View previous topic :: View next topic |
Author |
Message |
metaldragon
Joined: 08 Mar 2012 Posts: 4
|
LCD 16x2 not displaying any image |
Posted: Wed Apr 04, 2012 12:59 am |
|
|
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. |
|
|
stoyanoff
Joined: 20 Jul 2011 Posts: 375
|
|
Posted: Wed Apr 04, 2012 1:09 am |
|
|
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
|
|
Posted: Wed Apr 04, 2012 1:35 am |
|
|
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: 19510
|
|
Posted: Wed Apr 04, 2012 1:56 am |
|
|
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
|
|
Posted: Wed Apr 04, 2012 2:19 am |
|
|
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: 19510
|
|
Posted: Wed Apr 04, 2012 3:00 am |
|
|
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
|
|
Posted: Wed Apr 04, 2012 3:16 am |
|
|
Put pull-down resistors to data and control pins! And connect all data pins to the controller! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19510
|
|
Posted: Wed Apr 04, 2012 6:54 am |
|
|
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
|
|
Posted: Wed Apr 04, 2012 11:18 pm |
|
|
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.
|
|
|
Exfast
Joined: 24 May 2012 Posts: 1
|
Re: LCD 16x2 not displaying any image |
Posted: Thu May 24, 2012 11:28 am |
|
|
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. |
Need help, can you give me the code of <lcd.c>? |
|
|
jeremiah
Joined: 20 Jul 2010 Posts: 1348
|
|
Posted: Thu May 24, 2012 11:46 am |
|
|
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. |
|
|
|