/*
« Smart Table Project »
Script Version: 0.1 Alpha
Porgram Development: Kiel uVision, Assembly Assets.
Programmers_ Maxim 'Maxeyas' Zemlyansky
Dor 'Dor7539' Istrick • General Developers •
Moderator_ Afik Gilboa • Developers Moderator •
This script is private and is part of diploma project.
Nobody may edit/adjust this script without developers premission!
*/
// LCD - Main, Decoder Y3 - (011)16 = 6000H
// Data
mov A, #38h // Function Set
lcall SendCommand
lcall Delay
lcall SendCommand
lcall Delay
lcall SendCommand
lcall Delay
mov A, #06h // Display Control
lcall SendCommand
lcall Delay
mov A, #0Eh // Entry mode set
lcall SendCommand
lcall Delay
mov A, #01h // Clears the display
lcall SendCommand
lcall Delay
mov A, #'M'
lcall SendData
lcall Delay
mov A, #'A'
lcall SendData
lcall Delay
mov A, #'X'
lcall SendData
lcall Delay
SendCommand:
mov DPTR, #6000h
clr P1.2 // Setting 0 in RS (0=commands,1=data)
movx @DPTR, A
setb P1.3 // Setting 1 in EN (disabling the lcd)
clr P1.3 // Setting 0 in EN (enabling the lcd)
ret
SendData:
mov DPTR, #6000h
setb P1.2 // Setting 1 in RS (0=commands,1=data)
movx @DPTR, A
setb P1.3 // Setting 1 in EN (disabling the lcd)
clr P1.3 // Setting 0 in EN (enabling the lcd)
ret
Delay: // 100x100 = 10000us = 10 ms
mov R7, #100
D1: mov R6, #100
djnz R6,$
djnz R7,D1
ret
end
Hi,
No schematic?
No information about microcontroller?
No information about display..or at least the controller?
Clock frequency, or cycle time per instruction?
Black boxes usually show wrong initialisation.
Klaus
mov DPTR, #6000h
clr P1.2 // Setting 0 in RS (0=commands,1=data) ...[COLOR="#FF0000"]this seems to be "port access" or "bit bang mode"[/COLOR]
movx @DPTR, A..[COLOR="#FF0000"]this seems to be "memory mapped"access[/COLOR]
Are you sure?in the actual circuit is that VDD is grounded and VSS is going to VCC
I can´t see why....and Vo does not even effect the LCD, i can literly take it out and the lcd will still work
Y3 is not connected....so how can it control the LCD access?LCD to be in Y3 i make a code 011 and then it gives output 16 bit (0110000000000000 = 6000H).
Hi,
either i don´t understand your hardware concept or you totally mixed up memory_mapping and bit_bang modes.
But step by step:
Are you sure?
***
I can´t see why....
***
Y3 is not connected....so how can it control the LCD access?
***
How can your RESET circuit work without GND?
***
No capacitors at the VCC pins.
***
No capacitors for the ADC VCC as well as signal connections.
****
Conclusion.
* forget the memory mapped concept. It doesn´t work with your hardware (as far as i can see)
* instead control port P2 like an IO port
Klaus
You see black boxes. That means the LCD controller is not set up yet. So it is very likely that you can not see any change in contrast.Yes Vo is not effecting the LCD idk why? I'm connecting a pot named 3296 (W103 = 10k) wiring VSS and VDD to it and the middle to VO and its not changing contrast.
Hi,
You see black boxes. That means the LCD controller is not set up yet. So it is very likely that you can not see any change in contrast.
Klaus
- - - Updated - - -
Added:
Do you know that in "memory mapped" mode P0 is a multiplexed bus. It switches from data to low_address and back. every external access. It is controlled by the ALE line.
So when you enable one of your external periferal devices, then they drive to the databus. But with every memory mapped addressing the microcontroller also drives to the databus.
This is an access conflict and may cause short circuit currents.
I´m not very experienced with the 8051, but I don´t think your hardware is made for external memory access.
I know other microcontrollers with similar external memory interface... i don´t think the 8051 is that different.
Klaus
I would expect that the test setup gives sufficient time for LCD power-on-reset. Unfortunately we don't know how the test is performed."wait for 15ms or more after Vdd reaches 4.5V"
Might work, but unrealiable in this setup. Problem is that P0 is open drain output. Regular writing to P0 (MOV P0,A) only controls open drain outputs and can't set high level without pull-up resistors. Writing to external data bus however activates temporarily pull-up drivers and set high level. But it's not guaranteed that the written data is still valid when EN is activated. Leakage currents of connected peripherals can disturb it.I'm actually send P0 the content in A its just going through DPTR, thats what my teacher told me to do...
**broken link removed**
(page 24)
...at beginning:
"wait for 15ms or more after Vdd reaches 4.5V"
....
maybe helping you!
I would expect that the test setup gives sufficient time for LCD power-on-reset. Unfortunately we don't know how the test is performed.
Might work, but unrealiable in this setup. Problem is that P0 is open drain output. Regular writing to P0 (MOV P0,A) only controls open drain outputs and can't set high level without pull-up resistors. Writing to external data bus however activates temporarily pull-up drivers and set high level. But it's not guaranteed that the written data is still valid when EN is activated. Leakage currents of connected peripherals can disturb it.
You could provide pull-up resistors for P0 and use regular port output MOV P0,A.
I hope you have delay at start before INIT LCD like here:
**broken link removed**
if INIT is OK then LCD go from black 1st line to grayed all lcd!
-Try with oscilloscope if you get signals at PINs
-try with longer delays or try 12MHz quartz
EN EQU P1.3 // Enable Pin
RS EQU P1.2 // Register Select
lcall Reset
// Insure 8 Bit Mode
mov A, #03h // Function Set
lcall SendCommand
lcall SendCommand
lcall SendCommand
mov A, #38h // Function Set
lcall SendCommand
mov A, #0Eh // Display Control
lcall SendCommand
mov A, #06h // Entry mode set
lcall SendCommand
mov A, #01h // Display Control
lcall SendCommand
mov A, #'M'
lcall SendData
mov A, #'A'
lcall SendData
mov A, #'X'
lcall SendData
sjmp $
SendCommand:
clr RS // Setting 0 in RS (0=commands,1=data)
mov DPTR, #6000h
movx @DPTR,A
setb EN // Setting 1 in EN (pulse)
NOP
NOP
NOP
NOP
clr EN // Setting 0 in EN (send pulse)
lcall Delay
ret
SendData:
setb RS // Setting 1 in RS (0=commands,1=data)
mov DPTR, #6000h
movx @DPTR,A
setb EN // Setting 1 in EN (pulse)
NOP
NOP
NOP
NOP
clr EN // Setting 0 in EN (send pulse)
lcall Delay
ret
Delay: // 100x5 = 5000us = 5 ms
mov R7, #100
D3: mov R6, #5
djnz R6,$
djnz R7,D3
ret
Reset: // 160x250 = 40000us = 40 ms
mov R7, #160
D4: mov R6, #250
djnz R6,$
djnz R7,D4
ret
end
Hi,
Please measure the voltage at the LCD pins:
Pin1:
Pin2:
Adjust contrast pot so that on PIN3 you see 0.25V.
******
You need a scope.
Measure signals on LCD pins:
Pin4, pin6, pin10 in one scope screen.
(single shot trigger mode. Press and hold reset, enable trigger, release trigger. )
Klaus
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?