Microchip Technology

user Occupation hasn't been added

Company Logo Microchip

  • Tetris Video Game Using PIC microcontroller

  • Created: Jun 07, 2016

    • view4181
    • comment0
    • bookmark0
    • fork1


No description available.


The game Tetris is an Old Russian computer game, where you fit blocks into a field to complete a full horizontal line to score. The name came from a Greek prefix Tetra-, since all of the game pieces contain four segments, and tennis, the designer’s favorite sport. This circuit design is a PIC platform of the Tetris game. The PIC used is Microchip’s PIC16F84A-04/P, it is an 8-bit microcontroller that has a high performance RISC CPU with 13 I/O pins with individual direction control.

The circuit’s hardware is simple, because the software of the PIC16F84A-04/P microcontroller does most of the work. The power supply uses a standard 7805 linear regulator that supplies a +5V supply. The microcontroller calculates the video signal in real time as the electron beam sweeps over the screen. The two resistors (R26 and R25) make a 2-bit DA converter for the video output. The audio output also has two resistors; one is a variable resistor (R22 and R21) for its 1-bit DA converter. The PORTB is used as a shift register when generating a video and is set as output if a whole byte is to be shifted out. The PORTB is also used as an input when not used as a shift register. A joystick is used as the input controls for the Tetris game, but a C64 compatible joystick push button circuit is provided incase the unavailability for a joystick device. The joystick is a switch to ground, so a pull up resistor is required. The internal pull up resistor can not be used, because if a pin on a port is grounded when used as an output, the output buffer of the PIC would burn up, so this is solved by adding one extra 1k resistor on each pin to limit the current. To pull the input low enough, an external 100k pull up resistor is used instead of the 10k internal resistor. The video and audio out are to be connected to the monitor. The basic controls for the game are right, left, down, up, and fire. The right, left, and down are used in the game field and menu, while the up control is only used in the menu. The fire button is used to rotate the blocks. The score is also shown in the screen.

The color you can see on the screen are limited to the shades of white and black, the level of voltages it can generate for the shades in the screen are; 0V (sync), 0.3V(black), 0.7V(gray), and 1.0V(white). The field of the game is kept in memory as a 32byte array, 16x16 bits, where one bit is one pixel block on the screen. The use of microcontroller as a video game platform is not limited to a Tetris game only; other old video games may be incorporated to the microcontroller.



  • No components added




Document Support:

- None