PIC16F84 PONG

Discussion in 'Technical Discussion' started by Hodgy, Sep 6, 2010.

  1. Hodgy

    Hodgy

    Member
    797
    0
    16
    UK
    Games programming :)
    As the title says this is a game of pong that I have programmed for a PIC16F84 that is used in a circuit I have designed and put together for my electronics project :)

    <!--id1--><object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/Ufd_7XhIBtM&"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/Ufd_7XhIBtM&" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object><!--id2-->

    as you can see from the circuit diagram below it is fairly simple.
    to make the LED's light up in the dot matrix display 6 output pins are connected to 2 BCD to decimal encoders one of these handles the X axis the other handles the Y axis the outputs of one of these then nave to be inverted so that the signals work with the dot matrix display.
    The socring system uses by counting the pulses from 2 pins from the PIC chip using up counters that reset at 10 the outuput from these go to a BCD to 7-seg dencoder wich then goes to the 7-segment display. there are 2 of these one for each player.
    the circuits clock is generated from a 42pf capacitor and a 100Kohm resistor (contrary to what the diagram says this is what I ended up using)to generate a clockspeed of 238Khz (238095Hz)
    the inputs were handled with simple push switches, 2 for each player and a reset button.
    Below is the circuit diagram and a picture of the circuit made on protoboard.

    [​IMG]
    [​IMG]
    (the pic chip was removed from this picture as it was in its testing board while I was programming and debugging my program.)

    The source for the program I wrote for this chip is linked below:
    <a href="http://www.box.net/shared/sqfrdianyl" target="_blank">http://www.box.net/shared/sqfrdianyl</a>

    It is written in PIC assembler and I know it isnt perfect, I wrote it in a week after the first version of my program wouldn't work for unknown reasons O_o but it got the job done and worked well enough to earn me an A in the module (37/40) :D
     
  2. amphobius

    amphobius

    doing more important things with my life Member
    2,120
    0
    16
    life
    This is pretty cool. Nice to see you got an A, too. :)
     
  3. SegaLoco

    SegaLoco

    W)(at did you say? Misfit
    Yeah, that's pretty amazing :O
     
  4. TmEE

    TmEE

    Master of OPL3-SA2/3 Tech Member
    1,726
    1
    18
    Estonia, Rapla City
    T-04YBSC-A !
    cool stuff ^^
     
  5. Namo

    Namo

    take a screenshot of your heart Member
    2,912
    0
    0
    But can it run Crysis? :v:

    Seriously though, nice work.