I haven't given up yet on an Arduino solution! CMOS 4000 series requires virtually no input voltage conditioning because 3 chips are powered from a step down 9V regulator and the flow sensor is Hall effect on the same supply outputing clean pulses. The 3 CD4089s drop input pulses in real time and each have a hex switch and are battery backed to save a mid count when the 12-14V supply is removed. I could have used 2 chips but 3 gives better accuracy.
Back to Arduino basic concepts which is where I came in: Liquid flow sensors are often specified with a 'K' factor rating (pulses per liter) and flow versus pulse output is close to linear with an error margin of 1-2%. So one flow sensor could have a 'K' factor of 22000 and another much lower at 3779. A 'precision' flow sensor K=2200 will have a smaller rotating vane with more magnets per vane.
It's easy to match each flow sensor to a new display showing instantaneous flow and totalised volume in a new project. But in many cases the display electronics are fitted, already defined and the sensor has failed and may be obsolete. The challenge therefore would be a universal Arduino solution that could accept pulse inputs from a flow sensor with different 'K' values and output pulses Greater or Less than input whilst remembering the interediate pulse division or multiplication when the Arduino is powered off.
I chose a precision more expensive sensor with a K factor of 22000 because dropping pulses to match my existing flowmeter was easier. But a cheaper flow sensor costing <$10 could have done the job, but it's output pulse rate would have to be about 5.8X for a flowmeter calibrated for the expensive sensor - and for accuracy the pulse multiplier/divider won't be an easy whole number. The good news is mark space can be anything or variable as long as theconverted pulse count is the correct ratio.
My black box Arduino flowmeter converter would hold a programmable variable factor to 2 decimals. This variable would modify the pulse output to be X.XX times greater or lower than the input pulses and work in real time. When stopped during power down, it would restart without losing the intermediate calculated values.
Thanks for replies code snippets and suggestions so far. I'm willing to experiment with Arduino code, but still wanting to grasp the principle of what its structure should be like in a flow chart?
I understand dedicated CMOS architecture may be old fashioned to many implementing Arduino code, but they are building blocks I've used for years. I once tried to write universal code to use a cheap 12F PIC to replicate the 555 timer. It's quite hard and you have to voltage condition input and output current sink so it cannot replace a 555 on its own.