Target processor: All the questions in this lab sheet should be targeted to the PIC16F877A. Description of Task 1: Three independent periodic processes P1, P2 and P3 are to be scheduled using a STATIC...








Target processor: All the questions in this lab sheet should be targeted to the PIC16F877A. Description of Task 1: Three independent periodic processes P1, P2 and P3 are to be scheduled using a STATIC Rate Monotonic cycle Scheduler (RMS). The RMS scheduler is pre-emptive and will thus require you to implement a user stack to store context information .All processes arrive initially at time instant 0. The processes are detailed in the table below: Process Execution time Deadline P1 4ms D1=20ms P2 10ms D2=40ms P3 40ms D3=80ms Table 1: Deadline and execution time of processes Each process will contain an empty wait loop and a signal. The signal will be output on a PORTB pin. i.e.: Voltage on pin RBx Signal 5v idle Overhead Wait Dx Execution Time Time/ Sec Figure 1: Graphical description of process X So for process 1 the deadline Dx = D1 and the signal pin is RB1, for process 2 the deadline Dx =D2 and the signal pin is RB2 and for process 3 the deadline Dx = D3 and the signal pin is RB4. When a process is pre-empted the process will be stopped and any required context information will be stored in a user defined stack. As can be seen from Figure 1 there will be some processor overhead required to handle the pre-emption of a given task and polling of the timer. You will need to determine this overhead and incorporate this into your timing. The system clock of the PIC is 4MHz, so the instruction rate is 1MHz. Some Tips: · Poll the 16-bit Timer, ‘Timer 1’ to determine when a given task should be executed. · Keep track of PCL, PCLATH (if required), STATUS and any other counter variables so that you can save and re-instate context information. TASK 1- Part A: Macro for user defined stack. Create a macro that will implement a user defined stack that allows the programmer to push and pull all required context data from/onto the accumulator and/or into file registers. Deliverables for Part A: In your report: · show the code for your macro, · explain how the STACK macro works · explain how it will meet the requirements of the problem detailed in the TASK A description. TASK 1- Part B: Processes Establish how you will pre-empt and poll the timer and then write code for processes P1, P2 and P3. Deliverables for Part B: In your report: · show code for processes P1, P2 and P3. · carefully explain using explanations and flowcharts how you will perform pre-emption and the associated context data handling. · Using detailed cycle time calculations carefully explain how the processes meet the timing requirements detailed in Table 1. Note: the processes should be written as subroutines. TASK 1 - Part C: Scheduler · write a STATIC scheduler algorithm that meets the requirements and implements the functionality discussed in the TASK 1 description section. · to reduce the required power requirements of the system make sure that your solution reduces overhead to a minimum. Deliverables for Part C: In your report: · show the complete code for your scheduler. · using a gantt chart show the time line for the scheduling of proceses P1 , P2 and P3 up to time =160ms. · explain how the scheduler algorithm works. · explain how the code implements the scheduling algorithm. · explain how the implementation of the scheduler has been optimised to ensure that overhead is kept to a minimum. · If timing and/or deadlines of your solution are not exact explain why this has happened and where possible identify any limitations of the hardware that may have caused this problem.
May 10, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here