Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/26/05 10:45
Read: times


 
#88520 - Spend a bit time!
Responding to: ???'s previous message
Dear Raymond
I am not sure but i think there is a
bit problem in your code!
is this your meaning?
In Loop1 you call Loop2 and in Loop2
you call Loop3 ...
Do you want go back to certain loop After desired times?

If you do this you must be very careful!
because in that situation your stack destroys
IRAM and some of your required data maybe lost!
Stack managing is the most important in a program
Because it damages your program without any sounds!
so,Spend a time with the code below:

counter1 equ 60h
counter2 equ 61h
counter3 equ 62h
counter4 equ 63h
counter5 equ 64h
...
...
...



main_loop:
mov counter1,#5 ;or other value
mov counter2,#5 ;or other value
mov counter3,#5 ;or other value
mov counter4,#5 ;or other value
mov counter5,#5 ;or other value
...
...
...



main1:
lcall main_loop1
djnz counter1,main1
mov counter1,#5
main2:
...
...
...






main_loop1:
lcall loop1
lcall loop2
lcall loop3
...
...
...
ret

loop1:
..
..
code1
..
..
ret ;if the condition is desired
;then return from this loop



loop2:
..
..
code2
..
..
ret ;if the condition is desired
;then return from this loop

.......
.......
.......
.......
.......


end_of_program:
END








List of 3 messages in thread
TopicAuthorDate
LOOP HELP            01/01/70 00:00      
   All looped up...            01/01/70 00:00      
   Spend a bit time!            01/01/70 00:00      

Back to Subject List