diff options
author | Leonard Kugis <leonard@kug.is> | 2020-08-31 15:45:37 +0200 |
---|---|---|
committer | Leonard Kugis <leonard@kug.is> | 2020-08-31 15:45:37 +0200 |
commit | ff865773c2edadbde7e57cc88d31ed2e4bc3924a (patch) | |
tree | e6345dfdaa9e9834a59373db6dbd62f9bdab659f /Software/pinlock.asm | |
parent | 9b1eb21f2bffaa3f42702cb73b9f19eae2fee761 (diff) | |
parent | 22787ade85e5943954bcb8963b332860d3fa3553 (diff) |
Merge branch 'master' of collaborating.tuhh.de:cev7691/pinlock
Diffstat (limited to 'Software/pinlock.asm')
-rw-r--r-- | Software/pinlock.asm | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/Software/pinlock.asm b/Software/pinlock.asm index ee80741..ba12dc9 100644 --- a/Software/pinlock.asm +++ b/Software/pinlock.asm @@ -5,6 +5,8 @@ .def cnt = r19 .def tmp1 = r20 .def tmp2 = r21 +.def ret0 = r22 +.def ret1 = r23 init: ldi tmp0, HIGH(RAMEND) @@ -18,7 +20,7 @@ init: out DDRA, tmp0 ldi tmp0, 0b11111111 out DDRB, tmp0 - ldi tmp0, 0b11000000 + ldi tmp0, 0b11101100 out DDRD, tmp0 ldi tmp0, 0b00000000 out PORTD, tmp0 @@ -39,6 +41,7 @@ init: main: ldi par0, 0b11111111 rcall status + rjmp [tmp0] wait: mov tmp0, par0 @@ -52,7 +55,10 @@ wait: ret ; Output the status +; Parameters: ; par0 = Status bits +; Returns: +; None status: ldi tmp0, 1 status_loop: @@ -77,9 +83,12 @@ status_end: brne status_loop ret -; Display the digit on a given display +; Display the digit on a given display. +; Parameters: ; par0 = Display number ; par1 = Digit +; Returns: +; None display: mov tmp0, par1 andi tmp0, 0x0F @@ -124,3 +133,19 @@ display_3: or tmp1, tmp0 out PORTB, tmp1 ret + +; Read the input buttons. +; Parameters: +; None +; Returns: +; ret0 = 123A456B +; ret1 = 789C*0#D +input: + ; Write selection rows + ldi tmp0, 1 + ldi tmp1, 1 +input_loop: + mov tmp2, tmp0 + and tmp2, tmp1 + cp tmp1, tmp2 + breq input_set |