]> hackdaworld.org Git - my-code/atmel.git/commitdiff
test port d asm code
authorhackbard <hackbard>
Sun, 7 Dec 2003 20:50:43 +0000 (20:50 +0000)
committerhackbard <hackbard>
Sun, 7 Dec 2003 20:50:43 +0000 (20:50 +0000)
beginners/test_port_d.asm [new file with mode: 0644]

diff --git a/beginners/test_port_d.asm b/beginners/test_port_d.asm
new file mode 100644 (file)
index 0000000..0e31045
--- /dev/null
@@ -0,0 +1,47 @@
+.include "../include/2313def.inc"
+
+INIT:
+ldi r31,0
+ldi r30,0
+ldi r29,0
+out DDRD,r29 ; select all pins as input
+jmp DECIDE
+
+DECIDE:
+adiw r30,1
+cp r30,0
+breq SET_0
+cp r30,1
+breq SET_1
+cp r30,2
+breq SET_2
+ldi r30,0
+jmp DECIDE
+
+SET_0:
+ldi r16,0
+sbr r16,14
+out PORTD,r16
+jmp WAIT
+SET_1:
+ldi r16,0
+sbr r16,48
+out PORTD,r16
+jmp WAIT
+
+SET_2:
+ldi r16,0
+sbr r16,42
+out PORTD,r16
+jmp WAIT
+
+WAIT:
+adiw r31,1
+cpi r31,0xff
+breq RESET
+jmp WAIT
+
+RESET:
+ldi r31,0
+jmp DECIDE