EASy68K
http://www.easy68k.com/EASy68Kforum/

Password entering by using Keypad and 2x16 LCD display
http://www.easy68k.com/EASy68Kforum/viewtopic.php?f=6&t=937
Page 1 of 1

Author:  amy87 [ Sun Nov 07, 2010 10:45 pm ]
Post subject:  Password entering by using Keypad and 2x16 LCD display

Hi

My name is Amy, i want to ask help from everyone. I need to write an assembly program entitle password entering by using keypad and the result will be displayed at LCD display. Hope everybody can help me ... Grateful for everything. Thanks

Author:  clive [ Mon Nov 08, 2010 1:09 am ]
Post subject:  Re: Password entering by using Keypad and 2x16 LCD display

amy87 wrote:
I need to write an assembly program entitle password entering by using keypad and the result will be displayed at LCD display.

Hi Amy,

Please post the code you have written so far, as I don't think anyone here is answering homework assignments. Or frame the question around aspects of the task which you are having specific problems with.

Author:  amy87 [ Mon Nov 08, 2010 6:46 am ]
Post subject: 

Hi

Thanks for soon reply. Act it is not my home assignment, it is my final University project. I not sure about the string code .

Here i attach my code , hope can help me so far.

some part from my program because the whole program is tooo long. I not sure aout the password compared and string sent to LCD display.

* KEYPAD SCANNING for one key
KEY1 MOVE D0, D1
BCLR #3, OUT
MOVE KEYPAD_INP, D0
AND #$0F,D0
CMP #$77, D0
BNE N1
MOVE #'1',D1
JSR DATAWRITE1
JSR DELAY1
N1 CMP #$7B, D0
BNE N2
MOVE #'2',D1
JSR DATAWRITE1
JSR DELAY1
N2 CMP #$7D, D0
BNE N3
MOVE #'3',D1
JSR DATAWRITE1
JSR DELAY1
N3 CMP #$7E, D0
BNE N4
MOVE #'A',D1
JSR DATAWRITE1
JSR DELAY1
N4 JSR DELAY1
BSET #3, OUT
RTS



*******************************************
MOVE #'N', D0
JSR DATAWRITE
NOP
MOVE #'U',D0
JSR DATAWRITE
NOP
MOVE #'M',D0
JSR DATAWRITE
NOP
* Izzit we can direct send the string by using such as #'S' to the address? Or need also changed it to ascii code?

Thanks for everything.

Author:  clive [ Mon Nov 08, 2010 7:56 pm ]
Post subject: 

The keypad code is problematic because you mask off bits you want to use/compare later. You'll need to review how you are supposed to read the keypad. I've rationalized the code some what, so that it exits and performs common code after it gets a match.

Code:
* KEYPAD SCANNING for one key
KEY1    MOVE D0, D1
    BCLR #3, OUT
    MOVE KEYPAD_INP, D0

    AND #$0F,D0  * ??? If you mask with $0F it will never pass $77,$7B,etc

    CMP #$77, D0    * $77 -> '1'
    BNE N1

    MOVE #'1',D1
    BRA X1

N1    CMP #$7B, D0    * $7B -> '2'
    BNE N2

    MOVE #'2',D1
    BRA X1

N2    CMP #$7D, D0    * $7C -> '3'
    BNE N3

    MOVE #'3',D1
    BRA X1

N3    CMP #$7E, D0    * $7E -> 'A'
    BNE N4

    MOVE #'A',D1

X1    JSR DATAWRITE1 * Common code
N4    JSR DELAY1
    BSET #3, OUT
    RTS


The output string can be done as a subroutine
Code:
   LEA   num,A0
   BSR   OUTSTR

   ...

OUTSTR   MOVE.B   (A0)+,D0
   BEQ   OUTDONE
   JSR   DATAWRITE
   NOP
   BRA   OUTSTR
OUTDONE   RTS

   ...

num   dc.b   'NUM',0

Author:  amy87 [ Thu Nov 11, 2010 4:39 am ]
Post subject: 

Thanks for the commment. If i dont want use subroutine for the string , is it possible?

Author:  clive [ Thu Nov 11, 2010 6:05 pm ]
Post subject: 

amy87 wrote:
Thanks for the comment. If i dont want use subroutine for the string , is it possible?


You are free to implement your project however you choose. However it is generally more efficient to use subroutines to contain and compartmentalize repetitive code of this nature. It might help showcase your assembly programming skills, and structured design, as the use of 68K is not very prevalent in the commercial world in 2010.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/