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.

How to solve this interrupt issue ?

Status
Not open for further replies.

milan.rajik

Banned
Joined
Apr 1, 2013
Messages
2,524
Helped
540
Reputation
1,078
Reaction score
524
Trophy points
1,393
Activity points
0
I am making a water level system using two flow sensors. One will be fixed to pump and another to over head tank outlet. I will interface the sensor outputs to INT0 and INT1 or T0CKI and T1CKI pins. If water is being pumped and at the same time water is being drained from over head tank both interrupts can occur at the same time. How to solve this issue. The rate of flow of water from overhead tank outlet will be less compared to the one being pumped to overhead tank.
 

Dear Milan.rajik
you can use both sensor with priority basis, according that process you should have give priority using IP register.
 
I thought of that but what if both T0CKI and T1CKI interrupts occur at the same time ? The ISR will only contain 2 counters, one for each sensor. Once every 20 seconds the counter value is used to make some calculations.

Are all hardware interrupts like, CC, INTx, Timerx are parallel that is they can interrupt at the same time in hardware and set their respective interrupt flags like both INT0 and INT1 can occur and set INT0IF and INT1IF ?

Earlier I though of making fluid level monitering system using ultarsonic sensors and thought using MAX485 or Xbee but the cost will be high but using flow sensors will reduce the price. I found good 40 L/min Hot & Cold Water flow sensors. I am going to use it. Just want to make sure that it can work. I don't know home many pulses it gives per second.



Edit:

I found that it gives 330 pulses per liter and my pump pumps around 15 liters per minute. So, it is 15 * 330 = 4950 pulses per minute. It is an open collector type sensor. I found that at Futurlec.

https://www.futurlec.com/Flow_Sensor.shtml

So, 83 pulses per second and 83 interrupts can occur in a second. So, what happens if 83 interrupts occur at both INT0 and INT1 continuously ?
 
Last edited:

if both interrupts are the same priority once you get an interrupt it will be serviced even if the processor receives a change on the input to the other interrupt. Once you clear the interrupt flag for the first interrupt (usually the last thing in the interrupt service routine) the other interrupt will occur and be serviced.

If one interrupt has a higher priority it can interrupt the interrupt service routine of the lower priority interrupt which will resume when servicing the high priority interrupt is complete.

The main thing is to keep the interrupt service routines as short as possible with any calculations and logging etc carried out in the main function.
 
Thank you horace. The ISR will only increment two counters.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top