Bird
0
0

Which of the following is the correct way to write an ISR (Interrupt Service Routine) in FreeRTOS?

easy📝 Syntax Q12 of 15
FreeRTOS - Interrupt Management
Which of the following is the correct way to write an ISR (Interrupt Service Routine) in FreeRTOS?
Avoid ISR_Handler() { vTaskDelay(100); }
Bvoid ISR_Handler() { while(1) {} }
Cvoid ISR_Handler() { delay(1000); }
Dvoid ISR_Handler() { BaseType_t xHigherPriorityTaskWoken = pdFALSE; xSemaphoreGiveFromISR(&xSemaphore, &xHigherPriorityTaskWoken); }
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct ISR practices in FreeRTOS

    ISRs must be quick and use FreeRTOS-safe functions like xSemaphoreGiveFromISR.
  2. Step 2: Check each option for ISR correctness

    void ISR_Handler() { BaseType_t xHigherPriorityTaskWoken = pdFALSE; xSemaphoreGiveFromISR(&xSemaphore, &xHigherPriorityTaskWoken); } uses xSemaphoreGiveFromISR with proper parameters, which is correct.
  3. Final Answer:

    void ISR_Handler() { BaseType_t xHigherPriorityTaskWoken = pdFALSE; xSemaphoreGiveFromISR(&xSemaphore, &xHigherPriorityTaskWoken); } -> Option D
  4. Quick Check:

    Use FreeRTOS-safe calls in ISR [OK]
Quick Trick: Use FreeRTOS-safe calls inside ISR [OK]
Common Mistakes:
  • Calling blocking functions like vTaskDelay inside ISR
  • Using infinite loops inside ISR
  • Using non-ISR safe delay functions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes