summaryrefslogtreecommitdiff
path: root/Software
diff options
context:
space:
mode:
Diffstat (limited to 'Software')
-rw-r--r--Software/pinlock.asm70
-rw-r--r--Software/pinlock.hex19
-rw-r--r--Software/pinlock.objbin518 -> 914 bytes
3 files changed, 74 insertions, 15 deletions
diff --git a/Software/pinlock.asm b/Software/pinlock.asm
index b119723..ee80741 100644
--- a/Software/pinlock.asm
+++ b/Software/pinlock.asm
@@ -18,18 +18,26 @@ init:
out DDRA, tmp0
ldi tmp0, 0b11111111
out DDRB, tmp0
- ldi tmp0, 0x31
- mov cnt, tmp0
- out PORTA, tmp0
- ldi tmp0, 0x42
- out PORTB, tmp0
ldi tmp0, 0b11000000
out DDRD, tmp0
ldi tmp0, 0b00000000
out PORTD, tmp0
+ ldi par0, 0
+ ldi par1, 0
+ rcall display
+ ldi par0, 1
+ ldi par1, 1
+ rcall display
+ ldi par0, 2
+ ldi par1, 2
+ rcall display
+ ldi par0, 3
+ ldi par1, 3
+ rcall display
+
main:
- ldi par0, 0b11000011
+ ldi par0, 0b11111111
rcall status
wait:
@@ -41,8 +49,6 @@ wait:
dec par1
nop
brne wait
- inc cnt
- out PORTA, cnt
ret
; Output the status
@@ -70,3 +76,51 @@ status_end:
cpi tmp0, 0
brne status_loop
ret
+
+; Display the digit on a given display
+; par0 = Display number
+; par1 = Digit
+display:
+ mov tmp0, par1
+ andi tmp0, 0x0F
+ cpi par0, 0
+ breq display_0
+ cpi par0, 1
+ breq display_1
+ cpi par0, 2
+ breq display_2
+ cpi par0, 3
+ breq display_3
+ ret
+display_0:
+ in tmp1, PORTA
+ andi tmp1, 0xF0
+ or tmp1, tmp0
+ out PORTA, tmp1
+ ret
+display_1:
+ in tmp1, PORTB
+ andi tmp1, 0xF0
+ or tmp1, tmp0
+ out PORTB, tmp1
+ ret
+display_2:
+ in tmp1, PORTA
+ andi tmp1, 0x0F
+ lsl tmp0
+ lsl tmp0
+ lsl tmp0
+ lsl tmp0
+ or tmp1, tmp0
+ out PORTA, tmp1
+ ret
+display_3:
+ in tmp1, PORTB
+ andi tmp1, 0x0F
+ lsl tmp0
+ lsl tmp0
+ lsl tmp0
+ lsl tmp0
+ or tmp1, tmp0
+ out PORTB, tmp1
+ ret
diff --git a/Software/pinlock.hex b/Software/pinlock.hex
index d156dea..222b940 100644
--- a/Software/pinlock.hex
+++ b/Software/pinlock.hex
@@ -1,9 +1,14 @@
:020000020000FC
-:1000000004E00EBF0FE51FEF2FEF10D00DBF0FEF75
-:100010000ABB0FEF07BB01E3302F0BBB02E408BBA9
-:1000200000EC01BB00E002BB13EC0BD0012F1A95D2
-:100030000000E1F7102F2A950000C1F733953BBB74
-:10004000089501E0412F4023041729F04FE342BBFC
-:100050004FEB42BB05C04FE742BB4FEF42BB00C076
-:08006000000F003079F708954C
+:1000000004E00EBF0FE51FEF2FEF17D00DBF0FEF6E
+:100010000ABB0FEF07BB00EC01BB00E002BB10E026
+:1000200020E027D011E021E024D012E022E021D00E
+:1000300013E023E01ED01FEF09D0012F1A95000016
+:10004000E1F7102F2A950000C1F7089501E0412F34
+:100050004023041729F04FE342BB4FEB42BB05C0DE
+:100060004FE742BB4FEF42BB00C0000F003079F7B3
+:100070000895022F0F70103039F0113051F0123006
+:1000800069F01330A1F008954BB3407F402B4BBB78
+:10009000089548B3407F402B48BB08954BB34F7041
+:1000A000000F000F000F000F402B4BBB089548B30B
+:1000B0004F70000F000F000F000F402B48BB08953A
:00000001FF
diff --git a/Software/pinlock.obj b/Software/pinlock.obj
index 91d4cba..7c4452f 100644
--- a/Software/pinlock.obj
+++ b/Software/pinlock.obj
Binary files differ