View previous topic :: View next topic |
Author |
Message |
yuripace
Joined: 26 Nov 2013 Posts: 21
|
Problem with flex lcd driver |
Posted: Tue Dec 10, 2013 2:22 pm |
|
|
Hi,
i have a problem with this driver, sure for my error
http://www.ccsinfo.com/forum/viewtopic.php?t=24661
i'm using pic16f876 and LCD HD44780 (QC1602a reported on the LCD), and i changed flexdriver with this pins
Code: |
#define LCD_DB4 PIN_B0
#define LCD_DB5 PIN_B1
#define LCD_DB6 PIN_B2
#define LCD_DB7 PIN_B5
#define LCD_E PIN_A1
#define LCD_RS PIN_A0
#define LCD_RW PIN_A2
//#define USE_LCD_RW 1 |
this is the sample program
Code: |
#include <16F876.h>
#fuses XT, NOWDT, NOLVP, NOPROTECT,NOBROWNOUT, NODEBUG, PUT
#use delay(clock = 4000000)
#include "..\_inc\types.h"
#include "flexlcd.c"
void main
{
lcd_init();
delay_ms(500);
lcd_putc("\fCiao\n");
output_high(PIN_B4);
delay_ms(500);
output_low(PIN_B4);
}
|
RW is connected to the ground, trimmer to regulate the contrast and pin A and K connected to retroillumination. Proteus simulation is working, but unfortunately i see only black square or strange character.
Whats the problem? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19552
|
|
Posted: Tue Dec 10, 2013 3:54 pm |
|
|
Wait at the start _before_ calling lcd_init.
LCD's take a long time to wake up after power is applied. Many 'third party' clone chips take longer than the original Hitachi controllers, and also the chips often don't start to wake till the power rail gets up to perhaps 4.5v, while the PIC will often start to wake when the rail gets up to only perhaps 3v.
No pause is needed after lcd_init.
Proteus tends to get timings like this wrong.....
Generally, as a separate comment, it is bad practice to have the code 'dropping off the end'. Study all examples, and you will see a loop or similar operation to stop this.
Best Wishes |
|
|
yuripace
Joined: 26 Nov 2013 Posts: 21
|
|
Posted: Thu Dec 12, 2013 1:30 pm |
|
|
i added a
delay_ms(500);
before the lcd_init and a loop at the end of the program, but the situation wont change..any ideas? :(
thanks
Yuri |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Dec 12, 2013 1:47 pm |
|
|
Look at this drawing of the LCD connections:
www.mikroe.com/img/publication/8051-books/programming-8051-mcu/chapter/ch6/20.gif
These pins below, should connect to pins D4 to D7 on the LCD.
Make sure you have those connections done correctly.
Code: |
#define LCD_DB4 PIN_B0
#define LCD_DB5 PIN_B1
#define LCD_DB6 PIN_B2
#define LCD_DB7 PIN_B5 |
The LCD pins for D0 to D3 should be unconnected. They are not used.
Carefully check all the other connections. |
|
|
yuripace
Joined: 26 Nov 2013 Posts: 21
|
|
Posted: Thu Dec 12, 2013 1:58 pm |
|
|
all the connection seems correct. i do not have resistor on background light, but i think this is not the problem.
maybe i'm missing some pic initialization? led is working correctly. |
|
|
yuripace
Joined: 26 Nov 2013 Posts: 21
|
|
Posted: Thu Dec 12, 2013 2:08 pm |
|
|
ehm..coff coff..wrong connection
now its working!!! :D
many thanks!!! |
|
|
|