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.

RESTART while(1), after occcuring an interrupt

Status
Not open for further replies.

akhilfrancis

Junior Member level 2
Joined
Jan 13, 2017
Messages
20
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
180
Hi,

Is it possible to restart while(1) in c code, after occurring an interrupt / satisfying any conditions
 

Hello!

Being a while(1), when you get out from the interrupt ore from a conditions, you shoul get back to the main.

If not something wrong must happen!

Hope to be helpful
 

while running the while loop, in middle of the while loop, i i got an interrupt. is it possible restart the while loop from the begining
 

But how do you know you are in the middle or beginning when interrupt happens?
 

Hi,

for me it makes no sense.

This means you don´t finish your current operation/function ... then for sure you need to initailize a lot of processes again.

Example:
* Let´s assume you are in the middle of an I2C, SPI or UART communication.. and don´t finish it. What happens to the bus sate and protocol?

* Or you are just in a function and you had some data pushed on the stack... how do you decide to handle this?

Klaus
 

Is it possible to restart while(1) in c code, after occurring an interrupt

Let the watchdog conter overflows, so your program will be interrupted and will restart from beginning. Anyway, the question itself do not make sense at all, considering that this would imply in a break on the program execution.
 

Set a flag in the ISR which is tested at an appropriate point in the while loop and causes it to execute a 'continue' statement.
At least that way you retain control of whatever processing is occurring in the 'while' loop.
Susan
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top