A/D converter interrupt service exercises
Level crossing time difference detector
The ADC interrupt service routine should count the number of samples taken between two level crossings of the input signal. The beginning of the measurement should start when the signal crosses the first level upwards, and should stop when it crosses the second level downwards. Setting a flag bit should start the measurement and this flag must be cleared at the end of the measurement.