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 remainder of this appendix.

image

Figure A2.1 The electronic ping-pong circuit diagram

Program Example A2.1 The electronic ping-pong program

image image image image
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.37.68