In this input wave is given through I/O pin and then counting begins. Here also time scheduling is used. Timer 0 is set as fast interrupt request and after every 2 us ISR is executed. And a static variable count is incremented and if count==1 the status at I/O pin is stored in pre variable. Then again after 2 us ISR is executed and count is again incremented if count==2 status at input I/O pin is stored in nex variable and count=0. So after this we have previous state in pre and next state in nex. Then pre is compared with 0 and nex with 1 now if pre == 0 and nex == 1 means a positive edge has occurred so another variable num is incremented num++. Find out project circuit diagram, understand its code and put it to work.