8051 microcontroller programming:Tutorial-factorial in assembly with Keil
Finding factorial is one of the basic programs. It's a good practice code. Factorial is given as: n!=n*(n-1)*(n-2)*..........................*1 PROGRAM: ORG 00H MOV DPTR,#2000H MOVX A,@DPTR MOV R0,A MOV A,#01H MOV B,A MOV R1,A LOOP: MUL AB MOV R5,B MOV B,A MOV A,R1 INC A MOV R1,A DJNZ R0,LOOP MOV A,R5 INC DPTR MOVX @DPTR,A MOV A,B INC DPTR MOVX @DPTR,A END
Comments
Post a Comment