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 CCS Technical Support

Problem with flex lcd driver

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



Joined: 26 Nov 2013
Posts: 21

View user's profile Send private message

Problem with flex lcd driver
PostPosted: Tue Dec 10, 2013 2:22 pm     Reply with quote

Hi,
i have a problem with this driver, sure for my error Smile
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: 19544

View user's profile Send private message

PostPosted: Tue Dec 10, 2013 3:54 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Dec 12, 2013 1:30 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Dec 12, 2013 1:47 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Dec 12, 2013 1:58 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Dec 12, 2013 2:08 pm     Reply with quote

ehm..coff coff..wrong connection Smile
now its working!!! :D
many thanks!!!
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