microprocessor: delay technique
TRANSCRIPT
![Page 1: Microprocessor: Delay technique](https://reader035.vdocument.in/reader035/viewer/2022071818/55ae4eeb1a28abd7738b46d3/html5/thumbnails/1.jpg)
Delay Technique
MCS-51 Microcontroller
![Page 2: Microprocessor: Delay technique](https://reader035.vdocument.in/reader035/viewer/2022071818/55ae4eeb1a28abd7738b46d3/html5/thumbnails/2.jpg)
Why Delay?
• CPU run with 11.059MHz clock frequency
• 1 Machine cycle (about 1 Second)
• Human eyes able to see only 14 frame / Second
![Page 3: Microprocessor: Delay technique](https://reader035.vdocument.in/reader035/viewer/2022071818/55ae4eeb1a28abd7738b46d3/html5/thumbnails/3.jpg)
How to Delay ?
• Create loop (Each loop take time to complete)
• Create Nested loop to make more delay
• Use DJNZ as a tools for loop
• Write the code as Sub routine for easy to use them.
![Page 4: Microprocessor: Delay technique](https://reader035.vdocument.in/reader035/viewer/2022071818/55ae4eeb1a28abd7738b46d3/html5/thumbnails/4.jpg)
Create loop
MOV R7, #XXH
Loop_inner:
NOP
NOP
DJNZ R7, Loop_inner
R7 = #XXH
Process
Loop_inner:
DJNZ R7, Loop_Inner
![Page 5: Microprocessor: Delay technique](https://reader035.vdocument.in/reader035/viewer/2022071818/55ae4eeb1a28abd7738b46d3/html5/thumbnails/5.jpg)
Create Nested loop
MOV R6, #XXH
Loop_Outter:
MOV R7, #XXH
Loop_inner:
NOP
NOP
DJNZ R7, Loop_inner
DJNZ R6, Loop_Outter
R7 = #XXH
Process
Loop_inner:
DJNZ R7, Loop_Inner
R6 = #XXH
Loop_Outter:
DJNZ R6, Loop_Outter
Process
![Page 6: Microprocessor: Delay technique](https://reader035.vdocument.in/reader035/viewer/2022071818/55ae4eeb1a28abd7738b46d3/html5/thumbnails/6.jpg)
Create Nested of Nested loop
MOV R5, #XXH
SuperLoop:
MOV R6, #XXH
Loop_Outter:MOV R7, #XXH
Loop_inner:
NOP
NOP
DJNZ R7, Loop_inner
DJNZ R6, Loop_Outter
DJNZ R5, SuperLoop
R6 = #XXH
Loop_Outer:
DJNZ R6
R5 = #XXH
SuperLoop:
DJNZ R5
Process
goto SuperLoop
goto Loop_Outer
Delay
![Page 7: Microprocessor: Delay technique](https://reader035.vdocument.in/reader035/viewer/2022071818/55ae4eeb1a28abd7738b46d3/html5/thumbnails/7.jpg)
Sample Delay Code
DELAY_100ms: MOV R7, #64H
DELAY_1ms_1:MOV R6, #0E6H
DELAY_1ms_2:NOPNOPDJNZ R6, DELAY_1ms_2DJNZ R7, DELAY_1ms_1
![Page 8: Microprocessor: Delay technique](https://reader035.vdocument.in/reader035/viewer/2022071818/55ae4eeb1a28abd7738b46d3/html5/thumbnails/8.jpg)
Write as Subroutine
Delay100ms:
MOV R6, #0FFH
Loop_Outter:MOV R7, #0FFH
Loop_inner:
NOP
NOP
DJNZ R7, Loop_inner
DJNZ R6, Loop_Outter
RET
![Page 9: Microprocessor: Delay technique](https://reader035.vdocument.in/reader035/viewer/2022071818/55ae4eeb1a28abd7738b46d3/html5/thumbnails/9.jpg)
Question ?
• How to make more delay?
– Add the NOP Instruction
– Increase initial value
– Create more nested loop
![Page 10: Microprocessor: Delay technique](https://reader035.vdocument.in/reader035/viewer/2022071818/55ae4eeb1a28abd7738b46d3/html5/thumbnails/10.jpg)
DC Motor
• Small size
![Page 11: Microprocessor: Delay technique](https://reader035.vdocument.in/reader035/viewer/2022071818/55ae4eeb1a28abd7738b46d3/html5/thumbnails/11.jpg)
Transistor
![Page 12: Microprocessor: Delay technique](https://reader035.vdocument.in/reader035/viewer/2022071818/55ae4eeb1a28abd7738b46d3/html5/thumbnails/12.jpg)
Relay
![Page 13: Microprocessor: Delay technique](https://reader035.vdocument.in/reader035/viewer/2022071818/55ae4eeb1a28abd7738b46d3/html5/thumbnails/13.jpg)
Stepping Motor
• Program to
– Fill value #F0 to #FFH to memory address 20h to 2Fh
– Fill value #00 to #0FH to memory address 30h to 3Fh
– Make Left shift for every number that is just filled.
Refer to the display of the Emulator 8051 Software
– Complete the Additional operation (Don’t care carry flag) of Top and bottom, store the result on the 40h to 4Fh. Such as
• 20h + 30h store in 40h
• 21h + 31h store in 41h and so on.
![Page 14: Microprocessor: Delay technique](https://reader035.vdocument.in/reader035/viewer/2022071818/55ae4eeb1a28abd7738b46d3/html5/thumbnails/14.jpg)
Speaker
![Page 15: Microprocessor: Delay technique](https://reader035.vdocument.in/reader035/viewer/2022071818/55ae4eeb1a28abd7738b46d3/html5/thumbnails/15.jpg)
Sample Question (Design)
• Write