From 1760591ab1547944a705c1785af0c5d23fe6b726 Mon Sep 17 00:00:00 2001 From: hackbard Date: Sun, 7 Dec 2003 22:11:14 +0000 Subject: [PATCH] increased wait --- beginners/test_port_d.asm | 52 ++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/beginners/test_port_d.asm b/beginners/test_port_d.asm index 0e31045..8dc6e44 100644 --- a/beginners/test_port_d.asm +++ b/beginners/test_port_d.asm @@ -1,47 +1,55 @@ .include "../include/2313def.inc" INIT: -ldi r31,0 -ldi r30,0 -ldi r29,0 -out DDRD,r29 ; select all pins as input -jmp DECIDE +ldi r31,0 ; wait counter +ldi r30,0 ; decide counter +ldi r29,0 ; another wait counter +ldi r28,1 ; constant +out DDRD,r30 ; select all pins as input +rjmp DECIDE ; goto decide DECIDE: -adiw r30,1 -cp r30,0 +add r30,r28 ; add 1 to decission counter .. so we start with SET_1 +cpi r30,0 breq SET_0 -cp r30,1 +cpi r30,1 breq SET_1 -cp r30,2 +cpi r30,2 breq SET_2 -ldi r30,0 -jmp DECIDE +ldi r30,0 ; now begin with SET_0 +rjmp DECIDE SET_0: ldi r16,0 -sbr r16,14 +sbr r16,14 ; ports 3,4,5 out PORTD,r16 -jmp WAIT +rjmp WAIT SET_1: ldi r16,0 -sbr r16,48 +sbr r16,48 ; ports 6,7 out PORTD,r16 -jmp WAIT +rjmp WAIT SET_2: ldi r16,0 -sbr r16,42 +sbr r16,42 ; ports 3,5,7 out PORTD,r16 -jmp WAIT +rjmp WAIT WAIT: -adiw r31,1 -cpi r31,0xff -breq RESET -jmp WAIT +ldi r29,0 ; reset inner wait counter +add r31,r28 ; increment wait counter +cpi r31,0xff ; after 255 steps +breq RESET ; reset wait counter +rjmp WAIT_MORE + +WAIT_MORE: +add r29,r28 ; increment inner wait loop counter +cpi r29,0xff ; goto first wait loop after 255 cycles +breq WAIT +rjmp WAIT_MORE RESET: ldi r31,0 -jmp DECIDE +rjmp DECIDE -- 2.39.2