The need for this project aroused when once I was trying to interface uart and multiplexed ssds together. The problem was that I had to do 2 process simultaneously that is receive characters from uart send them back to uart, print them at the same time update all ssds. Now ssds use persistent of vision that is a particular ssd is turned on digit is displayed on it then after few microseconds other ssd is turned on and corresponding digit is displayed and this goes on for other ssds also. So as a solition to this, a mechanism had to be developed that after few us turns on a ssd displays digit, then after few us turns other ssd on displays corresponding digit and at the same time receive digits from uart put them back and displays on term. And apart from displaying on term also update digits to be displayed on ssds.
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.