Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Embedded C interrupt and while loop question

Status
Not open for further replies.

hithesh123

Full Member level 6
Joined
Nov 21, 2009
Messages
324
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Location
lax
Activity points
3,548
Basic question about while loop. It's common to use while loop for checking interrupt flag. Can I use while to check 2 interrupt flags -

while((!INT1F) & (!INT2F));

IAR gives me an error "Warning[Pa082]: undefined behavior: the order of volatile accesses is undefined in this ...."

Interrupt subroutine question -

let's say i am in a while loop waiting for interrupt flag - while(!INT1F);
This while loop is inside a function called ack().
But a time out interrupt occurs and I wanna get out of the function ack(). Is this possible?
 

Hello there,

Let me clarify one thing why are you using while loop for interrupt ?

The basic thing interrupt is a subroutine and most of the case its hardware control means through s/w only we can clear or read. When ever the interrupt occurs the hardware set interrupt flag bit ..so Our program execution would pause for a while to service the interrupt and it would continue .

. The processor responds by suspending its current activities, saving its state, and executing a small program called an interrupt handler (or interrupt service routine, ISR) to deal with the event. This interruption is temporary, and after the interrupt handler finishes, the processor resumes execution of the previous thread.

so just make ISR routine and code it.

Best regards.
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top