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

16x2 lcd behaving as 8x2

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



Joined: 23 Jul 2018
Posts: 20

View user's profile Send private message

16x2 lcd behaving as 8x2
PostPosted: Tue Aug 28, 2018 1:45 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Aug 28, 2018 2:13 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Aug 28, 2018 2:16 am     Reply with quote

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

View user's profile Send private message

Re: 16x2 lcd behaving as 8x2
PostPosted: Tue Aug 28, 2018 2:20 am     Reply with quote

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

View user's profile Send private message

Re: 16x2 lcd behaving as 8x2
PostPosted: Tue Aug 28, 2018 2:22 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Aug 28, 2018 2:33 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Aug 28, 2018 2:36 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Aug 28, 2018 2:50 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Aug 28, 2018 2:52 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Aug 28, 2018 3:23 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Aug 28, 2018 4:04 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Aug 28, 2018 4:14 am     Reply with quote

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: 9246
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Aug 28, 2018 5:31 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Aug 28, 2018 10:33 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Aug 29, 2018 12:20 am     Reply with quote

Yes.
I think we were all glad to hear it was a hardware issue, and that you had it fixed. Smile

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.... Very Happy
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