"LOOP" routine in Assembly

DJNZ R2,$
DJNZ R1,REPEAT
RET
END
#################################################
Any suggestions will be greatly appreciated
Reply to
Lodewicus Maas
Loading thread data ...
Hi All
Google is NOT my friend here, or maybe I'm not searching correct - gets gazillions of hits on examples which I don't understand
I have the below routine that work 100%, but I want to add a "LOOP" to execute the FLASH routine i,e 5 times and then the FLASH_ODD routine 7 times before calling "AJMP FLASH" again to start from the beginning. Below is just a scale down version of my code, but If I can get this resolved, I will be able to implement it in my code
#################################################
ORG 00H ; Starts Here FLASH: CPL P1.0 ; Turn on/off the LED P1.0 ACALL DELAY ; call one second delay AJMP FLASH_ODD ; jump to FLASH_ODD
FLASH_ODD: CPL P1.3 ; Turn on/off the LED P1.3 ACALL DELAY ; call one second delay AJMP FLASH ; jump to FLASH
DELAY: MOV R1,#0FFH REPEAT: MOV R2,#0FFH DJNZ R2,$ DJNZ R1,REPEAT RET END
#################################################
Any suggestions will be greatly appreciated
Reply to
TTman
Hi All
Google is NOT my friend here, or maybe I'm not searching correct - gets gazillions of hits on examples which I don't understand
I have the below routine that work 100%, but I want to add a "LOOP" to execute the FLASH routine i,e 5 times and then the FLASH_ODD routine 7 times before calling "AJMP FLASH" again to start from the beginning. Below is just a scale down version of my code, but If I can get this resolved, I will be able to implement it in my code
#################################################
ORG 00H ; Starts Here FLASH: CPL P1.0 ; Turn on/off the LED P1.0 ACALL DELAY ; call one second delay AJMP FLASH_ODD ; jump to FLASH_ODD
FLASH_ODD: CPL P1.3 ; Turn on/off the LED P1.3 ACALL DELAY ; call one second delay AJMP FLASH ; jump to FLASH
DELAY: MOV R1,#0FFH REPEAT: MOV R2,#0FFH DJNZ R2,$ DJNZ R1,REPEAT RET END
#################################################
Any suggestions will be greatly appreciated
Reply to
Lodewicus Maas
DJNZ R2,$ DJNZ R1,REPEAT RET END
begin: mov r3,#05 mov r4,#07
loop1: lcall flash djnz r3,loop1
loop2: lcall flash_odd djnz r4,loop2 ljmp begin
Reply to
Lodewicus Maas

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.