From f24e742bc7e1c8c86bd4bb8add6f621daf5d0f49 Mon Sep 17 00:00:00 2001 From: hackbard Date: Sun, 7 Dec 2003 20:50:43 +0000 Subject: [PATCH] test port d asm code --- beginners/test_port_d.asm | 47 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 beginners/test_port_d.asm diff --git a/beginners/test_port_d.asm b/beginners/test_port_d.asm new file mode 100644 index 0000000..0e31045 --- /dev/null +++ b/beginners/test_port_d.asm @@ -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 -- 2.39.2