






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







Submitted By: (Zaheer ul Islam) (M.Bilal Arshad) (Rehmat Faraz Danish)
The objective of this lab is to learn how to use various conditional and unconditional jumps loops and call as well as generation of desired delay using loops.
In assembly language, when we need repeated action, jumps/loops are used. The 8051 offers two types of jumps, conditional jumps and un-conditional jumps. In conditional jumps, if specific conditions are met, certain tasks are performed otherwise left. In un-conditional jumps, there are not conditions specified and tasks specified are performed. Using single jump/loop, maximum 256 repetition can be achieved because a register canโt hold a value more than that. If you need more than 256 repetitions, the concept of nested loop is useful.The following conditional jumps which are short jumps. Where short jump means that the address should be in the range of - 128 to +127.
Write a program to (a) load the accumulator with the value 55H, (b) complement the ACC 700 times and calculate the time taken by it (for each instruction separately too). Examine the PSW register after each instruction and explain it with the help of dry run. TASK DESCRIPTION: In this Task we have to load 55Hex to accumulator and then complement the accumulator 700 times, this can be easily with creating two loops. TASK CODE: ORG 0000H MOV A,#55H ;A=55H INITIALIZE1: MOV R0,#7 ;R0=7 OUTER LOOP COUNT INITIALIZE2: MOV R1,#100 ;R1=100 INNER LOOP COUNT OUTERLOOP:CPL A ;COMPLEMENT REPEATS 700TIMES DJNZ R1,OUTERLOOP INNERLOOP:DJNZ R0,OUTERLOOP RET
Submitted By: (Zaheer ul Islam) (M.Bilal Arshad) (Rehmat Faraz Danish)
Write assembly code to generate 1000 uSeconds delay using DJNZ instructions and display calculation in tabular form (for each instruction separately too). TASK DESCRIPTION: In this task we have to generate a delay of 1000 uSeconds using DJNZ. TASK CODE ORG 0000H DELAY: MOV R1,#02H ;INITIALIZES R1 WITH 2HEX AGAIN: MOV R0,#06H ;INITIALIZES R0 WITH 6HEX HERE: DJNZ R0,HERE ;DECREMENTS R0 R0 TIMES DJNZ R1,AGAIN ;DECREMENTS R1 MOVES TO AGAIN RET END TASK FLOW CHART Instruction Machine Cycles (A) Repeatetion (B) C= AxB MOV 1 3 3 DJNZ 2 12 24 RET 2 1 2 Total 29 Total Time in Sec 291.085us (^) 3.21 ๐๐โ๐
Submitted By: (Zaheer ul Islam) (M.Bilal Arshad) (Rehmat Faraz Danish) TASK DEBUGGER CONCLUSION: From this task we learned how we can create a delay using loop i.e DJNZ.
Write assembly code to write 00H and FFH to accumulator after 10 uSeconds and display calculation in tabular form (for each instruction separately too). TASK DESCRIPTION : In this task we have to write a code in which we have to overwrite 00H on FFH on accumulator after 10u seconds delay. TASK CODE: ORG 0000H MOV A,#00H ;INITIALIZES A WITH 00H ACALL DELAY ;CALLS DELAY MOV A,#0FFH ;INITIALIZES R0 WITH FFH ACALL DELAY ;CALLS DELAY DELAY: MOV R3,#03H ;INITIALZES R3 WITH 03H HERE: DJNZ R3,HERE ; DECREMENTS R3 R3 TIMES RET END
Submitted By: (Zaheer ul Islam) (M.Bilal Arshad) (Rehmat Faraz Danish)
Write assembly code to generate 10 mSeconds delay using DJNZ instructions and display results in tabular form using nested loops. TASK DESCRIPTION: In this task we have to code a program which will have to generate a delay of 10msecond using DJNZ. TASK CODE: ORG 0000H MOV R0,#2 ;R0= INITIALIZE: MOV R1,#255 ;R1= LOOP1:DJNZ R1, LOOP1 ;DECREMENT R1 TIMES LOOP2: DJNZ R0,INITIALIZE ;DECREMENT R0 TIMES RET ;RETURN TO CALLER END ; END OF ASM FILE TASK DEBUGGER: Instruction Machine Cycles (A) Repeatetion (B) C= AxB MOV 1 3 3 DJNZ 2 512 1024 RET 2 1 2 Total 1029 Total Time in Sec 1029*1.085us 0.
Submitted By: (Zaheer ul Islam) (M.Bilal Arshad) (Rehmat Faraz Danish) TASK FLOWCHART: TASK CONCLUSION: In this task we wrote a code to generate 10m seocnds delay.
Submitted By: (Zaheer ul Islam) (M.Bilal Arshad) (Rehmat Faraz Danish) TASK FLOWCHART: RESULTS AND CONCLUSION: In this task we have to code in a way to toggle port 1 with an address keeping time delay.
Submitted By: (Zaheer ul Islam) (M.Bilal Arshad) (Rehmat Faraz Danish)
In this lab we learned how we can apply loops in keil uvision and how we can introduce delay to our machine and furthermore after this lab we are able to deduct calculate time delay and implement different coding techniques to produce desired delay such as nested loop sequence.