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

  • Home
  • SEARCH
  • 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 8034879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:08:58+00:00 2026-06-05T02:08:58+00:00

I have a question to ask regarding about external interrupt program. If i’m using

  • 0

I have a question to ask regarding about external interrupt program. If i’m using INT1(External Interrupt 1 set to Falling Edge) of DS89C450 and my program of the external interrupt is very long, will it function properly? or will there be any problem with it?
I’m using Keil embedded C.

  • 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-05T02:09:00+00:00Added an answer on June 5, 2026 at 2:09 am

    Another way to do this without an RTOS is to use event flags and state machines. Your program can be diagrammed into discrete states that transition when a particular event is called. For example, in this diagram I found using google:

    enter image description here

    A button click is an event; something that can be triggered from your INT1 interrupt for example. You would then put the following loop in the foreground:

    #define STATE_POWER_OFF   1
    #define STATE_POWER_ON    2
    
    #define EVENT_BUTTON_CLICK  0x01
    
    volatile unsigned char bEventFlags = 0;
    unsigned char bState = STATE_POWER_OFF;
    
    unsigned char getEventFlags( void ) ;
    
    int main(void)
    {
        for(;;)
        {
            unsigned char flags = getEventflags() ;
    
            if (flags != 0)
            { 
               switch (bState)
               {
                    case STATE_POWER_OFF:
                        if (flags & EVENT_BUTTON_CLICK)
                        {
                            // Do something
                            bState = STATE_POWER_ON;
                        }
                        break;
    
                    case STATE_POWER_ON:
                        if (flags & EVENT_BUTTON_CLICK)
                        {
                            // Do something
                            bState = STATE_POWER_OFF;
                        }
                        break;
                }
            }
        }
    }
    
    unsigned char getEventFlags( void )
    {
        unsigned char flags = 0 ;
    
        // Get copy of flags in critical section and clear down
        _disable_interrupts() ;
        flags = bEventFlags ;
        bEventFlags = 0 ;
        _enable_interrupts ;
    
        return flags ;
    }
    

    And your ISR would then be very short:

    void INT1_ISR(void)
    {
        bEventFlags |= EVENT_BUTTON_CLICK;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Well,i have a weird question to ask,sometimes when designing a form and using lots
[i meant to ask this question on StackOverflow...] I have been using VisualSVN Server
Hello every one I want to ask a question about file transfer using sockets.
I have a question about best practices regarding how one should approach storing complex
This is the second question i have had to ask regarding the building of
guys I have two question to ask, they're easy, but bothering me for a
I have seen stackoverflow ask question page they disable button until my postback event
I have a question that I'm ashamed to ask, but I'm going to have
I have to ask this question because I'm stuck, and I think its because
I have to really ask this question as I donot know Python. Following are

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.