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

16f877a and lcd won't work

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

Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Feb 11, 2007 5:25 pm     Reply with quote

I made a small test program, using the Flex LCD driver, and tested it
with three brands of 8x2 LCDs. It worked with all of them.

Here are the 8x2 LCDs:
1. CrystalFontz CFAH0802A-NYA-JP
2. Hantronix HDM08216H-3-S00S
3. Fema CM0823-SYR1 (Note: obsolete -- replaced by CM0826)

Here's the test program:

#include <16F877.H>
#use delay(clock=4000000)

#include "Flex_LCD.c"
void main()

lcd_putc("Hello  1\n");
lcd_putc("World  2");



I have r/w tied to ground for a 6-wire interface. This did work with picbasic. Does CCS have any dificulty with this?

It's not a CCS issue, it's the Flex LCD driver. It has to be configured
to work with a 6-pin interface. This is done by commenting out the
following line in the Flex_LCD.c file:
// #define USE_RW_PIN   1

If that line is commented out, the Flex driver will be configured to work
with a 6-pin interface. I tested it this way, and it worked.

I suggest that you use the Flex LCD driver from the CCS code library.
Don't edit it, except to change the pin numbers to fit your board, and to
comment out the "#define USE_RW_PIN 1" statement.

PostPosted: Mon Feb 12, 2007 3:57 am     Reply with quote

Hi PCM Programmer

Yes this does work! I just changed the device to the "a" type and the pin settings in the flex lcd driver, and voila!

So I tried to figure out why it doesn't work in the main program. Finally I have a display now, but don't really know why. I commented out the following fuses



#device ICD=TRUE

and changed


These had all been set by the project wizard.

Now I will further debug the code to make sure there's not only some text displayed but the one there should be...

Thanks a lot for this help for the moment, chances are good that I'll come back with further questions.


Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

PostPosted: Fri Mar 30, 2007 9:26 am     Reply with quote

PCM programmer wrote:

2. Do you have the contrast voltage set properly on the LCD ?
It should typically be somewhere in the range of 0 to .5 volts.
You have to set it with two resistors, or with a trimpot connected
between +5 and ground, with the center tap going to the LCD
contrast pin.

What happens to the LCD, when V_contrast = Vcc = +5V?

(I'm struggling with the same symptoms as the original poster.)

EDIT: Solved the problem at the end of the thread.

Powertip PC200-ARS-ASO-A
PostPosted: Wed Jun 20, 2007 8:17 am     Reply with quote

I am having the same trouble as the other posters.

Have anyone got the LCD mentioned in the subject to this post to work ?

I am using the FLEX_LCD driver, 4 bit mode and the display is correctly contrast.

The PIC is 18F2680

Is there any fine detail that I might have missed that anyone can offer ?
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