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 driver

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



Joined: 06 Jan 2013
Posts: 39

View user's profile Send private message

Lcd driver
PostPosted: Sun Jan 06, 2013 3:52 pm     Reply with quote

Is anyone who have an lcd driver which is working??

This is the first time which i try to program a pic microcntroller that's why i need help in this
temtronic



Joined: 01 Jul 2010
Posts: 9229
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Jan 06, 2013 4:21 pm     Reply with quote

The LCD driver(LCD.C) that CCS supplies works fine and the 'flex_lcd.c' driver posted on this forum is 'better' in that it is flexible with resepect to pin usage.
Those are both '4bit' LCD drivers which save 4 I/O pins but if you have extra pins, the default '8 bit' mode of most common LCD modules doesn't need a complicated 'driver'.

Please take the time to learn the 'search' feature of this forum and visit the 'code library' as there is a LOT of 'LCD' information here. What is applicable to your project, only you know, as you haven't said which PIC or LCD module you're using.

hth
jay
Tom1234



Joined: 06 Jan 2013
Posts: 39

View user's profile Send private message

Lcd driver
PostPosted: Sun Jan 06, 2013 4:37 pm     Reply with quote

I used PC1602ARU-HWB-G-Q lcd and dspic33fj128gp202.

I have already used flex_lcd.c without success.

The lcd is connected to different power supply - 5v, from the microcontroller power supply which is 3.3V. Is this possible to create the problem ??
temtronic



Joined: 01 Jul 2010
Posts: 9229
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Jan 06, 2013 8:03 pm     Reply with quote

'Classic' problem.

You cannot run a 5 volt LCD and a 3 volt PIC without proper interface 'voltage translator' chips.

3 usual choices..
1) use 5 volt PIC and 5 volt LCD. My usual choice.

2) use 3 volt PIC and 3 volt LCD. Hard to find LCD!

3) use 3 volt PIC, 5volt LCD AND 'level translator' interface chip. The 'standard nowadays.

There are very, very few 3 volt LCD modules for sale (at least here in Canada). Seems to me to be a HUGE market though considering the vast number of 3 volt microcomputers available.

hth
jay
Tom1234



Joined: 06 Jan 2013
Posts: 39

View user's profile Send private message

Lcd driver
PostPosted: Sun Jan 06, 2013 8:22 pm     Reply with quote

Do you know any level translator from farnell,RS ??


I can't find anything !
Ttelmah



Joined: 11 Mar 2010
Posts: 19518

View user's profile Send private message

PostPosted: Mon Jan 07, 2013 2:06 am     Reply with quote

Start with the simple comment - get another LCD!..... Smile

This is a standard Powertip device, and has inputs that require 3.7v as a 'high' level, hence can't directly be driven from a processor running at 3.3v. It is one of the relatively small number of displays where this is the case. There are plenty of similar devices that will accept lower voltages as a 'high', and these can be directly driven from a 3.3v PIC. For example, from the same manufacturer, the PC1602ARS-H, accepts 2.2v as a 'high'. There are also fully 3.3v versions of these displays (look at the EA DOG series).

However if you can't change the display, then the following comments apply:
The easiest way to buffer the signals is just to use 74HCT logic gates. These are CMOS gates which will run off 5v (and hence can drive the 5v display), with inputs that accept 2.4v as a logic high (and hence can be driven from the 3.3v device). A non inverting buffer like the 74HCT241, does the interfacing easily. Since this handles 8 lines, you can just connect the 4 data lines needed, the RS line and the EN line through this. Pull 2OE high and 1OE low to enable all the buffers.
With a 5v display, it is very much safer/easier to just connect the 'output' lines, and run with the driver setup to _not_ use the R/W line. To implement reading the status 'back', gets much more complex (requiring bi-directional buffers). So, use the flex LCD driver, comment out the line '#define USE_LCD_RW 1', and connect the R/W pin to ground.

This combination 'works'. Have done it when I needed to change a processor board only, on a 'already in use' system, going from a 18F2550 to a 18F26J50, and having to interface to an existing display. The version built a few months later as the full upgrade, changed to a 3.3v display.

Best Wishes
Tom1234



Joined: 06 Jan 2013
Posts: 39

View user's profile Send private message

Lcd driver
PostPosted: Wed Jan 09, 2013 5:12 pm     Reply with quote

Guys i change the lcd with another one (which power supply is 3v) but the problem is still there.

Now i used this one
http://uk.farnell.com/fordata/fdcc1602l-rnnybw-16le/disp-lcd-16x2-3v-reflect/dp/1847939?Ntt=1847939


Is anyone who can suggest me anything to fix?

(I use D4-D7 is needed to use D0-D7 ??????)
Tom1234



Joined: 06 Jan 2013
Posts: 39

View user's profile Send private message

Lcd driver
PostPosted: Wed Jan 09, 2013 5:29 pm     Reply with quote

To make more clear my last post instead to see to lcd the "Hello" i see stranger characters
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jan 09, 2013 6:38 pm     Reply with quote

1. Post a complete list of connections between the PIC and the LCD. Post
a list of all other connections to the LCD (power, ground, contrast).
Give a detailed explanation that tells the voltages used, as well as
component values.
Or, post a schematic on a free image hosting website, and then post a
link to the schematic here in this thread.

2. Post a small test program that shows how you are testing the LCD.
Make sure you post the #include line for the PIC, #fuses, #use delay,
and the #include line for the lcd driver file. Post all #define statements
that are required. Post a main() with a "Hello World" lcd test.
Tell us what LCD driver you are using (CCS, flex, or other ?).

3. Post your CCS compiler version.
Tom1234



Joined: 06 Jan 2013
Posts: 39

View user's profile Send private message

Lcd driver
PostPosted: Wed Jan 09, 2013 7:38 pm     Reply with quote

Sorry guys, i had a connection problem between pic and lcd now everything is ok. Thanks.

Now if i need to present to the lcd the results of a sensor, is needed to change anything to the current driver? (i used flex driver)
temtronic



Joined: 01 Jul 2010
Posts: 9229
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Jan 09, 2013 9:10 pm     Reply with quote

No changes to the driver are necessary.

this line..
printf(lcd_putc,"level %4x",ledlvl);

allows the LCD module to display a 16 bit variable 'ledlvl' as 4 hex characters preceeded by the phrase 'level'.
This is acomplished by the printf(....) function sending the data to the lcd_putc function that is in the flex driver.

If you press F11 while your project is open, you can quickly search the CCS Help screens and readup on the 'printf(...)' function.As well there is an FAQ section and of course LOTS of examples of all sorts of code in the 'examples' folder.

Also...If you do wnat to add a function to the driver, be sure to copy the original 'flex.c' to say 'myflex.c' and modify 'myflex.c',that way you will always have the original 'flex.c' available.

hth
jay
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