i think you may use a bi-stable multivibrator circuit with V(spike) adapted to switching at V=Vmax,thats what i think.I 'd be happy to help u .