View previous topic :: View next topic |
Author |
Message |
bliztkrieg
Joined: 23 Jul 2018 Posts: 20
|
16x2 lcd behaving as 8x2 |
Posted: Tue Aug 28, 2018 1:45 am |
|
|
Hey guys I'm trying to interface a 16x2 lcd which is working fine on proteus but on hardware only the first 8 columns are working anything after that is just completely blank. What could be the problem ??
Schematic:
https://imgur.com/fozU4Yv
Code:
Code: |
#include <18f252.h>
#use delay (clock=20M)
#fuses NOLVP, NOPROTECT, NOWDT, HS, NOBROWNOUT
#include "LCD_Driver.c"
void main()
{
lcd_init(); delay_ms(1000);
while(1)
{
lcd_gotoxy(0,1);
printf(lcd_putc, "Date: 28/08/18");
}
} |
|
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Tue Aug 28, 2018 2:13 am |
|
|
See the sticky about Proteus/ISIS.
LCDs don't wake up as soon as the power is applied.
Try putting a delay_ms(1000) before the lcd_init(), rather than after.
Mike |
|
|
bliztkrieg
Joined: 23 Jul 2018 Posts: 20
|
|
Posted: Tue Aug 28, 2018 2:16 am |
|
|
Mike Walne wrote: | See the sticky about Proteus/ISIS.
LCDs don't wake up as soon as the power is applied.
Try putting a delay_ms(1000) before the lcd_init(), rather than after.
Mike |
still didnt fix the issue only half side is working the other half is completely blank. I mean the output is like this Date: 28 when it should be Date: 28/08/18 |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
Re: 16x2 lcd behaving as 8x2 |
Posted: Tue Aug 28, 2018 2:20 am |
|
|
bliztkrieg wrote: |
void main()
{
lcd_init();
delay_ms(1000);
while(1)
{
lcd_gotoxy(0,1);
printf(lcd_putc, "Date: 28/08/18");
}
} |
1. The delay should be at the start of main(). Then do the lcd init.
The delay gives the lcd time to start up, before you give it any commands.
2. You are giving lcd_gotoxy() an incorrect parameter of 0.
The lcd.c file says:
Quote: | //// lcd_gotoxy(x,y) Set write position on LCD (upper left is 1,1) |
|
|
|
bliztkrieg
Joined: 23 Jul 2018 Posts: 20
|
Re: 16x2 lcd behaving as 8x2 |
Posted: Tue Aug 28, 2018 2:22 am |
|
|
PCM programmer wrote: | bliztkrieg wrote: |
void main()
{
lcd_init();
delay_ms(1000);
while(1)
{
lcd_gotoxy(0,1);
printf(lcd_putc, "Date: 28/08/18");
}
} |
1. The delay should be at the start of main(). Then do the lcd init.
The delay gives the lcd time to start up, before you give it any commands.
2. You are giving lcd_gotoxy() an incorrect parameter of 0.
The lcd.c file says:
Quote: | //// lcd_gotoxy(x,y) Set write position on LCD (upper left is 1,1) |
|
but that still doesnt explain why only the half side is working and other half is not. im confused |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Tue Aug 28, 2018 2:33 am |
|
|
Is your LCD_Driver.c the same as the CCS supplied lcd.c file?
Have you tried PCM's flex driver?
Mike |
|
|
bliztkrieg
Joined: 23 Jul 2018 Posts: 20
|
|
Posted: Tue Aug 28, 2018 2:36 am |
|
|
Mike Walne wrote: | Is your LCD_Driver.c the same as the CCS supplied lcd.c file?
Have you tried PCM's flex driver?
Mike |
i downloaded the driver from this very forum, the only difference is that you define all the pins in the header file instead in your program. I havent tried the ccs lcd file i'll give it a go this has never happened before so im really confused if it is a hardware issue or softawre |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Aug 28, 2018 2:50 am |
|
|
Post a link to the driver that you downloaded from the forum.
Post the part number of your LCD. If you don't know it, then post a link
to the website where you bought it from. |
|
|
bliztkrieg
Joined: 23 Jul 2018 Posts: 20
|
|
Posted: Tue Aug 28, 2018 2:52 am |
|
|
PCM programmer wrote: | Post a link to the driver that you downloaded from the forum.
Post the part number of your LCD. If you don't know it, then post a link
to the website where you bought it from. |
i just looked it up yes it is your flex lcd driver. i may have renamed it a while back i guess. |
|
|
bliztkrieg
Joined: 23 Jul 2018 Posts: 20
|
|
Posted: Tue Aug 28, 2018 3:23 am |
|
|
PCM programmer wrote: | Post a link to the driver that you downloaded from the forum.
Post the part number of your LCD. If you don't know it, then post a link
to the website where you bought it from. |
i bought from a local store didnt order it online |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19553
|
|
Posted: Tue Aug 28, 2018 4:04 am |
|
|
There are three basic reasons for this:
1) Using a driver with the wrong init sequence. PCM_Programmer's flex LCD is 'known good' for just about every text LCD.
Check the version you have _is_ the 16x2 release. Particularly that the init sequence is the one in the driver in the code library.
2) Trying to initialise too quickly after power on.
3) A hardware fault with the LCD. Does happen. |
|
|
bliztkrieg
Joined: 23 Jul 2018 Posts: 20
|
|
Posted: Tue Aug 28, 2018 4:14 am |
|
|
Ttelmah wrote: | There are three basic reasons for this:
1) Using a driver with the wrong init sequence. PCM_Programmer's flex LCD is 'known good' for just about every text LCD.
Check the version you have _is_ the 16x2 release. Particularly that the init sequence is the one in the driver in the code library.
2) Trying to initialise too quickly after power on.
3) A hardware fault with the LCD. Does happen. |
yea the problem was with lcd and i finally found a spare one and it is working perfectly fine. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9247 Location: Greensville,Ontario
|
|
Posted: Tue Aug 28, 2018 5:31 am |
|
|
comment.
I read the post as the 'right half of display not working' ,which to me means a hardware problem on the LCD module not software. Usually these device have several chips, each controlling a portion of the screen.
I'm glad he found a spare, it worked, and now 'up and running'. Just be sure to mark the bad one !!
Jay |
|
|
bliztkrieg
Joined: 23 Jul 2018 Posts: 20
|
|
Posted: Tue Aug 28, 2018 10:33 pm |
|
|
temtronic wrote: | comment.
I read the post as the 'right half of display not working' ,which to me means a hardware problem on the LCD module not software. Usually these device have several chips, each controlling a portion of the screen.
I'm glad he found a spare, it worked, and now 'up and running'. Just be sure to mark the bad one !!
Jay |
it was a new lcd so i thought maybe i did something wrong and since I changed the name of PCM's driver file i thought i may have changed something there too and it is the first time something like this has happened. Yea glad i had a spare but it did cost me some time :( |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19553
|
|
Posted: Wed Aug 29, 2018 12:20 am |
|
|
Yes.
I think we were all glad to hear it was a hardware issue, and that you had it fixed.
Problem is particularly that most of the displays will behave as having only 8 columns, until they are properly initialised, hence the possibility that it could be a software issue as well...
However PCM_Programmer's driver is one of the mainstay "this works well" drivers here, so provided you were using the correct version of this, if the problem remained, 'hardware' becomes the most likely problem.... |
|
|
|