View previous topic :: View next topic |
Author |
Message |
Varpulis
Joined: 26 Apr 2014 Posts: 4
|
Posted: Sat Apr 26, 2014 7:47 pm Post subject: 20x2 LCD displaying on only the first half |
|
|
I've got an urgent problem and I'm asking for your help.
My graduation project needs to be done in a couple of weeks but I've hit a wall. The LCD is displaying on only half the screen area and my mentor doesn't know whats causing it. I've searched for this problem but everywhere the problem is with 16x2 displays that need to be configured as something other than 16x2. There is never any mention for 20x2.
The LCD is DEM 20231 SYH-PY/V 427, connected for 4-bit transfer according to this schematic:
LCD goes through the initialization and displays 20 black squares in the first line for a second of 2 after power is turned on. After that it should display Brzina: (speed) in the first line and m/s in the lower line to the right but there are just some smudges... my guess is that in the picture the LCD tried to display a two number result. Something like 22.22 m/s. The squares lit up in the correct places but still something is wrong.
The code was written in Bascom-8051 version 2.0.14.0. I've translated it to English so its easier to understand. Its meant for a ballistic chronograph:
Code: | $crystal = 24000000
$regfile = "89s8253.DAT"
Enable Timer0
Config Timer0 = Timer , Gate = External , Mode = 1
On Timer0 Pot
Enable Interrupts
Config Lcd = 20 * 2
Config Lcdbus = 4
Config Lcdpin = Pin , Db7 = P1.4 , Db6 = P1.5 , Db5 = P1.6 , Db4 = P1.7 , E = P2.1 , Rs = P2.0
Cursor Off
Dim A As Byte , Ctr As Word , Nbr As Long , Sum As Long , Time As Single , Spd As Single , Targ As String * 6
Check:
A = 0
Counter0 = 0
Cls
Lcd " Speed:"
Locate 2 , 10
Lcd Targ ; " m/s"
Do
Debounce P1.0 , 0 , Cstart
Loop
Cstart:
Start Timer0
Do
If P1.1 = 0 Then
Goto Cstop
End If
Loop
Cstop:
Stop Timer0
Ctr = Counter0
Goto Calc
Pot:
Incr A
Return
Calc:
Do
Nbr = 65535 * A
Sum = Nbr + Ctr
Time = Sum / 2000000
Spd = 0.3 / Time
Targ = Fusing(spd , #.##)
Goto Check:
Loop |
Is the LCD faulty? Did I make an error in the code or wiring? This problem makes no sense to me since the LCD is brand new and both the schematic and code were tested on another board with a 16x2 LCD and proven correct.
(BASCOM-AVR version : 2.0.14.0 , Latest : 2.0.7.7 ) |
|
Back to top |
|
|
techknight
Joined: 21 Apr 2008 Posts: 231
|
Posted: Sat Apr 26, 2014 8:02 pm Post subject: |
|
|
That LCD is definitely faulty. You will need to replace it. One of the scan driver ICs failed. |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Sat Apr 26, 2014 9:19 pm Post subject: |
|
|
you can best run a simple test :
$crystal = 24000000
$regfile = "89s8253.DAT"
Enable Timer0
Config Timer0 = Timer , Gate = External , Mode = 1
On Timer0 Pot
Enable Interrupts
Config Lcd = 20 * 2
Config Lcdbus = 4
Config Lcdpin = Pin , Db7 = P1.4 , Db6 = P1.5 , Db5 = P1.6 , Db4 = P1.7 , E = P2.1 , Rs = P2.0
CLS
dim x as byte
for x=1 to 80
lcd chr(x)
waitms 250
next
end
then see if the characters are visible on the screen.
otherwise post a link to the pdf of the lcd _________________ Mark |
|
Back to top |
|
|
Varpulis
Joined: 26 Apr 2014 Posts: 4
|
Posted: Sun Apr 27, 2014 1:00 pm Post subject: |
|
|
Thanks for the replies.
Any ideas what could have caused one of the driver ICs to fail?
I won't have access to the programmer next week but I'll run the test as soon as I can. Heres the LCD datasheet |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Mon Apr 28, 2014 10:18 am Post subject: |
|
|
i checked the PDF and the mentioned address is the same as bascom uses.
so my advise : try me code first. you must make sure that you do not call the CLS : lcd in a loop too quick.
if you have a cls too quick after the LCD it will fade away. so a first test should be where you show data and then quit to program. _________________ Mark |
|
Back to top |
|
|
|
|
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 You cannot attach files in this forum You cannot download files in this forum
|
|