PDA

View Full Version : problem with LCD



Rhatidbwoy
- 6th October 2005, 18:58
Hello:

I am working on this project that interest me and I am having problems with the LCD working. I have checked the voltages and all the connection at different points of this project.

The chip I am using is the 16f628, the LCD is vishay lcd-020m004b. I have PICBasic programming my chip threw a EPic programmer and those work. My setup for the project board is a voltage regulator running off of a 9 volt battery powering the mcu. the mclr is powered by the 5 volts with the 4.7k resistor on the mclr pin (that is normal). the ground (Vss)is grounded, the power (Vdd) has 5 volts with a .1uf cap hooked to ground on it works fine also. The LCD has power going to it and ground also. I hooked it up to how the example program did in PICBasic and got nothing.

LCD should be connected as follows:
' LCD PICmicro
' DB4 PortA.0
' DB5 PortA.1
' DB6 PortA.2
' DB7 PortA.3
' RS PortA.4 (add 4.7K pullup resistor to 5 volts)
' E PortB.3
' RW Ground
' Vdd 5 volts
' Vss Ground
' Vo 20K potentiometer (or ground)
' DB0-3 No connect

I am wondering is there anything that I might have done wrong that I should look out for. A mistake that is common for rookies like myself and many others to follow.

rhino
- 6th October 2005, 19:36
A quick look at the datasheet states "Built - in controller (KS 0066 or Equivalent)". Don't know if that is equivalent to the Hitachi 44780 controller (which the LCDOUT commands are intended for). Also... post your code, there may be something minor there that may be causing the problem. Are you getting any "black boxes"? Try adjusting the contrast as well.

Dwayne
- 6th October 2005, 22:54
a couple of things...

1. no code to look at.
2. Did you put a pause 500 to "power up" the LCD first?
3. It is compatible LCD controller? (seems you found this info, check it out!)
4. Are you writing to the LCD to fast? use the Default char spacing to slow it down.
5. are you pins correctly connected to the LCD?
6. Is your port assigned to all outputs for the LCD??? trisb=%00000000 ?

Dwayne

Darrel Taylor
- 6th October 2005, 23:14
Along with everything Rhino and Dwayne said.

Did you set CMCON = 7 to disable the comparators on PORTA?
<br>

Rhatidbwoy
- 7th October 2005, 14:36
Ok after relaxing and checking the whole LCD config on the lcd I found the problem. the contrast was not connected. the next step for anything is to get the program to write to the lcd. thanks for all the help. that really did help.

The program is attached to this post. that is what I am working with. The pause times on them are for a 20mhz crystal. using that just to experiment.

Rhatidbwoy
- 10th October 2005, 19:05
The other problem that I am getting with my lcd is that I have nothing coming on the screen other than two black lines. I can not even get a blinker blinking. I can not get the blinker to move from one position to another. nothing.

Dwayne
- 10th October 2005, 19:35
Hello RHatid,

R>>The other problem that I am getting with my lcd is that I have nothing coming on the screen other than two black lines. I can not even get a blinker blinking. I can not get the blinker to move from one position to another. nothing.<<

This is contrast adjustment... Two black lines is better than nothing at all!.. Adjust your contrast to where these black lines are BARELY visible. That is a starting point.

Dwayne

Rhatidbwoy
- 11th October 2005, 03:13
Dwayne

I will have to try and do that. That is some else that I can try. Thanks I will get back to you.

Rhatidbwoy
- 12th October 2005, 17:54
ok I tried the dimming and I got nothing. I even pause 500 at the beginning of initialization for the lcd and nothing. The funny part is that now on this 4x20 lcd screen only two lines light. the second and the fourth. What really am I to see when this thing really kicks off.

the program that is attached is the last program that I am actualling trying to get to work. It worked before for someone else why not me right. Tried it and got nothing.

could the crystal play a role to the problem

Rhatidbwoy
- 13th October 2005, 23:01
I got this to ask. When I write pause 15 does that mean I pause 15mS for a 4MHz crystal. What is the time constant for the 4MHz crystal. isn't it .25us. so that leave the program and the chip to produce a 15ms pause time.

I am trying to figure out my problem and all that I am possed with is a timing issue. Why I bring this up is that even my LCD sample program does not work with the setup that I am running. I have attached the program(s) that I use as the sample.