Fybertech Forums
January 18, 2020, 05:13:35 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: 06/21/08 - Fybertech: Forgotten History
06/13/08 - Fybertech: The De Novo Project, part 14
06/04/08 - Fybertech: The De Novo Project, part 13
 
   Home   Help Search Calendar Members Login Register  
Pages: [1]
  Print  
Author Topic: AVR Text Console / Pong System  (Read 6484 times)
FyberOptic
King of Earth
Administrator
*****
Posts: 2521


Oh god what is that?


WWW
« on: November 13, 2010, 12:20:17 AM »

I thought I would crosspost this to here, since I realized I never made a topic about it!



I suppose I can post the videos I made recently of my AVR video project.  They're not much to look at, particularly since I have a hard time filming it without the picture looking overexposed (which it still does a little even in these, because the TV image has crisp edges).  But they're enough to demonstrate what my code is doing for now.

The first one is of my 16x8 text display, using a 4x6 font.  I only put in 128 possible characters, and some of those aren't even there so I just used black and white blocks for the time being.  But the alpha-numeric ones are the most important anyway.  I'm just incrementing through all the possibilities, at a slow enough rate to view them.  It's also showing off the text scrolling capability I added.

<a href="http://www.youtube.com/watch?v=gKgVoWyGCdA" target="_blank">http://www.youtube.com/watch?v=gKgVoWyGCdA</a>

The later iteration still had the ability to draw text and everything, but it's not doing it anymore.  It's basically a simple Pong game, using a potentiometer (a knob) to control a paddle on the screen to bounce the ball around.  There's even sound, using a roughly 1300hz tone through the TV speaker.  You can hear it faintly through the terrible buzzing sound of the camera.

<a href="http://www.youtube.com/watch?v=0GrvTjoXa0w" target="_blank">http://www.youtube.com/watch?v=0GrvTjoXa0w</a>

I thought I would have a problem cleaning up the pot input, because the paddle was jittering around at first.  But a smoothing capacitor took care of that.  A neat thing I found was that using a cap that was too high in value would actually make the paddle glide to position rather than respond instantaneously.  That could be neat to implement in something in the future.

The sound is a simple square wave generated by one of the PWM channels of the chip.  Not much needed externally for that, aside from resistors to limit the output and a capacitor for coupling.  Though since it uses the same pin as one of the connections used for programming it, I had to stick a diode in too.  Every time I program it now I hear a neat little electronic spurt through the speaker briefly.

This is still using the 64x48 pixel display as from before, just to clarify.  It takes 768 bytes for video memory, since each pixel takes 2 bits (allowing four possible colors, of black, white, and two shades of gray).  The ATmega8 I'm using to do all of this only has 1KB of RAM, which is a huge limitation in the quality of the video I can generate.  I mean, it's possible to generate higher resolution video lines on the fly if I wanted, but that's too much like Atari 2600, where you figure out what to draw on each line when you get to it.  In other words, too much work.  I just wanted a bitmap-based display, where I could have a code loop running which just writes pixels to memory locations, and then the video interrupt handles displaying that independently. 

If I went to 1-bit-per-pixel, that would still just allow something like 128x48 resolution with the way things work now, and limit me to just two colors.  Even using every single byte of RAM and limiting the functionality of the game code would manage 128x64.  Just not worth the limitations it would cause.

Anyhow, I want to put this all in a project box, running from a battery, and with a couple of RCA jacks for audio and video sticking out of the top.  I have a box like that laying here which I ordered years ago.  Just needs a hole drilled into it for the pot's stem to come through.  I also need to find a knob for the pot.  It's almost worn a blister on my finger from turning the stem so much, since it's kind of stiff.  I stuck a piece of plastic on it for now which makes it a bit easier.  I'm just not sure who even sells individual knobs that will fit on that, other than like Ebay.  I'd rather buy it local though so I can make sure it fits first well.

I still need to clean the code up too, maybe add in a scoring system, maybe an AI paddle, I dunno.  But I still feel like I accomplished my original goal(s).  Not only of a generating video, but of a text display, as well as a simple Pong game.  So anything else I add is just icing on the cake.  It's been a good learning experience and confidence booster, and I feel like now that I'm comfortable with AVRs enough that I can do most anything I want in the future with them now.
Logged
FyberOptic
King of Earth
Administrator
*****
Posts: 2521


Oh god what is that?


WWW
« Reply #1 on: November 13, 2010, 12:21:40 AM »

I initially just did some static images as a test.  Here's a peek at the source code of that if anyone's curious.

And some of the photos of other junk I stuck on Facebook before, while I'm at it:









This last one was a demo from after I added a fourth color possibility by putting the sync on a separate output pin.

« Last Edit: November 13, 2010, 12:32:12 AM by FyberOptic » Logged
Bluejay
HERO OF FYBERTECH (tm)
Collguy
*
Posts: 1624


Careful, or the mice will rise up.


WWW
« Reply #2 on: November 30, 2010, 05:02:10 PM »

The last one made me think of Excite bike.
Logged

One day, when the zombies rise and destroy humanity; I will survive, I will live on, I will take your best stuff for myself.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.054 seconds with 20 queries.