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

20x4 lcd not working..
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Krazzy7434



Joined: 21 Aug 2014
Posts: 39
Location: India

View user's profile Send private message

20x4 lcd not working..
PostPosted: Thu Oct 16, 2014 2:03 am     Reply with quote

Hello guys...

I was trying to interface a 20x4 lcd display with a pic18f4550....But it showing only dark square, not on the first line but here and there and disappears within 3 seconds...
Here is my code:

Code:


#include <18f4550.h>
#device ADC=10
#fuses HS, PLL5, CPUDIV1, NOWDT, NOPROTECT, BROWNOUT, NOLVP, PUT, NOMCLR
#use delay(clock=20000000)
//#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7,parity=N,bits=8,ERRORS)
#include<flex_lcd420.c>

void main()
{
float32 T , val;
delay_ms(500);
lcd_init();
lcd_setcursor_vb(1,1);
printf(lcd_putc,"\f ");
setup_comparator(NC_NC_NC_NC);
setup_adc_ports(AN0_TO_AN1);
setup_adc(ADC_CLOCK_DIV_8);
for(;;)
{
set_adc_channel(0);
delay_ms(10);
T=read_adc();
delay_ms(100);
val=T*(4.26/1023)*100;
delay_ms(600);
lcd_gotoxy(1,1);
delay_ms(10);
printf(lcd_putc,"Tem Read:%3.1f ",val);
delay_ms(10);
output_toggle(PIN_D1);
delay_ms(10);
output_toggle(PIN_E1);
delay_ms(10);
}

}



but when i replaced the circuit with 16x2 lcd its working perfectly...
It's not working for 20x4 lcd.....is my 20x4 lcd defective???
I'm using a 10 k pot for my lcd..
Plz help..

Thank You....
_________________
Krazzy7434
Ttelmah



Joined: 11 Mar 2010
Posts: 19481

View user's profile Send private message

PostPosted: Thu Oct 16, 2014 5:02 am     Reply with quote

It'd help if you gave a part number for the 20*4, in case there is something 'odd' about this unit.

Bit puzzled at you toggling E1, when the default connections have this as the R/W pin for the LCD.
Krazzy7434



Joined: 21 Aug 2014
Posts: 39
Location: India

View user's profile Send private message

PostPosted: Thu Oct 16, 2014 5:33 am     Reply with quote

Ttelmah wrote:
It'd help if you gave a part number for the 20*4, in case there is something 'odd' about this unit.

Bit puzzled at you toggling E1, when the default connections have this as the R/W pin for the LCD.


Hello Ttelmah..

I'm having a ODM 20416 1SLW lcd display....are you saying that i should toggle the EN pin and R/w pin....

plz help me
Thank You...
_________________
Krazzy7434
temtronic



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

View user's profile Send private message

PostPosted: Thu Oct 16, 2014 7:33 am     Reply with quote

simple logic101...
Since a 2x16 works OK with your code and PIC then the 4x20 LCD must be defective.
I checked the datasheet for the display and it has the same pinout/connections aside from the LED backlighting (which will NOT affect displaying data).

I also am puzzled about the toggling LED code but I've assumed you modified the LCD driver as you did say a 2x16 LCD works fine.

You may want to post the LCD driver code....

hth
jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19481

View user's profile Send private message

PostPosted: Thu Oct 16, 2014 7:34 am     Reply with quote

No, You should not be toggling the pin at all. The driver controls all the LCD pins, you don't want to touch them in your own code.

I must admit, I wouldn't touch any product that does not have a full data sheet available. There is no specification for what voltage is required on Vl (while many modern displays will show a picture OK with 0v, the circuits for this display all show a contrast voltage being input). There is also nothing actually saying that this is a 'standard' Hitachi compatible LCD.

Save yourself a lot of bother and get an LCD with better documentation.
Krazzy7434



Joined: 21 Aug 2014
Posts: 39
Location: India

View user's profile Send private message

PostPosted: Thu Oct 16, 2014 8:39 am     Reply with quote

Ttelmah wrote:
No, You should not be toggling the pin at all. The driver controls all the LCD pins, you don't want to touch them in your own code.

I must admit, I wouldn't touch any product that does not have a full data sheet available. There is no specification for what voltage is required on Vl (while many modern displays will show a picture OK with 0v, the circuits for this display all show a contrast voltage being input). There is also nothing actually saying that this is a 'standard' Hitachi compatible LCD.

Save yourself a lot of bother and get an LCD with better documentation.


hi Ttelmah...
i googled for its datasheet...but didnt find any with good details...
Is there any possibility for its working if my lcd is a HD44780 type...
also there is a label " E187451 94V-0 "...

I Hope it may be helpful...

THANK YOU...
_________________
Krazzy7434
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Oct 16, 2014 12:50 pm     Reply with quote

Quote:
there is a label " E187451 94V-0 "...

Those are manufacturing marks. They are not important to your problem.

Quote:

But it showing only dark square, not on the first line but here and there
and disappears within 3 seconds

If the lcd doesn't initialize correctly, you will get black squares.
But the fact that they disappear shows some other problem. It could the
power supply for your board is bad, or the power and ground connections
to the lcd are intermittent. Or the contrast circuit.

I would check for a stable +5v power supply, and carefully check that
all connections between the PIC and the LCD are solid, good connections.
Krazzy7434



Joined: 21 Aug 2014
Posts: 39
Location: India

View user's profile Send private message

PostPosted: Fri Oct 17, 2014 12:40 am     Reply with quote

Quote:
.

