Industrial washer controller - How to get program to monitor whilst in progress

Trying to decide the best approach for making a simplified industrial washer controller.

I'm stuck on the best way to monitor the inputs whilst having the ability to pause or stop the process.

Sensors to be monitored are a magnetic flowmeter. This can pulse up to 300Hz depending flowrate. To fill up the machine may take up to 15 minutes.

In the mean time I will also be opening and closing steam valves for heating so need to measure the temperature throughout the filling process. But this could be monitored every second for example.

I also need to monitor 2 switches, namely pause and stop.

With the flowmeter pulsing at 300Hz I'm trying to work out what is the best way to be able to monitor the other inputs without losing accuracy? I'm uncertain as to how long the various reads will take to check the other inputs.

Would it be best to put the flowmeter on an interrupt and only get it to increment a counter but at this speed, will the process ever go back to checking temp and inputs because it is being interrupted too often.

I have never used interrupts so far, so learning curve for me, but trying to work out the best approach first.


300 Hz isn't that much, that's a pulse every 3.3 mS. An interrupt can be serviced in about 5 uS, plus whatever time it takes to add to a counter, so maybe 6 uS in your case.

Thus counting with interrupts should be OK.

Thanks for the quick response.

So if I understand correctly, basically keep everything else in the normal loop and just count the flowmeter pulses using interrupts.

Yes, that should work.

Thanks, will now see what I can do... :)

Looking at your article on interrupts, mine should be EXCEEDINGLY easy... (famous last words!)