Hello,
i'm trying to send data to LCD with a Keypad (3x4) like a phone keypad.
so i know how to send data one by one, like when i click 1 it displays 1 in the LCD and so on.
This is ok for me.
But now i want to type a word for example "ABC" then when i will click on "#" button it will send the word "ABC" to the LCD and only after i clicked the "#" button not one by one letter.
how do i have to modify my asm code.
The LCD is connected to P2.
here is the code :
KEYPAD:
Thank you
PS: there is one problem with my code, the letter A is never displayed, i tried to understand, for me the code is good maybe there is a problem with xtal frequencey or i don't know what.
i'm trying to send data to LCD with a Keypad (3x4) like a phone keypad.
so i know how to send data one by one, like when i click 1 it displays 1 in the LCD and so on.
This is ok for me.
But now i want to type a word for example "ABC" then when i will click on "#" button it will send the word "ABC" to the LCD and only after i clicked the "#" button not one by one letter.
how do i have to modify my asm code.
The LCD is connected to P2.
here is the code :
KEYPAD:
Rich (BB code):
mov p1,#0ffh ; MAKE P3 as input for keypad
lcall Line0
lcall delay
mov p1,#0ffh
lcall Line1
lcall delay
mov p1,#0ffh
lcall Line2
lcall delay
Line0:
clr p1.0
jb p1.1,L1
lcall Col1
jnb p1.1,$
ret
L1:
jb p1.4,L2
lcall Col2
jnb p1.4,$
ret
L2:
jb p1.5,L3
lcall Col3
jnb p1.5,$
ret
L3:
jb p1.6,L4
lcall Col4
jnb p1.6,$
l4:ret
;---------------
Col1:
lcall lcdtrans
mov a,#'A'; display 1
mov p2,a
lcall LCDdata
ret
Col2:
lcall lcdtrans
mov a,#'D'; display 4
mov p2,a
lcall LCDdata
ret
Col3:
lcall lcdtrans
mov a,#'G'; display 7
mov p2,a
lcall LCDdata
ret
Col4:
lcall lcdtrans
mov a,#'J'; dipslay *
mov p2,a
lcall LCDdata
ret
Line1:
clr p1.1
jb p1.3,L11
lcall Col11
lcall lcdtrans
jnb p1.3,$
ret
L11:
jb p1.4,L22
lcall Col22
lcall lcdtrans
jnb p1.4,$
ret
L22:
jb p1.5,L33
lcall Col33
lcall lcdtrans
jnb p1.5,$
ret
L33:
jb p1.6,L44
lcall Col44
lcall lcdtrans
jnb p1.6,$
L44:ret
;----------------
Col11:
lcall lcdtrans
mov a,#'B'; display 2
mov p2,a
lcall LCDdata
ret
Col22:
lcall lcdtrans
mov a,#'E'; display 5
mov p2,a
lcall LCDdata
ret
Col33:
lcall lcdtrans
mov a,#'H'; display 8
mov p2,a
lcall LCDdata
ret
Col44:
lcall lcdtrans
mov a,#'K'; dipslay 0
mov p2,a
lcall LCDdata
ret
;---------------
Line2:
clr p1.2
jb p1.3,LA
lcall ColA
lcall lcdtrans
jnb p1.3,$
ret
LA:
jb p1.4,LB
lcall ColB
lcall lcdtrans
jnb p1.4,$
ret
LB:
jb p1.5,LC
lcall ColC
lcall lcdtrans
jnb p1.5,$
ret
LC:
jb p1.6,LD
lcall ColD
lcall lcdtrans
jnb p1.6,$
LD:ret
;-----------------
ColA:
lcall lcdtrans
mov a,#'C'; display 3
mov p2,a
lcall LCDdata
ret
ColB:
lcall lcdtrans
mov a,#'F'; display 6
mov p2,a
lcall LCDdata
ret
ColC:
lcall lcdtrans
mov a,#'I'; display 9
mov p2,a
lcall LCDdata
ret
ColD:
lcall lcdtrans
mov a,#'L'; dipslay #
mov p2,a
lcall LCDdata
ret
PS: there is one problem with my code, the letter A is never displayed, i tried to understand, for me the code is good maybe there is a problem with xtal frequencey or i don't know what.