| ??? 02/09/07 07:07 Read: times |
#132335 - You didn't take the challenge Responding to: ???'s previous message |
Mike, check this:
;
; lcd data ->port bit. Any order or port as you like as long it
; is available and usable
;
LCD_D4 equ P0.2
LCD_D5 equ P0.1
LCD_D6 equ P0.3
LCD_D7 equ P0.0
LCD_RS equ P3.2
LCD_DEN equ P3.3
;----------------------------------------------------------------------------
;
;
; send a command to the lcd display. command in A
; Zaps: A,B
;
;----------------------------------------------------------------------------
lcd_comm_wr
clr LCD_RS
mov b,a ;save the command
swap a ;get hi nibble into low nibble
anl a,#0fh
mov c,a.0 ;Mike ->the translation done here
mov LCD_D4,c
mov c,a.1
mov LCD_D5,c
mov c,a.2
mov LCD_D6,c
mov c,a.3
mov LCD_D7,c
nop
nop
setb LCD_DEN
nop
nop
clr LCD_DEN
mov a,b
anl a,#0fh
mov c,a.0
mov LCD_D4,c
mov c,a.1
mov LCD_D5,c
mov c,a.2
mov LCD_D6,c
mov c,a.3
mov LCD_D7,c
nop
nop
setb LCD_DEN
nop
nop
clr LCD_DEN
;
; delay for lcd controller
;
mov b,#25 ;at least 40uS
ldrw_1
djnz b,ldrw_1 ;waste some time
ret
However, I do note that I was lazy when writing this code, the first part of the initialisation needs fixing, equates for the port pins and maybe a macro or subroutine to output the data. You can also mix ports. If I was making a plainly false statement, I'm sure the others would've picked me up real quick. So open that flexible mind of yours and take the challenge. I know it works. |



