Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

lcd programming

Status
Not open for further replies.

neo_matrix671

New Member
i'm using 16*2 lcd.
i want to show "distance '(content of register)'" in first row,
and in second row "speed '(content of register)'".

i'm doing lcd interfacing for the first time so i am writing a simple program as follow:


org 3000h
mov A, #38H ; Initialize, 2-lines, 5X7 matrix.
scall command;
mov A, #0EH ; LCD on, cursor on
lcall command;
mov A, #01H ; Clear LCD Screen
lcall command
mov A, #06H ; Shift cursor right
lcall command
mov a,#'M'
lcall data
mov a,#'A'
lcall data
mov a,#'H'
lcall data
mov a,#'E'
lcall data
mov a,#'S'
lcall data
mov a,#'H'
lcall data
end


ready:
setb P1.7 ;D7 as input
clr P3.6 ;RS=0 cmd
setb P3.5 ;RW=1 for read

again:
setb P3.7 ;H->L pulse on E
clr P3.7
jb P1.7, again
ret

data:
mov P1, A ;move acc. data to port
setb P3.6 ;RS=1 data
clr P3.5 ;RW=0 for write
setb P3.7 ;H->L pulse on E
clr P3.7
lcall ready
ret



command:
mov P1, A ;move acc. data to port
clr P3.6 ;RS=0 for cmd
clr P3.5 ;RW=0 for write
setb P3.7 ;H->L pulse on E
clr P3.7
lcall ready
ret



initialization:
mov A, #38H ; Initialize, 2-lines, 5X7 matrix.
lcall Command
mov A, #0EH ; LCD on, cursor on
lcall Command
mov A, #01H ; Clear LCD Screen
lcall Command
mov A, #06H ; Shift cursor right
lcall Command

clear:
setb p3.7 ;enable EN
clr 3.6 ;RS=0 for cmd.
mov DATA,#01h
clr p3.7 ;disable EN
lcall ready
RET





i'm working in keil and i'm getting error related to 'call' instruction that is


undifined symbol (pass-2)
syntax error

so please help me solve this problem.
 
Status
Not open for further replies.

Latest threads

Back
Top