I would check for a stable +5v power supply, and carefully check that
all connections between the PIC and the LCD are solid, good connections.


Hi PCM programmer

I double checked every thing....i also tested the same ciruit with a 16X2 lcd display and it working...but not working with my 20x4 lcd.
can i confirm its defective..???

Thank You...
_________________
Krazzy7434
Ttelmah



Joined: 11 Mar 2010
Posts: 19481

View user's profile Send private message

PostPosted: Fri Oct 17, 2014 12:52 am     Reply with quote

The first thing to try is a pot on the contrast pin.

Most modern text LCD's will display an image with this grounded. However as I already commented, the notes from this manufacturer show this having a small positive voltage applied (common on older LCD technologies). When the display first switches on, the chip is running at the wrong clock rate, and this will commonly show a block on the display, even if the contrast voltage is wrong, but once the chip is programmed, this will disappear, and if the voltage is outside the range that this LCD will display an image, then the display would go clear, with nothing visible, even if the display was in fact working perfectly.
Krazzy7434



Joined: 21 Aug 2014
Posts: 39
Location: India

View user's profile Send private message

PostPosted: Fri Oct 17, 2014 11:12 am     Reply with quote

Ttelmah wrote:
The first thing to try is a pot on the contrast pin.

Most modern text LCD's will display an image with this grounded. However as I already commented, the notes from this manufacturer show this having a small positive voltage applied (common on older LCD technologies). When the display first switches on, the chip is running at the wrong clock rate, and this will commonly show a block on the display, even if the contrast voltage is wrong, but once the chip is programmed, this will disappear, and if the voltage is outside the range that this LCD will display an image, then the display would go clear, with nothing visible, even if the display was in fact working perfectly.


hi Ttelmah..
I have connected contrast pin to a 10k pot and i have also tried without using the data lines and controls...when the contrast pin is given a voltage of 3.87 the display is clear....when 0v is give 8 blacks square appears in the first line and second line.. when 5v is given dark square appears in the remaining boxes....
no image is seen at any time...

still any Hope....???

Thank You...
_________________
Krazzy7434
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Oct 17, 2014 11:49 am     Reply with quote

Black squares means the LCD is not initialized. The standard reason is
because the list of #define statements for the pins (at the start of the
flex driver file) does not match the actual wired connections to the LCD.


The #define statements below must be edited to exactly match the
wired connections between your PIC and the LCD.
Code:
// Flex_LCD420.c

// These pins are for my Microchip PicDem2-Plus board,
// which I used to test this driver.
// An external 20x4 LCD is connected to these pins.
// Change these pins to match your own board's connections.

#define LCD_DB4   PIN_D4
#define LCD_DB5   PIN_D5
#define LCD_DB6   PIN_D6
#define LCD_DB7   PIN_D7

#define LCD_RS    PIN_E0
#define LCD_RW    PIN_E1
#define LCD_E     PIN_E2


On your LCD, the LCD_DB4 to LCD_DB7 data pins are on pins 11 to 14.
http://www.orioleindia.com/LCD%20MANUAL/20x4.pdf

Post your list of #define statements so we can see it.
Krazzy7434



Joined: 21 Aug 2014
Posts: 39
Location: India

View user's profile Send private message

PostPosted: Fri Oct 17, 2014 1:34 pm     Reply with quote

Hello PCM programmer..
Quote:

Black squares means the LCD is not initialized.


Actually black squares dont have any order,,,they just appear here and there....

Also i didnt understand your previous post...You mean,, i have to edit the driver....If so, why?? I have connected

Code:


Pin11(DB4)--------->PIN_D4
Pin12(DB5)--------->PIN_D5
Pin13(DB6)--------->PIN_D6
Pin14(DB7)--------->PIN_D7

Pin4(RS)------------>PIN_E0
Pin5(RW)------------>GND
Pin6(EN)------------>PIN_E2



Also dark square are not stable...they disappears slowly....
Plz make me corrected if i m wrong....

Thank You......
_________________
Krazzy7434
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Oct 17, 2014 1:56 pm     Reply with quote

You have R/W connected to ground. That means the following paragraph
in the driver file applies to you:
Code:

// If you want only a 6-pin interface to your LCD, then
// connect the R/W pin on the LCD to ground, and comment
// out the following line.  Doing so will save one PIC
// pin, but at the cost of losing the ability to read from
// the LCD.  It also makes the write time a little longer
// because a static delay must be used, instead of polling
// the LCD's busy bit.  Normally a 6-pin interface is only
// used if you are running out of PIC pins, and you need
// to use as few as possible for the LCD.
#define USE_RW_PIN   1     



You need to edit the driver file and comment out the following
line, as shown below. Put comment marks // in front of the line:
Quote:

// #define USE_RW_PIN 1

Then re-compile and test.
Krazzy7434



Joined: 21 Aug 2014
Posts: 39
Location: India

View user's profile Send private message

PostPosted: Fri Oct 17, 2014 2:08 pm     Reply with quote

Hello PCM Programmer...

I commented that line when i connected RW pin To GND...I think you have been refering with my old lcd driver from my previous threads...i have edited it when i thought connecting RW to ground is better ...

if u think my lcd is damaged ,,could u plz suggest me a good and a cheap 20X4 lcd display....

Thank You...
_________________
Krazzy7434
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Oct 17, 2014 3:36 pm     Reply with quote

I'm in the USA, so I would buy from crystalfontz.com or sparkfun.com
or digikey.com or mouser.com. If you're in a different country I don't
know where you would buy an lcd.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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