Published:2011/8/5 1:41:00 Author:Li xiao na From:SeekIC
By Andy Morell
Operation
The game is played using two potentiometers and two switches. SI serves to serve a ball. S3 is the speed selector. When it is closed, the ball moves faster making the game more difficult to play. There is a connection for a third switch (S2) but this is not used in the Pong game. P3 and P4 may be ordinary rotary potentiometers but slide pots will of course give a more realistic con¬trol of the bats on the field. A real joy¬stick is of coursed the ultimate.
Analogue’ PC joysticks in general con¬tain two potentiometers, one for each direction (horizontal and vertical). In most cases 470-kohm pots are used of which the 0-120 kohm resistance range is actually used. For our circuit, a resistance range of 0-4.7 kohm is required, so if a joystick is connected, a resistor has to be connected in paral¬lel with the input (between +5 V and pin 2 / 3 of the PIC) to make sure a much lower resistance is obtained. The equivalent resistance of the parallel network is calculated from
1/Req = 1/R1 + 1/R2
So, if we want 4.7 kohms and the joystick Rl = 120 kohms then
1/R2= l/120k-l/4.7k R2 = 4.89 k
In practice no problems will occur if you use a resistor of 4.7 kohms.
Pins 1 and 3 on the 15-way joystick connector (a sub-D type) are for the horizontal direction and pins 1 and 6 for the vertical direction.
Finally, Rl/Cl and R2/C2 suppress noise generated by the potentiometers as they are operated.
Construction
The printed circuit board (Figure 2) consists of two parts interconnected with a piece of Saleable. Building the LED matrix is sure to take some time. Although the job itself is straightfor¬ward, we should emphasize the impor¬tance of checking the LED polarity because it is hard to think of anything more annoying than 88 LEDs fitted the wrong way around. Usually, the cath¬ode is the largest surface inside the LED as well as the shorter pin. Usu¬ally... not always, so make sure of the polarity and in case of doubt use a con¬ductance tester.
The orientation of the 7-segment dis¬plays may appear to be wrong but if you follow the indications on the com¬ponent overlay shown in Figure 2 the circuit will work as expected. The polarity of the electrolytic capaci¬tors and transistors in the circuit also deserve your attention. Also, run a double check on the orientation of the PIC micro before inserting it into its socket — after all, the PIC is the most expensive component.
The circuit board is best mounted into a case that will also accommodate the switches, mains adapter socket, pots and LEDs. A red bezel on top of the matrix clearance and the score dis¬plays will provide the finishing touch to the game.
If necessary the game may be pow¬ered by four AA batteries. In that case the current through the LEDs has to be reduced, however, by increasing the value of R8-R15. This is necessary to save battery power.
Software
That leaves us with the software burned into the PIC micro, here, a PIC18F452. Since we are looking at a game that should not cost too much, we looked for an ultra-simple programmer that allows anyone to program the chip using his/her PC. The article ’Free PlCProg’ elsewhere in this issue comes up with the goods. As usual, the PIC software for his project may be obtained free of charge from our website as file number 030320-11 (see Free Downloads, month of publication) The PIC assembly code file is well commented.
Reprinted Url Of This Article: http://www.seekic.com/blog/project_solutions/2011/08/05/Pocket_Pong__a_primeval_game_cast_in_modern_hardware_(2).html
Print this Page | Comments | Reading(355)
Author:Ecco Reading(30193)
Author:Ecco Reading(3461)
Author:Ecco Reading(3181)
Author:Ecco Reading(3662)
Author:Ecco Reading(5231)
Author:Ecco Reading(3248)
Author:Ecco Reading(3390)
Author:Ecco Reading(3530)
Author:Ecco Reading(3935)
Author:Ecco Reading(3707)
Author:Ecco Reading(3677)
Author:Ecco Reading(3714)
Author:Ecco Reading(6028)
Author:Ecco Reading(3692)
Author:Ecco Reading(4478)