| ??? 07/15/06 19:31 Read: times |
#120292 - lcd code not working in bit mode. |
;___________________________________________________________________________
;--------------------command and data write subroutines---------------------
;___________________________________________________________________________
cmdw: acall write_4bit
clr rs
setb en
clr en
acall delay_100us
acall write_4bit
clr rs
setb en
clr en
ret
datw: acall write_4bit
setb rs
setb en
clr en
acall delay_100us
acall write_4bit
setb rs
setb en
clr en
ret
;--------------------4bit write sequence---------------------
write_4bit: push 00h
;mov r0,a
rlc a
mov p0.0, c
rlc a
mov p0.1, c
rlc a
mov p0.2, c
rlc a
mov p0.3, c
;mov a,r0
pop 00h
ret
;___________________________________________________________________________
;--------------------------line select subroutines--------------------------
;___________________________________________________________________________
line1: mov a,#80h ;initial position of cursor
acall cmdw
acall delay_100us
ret
line2: mov a,#0c0h ;initial position of cursor
acall cmdw
acall delay_100us
ret
;___________________________________________________________________________
;----------------------lcd initialisation subroutine------------------------
;___________________________________________________________________________
lcd4_initialise: acall delay_16ms ;wait more than 15ms after vdd reaches 4.5v
mov a,#28h ;2line 5x7 matrix
acall cmdw
acall delay_100us
mov a,#0fh ;display on, cursor on, cursor blinking
acall cmdw
acall delay_100us
mov a,#01h ;clear screen
acall cmdw
acall delay_100us
mov a,#06h ;cursor and display shifts(right/left)
acall cmdw
acall delay_100us
ret
;___________________________________________________________________________
;-------------------------------lcd main code-------------------------------
;___________________________________________________________________________
lcd4_main: mov p0,#00h
clr RS ;make out pins
clr EN ;make out pins
acall lcd4_initialise
;---------------------------------------------------------------------------
acall line1 ;select first or second line of display
mov a,# 'a'
acall datw
acall delay_half_second
acall delay_half_second
mov a,# 'b'
acall datw
acall delay_half_second
acall delay_half_second
acall line2
mov dptr,#disp_ashwin
acall disp_message
sjmp $
end
|
| Topic | Author | Date |
| lcd code not working in bit mode. | 01/01/70 00:00 | |
| correction=>the code here is for 4bit mode | 01/01/70 00:00 | |
| A few possible problems | 01/01/70 00:00 | |
| a few blind shots | 01/01/70 00:00 | |
| Whats wrong with | 01/01/70 00:00 | |
| the difference is... | 01/01/70 00:00 | |
| You can do | 01/01/70 00:00 | |
| So mask it | 01/01/70 00:00 | |
| Yes I realise this! | 01/01/70 00:00 | |
| I didn't know that... | 01/01/70 00:00 | |
| A.x | 01/01/70 00:00 | |
| 8bit mode works by entering 38h only once | 01/01/70 00:00 | |
| But you're not using 8 bit mode. | 01/01/70 00:00 | |
| LCD datasheets ... | 01/01/70 00:00 | |
| A contentious issue! | 01/01/70 00:00 | |
| cpu and speed | 01/01/70 00:00 | |
| Oakely Doakely | 01/01/70 00:00 | |
| Clear LCD delay too short? | 01/01/70 00:00 | |
| Check this also | 01/01/70 00:00 | |
| delays are just fine | 01/01/70 00:00 | |
| Did you try... | 01/01/70 00:00 | |
| Look here | 01/01/70 00:00 | |
| also note that... | 01/01/70 00:00 | |
thank you Jon | 01/01/70 00:00 | |
| You Sure | 01/01/70 00:00 |



