Happens if hardware interrupt and timer interrupt are activated simultaneously totally depends on the hardware as interrupts are concept that can be implemented in many different ways.I assume that I am working on the system that performs 102 tasks. This entire system has 100 normal tasks and 2 very important tasks
suppose main routine complete 100 tasks and we have two interrupt routine tasks
Task 101 : Whenever panic button press, alert buzzer should ring
Task 102 : check temperature of system at every 1 ms if it is greater then specified range. stop system
You can see that while loop is busy to complete 100 tasks. but whenever panic button will press processor will stop whatever is doing in while loop and it will execute whatever written in hardware interrupt routine. Same when timer interrupt generate, processor will stop what it is doing in main routine for 1msC:main () { while (1) { Task1(); Task2(); Task100(); } } interrupt1 // hardware interrupt { if (panic button pressed) { ring buzzer; } } interrupt1 // timer interrupt for every 1ms { if (temprater >44) { stop system; } }
I just wants to know what happens if hardware interrupt and timer interrupt are activated simultaneously
C:
interrupt // interrupt
{
if (panic button pressed)
{
ring buzzer;
}
if (timer interrupt ) {
if (temprater >44)
{
stop system;
}
}
}
Exactly simultaneous interrupts here would only (as a simplification of the actual hardware sequence) set flags and cause one ISR execution to handle both interrupts.
Another interrupt hardware implementation would be one level, multi ISR vector hardware with a internal call sequence to a address (a ISR vector) for each interrupt source.
C:
interrupt1 // hardware interrupt
{
if (panic button pressed)
{
ring buzzer;
}
}
interrupt2 // timer interrupt for every 1ms
{
if (temprater >44)
{
stop system;
}
}
Another possibility is multi level, ISR vector (single or multi vectors per level) hardware that can handle preemption of ISR individual event vector execution.
Last edited: