chipKIT® Development Platform

Inspired by Arduino™

Finished: Pong on a VGA monitor with the Uno32

Created Fri, 15 Jul 2011 19:17:36 +0000 by hairymnstr


hairymnstr

Fri, 15 Jul 2011 19:17:36 +0000

I've just finished the write-up of a project I've been working on for a couple of weeks in my (sadly very limited) spare time.

[url]http://nathandumont.com/node/242[/url]

It's basically a simple game of Pong on a VGA display. The horizontal sync is made with one of the hardware PWM signals and the period end interrupt is used to prepare the next line. Because of the limited memory and no DMA on the Uno the screen is only drawn to when an object is present using timer based interrupts to draw coloured pixels, freeing up the CPU for the rest of the time to do the game logic/read inputs etc.

It's a bit of mash of low-level C code and arduino functions, I'd never used an Arduino before and things like analogRead() are amazing time savers for someone coming from assembly code on 8bit PICs!

Hopefully the documentation is good enough you can duplicate my work, let me know if you have any questions!


svofski

Sat, 16 Jul 2011 00:24:04 +0000

Nice :) I would have tried to display the score on the screen though. Not possible? Probably it's hard to overlap two different thingies when doing purely software rasters. I did a VGA Pong some time ago too, it was my first FPGA project.


pburgess

Sat, 16 Jul 2011 06:33:59 +0000

This is made of win!

Funny...I'd been pondering some sort of VGA output project for the chipKIT, using 3/3/2 color using the parallel master port and all that...but have been busy on other things, and also had some doubts if I could figure out the timings. So if I ever get to it, this'll make a great starting point to learn from. Bookmarked for future reference. Thank you!


hairymnstr

Sat, 16 Jul 2011 08:42:00 +0000

@svofski thanks, I thought about displaying the scores on the VGA screen, but didn't have time to mess about with it any more. I'm sure some sort of scheme could be developed as long as the raster region is sufficiently small compared to the screen that it doesn't block the main loop too long. I also wanted to put some more "Arduino" type stuff in to show off the abstraction layer a bit.

@pburgess thanks, glad it was useful!

I'd like to have a shot at doing a proper bitmap display using a MAX32 with DMA to write the pixels but I don't have the board or the time at the moment.