display lcd problem black square

Thread Starter

MED_TN

Joined Feb 21, 2013
15
Hi.
my program function well in ISIS proteus but in the real life it dosen't, the problem thats a have in the first line many black square.
i use a 4 bits configuration and 18f4550 pic.
thats my program please help me.
sorry for my bad level of english thats my first time in this forum.


Rich (BB code):
sbit LCD_RS at LATB0_bit;
sbit LCD_EN at LATB1_bit;
sbit LCD_D4 at LATB2_bit;
sbit LCD_D5 at LATB3_bit;
sbit LCD_D6 at LATB4_bit;
sbit LCD_D7 at LATB5_bit;

// Pin direction
sbit LCD_RS_Direction at TRISB0_bit;
sbit LCD_EN_Direction at TRISB1_bit;
sbit LCD_D4_Direction at TRISB2_bit;
sbit LCD_D5_Direction at TRISB3_bit;
sbit LCD_D6_Direction at TRISB4_bit;
sbit LCD_D7_Direction at TRISB5_bit;


/****************************Programme Principal*********************/

void main()
{

TRISA=0x00;
TRISB=0x00;
PORTB.f0=0;
PORTA=0xFF;
delay_ms(1000);
Lcd_Init();
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);

delay_ms(500);
Lcd_Out(1,1,"bonjour");
delay_ms(500);
LCD_out(2,2,"Salut");
delay_ms(500);
}
i put the third pin (3) of the LCD in the GND i didn't use a pot and (do you think thats not wrong ??)
also i I connected RW pin to Ground because i use the lcd only to write things and i see in others forum that it is wrong and i must connect R/W to a pin of the pic. thats true ????
and if i must do it what i must change in my program
I use MIKROC pro for pic
Thx
 

MrChips

Joined Oct 2, 2009
30,618
The first line with black squares means that the LCD is not initialized properly.
Check:
1) All wiring to the LCD,
2) Make sure you have a 0.1μF capacitor between VCC and GND at the LCD pins,
3) Check software timing,
4) Double check your code.
 

ErnieM

Joined Apr 24, 2011
8,377
Hi Med, nice to see you in this forum.

Do you have a schematic of your setup you can post? If you need help on software to draw that we can help there too, but any sort of sketch will do, even scanned pencil on paper or a bitmap sketch.
 

Thread Starter

MED_TN

Joined Feb 21, 2013
15
Hi Med, nice to see you in this forum.

Do you have a schematic of your setup you can post? If you need help on software to draw that we can help there too, but any sort of sketch will do, even scanned pencil on paper or a bitmap sketch.
Thx to you for your help.

thats my schematic and i use the intern oscillatateur of the pic

 

Thread Starter

MED_TN

Joined Feb 21, 2013
15
when i did the calcul with this table i must have V0 between 0.8 v and 0.2 v and me i put it in the ground.
Do you thinks thats wrong
 

MrChips

Joined Oct 2, 2009
30,618
VEE pin-3 on the LCD is usually the contrast control.
On my LCD, if VEE is connected to VDD I get a blank screen.
VEE connected to VSS gives darkened boxes. Text is visible with poor contrast.
I normally connect VEE to VSS via a 1kΩ resistor.
 

Thread Starter

MED_TN

Joined Feb 21, 2013
15
VEE pin-3 on the LCD is usually the contrast control.
On my LCD, if VEE is connected to VDD I get a blank screen.
VEE connected to VSS gives darkened boxes. Text is visible with poor contrast.
I normally connect VEE to VSS via a 1kΩ resistor.

i was rong in my posted shematin me i connected VEE to the Ground but the thing which i dont understand it thas i have Black Square only in the first row, in the second row i dont have any thing it is blank!!!!!!!!!!

in the datasheet VEE must be between 0.2 v and 0.8 v and me i put it in the ground (0 v) i will try to use a potentiometre and see what will hapen
 

spinnaker

Joined Oct 29, 2009
7,830
What is "sonore bip"? Did you check continuity or did you actually check the transition of each bit? You can write a test program to verify one bit at a time. first setting it high then low. Step through your program and verify that each bit changes as excepted.

Yes you should ground each bit. You should also add a pot on the contrast pin.
 

Thread Starter

MED_TN

Joined Feb 21, 2013
15
What is "sonore bip"? Did you check continuity or did you actually check the transition of each bit? You can write a test program to verify one bit at a time. first setting it high then low. Step through your program and verify that each bit changes as excepted.

Yes you should ground each bit. You should also add a pot on the contrast pin.
yes i checked continuity and it is ok.
and i checked a program to turn on a LED and it is ok.
i checked voltage in pins of the LCD and are ok.
 

Thread Starter

MED_TN

Joined Feb 21, 2013
15
Read my post #5.
Black squares on the first line means that the LCD is not initialized.
yes i readed your post and all says that is a problem of initialized or of contrast.
you say that my LCD is not initialized but i put LCD_init() !!!!!

so what i must correct in my program , do you think i must put dela_ms(1000) before LCD_inti() !!!!

please if you can say to me what can be wrong in my intialisation.
THX
 

Thread Starter

MED_TN

Joined Feb 21, 2013
15
thx for all to help me.

Please my LCD driver is 'SAMSUNG KS0070BP' is this driver compatible with HITACHI HD 44780 ????
 
Top