Lecture 5: Digital Input Flashcards
What is response time?
It is the time difference between the presentation of inputs and the receival of corresponding outputs.
What is the WCRT?
It is the Worst Case Response Time.
What is Jitter?
It is the difference between the worst and best case response times.
What is an interrupt?
A signal that will notify the CPU when an event occurs. Hardware mechanism will capture the input with Software using ISR to respond.
What are the advantages of Interrupts?
The CPU doesn’t need to waste time checking.
Faster response time because of this.
What are disadvantages of Interrupts?
Interrupts can occur at any time, making it more complicated to program.
What are the two main categories of interrupts?
Ones that are triggered by an event that sets an interrupt flag.
Ones that are triggered as long as the interrupt condition is present.
What does interrupt Priority depend on?
The architecture of the system.
On the ATMega8, which has higher priority, a lower or higher ISR vector address?
The lower vector address.
What happens if 2 or more interrupts occur at the same time?
The one with the highest priority will be dealt with first. The other ones will go onto a wait list in order of priority.
What is the procedure for handling an interrupt?
- The interrupt will occur.
- The current program will be stopped.
- Jump into the ISR Service routine.
- Save registers onto the stack -> this includes the current registers being used, the program counter and stack pointer.
- Execute code in the ISR
- Restore registers from the stack.
- Continue program execution from where the program was stopped.
On the ATMega8, what are the locations of the 2 interrupts?
Pin 2 and 3 on register D.
How can we change whether or not the interrupt occurs on the rising or falling edge of the signal?
By changing bits in the MCUCR register.
What is interrupt latency?
It is the time between the event occurring and when the ISR is triggered.
What is interrupt response time?
It is a combination of the latency along with the execution time which is how long the ISR takes to execute.
What is the Foreground - Background approach?
Use the background as the infinite loop that performs the main functionality. The foreground is where the interrupts occur, we handle them with an ISR. Any critical events happen in the foreground but any long calculations should be passed to the background loop.
When will the ISR get processed?
When the background loop reaches that specific point.
What happens if the CPU takes too long to process an interrupt?
It will miss another interrupt.
What can happen if the switch is too short?
It can cause something like switch debouncing where a mechanical switch can cause multiple interrupts.
What is a critical section?
This is a piece of code that we don’t want to be interrupted so we disable interrupts for a small section.
What is a software approach to mitigating the risk of switch debouncing?
When the switch is pressed, wait a certain period of time and see if the switch is still pressed. If it is then accept the signal and proceed to further execution. Generally the period that we wait will still be faster than what a human can press a switch.