【试题总结】: Consider the above synchSM. Round time answers to the nearest 100 ms, as in 500 rather than 499. Omit “ms” from your answers. When a button is pressed, a door bell rings. Given each timing specification, complete the corresponding synchSM constraints. Valid answers for questions 1-3 are (<, <=, >, >=, ==). 【定义】 A buffer IC may be added to a microcontroller output to increase the voltage and/or current drive capability a load resistor may be added to reduce a microcontroller’s output voltage to the desired voltage. In contrast, in the pull-up configuration, if a pin is not driven with a 0 or a 1, reading the pin yields a 1. If a microcontroller pin has a max output current of 25 mA, and an LED requires 15 mA, what is the maximum number of LEDs can be connected to that pin and still work properly?:1 The pull-up pulls the voltage up to 1 by default. Pressing the button completes a connection between ground and the pin, resulting in a reading of 0. Scheduler in ISR with flag indicating that ready tasks are being processed. A microcontroller executes a single synchSM task. Each task execution requires T ms. The task’s period is P ms. Determine the utilization for the following T and P values. Ready means the period has already elapsed and the task is now ready to execute. A waiting task is not ready to execute, but instead waiting for its period to elapse. Even if the microcontroller is available, a waiting task should not execute. Ideally, the moment a task becomes ready, the task would immediately begin executing. A task status can change from ready to waiting. Scheduling is the job of choosing which of several ready tasks to execute. A scheduler is the code responsible for scheduling tasks. A task’s deadline is the time by which a task must complete after becoming ready. Priority is an ordering of tasks indicating which ready task should execute first. A static-priority scheduler assigns a priority to each task before the tasks begin executing, and those priorities don’t change during runtime. 1.shortest deadlines. dynamic-priority scheduler determines task priorities as the program runs, meaning those priorities may change. The approach is known as earliest deadline first (EDF). 11.1 计算任务最坏执行时间 【错题总结】 状态的动作可能包括循环,函数调用,分支语句等悉尼科技大学期末复习笔记
Latency:The time between the input event and the triggered output event latency.
6.2.1: Latency.
6.2.2: Button/LED system timing.
6.3 Input conditioning
【问题】
6.4 Avoiding output glitching
Each state machine below waits for A7 to be pressed, then counts the number of 1s on the low nibble of input A and displays the result on B.
6.5 I/O electrical issues
【问题】解析: Only 1 LED can be connected to the pin without exceeding the max output current of the pin
6.6 Dealing with too few pins
7.1 Pulse width modulation
7.2 UARTs
7.3 Analog-digital conversion
8.1 Converting different-period tasks to C
8.2 Creating a task structure in C
typedef struct task { int state; // Task's current state unsigned long period; // Task period unsigned long elapsedTime; // Time elapsed since last task tick int (*TickFct)(int); // Task tick function } task; task tasks[V]; const unsigned short tasksNum = V; enum BL_States { BL_SMStart, BL_S1 }; int TickFct_BlinkLed(int state) { // ... } enum TL_States { TL_SMStart, TL_S1, TL_S2, TL_S3 }; int TickFct_ThreeLeds(int state) { // ... } int main() { unsigned char i = 0; tasks[i].state = W; tasks[i].period = 500; tasks[i].elapsedTime = Y; tasks[i].TickFct = &TickFct_BlinkLed; i++; tasks[i].state = TL_SMStart; tasks[i].period = X; tasks[i].elapsedTime = Y; tasks[i].TickFct = Z; // ... }
8.3 Code for a simple cooperative task scheduler
for (i=0; i < tasksNum; i++) { if (tasks[i].elapsedTime >= tasks[i].period){ // Task is ready to tick, so call its tick function tasks[i].state = tasks[i].TickFct(tasks[i].state); tasks[i].elapsedTime = 0; // Reset the elapsed time } tasks[i].elapsedTime += tasksPeriodGCD; }
Complete the task scheduler.
void TimerISR() { unsigned char i; for (i = 0; i < tasksNum ; i++) { if (tasks[i].elapsedTime >= tasks[i].period ) { tasks[i].state = tasks[i].TickFct(tasks[i].state ); tasks[i].elapsedTime = 0; } tasks[i].elapsedTime += tasksPeriodGCD; } }
9.1 Timer overrun
unsigned char processingRdyTasks = 0; void TimerISR() { unsigned char i; if (processingRdyTasks) { printf("Period too short to complete tasks.rn"); return; } processingRdyTasks = 1; for (i = 0; i < tasksNum; ++i) { // Heart of the scheduler code if ( tasks[i].elapsedTime >= tasks[i].period ) { // Ready tasks[i].state = tasks[i].TickFct(tasks[i].state); tasks[i].elapsedTime = 0; } tasks[i].elapsedTime += tasksPeriodGCD; } processingRdyTasks = 0; }
1. Detect if timer interrupt occurred while processing tasks; print error and return 2. Raise flag (means processing tasks) 3. Process tasks 4. Lower flag (means no longer processing tasks)
9.2 Utilization
9.3 Utilization for multiple tasks
Single task: Timer overrun shouldn’t occur;Multiple tasks: Timer overrun may occur.9.4 Scheduling
2.shortest-period tasks( rate-monotonic scheduling (RMS),)
3.shortest-WCET tasks
4.manually assign static-priorities to tasks9.5 Preemptive scheduler
10.1 Introduction to control systems
10.2 Proportional control
10.3 Proportional-derivative (PD) control
10.4 Proportional-integral-derivative (PID) control
可以通过用汇编指令数乘执行器执行每个汇编任务的时间来估算。
假设每条指令需要2微秒才能执行。
对于for循环,分析应包括循环初始化(i = 0:3个指令),加上循环控制指令(i <4,而i ++,所以2 + 3),并且还应将每个循环的指令相乘-迭代次数。上面的循环迭代4次。如果循环迭代次数与数据有关,则应使用迭代次数的上限。
WCET:worst -case exectue time
【错题整理】
基于下图回答问题:
9. S0的WCET是多少?3+2+3+3 = 11
10. S1的WCET是多少? 3+(3+3+2)*100+3 = 806
11. WECT是S0和S1的最长执行时间。
本网页所有视频内容由 imoviebox边看边下-网页视频下载, iurlBox网页地址收藏管理器 下载并得到。
ImovieBox网页视频下载器 下载地址: ImovieBox网页视频下载器-最新版本下载
本文章由: imapbox邮箱云存储,邮箱网盘,ImageBox 图片批量下载器,网页图片批量下载专家,网页图片批量下载器,获取到文章图片,imoviebox网页视频批量下载器,下载视频内容,为您提供.
阅读和此文章类似的: 全球云计算