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 support@ccsinfo.com

Flexible LCD driver
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
 
Post new topic   Reply to topic    CCS Forum Index -> Code Library
View previous topic :: View next topic  
Author Message
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Aug 17, 2007 3:52 pm     Reply with quote

Based on those pin numbers, you are apparently using the new "Rohs
update" version of the PicDem2-Plus board.

That version of the board can be identified by a surface-mount pad
pattern at the bottom of the proto-typing area on the board. The older
version of the board doesn't have that surface-mount area on it.

If you have the new Rohs version of the board you need to use the
test program shown below. Notice how it adds a #define statement
for the LCD power pin, and it adds two new lines at the start of main().
Those lines are essential for the new Rohs version of the PicDem2-Plus.

Here are the pin assignments that you must set at the top of the Flex
driver. Also, for the "Rohs" PicDem2-Plus board, you must comment
out the "#define USE_LCD_RW 1" line, as shown below.
Code:

// These are the pin assignments used for the "Rohs"
// PicDem2-Plus:
#define LCD_DB4   PIN_D0
#define LCD_DB5   PIN_D1
#define LCD_DB6   PIN_D2
#define LCD_DB7   PIN_D3

#define LCD_E     PIN_D6
#define LCD_RS    PIN_D4
#define LCD_RW    PIN_D5

// The following line must be commented out for
// the "Rohs" board.

// #define USE_LCD_RW   1   
     


Test program for "Rohs" version of PicDem2-Plus board:
Code:

#include <18F4520.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)

#define LCD_POWER  PIN_D7

#include "Flex_LCD.c"

//============================
void main()
{
output_high(LCD_POWER);  // Turn on power to LCD
output_low(LCD_RW);      // Set R/W pin on LCD to a low level

lcd_init();              // Initialize the LCD

lcd_putc("\fHello World\n");
lcd_putc("Line Number 2");

while(1);
}
nmeyer



Joined: 09 Jul 2004
Posts: 70

View user's profile Send private message

PostPosted: Tue Aug 21, 2007 11:20 am     Reply with quote

These changes seem to be working well.
Thanks
d



Joined: 04 Sep 2007
Posts: 3

View user's profile Send private message

PostPosted: Thu Sep 06, 2007 8:32 am     Reply with quote

thanks for the code
works perfect, first time!

d.
syahrul.s



Joined: 09 Nov 2007
Posts: 6

View user's profile Send private message

PostPosted: Fri Nov 09, 2007 2:14 am     Reply with quote

can the flex_lcd.c be used with LCD-016M002B by Vishay??
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Nov 09, 2007 11:21 am     Reply with quote

The Vishay LCD has a KS0066 controller, which is compatible with
the HD44780. So it should work OK with the Flex driver.
Praad



Joined: 15 May 2008
Posts: 5

View user's profile Send private message

PostPosted: Thu May 15, 2008 10:42 am     Reply with quote

[ sorry for my bad english I'm .fr ;p ]

Hi,

Great work PCMProgrammer.

I've just tested lcd_flex on my PIC16F876 with a 2x16 LCD : gdm1602a
I changed pins etc. With Proteus ISIS all is ok, however when I test the program on the real pic & lcd it doesn't works. It print black squares (is it the good word ?).

Why ? :s

http://elmicro.com/files/lcd/gdm1602a_datasheet.pdf


thx
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu May 15, 2008 12:25 pm     Reply with quote

The LCD displays black squares when:

1. The LCD is not initialized.
or
2. The contrast voltage is not correct.


So, to fix this:
1. Make sure you call the lcd_init() function at the start of main().
Also make sure the connections to the LCD are correct.
The data pins on the LCD must be DB4-DB7 (do not use DB0-DB3).

2. Set the contrast voltage to 0.5 volts. Use a voltage divider or
a trimpot to get this voltage. The contrast pin is called "Vo" in the
LCD data sheet. It's on pin 3 of the LCD.
Praad



Joined: 15 May 2008
Posts: 5

View user's profile Send private message

PostPosted: Thu May 15, 2008 12:49 pm     Reply with quote

I use DB4-DB7 data pins on the LCD.
For the contrast voltage I use a poteniometer (RVLCD) :



But with all these things the LCD displays black squares Confused

I tried this morning (at school) to make it works but without success.


Thx
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu May 15, 2008 12:57 pm     Reply with quote

In your schematic, you have the R/W pin connected to ground.
With that connection, you must "comment out" the following line
in the Flex LCD driver. Do this by adding comment symbols in
front of the line. Example:
Quote:
// #define USE_LCD_RW 1


Then re-compile and test it.
Praad



Joined: 15 May 2008
Posts: 5

View user's profile Send private message

PostPosted: Thu May 15, 2008 1:07 pm     Reply with quote

PCM programmer wrote:
In your schematic, you have the R/W pin connected to ground.
With that connection, you must "comment out" the following line
in the Flex LCD driver. Do this by adding comment symbols in
front of the line. Example:
Quote:
// #define USE_LCD_RW 1


Then re-compile and test it.


This morning i did :

Code:

#define USE_LCD_RW   0   



Is this the same thing?

I'll try it as soon as possible (Monday... :s)


thx²
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu May 15, 2008 1:24 pm     Reply with quote

Absolutely not !

If you define it as 0, it is still defined !

You must comment it out if the R/W line is connected to ground.
Praad



Joined: 15 May 2008
Posts: 5

View user's profile Send private message

PostPosted: Thu May 15, 2008 1:38 pm     Reply with quote

Ok thx for your help PCM Programmer.
I'll try it Monday Very Happy
Praad



Joined: 15 May 2008
Posts: 5

View user's profile Send private message

PostPosted: Sat May 17, 2008 5:56 am     Reply with quote

By using the lib how could i clear a line (the first or the second) ?
I ask that because i would like to print a string which is displayed blinking.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat May 17, 2008 10:11 am     Reply with quote

Please ask general questions about using an LCD in the main forum.
netmonster



Joined: 08 Aug 2008
Posts: 1

View user's profile Send private message

lcd_Print
PostPosted: Fri Aug 08, 2008 6:33 am     Reply with quote

Hi all,
I really thank u for this amazing driver, I'm using it to dive my LCD 2X16 and it is perfect.

Well I wanted to add some extensions to the driver and I'll post them as soon as i finish...

Good luck all
Very Happy
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> Code Library All times are GMT - 6 Hours
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
Page 4 of 7

 
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