Hi, Pickles

<< I have many stumbles/crashes ahead of me.>> absolutely right !!!

I think you've forgotten an input circuit ...as PIC 0/1 states specs are not exactly the values Mel gave you for shape detect ...

Second problem ... that don't work for a 1:2 input freq range ... need to mesure the freq. before looking for the waveform ...

Alain