Video Game System on PIC18 uController
description
Transcript of Video Game System on PIC18 uController
![Page 1: Video Game System on PIC18 uController](https://reader035.fdocuments.net/reader035/viewer/2022081520/5681656b550346895dd7fcb4/html5/thumbnails/1.jpg)
Students: David Passov & Vladimir GorelovSupervisor: Boaz Mizrachi
Video Game System on PIC18 uController
![Page 2: Video Game System on PIC18 uController](https://reader035.fdocuments.net/reader035/viewer/2022081520/5681656b550346895dd7fcb4/html5/thumbnails/2.jpg)
Inspiration
The game institute - Hydra
UZEbox
Victor Timofeevs game console
![Page 3: Video Game System on PIC18 uController](https://reader035.fdocuments.net/reader035/viewer/2022081520/5681656b550346895dd7fcb4/html5/thumbnails/3.jpg)
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
![Page 4: Video Game System on PIC18 uController](https://reader035.fdocuments.net/reader035/viewer/2022081520/5681656b550346895dd7fcb4/html5/thumbnails/4.jpg)
uController Inputs and Outputs
Con
trol
s
Audio out
Video out
5V
supp
ly
![Page 5: Video Game System on PIC18 uController](https://reader035.fdocuments.net/reader035/viewer/2022081520/5681656b550346895dd7fcb4/html5/thumbnails/5.jpg)
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
![Page 6: Video Game System on PIC18 uController](https://reader035.fdocuments.net/reader035/viewer/2022081520/5681656b550346895dd7fcb4/html5/thumbnails/6.jpg)
Producing game video - raster scanVGA is normally operated at 60Hz rate.Each scan is composed from 525 lines from
which 480 carry image information.
![Page 7: Video Game System on PIC18 uController](https://reader035.fdocuments.net/reader035/viewer/2022081520/5681656b550346895dd7fcb4/html5/thumbnails/7.jpg)
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
![Page 8: Video Game System on PIC18 uController](https://reader035.fdocuments.net/reader035/viewer/2022081520/5681656b550346895dd7fcb4/html5/thumbnails/8.jpg)
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
![Page 9: Video Game System on PIC18 uController](https://reader035.fdocuments.net/reader035/viewer/2022081520/5681656b550346895dd7fcb4/html5/thumbnails/9.jpg)
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
![Page 10: Video Game System on PIC18 uController](https://reader035.fdocuments.net/reader035/viewer/2022081520/5681656b550346895dd7fcb4/html5/thumbnails/10.jpg)
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
![Page 11: Video Game System on PIC18 uController](https://reader035.fdocuments.net/reader035/viewer/2022081520/5681656b550346895dd7fcb4/html5/thumbnails/11.jpg)
Putting it all together-schematic
![Page 12: Video Game System on PIC18 uController](https://reader035.fdocuments.net/reader035/viewer/2022081520/5681656b550346895dd7fcb4/html5/thumbnails/12.jpg)
Putting it all together-block diagram
controls
VGA out
Audio out
POR
![Page 13: Video Game System on PIC18 uController](https://reader035.fdocuments.net/reader035/viewer/2022081520/5681656b550346895dd7fcb4/html5/thumbnails/13.jpg)
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
![Page 14: Video Game System on PIC18 uController](https://reader035.fdocuments.net/reader035/viewer/2022081520/5681656b550346895dd7fcb4/html5/thumbnails/14.jpg)
Aspects handled by interrupts Synch pulse generationRGB signal generationSound generationButtons read and de - bouncing
Aspects handled by RTOSAnimation formationGame algorithmSound change
Software – functional responsibility
![Page 15: Video Game System on PIC18 uController](https://reader035.fdocuments.net/reader035/viewer/2022081520/5681656b550346895dd7fcb4/html5/thumbnails/15.jpg)
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
![Page 16: Video Game System on PIC18 uController](https://reader035.fdocuments.net/reader035/viewer/2022081520/5681656b550346895dd7fcb4/html5/thumbnails/16.jpg)
Building -Hacking the PS2 mini wheel
![Page 17: Video Game System on PIC18 uController](https://reader035.fdocuments.net/reader035/viewer/2022081520/5681656b550346895dd7fcb4/html5/thumbnails/17.jpg)
![Page 18: Video Game System on PIC18 uController](https://reader035.fdocuments.net/reader035/viewer/2022081520/5681656b550346895dd7fcb4/html5/thumbnails/18.jpg)
![Page 19: Video Game System on PIC18 uController](https://reader035.fdocuments.net/reader035/viewer/2022081520/5681656b550346895dd7fcb4/html5/thumbnails/19.jpg)
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
![Page 20: Video Game System on PIC18 uController](https://reader035.fdocuments.net/reader035/viewer/2022081520/5681656b550346895dd7fcb4/html5/thumbnails/20.jpg)
Task name Start finish statusIntegration testing
20.3 31.3 -
Final presentation
10.4 10.4 -
Schedule
![Page 21: Video Game System on PIC18 uController](https://reader035.fdocuments.net/reader035/viewer/2022081520/5681656b550346895dd7fcb4/html5/thumbnails/21.jpg)
For handling task rich embedded systems using concurrency and OS handled prioritized tasks is an elegant and useful solution.
Study main result
![Page 22: Video Game System on PIC18 uController](https://reader035.fdocuments.net/reader035/viewer/2022081520/5681656b550346895dd7fcb4/html5/thumbnails/22.jpg)
Questions?