hi, maybe i can suggest some ideas.
a question first.
Do you want to be able to read/see the number of times the pump was shut off for records?
or
do you want to use that number in your code? (ok i see you want to use it in your code)
How many times do you expect the pump to be cycled on/off? this will help you decide
if you should use a bit, byte or word. (Variables - General page 10 in PICAXE_manual2)
www.picaxe.com/docs/picaxe_manual2.pdf
In the area of the code that shuts the pump off is where you should count because you can only shut off what
was on to start with.
and if you want to retain that number in memory if after power is off then you should store it in the eeprom
of the PICAXE. the command is page 61 or 62
note* im going to use a word in this pseudo example:
IF YOUR WORD OR BYTE IS LARGER THEN IT SHOULD BE YOUR CHIP MAY LOCK UP AND WILL NEED TO BE RESET.
so make sure you have something that can reset the value of the integer before it goes over
Byte variables can store integer numbers between 0 and 255
Words are capable of storing integer numbers between 0 and 65535
Code:
symbol PumpCycleCount = w2 ' w2 is also b5 and b4
symbol PresetNumber = w3 ' w3 is also b7 and b6
PresetNumber = 5 'or any other number you need
...
if batchHI = 1 or ClarLO = 0 then
low batchp 'Batch pump OFF
PumpCycleCount = PumpCycleCount + 1 ' this will make a counter for the pump cycles.
if PumpCycleCount = PresetNumber then
PumpCycleCount = 0
goto DoAnotherAction
endif
endif
return
DoAnotherAction:
other action code
...
return
I hope this helps
Regards from MN, USA