View previous topic :: View next topic |
Author |
Message |
rubenskc
Joined: 28 Sep 2011 Posts: 12
|
Using flex lcd driver, having blck squares on LCD's 2nd line |
Posted: Fri Feb 24, 2012 8:32 am |
|
|
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: 9216 Location: Greensville,Ontario
|
|
Posted: Fri Feb 24, 2012 10:44 am |
|
|
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
|
Hm... |
Posted: Fri Feb 24, 2012 10:57 am |
|
|
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
|
|
Posted: Fri Feb 24, 2012 1:22 pm |
|
|
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
|
Lol |
Posted: Sat Feb 25, 2012 5:28 am |
|
|
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
|
Working... |
Posted: Mon Feb 27, 2012 10:31 am |
|
|
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 |
|
|
|