
98
PROGRAMMING EXAMPLESI
MAIN: MOV R6, #03H ; term counter
MAIN1: MOV @R0, A ; save one term
DJNZ R7, NEXT ; continue if more terms are necessary
OVER: SJMP OVER ; all terms are generated, terminate here
NEXT: INC A ; next number
DJNZ R6, MAIN1 ; continue for maximum three times
; Following part generates, but not stores, the unwanted numbers.
MOV R6, #07H ; get number of gaps
NEXT1: INC A ; fi nd next number
DJNZ R6, NEXT1 ; count seven gaps
SJMP MAIN ; continue
Another way to solve this problem is to add 7 with every third generated number,
However, in that case only one loop would be suffi cient.
SUMMARY ...