Students: David Passov & Vladimir Gorelov Supervisor: Boaz Mizrachi Video Game System on PIC18 uController
Feb 24, 2016
Students: David Passov & Vladimir GorelovSupervisor: Boaz Mizrachi
Video Game System on PIC18 uController
Inspiration
The game institute - Hydra
UZEbox
Victor Timofeevs game console
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.
Project Goals
uController Inputs and Outputs
Con
trol
s
Audio out
Video out
5V
supp
ly
A highly popular Microchips PIC18 family controller 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 wrap method of construction possible instead manufacturing a PCB .
Choosing the Hardware
Producing game video - raster scanVGA is normally operated at 60Hz rate.Each scan is composed from 525 lines from
which 480 carry image information.
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
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 video – tiles
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.
Producing game audio
Putting it all together-schematic
Putting it all together-block diagram
controls
VGA out
Audio out
POR
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 – os
Aspects handled by interrupts Synch pulse generationRGB signal generationSound generationButtons read and de - bouncing
Aspects handled by RTOSAnimation formationGame algorithmSound change
Software – functional responsibility
Software – block diagram
OSA RTOS
Task_Game
Task_sound
Task_Animate
Task_Music
Interrupt handler
Sync pulse
RGB signal
Sound generation
Buttons read and debounce
Building -Hacking the PS2 mini wheel
Task name Start finish statusProject definition
16.11 16.11 completed
Architecture characterization
16.11 23.11 completed
Design (Hardware & software)
23.11 14.12 Completed
Construction 14.12 26.2 In progressMidterm presentation
16.1 16.1 -
Hardware testing
26.2 5.2 -
Software development
26.2 20.3 -
Schedule
Task name Start finish statusIntegration testing
20.3 31.3 -
Final presentation
10.4 10.4 -
Schedule
For handling task rich embedded systems using concurrency and OS handled prioritized tasks is an elegant and useful solution.
Study main result
Questions?