220 likes | 448 Vues
Video Game System on PIC18 uController. Students: David Passov & Vladimir Gorelov Supervisor: Boaz Mizrachi. Inspiration. UZEbox. The game institute - Hydra. Victor Timofeevs game console. Project Goals.
E N D
Video Game System on PIC18 uController Students: David Passov & Vladimir Gorelov Supervisor: Boaz Mizrachi
Inspiration UZEbox The game institute - Hydra Victor Timofeevs game console
Project Goals • Building video game system capable of creating graphics and polyphonic sound using PIC18 microcontroller • Programming an old school Socoban game for the system ,creating image and sound using the above platform.
uController Inputs and Outputs Video out Controls 5V supply Audio out
Choosing the Hardware • A highly popular Microchips PIC18 familycontroller was chosen for the task. • reducing line frequency required PLL support leaving us with PIC18F258, PIC18F2580 ,PIC18F2550(which was chosen) • PIC18 family have maximum frequency of 10 – 12 MIPS, making the use of wire wrapmethod of construction possible instead manufacturing a PCB .
Producing game video - raster scan • VGA is normally operated at 60Hz rate. • Each scan is composed from 525 lines from which 480 carry image information.
Producing game video • For a typical 60Hz VGA update rate and 525 scan lines, a single line scan time is given by: 1/60/525 = 31.74 µsec (25.17 µs for actual video data) • for operation frequency of 10 MIPS single instruction is carried out in 100 nsec ,so we can demand maximum horizontal resolution of 25.17/0.1 = 251 pixels per line
Producing game video • Wait!At least one more instruction is needed to prepare each pixel before sending it to the monitor so the maximum horizontal resolution is cut by half! • Solution: using the USART built in module to store information about 8 pixels during 2 cycles and then use the remaining 6 to concurrently perform calculations .
Producing game video – tiles • We choose to use tiles as the basic screen element (instead of a single pixel) • By considering the above we have chosen to uses tile size of 16x16 pixels. • Total tile number 30 x 15 tiles set on screen.
Producing game audio • We use the PWM module together with second order LPF as DAC to produce the game music and sound effects. • Digitized linear combination of sines is used to produce less artificial sounding audio.
Putting it all together-block diagram controls POR VGA out Audio out
Software – os • As mentioned ,the timing is critical for several tasks such as video output and sound generation. • A decision was made to use OSA open source OS. • A combination of interrupts and OS handled task is needed for providing desired results.
Software – functional responsibility • Aspects handled by interrupts • Synch pulse generation • RGB signal generation • Sound generation • Buttons read and de - bouncing • Aspects handled by RTOS • Animation formation • Game algorithm • Sound change
Software – block diagram Interrupt handler Task_Animate Task_Game Sync pulse OSA RTOS RGB signal Sound generation Task_Music Task_sound Buttons read and debounce
Study main result • For handling task rich embedded systems using concurrency and OS handled prioritized tasks is an elegant and useful solution.