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

LCD

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







LCD
PostPosted: Thu Mar 05, 2009 1:12 pm     Reply with quote

Hi

I have been a bit of a muppet and have connected my PIC to my LCD display using the DB0-DB3 data bits not DB4-DB7 as I should have. I have tried using the flexible LCD driver and just put in the pin definitions but no luck. Is it possible to use these pins and force it to work or am I going to have to use some messy jumpers to sort this out?

I am using a PIC18F4520, Batron 20x4 display. Compiler version 4.057.

Thanks for any advice.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Mar 05, 2009 1:18 pm     Reply with quote

See the LCD controller data sheet, on page 8, regarding pins DB0-DB3:
http://www.sparkfun.com/datasheets/LCD/HD44780.pdf
Quote:

DB0 to DB3 --

Four low order bidirectional tristate data bus pins.
Used for data transfer and receive between the
MPU and the HD44780U.
These pins are not used during 4-bit operation.

You will have to fix the board.
Muppet
Guest







PostPosted: Fri Mar 06, 2009 8:21 am     Reply with quote

Thanks PCM, have sorted that out its no messy but connected to the right pins, but I cant seem to get it to work still. I have checked all the connections and everything is fine. I am using DB4-DB7 connected to RB1-RB4, and D0-D2 connected to RS,RW,E respectively. Am using your flexible driver and have set the pins. I am using the BTHQ42003AV-FSTF-LED from farnell. If I leave it running sometimes all the segments go black and you can just about see different segments changing but its not characters just blocks and bits of blocks.

I am new to this and can't work out whats wrong any help would be much appreciated.
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Fri Mar 06, 2009 8:37 am     Reply with quote

..

Last edited by treitmey on Mon Mar 09, 2009 7:23 am; edited 1 time in total
Muppet
Guest







PostPosted: Fri Mar 06, 2009 10:29 am     Reply with quote

I think that it can be used like this. Another post from 2003 is about using this driver with this LCD http://ccsinfo.com/forum/viewtopic.php?p=68002 I may be wrong though.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Mar 06, 2009 2:46 pm     Reply with quote

Here is the data sheet for the BTHQ42003AV-FSTF-LED:
http://www.farnell.com/datasheets/47112.pdf
It's a 4x20 LCD with an LED backlight.

1. Check the connections. Trace them out carefully on the board. Then
post a list of the pin connections between the PIC and the LCD. The
typical case is, one of the connections is wrong.

2. This LCD uses the HD66712 controller. That controller has a
different set of starting addresses for the rows than the typical LCD.
The Flex driver has some #define statements for these row addresses.
You need to uncomment them, and comment out the normal ones
to make this LCD work.
Muppet
Guest







PostPosted: Fri Mar 06, 2009 7:46 pm     Reply with quote

Thanks PCM, I checked all connections by toggling the pin and checking the output, turned out I had a via on my board not soldered properly and RS was floating, so it now works....ish.

I am using the lines addresses for the HD66712U but it doesn't seem to be right, I get
Quote:
This is the 1st Next
1st Next is the 2nd
This is the 3rd line
3rd lineFinally the


Using the other addresses I get
Quote:
This is the 1st line
1st lineThis is the
Next is the 2nd line
2nd lineFinally the


Is this just a case of the wrong addresses or is it something else. It seems strange that I get a different first line when using the same address Confused
Muppet
Guest







PostPosted: Fri Mar 06, 2009 9:02 pm     Reply with quote

Have looked at it some more and it seems that the last 8 bits of lines 1 and 3 are copied to the first 8 bits of lines 2 and 4. I have tried changing the address to
Code:
//Custom
#define LCD_LINE_1_ADDRESS 0x00
#define LCD_LINE_2_ADDRESS 0xC
#define LCD_LINE_3_ADDRESS 0x40
#define LCD_LINE_4_ADDRESS 0x4C

but it then seems to do the reverse, I get
Quote:
This is the Next is
Next is the 2nd line
This is the Finally
Finally the 4th line


Any ideas as to what is going on?
Muppet
Guest







PostPosted: Tue Mar 10, 2009 11:14 am     Reply with quote

I still can't sort this out , any help would be much appreciated.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Mar 10, 2009 1:05 pm     Reply with quote

This post explains what to do:
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=printview&t=12851&start=0
To implement those suggestions, add the 3 entries shown in bold below
to the init string:
Quote:
int8 const LCD_INIT_STRING[4] =
{
0x20 | (lcd_type << 2), // Set mode: 4-bit, 2+ lines, 5x8 dots
0xc, // Display on
1, // Clear display
6, // Increment cursor
0x2c, // Enable writing to Ext. register
0x09, // Enable 4-line display
0x28 // Disable writing to Ext. register

};

See if that makes it work.
Guest








PostPosted: Tue Mar 10, 2009 1:49 pm     Reply with quote

PCM programmer you are a legend I could kiss you Laughing

It works a treat. Just in case others read this I changed

Code:
int8 const LCD_INIT_STRING[7] =


thanks again
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