View previous topic :: View next topic |
Author |
Message |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Aug 17, 2007 3:52 pm |
|
|
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
|
|
Posted: Tue Aug 21, 2007 11:20 am |
|
|
These changes seem to be working well.
Thanks |
|
|
d
Joined: 04 Sep 2007 Posts: 3
|
|
Posted: Thu Sep 06, 2007 8:32 am |
|
|
thanks for the code
works perfect, first time!
d. |
|
|
syahrul.s
Joined: 09 Nov 2007 Posts: 6
|
|
Posted: Fri Nov 09, 2007 2:14 am |
|
|
can the flex_lcd.c be used with LCD-016M002B by Vishay?? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Nov 09, 2007 11:21 am |
|
|
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
|
|
Posted: Thu May 15, 2008 10:42 am |
|
|
[ 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
|
|
Posted: Thu May 15, 2008 12:25 pm |
|
|
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
|
|
Posted: Thu May 15, 2008 12:49 pm |
|
|
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
I tried this morning (at school) to make it works but without success.
Thx |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu May 15, 2008 12:57 pm |
|
|
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
|
|
Posted: Thu May 15, 2008 1:07 pm |
|
|
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
|
|
Posted: Thu May 15, 2008 1:24 pm |
|
|
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
|
|
Posted: Thu May 15, 2008 1:38 pm |
|
|
Ok thx for your help PCM Programmer.
I'll try it Monday |
|
|
Praad
Joined: 15 May 2008 Posts: 5
|
|
Posted: Sat May 17, 2008 5:56 am |
|
|
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
|
|
Posted: Sat May 17, 2008 10:11 am |
|
|
Please ask general questions about using an LCD in the main forum. |
|
|
netmonster
Joined: 08 Aug 2008 Posts: 1
|
lcd_Print |
Posted: Fri Aug 08, 2008 6:33 am |
|
|
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
|
|
|
|