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

Using flex lcd driver, having blck squares on LCD's 2nd line

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



Joined: 28 Sep 2011
Posts: 12

View user's profile Send private message

Using flex lcd driver, having blck squares on LCD's 2nd line
PostPosted: Fri Feb 24, 2012 8:32 am     Reply with quote

I have an issue in my project. Using a 16F877A, running at 4MHz, and a JHD162A LCD (16x2). I use the flex lcd driver, and everything works fine on Proteus. My project reads a ADC, and adjusts the position of a servo via PWM, showing some information on the LCD. Before the installation of the LCD, circuits were working fine.

Now: on Proteus, everything goes well with LCD. On real circuit, the program seems to freeze during the initialisation line of the LCD, and the LCD shows no cursor. It has the backlight on, and it's displaying dark squares only on the second line. The PIC seems to freeze then.

I use the following pins on my PIC to control the LCD:

RB0, RB1, RB2

and RD4, RD5, RD6, RD7

The flex lcd file was only edited on these settings, nothing further.

Checked the 9.6k pot controlling the contrast already - no luck. Pin 3 of the LCD is getting 0.45V

Any PSP, comparators configuration? I see many people with problems like mine, but none with the squares on second line. I decided to open this as a new topic due to this reason. Do I have a faulty display?

Ideas? Proteus problems?

Rubens
_________________
Rubs
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Feb 24, 2012 10:44 am     Reply with quote

You should show us your program! Heck, programs in Proteus 'run fine' without power attached to pins, NO crystal in circuit,etc. so WHY would you 'trust' Proteus ?

As for the real hardware not running right, lets' see the code as well as your compiler version.

Also have you done a '1 Hz blinking LED' program to confirm the PIC does work correctly?
rubenskc



Joined: 28 Sep 2011
Posts: 12

View user's profile Send private message

Hm...
PostPosted: Fri Feb 24, 2012 10:57 am     Reply with quote

Hi there - and thank you for the answer. I'm running CCS 4.093. I'll post my program here later on.

I know the program is actually running on the circuit because the PWM works controlling the duty for the digital servo correctly for a while before freezing.
_________________
Rubs
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Feb 24, 2012 1:22 pm     Reply with quote

What if the LCD is actually displaying black squares on the top line,
except that you have the LCD upside down, so it looks like it's the 2nd line ?

Look at the first photo on this website:
http://iamsuhasm.wordpress.com/tutsproj/using-lcds/
Notice how the part number "JHD 162A" is "right reading" with the
connector facing towards you. So you probably think that's the correct
orientation for the LCD.

But scroll about half-way down the page, to the photo labeled
"The LCD showing my name". It shows "SUHAS". Notice how the
connector is at the top. That's the correct way to orient the LCD.

Given this information, do you still see black squares on the 2nd line ?
If they are now on the first line, then read the links in this post for
information about how to solve the black squares problem:
http://www.ccsinfo.com/forum/viewtopic.php?t=32244&start=6
rubenskc



Joined: 28 Sep 2011
Posts: 12

View user's profile Send private message

Lol
PostPosted: Sat Feb 25, 2012 5:28 am     Reply with quote

Mate... you nailed it!!! That's it! It's exactly the model of my LCD - so... indeed I had it upside down. Also - while debugging here, I found that the line that initialise the LCD is causing the freezing.....

Thank you! Some work ahead here now!!!!!
_________________
Rubs
rubenskc



Joined: 28 Sep 2011
Posts: 12

View user's profile Send private message

Working...
PostPosted: Mon Feb 27, 2012 10:31 am     Reply with quote

So, working now! I had to add a delay of 40ms before and 14ms after the initialisation of the LCD... working as perfect as possible!
_________________
Rubs
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