If you know the period of your waveform, you could write code that detects when the input is 0 for a period of time that is slightly longer than the period of your waveform.
1. Note time that waveform goes to zero.
2. If waveform goes to 1 reset your timer.
3. Loop and watch your timer, if the time minus noted time is greater than the waveform period, then write out the noted time.