APPENDIX 2. The electronic ping-pong program
This small embedded system is a game for two players, each of whom has a push-button ‘paddle’. Either player can start the game by pressing his/her paddle. The ball, represented by the row of eight LEDs, then flies through the air to the opposing player, who must press his/her paddle only when the ball is at the end LED and at none other. The ball continues in play until either player violates this rule of play. Once this happens, the non-violating player scores and the associated LED is briefly lit up. When the ball is out of play, an ‘out-of-play’ LED is lit.
A picture of the ping-pong game is shown in Figure 1.3. Its circuit diagram appears in Figure A2.1, with its program listing forming the ...

Get Designing Embedded Systems with PIC Microcontrollers, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.