Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9252865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:03:55+00:00 2026-06-18T11:03:55+00:00

The most heard advice in embedded programming is keep your interrupts short. Now my

  • 0

The most heard advice in embedded programming is “keep your interrupts short”.

Now my situation is that I have a very long running task in my main() loop (writing large blocks of data to SDcard), which can sometimes take 100ms. So to keep my system responsive I moved all other stuff to interrupt-handlers.

For example, normally one would handle the incoming UART data in an interrupt, then process the incoming command in the main() loop, and then send back the response. But in my case, the whole processing/handling of the commands also takes places in the interrupts, because my main() loop can be blocked for (relatively) long periods.

The optimal solution would be to switch to an RTOS but I don’t have the RAM for it. Are there alternatives for my design where the interrupts can be short?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T11:03:56+00:00Added an answer on June 18, 2026 at 11:03 am

    The traditional approach for this is for Interrupts to schedule a deferred procedure and end the interrupt as soon as possible.

    Once the interrupt has finished, the list of deferred procedures is walked from most-important to least important.

    Consider the case where you have your main (lower proiority) action, and two interrupts I1 and I2, where I2 is more important than main, but less important than I1.

    In this case, let’s suppose you’re running main and I1 fires. I1 schedules a deferred procedure and signals to the hardware that I1 is done. I1’s DPC now begins running. Suddenly I2 comes in from the hardware. I2’s interrupt takes over from I1’s DPC and schedules I2’s DPC and signals to the hardware that it’s done.

    The scheduler then returns to I1’s DPC (because it is more important), and when I1’s DPC completes, I2’s DPC begins (because it is more important than main), and then eventually returns execution to main.

    This design allows you to schedule the importance of different interrupts, encourages you to keep your interrupts small, and allows you to complete DPCs in an ordered and in-order prioritized way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have heard several podcasters (most recently the guys on DotNetRocks ) say that
Most people have heard of Content Management Systems. However, what basic features should an
Now I've heard the expression maths is the language if the universe; and most
I've heard more than one person say that if your build process is clicking
I have an MVC 4.5 project that has most of the UI logic organized
I have heard that in Windows, parameters are passed a single parameter, and then
I have heard lot about Javascript: Module Pattern . But most of those articles
I have multiple URLs that returns zip files. Most of the files, I'm able
Most of the ASP.NET MVC paging solutions I have found by googling look like
This may seem obvious to most people, but I'm just trying to confirm that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.