Keypad and LCD using Assembly Language

Status
Not open for further replies.

Rushdiey

Junior Member level 2
Joined
Jan 10, 2013
Messages
24
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,419
Hello im new here. I need to write assembly language.
When i press at keypad i will display at lcd
 

I Got the code.
But in C..
Can someboy convert to assembly?
 

Look again, the links I provided offer both source code examples in both C and Assembly Languages.

Example:
Code:
;In this whole 4-bit tutorial LCD is connected to
;my controller in following way...
;D4 - P3.0
;D5 - P3.1
;D6 - P3.2
;D7 - P3.3
;EN - P3.7
;RS - P3.5

        lcd_port equ P3         ;LCD connected to Port3
        en equ P3.7             ;Enable connected to P3.7
        rs equ P3.5             ;Register select to P3.5
       
lcd_reset:                  ;LCD reset sequence
        mov lcd_port, #0FFH
        mov delay,#20           ;20mS delay
        acall delayms
        mov lcd_port, #83H      ;Data = 30H, EN = 1, First Init
        mov lcd_port, #03H      ;Data = 30H, EN = 0
        mov delay,#15           ;Delay 15mS
        acall delayms
        mov lcd_port, #83H      ;Second Init, Data = 30H, EN = 1
        mov lcd_port, #03H      ;Data = 30H, EN = 0
        mov delay,#5            ;Delay 5mS
        acall delayms
        mov lcd_port, #83H      ;Third Init
        mov lcd_port, #03H
        mov delay,#5            ;Delay 5mS
        acall delayms
        mov lcd_port, #82H      ;Select Data width (20H for 4bit)
        mov lcd_port, #02H      ;Data = 20H, EN = 0
        mov delay,#5            ;Delay 5mS
        acall delayms
        ret

lcd_init:
        acall lcd_reset         ;Call LCD Reset sequence
        mov a,#28H              ;4-bit, 2 line, 5x7 dots
        acall lcd_cmd           ;Call LCD command
        mov a,#0CH              ;Display ON cursor OFF
        acall lcd_cmd           ;Call LCD command
        mov a,#06H              ;Set entry mode (Auto increment)
        acall lcd_cmd           ;Call LCD command
        mov a,#80H              ;Bring cursor to line 1
        acall lcd_cmd           ;Call LCD command
        ret

BigDog
 

I GOT 1 ERROR AT STORE:MOV..
IF I DELETE MOV..
NOTHING happen
 

make the following connections

;KEYPAD TO LCD
;
;FOR LCD
;P0 DATA LINES
;P2.0 - RS
;P2.1 - R/W
;P2.2 - EN

;FOR KEYPAD
;P1 - KEYPAD
;
 

port 0 - data lines for LCD
port 2.0 - RS pin for LCD
port 2.1 - R/W pin For LCD
Port 2.2 - En pin for LCD

port 1 - matrix keypad
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…