
Site Search
Chapter#4 - THE BRANCH, CALL, AND TIME DELAY LOOP CALCULATIONS IN PIC MICRO-CONTROLLER
Upon Completion of this chapter, You will be able to:
- Code PIC Assembly Language Instructions to create loops
- Code PIC Assembly Language conditional branch instructions
- Explain conditions that determine each conditional branch instruction
- Code GOTO (Long Jump) instructions for unconditional jumps
- Calculate target addresses for conditional branch instruction
- Code PIC Subroutines
- Describe the stack and its use in subroutines
- Discuss pipelining in the PIC
- Discuss crystal frequency versus instruction cycle time in the PIC
- Code PIC programs to generate a time delay.
SECTION I - BRANCH INSTRUCTIONS AND LOOPING
- SECTION I-1: Looping Action in PIC micro-controller
- SECTION I-2: DECFSZ Instruction and Looping in PIC micro-controller
- SECTION I-3: BNZ instruction for Looping in the PIC micro-controller
- SECTION I-4: Loop Inside a Loop in the PIC micro-controller
- SECTION I-5: Looping 100,000 Times in the PIC micro-controller
- SECTION I-6: PIC micro-controller Conditional Branch Instructions
- SECTION I-7: BZ, Branch if Z = 1 Instruction in the PIC micro-controller
- SECTION I-8: BNC, Branch If no Carry, Branch if CY = 0 in PIC micro-controller
- SECTION I-9: All Conditional Branches are short Jumps in the PIC micro-controller
- SECTION I-10: Calculating the short Branch Address the PIC micro-controller
- SECTION I-11: Unconditional Branch Instruction GOTO in the PIC micro-controller
- SECTION I-12: The GOTO to Itself Using $ Sign in the PIC micro-controller
SECTION II - CALL INSTRUCTIONS AND STACK IN THE PIC MICRO-CONTROLLER
- SECTION II-1: 4 Byte, 32 Bit CALL Instruction in PIC micro-controller
- SECTION II-2: Stack and Stack Pointer in the PIC18 micro-controller
- SECTION II-3: Stack Accessed and Pushing onto and Popping from the Stack
- SECTION II-4: Call Instruction and Role of the Stack in PIC microcontroller
- SECTION II-5: The Upper Limit of the Stack in PIC micro-controller
- SECTION II-6: Calling Many Subroutines from the Main Program in PIC micro-controller
- SECTION II-7: RCALL (relative call) in the PIC micro-controller
SECTION III: PIC18 TIME DELAY AND INSTRUCTION PIPELINE
- SECTION III-1: Delay Calculations for the PIC18 micro-controller
- SECTION III-2: The idea of pipelining in the PIC micro-controller
- SECTION III-3: Instruction Cycle Time for the PIC microcontroller
- SECTION III-4: Branch Penalty in the PIC microcontroller
- SECTION III-5: Delay Calculation for PIC18 micro-controller
- SECTION III-6: Loop Inside a Loop delay in PIC micro-controller
- SECTION III-7: PIC micro-controller Multistage Execution Pipeline
Basic Introduction of Chapter # 4
In This Chapter the flow of a program proceeds sequentially, from instruction to instruction, unless a control transfer instruction will be executed. The various types of control transfer instruction in Assembly Language include conditional and unconditional branches and call instructions. Looping in PIC assembly language will be performed using an instruction to decrement a counter and to jump to the top of the loop if the counter is not zero. The will be accomplished with the BNZ instruction. Other branch instructions jump conditionally, based on the value of the carry flag, the Z flag, or other bits of the status register. Unconditional branches can be long or short, depending on the location of the target address. Special attention will be be given to the effect of CALL and RCALL instructions on the stack.