1 / 27

Chapter 3 JUMP, LOOP and CALL Instructions

Chapter 3 JUMP, LOOP and CALL Instructions. Outlines. Loop instructions Conditional jump instructions Conditions determining conditional jump Unconditional long & short jumps Calculate target addresses for jumps Subroutines Using stack in subroutines Crystal frequency vs. machine cycle

Télécharger la présentation

Chapter 3 JUMP, LOOP and CALL Instructions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 3JUMP, LOOP and CALL Instructions

  2. Outlines • Loop instructions • Conditional jump instructions • Conditions determining conditional jump • Unconditional long & short jumps • Calculate target addresses for jumps • Subroutines • Using stack in subroutines • Crystal frequency vs. machine cycle • Code programs to generate time delay

  3. Looping - DJNZ

  4. Loop inside a Loop (Nested Loop)

  5. 8051 Conditional Jump Instructions

  6. Conditional Jump Example - JNZ, JNC

  7. Conditional Jump Example

  8. Unconditional Jump Instructions • All conditional jumps are short jumps • Target address within -128 to +127 of PC • LJMP (long jump): 3-byte instruction • 2-byte target address: 0000 to FFFFH • Original 8051 has only 4KB on-chip ROM • SJMP (short jump): 2-byte instruction • 1-byte relative address: -128 to +127

  9. Calculating Short Jump Addresses

  10. Calculating Short Jump Addresses

  11. Call Instructions • LCALL (long call): 3-byte instruction • 2-byte address • Target address within 64K-byte range • ACALL (absolute call): 2-byte instruction • 11-bit address • Target address within 2K-byte range

  12. LCALL

  13. CALL Instruction & Role of Stack

  14. CALL Instruction & Role of Stack

  15. Using PUSH & POP in Subroutines

  16. Using PUSH & POP in Subroutines

  17. Using PUSH & POP in Subroutines

  18. Calling Subroutines

  19. Calling Subroutines

  20. ACALL (absolute call)

  21. Programming Efficiently

  22. Time Delay Generation & Calculation • 1 instruction = n machine cycle • 1 machine cycle = 12 clock cycles

  23. Delay Calculation

  24. Delay Calculation Example

  25. Delay Calculation Example

  26. Increasing Delay Using NOP

  27. Large Delay Using Nested Loop

More Related