View previous topic :: View next topic |
Author |
Message |
seifpic
Joined: 11 Mar 2012 Posts: 45 Location: Egypt
|
LMB204BDC with Flex 4 x 20 driver not displaying text |
Posted: Thu Jun 07, 2012 11:35 am |
|
|
Hello,
I am trying to get an LMB204BDC LCD screen working with a PIC16F877a and the Flex 4x20 Driver, however for some reason the text is not displayed. Before, I mistaked the datasheet for saying to attach a 5k ohm resistor from the contrast pin to +5v, so I did that and later realized it said from the contrast pin to v0, I connected a 3k ohm resistor and the first and third lines only have faint boxes, might I have damaged the display?
Thanks in advance. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jun 07, 2012 12:27 pm |
|
|
1. Post your test program that calls the Flex driver. The program should
be a small "Hello World" program. It should be complete with #include
for the PIC, #fuses, #use delay, main(). It should compile with no errors.
(Do not post the flex driver. Post your test program that calls it.).
2. Post the list of #define statements for the flex driver, including the
line for USE_RW_PIN.
3. Post your compiler version.
4. Post your list of connections between the PIC and the LCD. Or better,
post a link to a schematic of your connections.
5. Post the power supply voltage of the PIC and the LCD. |
|
|
seifpic
Joined: 11 Mar 2012 Posts: 45 Location: Egypt
|
|
Posted: Thu Jun 07, 2012 12:43 pm |
|
|
PCM programmer wrote: | 1. Post your test program that calls the Flex driver. The program should
be a small "Hello World" program. It should be complete with #include
for the PIC, #fuses, #use delay, main(). It should compile with no errors.
(Do not post the flex driver. Post your test program that calls it.).
|
Code: |
#include <16f877a.h>
#use delay (crystal=4000000)
#include <Flex_LCD420.c>
void main() {
lcd_init();
printf(lcd_putc, "\fHello World");
}
|
Btw, I'm not sure what fuses to use in this program.
PCM programmer wrote: |
2. Post the list of #define statements for the flex driver, including the
line for USE_RW_PIN.
|
Code: | #define LCD_DB4 PIN_E1
#define LCD_DB5 PIN_E2
#define LCD_DB6 PIN_C0
#define LCD_DB7 PIN_C1
#define LCD_RS PIN_A0
#define LCD_RW PIN_A1
#define LCD_E PIN_A2 |
PCM programmer wrote: |
3. Post your compiler version.
|
4.068
PCM programmer wrote: |
4. Post your list of connections between the PIC and the LCD. Or better,
post a link to a schematic of your connections.
|
same pins as in the #define list.
PCM programmer wrote: |
5. Post the power supply voltage of the PIC and the LCD.
|
5v and 5v |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jun 07, 2012 12:51 pm |
|
|
What is your crystal frequency ? Look at the numbers stamped on the
crystal. Do you have the correct crystal circuit, including the two 22 pf
capacitors ? |
|
|
seifpic
Joined: 11 Mar 2012 Posts: 45 Location: Egypt
|
|
Posted: Thu Jun 07, 2012 1:45 pm |
|
|
PCM programmer wrote: | What is your crystal frequency ? Look at the numbers stamped on the
crystal. Do you have the correct crystal circuit, including the two 22 pf
capacitors ? |
Sorry for the delay (no pun intended), the crystal frequency is SD4.00000 (4MHz) and the 2 caps have 33 printed on them (it's a board I bought already made as I don't have time to print my own since this should be finished by this Saturday). |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jun 07, 2012 1:58 pm |
|
|
Add the two lines shown in bold below.
Quote: |
#include <16f877a.h>
#fuses XT,NOWDT,BROWNOUT,PUT,NOLVP
#use delay (crystal=4000000)
#include <Flex_LCD420.c>
void main() {
lcd_init();
printf(lcd_putc, "\fHello World");
while(1);
}
|
The XT fuse is essential to making the crystal oscillator work. |
|
|
seifpic
Joined: 11 Mar 2012 Posts: 45 Location: Egypt
|
|
Posted: Thu Jun 07, 2012 2:22 pm |
|
|
PCM programmer wrote: | Add the two lines shown in bold below.
Quote: |
#include <16f877a.h>
#fuses XT,NOWDT,BROWNOUT,PUT,NOLVP
#use delay (crystal=4000000)
#include <Flex_LCD420.c>
void main() {
lcd_init();
printf(lcd_putc, "\fHello World");
while(1);
}
|
The XT fuse is essential to making the crystal oscillator work. |
Added those lines, still no text and lines 1 and 3 are all boxes (shouldn't all the lines be boxes if there's no text?) |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jun 07, 2012 2:46 pm |
|
|
According to the LCD data sheet, it takes 80ms to go through its internal
initialization procedure. This is much longer than for most LCDs.
See section 4.2 on page 7:
http://www.topwaydisplay.com/Pub/Manual/LMB204BDC-Manual-Rev0.1.pdf
Edit the 20x4 flex driver and change the init delay to 100 ms. Look for
the line shown in bold below. That's the line you want to change from
35 to 100.
Quote: |
void lcd_init(void)
{
int8 i;
lcd_line = 1;
output_low(LCD_RS);
#ifdef USE_RW_PIN
output_low(LCD_RW);
#endif
output_low(LCD_E);
// Some LCDs require 15 ms minimum delay after
// power-up. Others require 30 ms. I'm going
// to set it to 35 ms, so it should work with
// all of them.
delay_ms(35); |
|
|
|
seifpic
Joined: 11 Mar 2012 Posts: 45 Location: Egypt
|
|
Posted: Thu Jun 07, 2012 3:22 pm |
|
|
PCM programmer wrote: |
Edit the 20x4 flex driver and change the init delay to 100 ms. Look for
the line shown in bold below. That's the line you want to change from
35 to 100.
|
Done. Still no text showing |
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Thu Jun 07, 2012 3:44 pm |
|
|
Hi,
Although that PIC has been around a while, that version of the compiler is rather old. I wonder if the compiler is not turning off the analog peripherals by default? I don't have that compiler version to test, but this might be worth a try:
Quote: |
#include <16f877a.h>
#fuses XT,NOWDT,BROWNOUT,PUT,NOLVP
#use delay (crystal=4000000)
#include <Flex_LCD420.c>
#byte ANSEL = getenv("SFR:ANSEL")
//==========================
void main() {
ANSEL = 0x00;
lcd_init();
printf(lcd_putc, "\fHello World");
while(1);
}
|
John |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jun 07, 2012 3:47 pm |
|
|
Have you ever made this PIC board do anything, such as blinking an LED ?
If not, you should do that first. Prove that the board works.
Here is a program that will blink an LED on pin B0.
Code: |
#include <16F877A.H>
#fuses XT, NOWDT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)
//===============================
void main()
{
while(1)
{
output_high(PIN_B0);
delay_ms(500);
output_low(PIN_B0);
delay_ms(500);
}
} |
Last edited by PCM programmer on Thu Jun 07, 2012 4:11 pm; edited 1 time in total |
|
|
seifpic
Joined: 11 Mar 2012 Posts: 45 Location: Egypt
|
|
Posted: Thu Jun 07, 2012 4:11 pm |
|
|
ezflyr wrote: | Hi,
Although that PIC has been around a while, that version of the compiler is rather old. I wonder if the compiler is not turning off the analog peripherals by default? I don't have that compiler version to test, but this might be worth a try:
|
I get 2 errors:
Quote: | unidentified identifyer
unidentified identifyer ANSEL |
PCM programmer wrote: | Have you ever made this PIC board do anything, such as blinking an LED ? If not, you should do that first. Prove that the board works. |
I have successfully done so yesterday :D |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jun 07, 2012 4:15 pm |
|
|
Post a link to the website for the board that you bought. |
|
|
seifpic
Joined: 11 Mar 2012 Posts: 45 Location: Egypt
|
|
Posted: Thu Jun 07, 2012 4:31 pm |
|
|
PCM programmer wrote: | Post a link to the website for the board that you bought. |
The website removes it off their catalogue when it's out of stock, but here's the ATMEL version (which asthetically is the same as the PIC version). |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jun 07, 2012 4:54 pm |
|
|
There is no schematic of the board posted on that website, so it's not
very useful.
Let's configure the driver so it doesn't use the lcd's busy bit.
1. Edit the flex driver, and comment out this line, as shown below:
Code: |
// #define USE_RW_PIN 1 // Comment out this line
|
2. Add the line shown below, to set the R/W line to a constant low level.
The line should be placed above the lcd_init() line, in your test program:
Code: |
output_low(LCD_RW); // Add this line here.
lcd_init(); |
|
|
|
|