Question: Given the following assembly code for PIC 16 F877A which execute a hardware delay. Assume the Fosc= 4 MHz #include p16f8a.inc cblock Ox20 cl endc


Given the following assembly code for PIC 16 F877A which execute a hardware delay. Assume the Fosc= 4 MHz #include p16f8a.inc cblock Ox20 cl endc org 00 loop call hwDelay goto loop hwDelay banksel OPTION REG movlw Ox03 movwf OPTION REG movlw d'150' movwf cl s2 banksel TMRO movlw d'156' movwf TMRO S1 btfss INTCON, 2 goto sl bcf INTCON, 2 decfsz cl, F w goto s2 return end Q1 [2 Marks]: Calculate the delay produced by the assembly code Q2 [3 marks]: Use the calculated delay in Q1, and use the MPLAB to write an assembly code to run a software delay. Q3 [5 marks]: Based on 16F84A, use the MPLAB to write an assembly program that does the following: When an external interrupt occurs on rising edge, make PORTA reads input signal. When an external interrupt occurs on falling edge, make PORTA writes output signal. Note: 1. Plagiarism or cheating will not be tolerated. Zero mark will be assigned to all parties. 2. Late submission will be excluded. Due date of the assignment must be met. 3. You are allowed to work in individual or group of 2. More than two students are not allowed, and it will be considered as a Plagiarism. 4. Follow the exact submission in order to avoid losing marks. Submissions: Use the VCLASS to submit the following documents: Q1: The calculation of the delay. Q2: a. A screenshot of your source code b. A screenshot of the stopwatch showing the produced delay Q3: a. A screenshot of your source code b. A screenshot of the Stimulus and Watch views Given the following assembly code for PIC 16 F877A which execute a hardware delay. Assume the Fosc= 4 MHz #include p16f8a.inc cblock Ox20 cl endc org 00 loop call hwDelay goto loop hwDelay banksel OPTION REG movlw Ox03 movwf OPTION REG movlw d'150' movwf cl s2 banksel TMRO movlw d'156' movwf TMRO S1 btfss INTCON, 2 goto sl bcf INTCON, 2 decfsz cl, F w goto s2 return end Q1 [2 Marks]: Calculate the delay produced by the assembly code Q2 [3 marks]: Use the calculated delay in Q1, and use the MPLAB to write an assembly code to run a software delay. Q3 [5 marks]: Based on 16F84A, use the MPLAB to write an assembly program that does the following: When an external interrupt occurs on rising edge, make PORTA reads input signal. When an external interrupt occurs on falling edge, make PORTA writes output signal. Note: 1. Plagiarism or cheating will not be tolerated. Zero mark will be assigned to all parties. 2. Late submission will be excluded. Due date of the assignment must be met. 3. You are allowed to work in individual or group of 2. More than two students are not allowed, and it will be considered as a Plagiarism. 4. Follow the exact submission in order to avoid losing marks. Submissions: Use the VCLASS to submit the following documents: Q1: The calculation of the delay. Q2: a. A screenshot of your source code b. A screenshot of the stopwatch showing the produced delay Q3: a. A screenshot of your source code b. A screenshot of the Stimulus and Watch views
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
