Oh, misread you a bit. How about this:
Instead of concentrating on timing and monitoring the input with the hardware, why not set up a 50% duty cycle PWM signal on an output, running continuously at 16hz, not needing any help from the program, all driven by the hardware.
Use the program (pulsin) to monitor the input and change the PWM registers to match the input once it gets above 16hz. Set the pulsin_max to a pulse width corresponding to 16hz at your oscillator speed (ie. OSC is 4mhz, pulsin_max value is 10us per count, pulsin_max = 6250).
With the PWM module, you can change freq and duty cycle, all you have to do is the math for it and change the registers to suit your needs.
Or am I still out in left field for what you're wanting...
Bookmarks