Music downloads
Video clips
Scene productions
Chip music
Hardware projects

Craft

Craft is a demo running on its own minimalistic demo platform. The demo platform is based on an ATmega88 microcontroller.

Having successfully built a soundchip out of a microcontroller together with my friends in kryo, I wanted to tackle the greater challenge of generating a realtime video signal along with the sound. This is the result:

(This video at youtube)

Download

Scene reaction

Craft won the Console / Real Wild compo at Breakpoint 2008. I will never forget the overwhelming reaction from the audience!

Here's the Pouët page for Craft.

How does it work?

Just like your average 80's home computer, the entire design is centered around the timing of the video signal.

A typical VGA-based, low-resolution CRT monitor will redraw the screen 60 times per second using an electron beam, which is sweeping across the screen one line at a time. TFT monitors work differently, but the VGA signal is still based on the idea of an electron beam. Timing is crucial: One display line takes 24 μs, and is followed by a 7.75 μs break called the horizontal blanking period. After 480 such lines, there's a longer break (1428.75 μs, equal to 45 full display lines) before it all starts over. Two digital signals are used to synchronize the sender (graphics card, custom demo hardware etc.) and the receiver (monitor). They are called the horizontal sync and the vertical sync signals. It's OK to deviate a bit from the standard timing values as long as you keep the sync signals steady.

The microcontroller is clocked at 20 MHz. If we convert the figures above into clock cycles, we get 480 cycles of visible pixels, 155 cycles of horizontal blanking and 45 full display lines worth of vertical blanking — but during those lines you need to keep generating the horizontal sync pulses. Due to rouding errors, we get a frame rate of 59.99 Hz, but that is well within the tolerance range of a computer monitor.

Music

Sound is generated during the horizontal blanking periods. That gives a sample rate of 31.496 kHz. Of course, only the really timing critical part (waveform generation) is performed during the horizontal blanking. Melody, rhythm, amplitude envelopes, arpeggios etc. are handled by a playroutine which gets called once for every video frame, during vertical blanking.

There are four sound channels in total, each with its own fixed waveform. The waveforms are 4-bit triangle, 50% pulse, 75% pulse and white noise. The noise is generated by means of a 15-bit shift register. The volume of each channel can be individually controlled, except for the triangle channel, which is always playing at full volume. This minimalistic softsynth was of course inspired by the NES sound chip.

Video

Apart from the sync signals mentioned above, a VGA signal contains three analog voltage lines — red, green and blue — that vary between ground and 0.7 V during the visible parts of the video frame. As you can see in the schematic below, I perform a two-bit digital-to-analog conversion for each of these signals, using R-2R resistor ladders. That way, the software can change the current colour in a single clock cycle using the out PORTC,register instruction.

In addition to this, I've hooked up a couple of diodes and a PNP transistor in such a way, that when the MOSI pin is low while the OC2B pin is high, the three color signals will be pulled to a high voltage, corresponding to white. This is used to generate high resolution scroll text: The MOSI pin is connected to a shift register internally in the AVR (it is typically used for serial data transmission), and this shift register can be programmed to emit a sequence of 8 bits with a single instruction, thus offloading the CPU. Smooth scrolling is then implemented by inserting variable delays before and after each display line, but that alone is not enough, because characters would appear and disappear suddenly at the edges of the screen. So additionally, the output comparator connected to timer 2 in the chip is set up to create a visibility window using the OC2B pin.

Schematics

This is how it all fits together, hardware-wise. If you are interested in the physical layout used on the breadboard, you can find it along with firmware and source code near the top of the page.

The variable 1K resistor can be used to adjust the brightness of the scroll texts.

                                 .---[ 1K ]-+------- E (PNP) C -------------------+---+---.
                                 |    /|\   |            B                       _|_ _|_ _|_
                                 |     `----'            |                       \ / \ / \ /
                                 |                       |                       --- --- ---
                                 |       .---__---.      |                        |   |   |
               (to programmer) --- RESET |        | PC5 ----[ 442 ]-----------+---+---|---|--- Red
                                 |       |        |      |          .-[ 220 ]-'       |   |
                              (n.c.) PD0 |        | PC4 ----[ 442 ]-+-[ 442 ]--- GND  |   |
                                 |       |        |      |                            |   |
            .----------+-[ 2K ]----- PD1 |        | PC3 ----[ 442 ]-----------+-------+---|--- Green
            | .-[ 1K ]-'         |       |        |      |          .-[ 220 ]-'           |
            | `--+-------[ 2K ]----- PD2 |        | PC2 ----[ 442 ]-+-[ 442 ]--- GND      |
            |    `-[ 2K ]-- GND  |       |        |      |                                |
            |                    `- OC2B |        | PC1 ----[ 442 ]-----------+-----------+--- Blue
            `---[ 1K ]-.                 |        |      |          .-[ 220 ]-'
              .--------+-[ 2K ]----- PD4 |        | PC0 ----[ 442 ]-+-[ 442 ]--- GND
              |                          |        |      |
              |                      VCC |        | GND  `-[ 1K ]-.
              |                          |        |               |
              |                      GND |        | AREF (n.c.)   |
              |            22pF          |        |               |
              |        GND -||--+- XTAL1 |        | AVCC (n.c.)   |
              |         20 MHz [ ]       |        |               |
              |        GND -||--+- XTAL2 |        | SCK -------------- (to programmer)
              `-[ 1K ]-.   22pF          |        |               |
              .--------+-[ 2K ]----- PD5 |        | MISO ------------- (to programmer)
              `-[ 1K ]-.                 |        |               |
              .--------+-[ 2K ]----- PD6 |        | MOSI ---------+--- (to programmer)
           +  `-[ 1K ]-.                 |        |
     ----)|------------+-[ 2K ]----- PD7 |        | OC1B ------------------------------------- HSync
Audio   10uF                             |        |
     --------- GND            (n.c.) PB0 |        | PB1 -------------------------------------- VSync
                                         `--------'

If you want to learn more, I suggest you dive into the source code, starting with boot.S, mainloop.S and asm.S. The most interesting part is probably the cycle-accurate code in asm.S.

Posted Thursday 27-Mar-2008 20:33

Discuss this page

Disclaimer: I am not responsible for what people (other than myself) write in the forums. Please report any abuse, such as insults, slander, spam and illegal material, and I will take appropriate actions. Don't feed the trolls.

Jag tar inget ansvar för det som skrivs i forumet, förutom mina egna inlägg. Vänligen rapportera alla inlägg som bryter mot reglerna, så ska jag se vad jag kan göra. Som regelbrott räknas till exempel förolämpningar, förtal, spam och olagligt material. Mata inte trålarna.

Anonymous
Fri 28-Mar-2008 19:31
I bow down in awe and wonder. This is just amazing...
Anonymous
Sat 29-Mar-2008 05:23
"The MOSI pin is connected to a shift register internally in the AVR ... and this shift register can be programmed to emit a sequence of 8 bits with a single instruction, thus offloading the CPU."

Hey, that's a *really* neat trick--makes me wonder what I could use that for. :-)

--Phil. (http://code.rancidbacon.com/)
Anonymous
Sun 30-Mar-2008 10:29
Fantastic work! You really deserved the victory at BP! :)
Anonymous
Mon 31-Mar-2008 10:46
Great! Best I've done on AVR was 4-chn 20kHz MOD-player, no graphics there ...
Anonymous
Mon 31-Mar-2008 13:03
Great job on the article! Congratulations for being posted on Make!
Anonymous
Mon 31-Mar-2008 15:01
You brought back such wonderful nostalgic memories for me.
A job really well done. :-D
Anonymous
Mon 31-Mar-2008 16:13
Seriously awesome work! Bet there isn't a free word left!

Jeff
warrantyvoidifremoved.com
Anonymous
Mon 31-Mar-2008 16:41
Great job! That gives to me a lot of good memories about the 80's computering styles.
Anonymous
Mon 31-Mar-2008 21:23
Really great old school demo :)

Thumbs Up !!!

Keep going, it's really awesome !!!!
Anonymous
Mon 31-Mar-2008 22:18
Great work! Nice to realize again how much can be done with a simple 8-bit processor.
Anonymous
Tue 1-Apr-2008 14:38
Wow that is amazing.

Would using 2 or 3 chips like this produce even more impressive results?

I notice there is some horizontal jitter in the lava field section, between 1:42 and 2:02.
I guess you are running short on the time needed to do the calculations accurately.
Anonymous
Tue 1-Apr-2008 21:28
beautiful work!
Anonymous
Thu 10-Apr-2008 22:44
Very great work. Absolut great demo and hardware... Big greetings, Chainsaw. (www.chainsaw72.ch.vu)
Autoscatto
autoscatto
Wed 16-Apr-2008 08:51
Hola! I`m working (for now copying =]) on your project but i have problems... What kind of diode do you use in this board?
Thanks for your good work!!! (and excuse my bad english)
lft
Linus Åkesson
Wed 16-Apr-2008 16:39

Autoscatto wrote:

Hola! I'm working (for now copying =]) on your project but i have problems... What kind of diode do you use in this board?
Thanks for your good work!!! (and excuse my bad english)

Glad you like it! =) I'm using 1N4148 diodes, but anything with a forward drop somewhere around 0.7 V should work.
Anonymous
Wed 23-Apr-2008 08:46
Really impressive. I'll be showing this to friends at KTH (kth.se), and probably build one or two. On my main lab board I have an AT90USB chip, which has to run at 16MHz to support USB, so I'd guess that means lower horizontal resolution. I think an Xmega could be really impressive, using its DMA engine to output high resolution colour signals.
-- Yann Vernier / LoneTech
Anonymous
Wed 30-Apr-2008 06:24
I am amazed and impressed. Bit-banging VGA and using the SPI port as a video shifter is too clever... wow. Does Atmel know about this demo of yours?
Anonymous
Thu 1-May-2008 07:45
the author should have drawn schematic more legibily using some circuit drawing software instead of this lousy ascii patterns

arun -
India
lft
Linus Åkesson
Thu 1-May-2008 12:21
the author should have drawn schematic more legibily using some circuit drawing software instead of this lousy ascii patterns

arun -
India

If you want to, feel free to draw the schematic using such a program, and I'll put it on the page.
Anonymous
Thu 1-May-2008 16:19
great work!
Anonymous
Thu 1-May-2008 23:54
I've been working on something simular for a few months (on and off, when i got the time) but i have not yet taken the time to create a full demo. (see www.electronicspit.com)

I must say this is a very good demo. Great work on the hardware too !
lft
Linus Åkesson
Fri 2-May-2008 09:46
I've been working on something simular for a few months (on and off, when i got the time) but i have not yet taken the time to create a full demo. (see www.electronicspit.com)

I must say this is a very good demo. Great work on the hardware too !

Yeah, I've already got it bookmarked. =) Some day I'll probably attempt something similar. The tradeoff between VGA and composite is of course that the VGA signal has a higher pixel clock, but in the composite signal you've got to modulate the colour signals. But when one tries to build something generic, such as your console, one needs external ram, and then it's not such a big deal to add further external components.
Anonymous
Sun 4-May-2008 21:48
Great job !!! my hobby is AVR's and bascom avr (too slow to done that things) but in my opinion you must show that fantastic work to atmel and you can win/get some gadgets from them for that fantastic work ! :)

Best Regards
George2002 from Poland
Anonymous
Wed 7-May-2008 16:06
Nice job :)
Will it run on ATMEGA8 overclocked to 20MHz?
Any hardware/registers specifed only for ATMEGA88 are used there?
Anonymous
Mon 16-Jun-2008 18:32

Eddy-B wrote:

I've been working on something simular for a few months (on and off, when i got the time) but i have not yet taken the time to create a full demo. (see www.electronicspit.com)

I must say this is a very good demo. Great work on the hardware too !

lft wrote:

Yeah, I've already got it bookmarked. =) Some day I'll probably attempt something similar. The tradeoff between VGA and composite is of course that the VGA signal has a higher pixel clock, but in the composite signal you've got to modulate the colour signals. But when one tries to build something generic, such as your console, one needs external ram, and then it's not such a big deal to add further external components.
Once i have a nice working version of my Console32, i will revert back to my Mega88 and create the same Console project (with limited graphics, since the Mega88 has only 2k RAM to work with).

It will still have a few external 8pin chips (i use a Tiny13 as my keyboard controller -heh! compare THAT to the standard 40-pin controller you find in XT's and AT's), and 1 external EEPROM for storing the BASIC program. The prototype PCB has already been desinged and should be 45x45mm only, but it requires SMD.

Cheers!
Eddy-B
Anonymous
Thu 19-Jun-2008 20:56
just brilliant!
you rule, dude
8 bits is enough!
coley
Graham Cole
Fri 27-Jun-2008 20:23
That was breathtaking Linus, probably the best thing I've seen an 8 bit micro do!
I'd be interested to see what you can do with a Parallax Propeller 32 Bit 8 Cores 32K RAM MCU :-)

Coley
Anonymous
Tue 15-Jul-2008 05:32
You are awesome. Thank you for sharing this!
Anonymous
Tue 15-Jul-2008 23:46
!!!I'M SPEECH-LESS!!!

Great demo!
Anonymous
Tue 22-Jul-2008 11:03
It's unbelievable !

Congratulations for your great work :)
Anonymous
Wed 23-Jul-2008 09:06
Very inspiring. I will give it a try. I hope this starts a new demo category.
Nice work!

-- George Laskowsky Ziguilinsky
Anonymous
Wed 23-Jul-2008 09:44
Great Job. You are an AVR SuperHero!
Anonymous
Wed 23-Jul-2008 11:03
Great job, it reminds me the old days of the C64 demo scene :).
I feel 20 year younger now :)
Anonymous
Tue 29-Jul-2008 06:04
I am highly impressed!
I was doing something similar, but I've only generated VGA signal and no sound... and my scheme involves two memory chips (page switching), a CPLD to control sync pulses and memory, and a PIC to write data into the memory.
Anyway, props to you for doing this all in software on one chip!

TSM
Anonymous
Wed 30-Jul-2008 14:53
I like this project. I like atmel. I like life.

After this, build your own OS.

Then automations...
metal
oash82@yahoo.com
Thu 31-Jul-2008 09:08
Hi,

I was wondering what software do u use to draw the stripboard layout ?

Thanks
Anonymous
Fri 1-Aug-2008 12:29
This is awesome! Never thought that little thing would have the power to generate that.
Anonymous
Fri 1-Aug-2008 12:45
Brilliant stuff man, really impressive.
Anonymous
Fri 1-Aug-2008 12:52
very impressive, and thank you for uploading the music.
Anonymous
Fri 1-Aug-2008 14:00
Wow, awesome! The music was absolutely fantastic!
Anonymous
Fri 1-Aug-2008 16:03
So nice! Just got teleported back to the 80's. This is awesome.
Anonymous
Fri 1-Aug-2008 23:26
awsome :D najs
Anonymous
Sat 2-Aug-2008 03:03
Your work is great!

AtomicZombie
Anonymous
Sat 2-Aug-2008 05:19
This is just breathtaking.. AMAZING!
Anonymous
Sat 2-Aug-2008 10:18
I have drawn the schematic in eagle, check it here as png:
http://www.bramsonderdelen.nl/vga_gen_m8.png
or as eagle sch:
http://www.bramsonderdelen.nl/vga_gen_m8.sch
contact me:
bram at atasco dot nl
what kind of transistor did you use?
Anonymous
Sat 2-Aug-2008 11:04
Mycket mycket imponerande bygge, och demot är kanon.
Anonymous
Sat 2-Aug-2008 17:27
Grymt snyggt!
Anonymous
Sat 2-Aug-2008 19:14
Cooool!!!
Respect!
Anonymous
Mon 4-Aug-2008 08:40
Mycket snyggt jobbat!
Man får en riktig resa tillbaka till den tid då dataspelen var som roligast och även oskyldigast. Jag måste säga att jag är mycket imponerad av det du gjort, det är alltid svårare att ha få resurser och utnyttja dessa till 100% än att ha den senaste tekniken och bara utnyttja delar av den.
Respekt från 40-årig gammal räv!
elosh
Henrik
Mon 4-Aug-2008 10:32
Kan bara säga hur imponerande det är. Påminner om gammla C64 och Amiga demos. Keep up the good work.
lft
Linus Åkesson
Tue 5-Aug-2008 05:41

metal wrote:

Hi,

I was wondering what software do u use to draw the stripboard layout ?

Thanks

Hi! Those are written in a text editor, in the PostScript language. Have a look in the .eps file and you'll see what I mean.
Anonymous
Tue 5-Aug-2008 20:19
Wow. I'm speechless.
Anonymous
Thu 7-Aug-2008 11:10
...

I would congratulate you, but there are no words to describe how amazing that was.
Anonymous
Sat 9-Aug-2008 00:24
You have a really demoscene talent, man!
Anonymous
Tue 12-Aug-2008 01:59
Have you been at all tempted by the AT94K05AL? It's a bit more towards the pricey end but soo many possibilities. I guess the best cheap boost would be a low end xmega.

I have this half baked idea of having a challenge where you take a standard pc keyboard and video connector and add $20 worth of parts to make the best computer you can. (you can use volume pricing for your price calculations though because the idea is to imagine if you made thousands of them)
Anonymous
Wed 27-Aug-2008 17:10
this is just amazing. would it be possible to have several of these chips work together, and specialize one chip for one kind of work, thus getting a better result? (higher computational power). couple that with a homemade input device (or something like an old NES controller), and you could make your own game console.

many, many kudos to you.
Anonymous
Sat 30-Aug-2008 21:05
.. mad skills, mad skills!
Anonymous
Mon 1-Sep-2008 06:11
Very nice work!!! What is the programming software/compiler you used for your source code?
lft
Linus Åkesson
Tue 2-Sep-2008 05:50
Very nice work!!! What is the programming software/compiler you used for your source code?

That would be the AVR port of the GNU toolchain. During early development I used C routines (compiled with avr-gcc) along with the assembly code. Have a look in the makefile for all the details.
Anonymous
Fri 5-Sep-2008 11:36
Hi lft!

I'm very much impressed by your work! I would like to ask a question:
Since you obviously have the knowhow to produce graphics and the VGA signals at the same time, would it be possible to create some kind of simple vga-driver for the MEGA88 in a way that you can set some graphic elements on the screen using a I²C or RS232 interface?
What I would like to see is a lib for the MEGA8. We just flash it and can do the following for example:
- setPixel(x,y,color)
- setCircle(x,y,radius, color, bfill)
- setText(x,y,cString, color, ...)
- other handy stuff

I know that communication between µC use a lot of time, but there is no need to have an ultra steady vga signal using a TFT? So we could transfer some instructions and the MEGA8 would display the data on the VGA-Panel. A couple of FPS per second would be enough.

Would that be possible?
Anonymous
Fri 5-Sep-2008 17:28
An AVR console using NES controllers and NTSC Composite Video output.

-> http://belogic.com/uzebox/
lft
Linus Åkesson
Sat 6-Sep-2008 12:24
... would it be possible to create some kind of simple vga-driver for the MEGA88 in a way that you can set some graphic elements on the screen using a I²C or RS232 interface?
What I would like to see is a lib for the MEGA8. We just flash it and can do the following for example:
- setPixel(x,y,color)
- setCircle(x,y,radius, color, bfill)
- setText(x,y,cString, color, ...)
- other handy stuff

Hi! The main problem with this approach is that the chip would have to keep track of a frame buffer. 1 kB of RAM is not a lot. Even if we opt for a simple black and white bitmap, there would only be room for 128 x 64 pixels. One alternative would be to use a tiled display, but without external RAM it would still be very limited.

Once we start using external RAM, we can do lots of things, and that area has been explored by others in several projects.
Anonymous
Sat 6-Sep-2008 15:56

lft wrote:

... would it be possible to create some kind of simple vga-driver for the MEGA88 in a way that you can set some graphic elements on the screen using a I²C or RS232 interface?
What I would like to see is a lib for the MEGA8. We just flash it and can do the following for example:
- setPixel(x,y,color)
- setCircle(x,y,radius, color, bfill)
- setText(x,y,cString, color, ...)
- other handy stuff

Hi! The main problem with this approach is that the chip would have to keep track of a frame buffer. 1 kB of RAM is not a lot. Even if we opt for a simple black and white bitmap, there would only be room for 128 x 64 pixels. One alternative would be to use a tiled display, but without external RAM it would still be very limited.

Once we start using external RAM, we can do lots of things, and that area has been explored by others in several projects.

If the problem with the above is just the 1K RAM, would a larger chip with, say 4K RAM, be enough to do some basic text and graphics? Thank you for your participation.
Anonymous
Sat 6-Sep-2008 16:14
I posted the above question and just realized that 4K would only allow 512 x 256 pixels, so how about some of the 8K RAM processors? Would that allow some basic text and graphics capabilities using serial port for video data input? Thanks again!
Anonymous
Sat 6-Sep-2008 17:43
My initial idea about the setPixel and stuff was to keep track about how things are created. Not storing the actual image.
If you want to set a pixel you check if the pixel should be painted by searching some kind of ObjectPaintInstruction-stack or something.

I have to add that this approach would loose speed the more objects are to be displayed.... hmmm... maybe a dedicated VGA driver chip would be the easier choice ;)
Anonymous
Fri 19-Sep-2008 13:40
That is a very nice example of lateral thinking making the best of the AVR's potential.

Full marks!

Joey
Anonymous
Fri 19-Sep-2008 16:25
I've played about with generating video directly from an AVR myself, did most of a space invaders game as a demo, and I've actually used similar techniques on commercial designs to drive graphic LCD displays directly from an AVR (the timing is rather less critical with LCD's)... That included driving a windowed display using a Mega128 with next to no external hardware, so from the perspective of someone who knows exactly what's involved let me say that you've done a beautiful job there... Congratulations :)
Anonymous
Sun 21-Sep-2008 19:19
Whats the potentiometer for?
Anonymous
Mon 22-Sep-2008 01:20
Hi, great work. I am trying to rebuild this thing. Whats the PNP transistor? Is "BC560C" okay?
Anonymous
Mon 22-Sep-2008 11:59
Hi, great work. I am trying to rebuild this thing. Whats the PNP transistor? Is "BC560C" okay?
Nevermind, I tried it. It works.
lft
Linus Åkesson
Fri 26-Sep-2008 16:18
Whats the potentiometer for?

It's for adjusting the intensity of the white high-res overlay used for text, so the text won't bleed (too high) or turn grey (too low). Different transistors have different hFE factors, which also vary with temperature, so it's convenient to be able to fine tune the system after it has been assembled.
Anonymous
Tue 30-Sep-2008 21:04
Very impressive, then I saw the Mandelbrot being calculated in real-time and my mind possibly just exploded :-)
Anonymous
Thu 9-Oct-2008 05:35
Absolutely amazing! Easily the most brilliant demo I've seen in years, possibly ever!

Now get an ATmega1284p (16K RAM) clocked at 20 MHz and do some REALLY fancy stuff! :-)

klaxon44
Anonymous
Thu 9-Oct-2008 05:45
Absolutely amazing! Easily the most brilliant demo I've seen in years, possibly ever!

Now get an ATmega1284p (16K RAM) clocked at 20 MHz and do some REALLY fancy stuff! :-)

klaxon44
Anonymous
Tue 28-Oct-2008 16:36
Is anyone else having trouble viewing the fullscreen rip video? I can't seem to get it to play properly, even after an hour or so of messing with codecs. ~_~
Anonymous
Fri 7-Nov-2008 03:47
I bow down in awe and wonder. This is just amazing...

I saw this on http://www.demoscene.tv
It reminded me so much of my commodore c=64 pure genius!!!!!

Add me on http://www.myspace.com/stuckinfremont510 is my personal site, I've allways loved the demoscene, I've been a fan since I was six years old, all of the demoscene coders are Brilliant Minds that creative abilities and talents cannot be measured for you do this out of the love of the hobby in itself, which no engineer out of profession could compare.
Anonymous
Tue 25-Nov-2008 21:21
AWESOME!!!! You're the god of microcontrollers.
i've just finished to make a little game for 2 players for the Atmel ATtiny13 connected to a TV (BAS signal generation) so i can imagine what you've programed.
Craft is really fantastic.
Anonymous
Fri 12-Dec-2008 15:26
Riktigt snyggt. Tror jag ska ta o bygga mej en sån själv så att jag verkligen kan visa hur kraftig en liten mega är.

Hur lång tid tog det att implementera?

Återigen riktigt snyggt!
Anonymous
Sun 4-Jan-2009 15:53
Awsome work!
I really loved this piece of Art when I saw it first, and I'm still in love. Being an Electrical Engineer I smile like hell when I see this demo. :))

Only one bug report:
This should be 31496 Hz, or 31.496 kHz I think:
""Sound is generated during the horizontal blanking periods. That gives a sample rate of 31496 kHz.""

Cheers....
NTAmi
lft
Linus Åkesson
Thu 8-Jan-2009 19:13
Only one bug report:
This should be 31496 Hz, or 31.496 kHz I think

Well spotted! I've fixed it now. Thanks!
Anonymous
Wed 14-Jan-2009 15:41
WOW ! You guys are just sick ! Amazing !

Best Regards
Ruben Täufer
Germany
Anonymous
Wed 14-Jan-2009 22:30
I cannot decompress lft_craft_src.tar.gz on XP.
How can it be decompressed?

Any help would be appreciated.
Anonymous
Thu 15-Jan-2009 23:47
I cannot decompress lft_craft_src.tar.gz on XP.
How can it be decompressed?

Any help would be appreciated.

Download winRAR or 7-zip =)
Anonymous
Tue 24-Feb-2009 01:17
I'm pretty bad at analogue electronics but you write in the description that the red,green and blue lines vary between ground and 0.7V. But when i look at the ladder in your ascii schematics for for example red (PC4, PC5) i would have thought that when both is set to 1 (5V) you get 3.75V? Am i missing something?
lft
Linus Åkesson
Mon 2-Mar-2009 07:31
I'm pretty bad at analogue electronics but you write in the description that the red,green and blue lines vary between ground and 0.7V. But when i look at the ladder in your ascii schematics for for example red (PC4, PC5) i would have thought that when both is set to 1 (5V) you get 3.75V? Am i missing something?

Yeah, actually I think there's something strange going on, because I realize I haven't connected the AVcc pin, which powers port C according to the datasheet. So presumably port C is severely current limited. When you calculate signal levels, you have to take into account the input impedance of the VGA monitor (75 Ohm), but that still gives you a signal range from ground to 1.27 V, which is clearly out of spec. The proper theoretical value for R would be 460 Ohm. Anyway, I learned the hard way in another project: Always connect AVcc!
Anonymous
Thu 12-Mar-2009 06:10
Class! I try to create that or like..... The Author of the site many thanks and respect from Russia!
Anonymous
Sat 28-Mar-2009 22:52
One more respect to Author from Russia!!! Linus is a genius!
Anonymous
Fri 3-Apr-2009 08:14
I'm thinking how to change it in to a "graphic&sound card".
How to force it to display data from UART (or other interface).
Anyway, awsome work. I'm highly impressed.

I apologize for my English.
Anonymous
Wed 8-Apr-2009 11:23
This is sweet!

It kicks ass!
Anonymous
Thu 9-Apr-2009 01:32
Hi

I have some questions. This is really one of the most amazing things i have seen, and since you have uploaded the source and schematics i wanted to build my own copy of your demo board to see if it actually works. (I REALLY want to see it with my own eyes and show it to my friends)

So,
I have an atmega168 lying around, which almost is identical to atmega88, but with more flash. My board is ready and built according to your ASCII description, but I can't make it work for some reason. Im quite new to microcontrollers and im not familiar enough with assembler to understand most of your code (I have tried for hours, really). Linux is my main OS and i have avr-gcc, avrdude, the build-essential metapackage and so on installed, so compiling your sources went without problems. The hex-file is uploaded and the fuses are set as you described. But as mentioned, it does not work.. there is no signal on any pin.

I think this is because the source is unchanged, and written for atmega88, so there are most likely some things that need to be changed in order to run it on atmega168, but i dont even know where to start. Usually i use eclipse with the avr plugin, so i dont really know how most things actually work. Here is a comparision between atmega48, 88 and 168: http://www.atmel.com/dyn/resources/prod_documents/doc2554.pdf

Would you pleeease help me getting started, i really want to make this work. I will upload my eagle schematics and board layout once im sure it works, together with the atmega168 hex file in case someone is interested.
Anonymous
Wed 22-Apr-2009 07:41
amazing work man, the sounds of your demo brought me back to my youth playing games on ancient hardware :D
Anonymous
Thu 23-Apr-2009 01:13

lft wrote:

the author should have drawn schematic more legibily using some circuit drawing software instead of this lousy ascii patterns

arun -
India

If you want to, feel free to draw the schematic using such a program, and I'll put it on the page.

I will take this up.
Ill draw it in eagle
Anonymous
Thu 23-Apr-2009 03:16

lft wrote:

the author should have drawn schematic more legibily using some circuit drawing software instead of this lousy ascii patterns

arun -
India

If you want to, feel free to draw the schematic using such a program, and I'll put it on the page.

I will take this up.
Ill draw it in eagle

Finished!
I replaced the pnp transistor with a P-Mosfet
I can Make the PCBS for these, but they will cost about $40-$60 a board fully assembled.
I used axle resistors and diodes in the schematic
Here is the schematic: http://dump.no/files/de4e5c2db4de/craft-sch.7z
In it is a High Contrast and Low Contrast Image of the Schematic, Also an Eagle CAD schematic file.
Eagle CAD is Freeware, many people use it: http://www.cadsoft.de/
Enjoy :3
Anonymous
Thu 23-Apr-2009 03:24
Hi

I have some questions. This is really one of the most amazing things i have seen, and since you have uploaded the source and schematics i wanted to build my own copy of your demo board to see if it actually works. (I REALLY want to see it with my own eyes and show it to my friends)

So,
I have an atmega168 lying around, which almost is identical to atmega88, but with more flash. My board is ready and built according to your ASCII description, but I can't make it work for some reason. Im quite new to microcontrollers and im not familiar enough with assembler to understand most of your code (I have tried for hours, really). Linux is my main OS and i have avr-gcc, avrdude, the build-essential metapackage and so on installed, so compiling your sources went without problems. The hex-file is uploaded and the fuses are set as you described. But as mentioned, it does not work.. there is no signal on any pin.

I think this is because the source is unchanged, and written for atmega88, so there are most likely some things that need to be changed in order to run it on atmega168, but i dont even know where to start. Usually i use eclipse with the avr plugin, so i dont really know how most things actually work. Here is a comparision between atmega48, 88 and 168: http://www.atmel.com/dyn/resources/prod_documents/doc2554.pdf

Would you pleeease help me getting started, i really want to make this work. I will upload my eagle schematics and board layout once im sure it works, together with the atmega168 hex file in case someone is interested.

My guess is the registries for the timer interrupts are different on the 88 then the 168.
You should see some signals on the pins tough.
Read the atmeag168 manual and the atmega88 manual
Look at the registries on the chips
Compare them, to what he is setting in code, make changes...
here is my email: (godberg[at]gmail{Dot}com)
I am also the one who posted the eagle schematic...
I'll help you out.
Anonymous
Mon 4-May-2009 00:31
Hi

I have some questions. This is really one of the most amazing things i have seen, and since you have uploaded the source and schematics i wanted to build my own copy of your demo board to see if it actually works. (I REALLY want to see it with my own eyes and show it to my friends)

So,
I have an atmega168 lying around, which almost is identical to atmega88, but with more flash. My board is ready and built according to your ASCII description, but I can't make it work for some reason. Im quite new to microcontrollers and im not familiar enough with assembler to understand most of your code (I have tried for hours, really). Linux is my main OS and i have avr-gcc, avrdude, the build-essential metapackage and so on installed, so compiling your sources went without problems. The hex-file is uploaded and the fuses are set as you described. But as mentioned, it does not work.. there is no signal on any pin.

I think this is because the source is unchanged, and written for atmega88, so there are most likely some things that need to be changed in order to run it on atmega168, but i dont even know where to start. Usually i use eclipse with the avr plugin, so i dont really know how most things actually work. Here is a comparision between atmega48, 88 and 168: http://www.atmel.com/dyn/resources/prod_documents/doc2554.pdf

Would you pleeease help me getting started, i really want to make this work. I will upload my eagle schematics and board layout once im sure it works, together with the atmega168 hex file in case someone is interested.

My guess is the registries for the timer interrupts are different on the 88 then the 168.
You should see some signals on the pins tough.
Read the atmeag168 manual and the atmega88 manual
Look at the registries on the chips
Compare them, to what he is setting in code, make changes...
here is my email: (godberg[at]gmail{Dot}com)
I am also the one who posted the eagle schematic...
I'll help you out.

Thanks for the reply!

I tried compiling it for the atmega 168 and it did not work. The problem seems to be related to many relative branch instructions. They did not work with 16 kb memory in some places for some reason. I tried simply replacing them with jmp instructions, but that seems to consume too many clock cycles, so the timing was way off after that. The registers used by this project however seemed to be the same on both mcus.

Well, i have replaced the atmega168 with an atmega88, and now it works perfectly!


Another thing i was thinking about is the way the sound is generated. As one 8-bit timer is free it should be possible to generate sound by running the timer in fast pwm with no prescale and simply adjusting the duty cycle by writing to OCRXX for the timer. Then the output from the OCXX pin for the timer could be used to simulate the analog sound value with a 78 kHz frequency with variable duty cycle. Doing this would be easier in software and much easier in hardware as one of the DA-converters is not needed any more, and i think it would give almost the same sound.
Anonymous
Wed 3-Jun-2009 05:04
Awesome.
Just awesome.
I don't have any other words.
Anonymous
Sat 6-Jun-2009 19:08
Wow!
I am really impressed!
Need to learn some assembler, i think....
Enleth
Mon 8-Jun-2009 20:53
Hello,

first, I must say that I'm really in awe, and that reading the craft source code was possibly the most educational AVR experience I've ever had.

However, I've got a problem with getting my own copy to work - basically, the video is there, perfectly stable and all correct, but there's no sound. I've already octuple-checked (is that even a word?) all the connections, resistor values, polarity of the capacitor and so on, and still I've got no clue as to why wouldn't it work. There's a silent "knock" in the speakers when the microcontroller kicks in after reset, some interference from the video signal can be heard (the sound fluctuates with the "waves" in the opening screen and changes completely witch each screen), but absolutely no signs of music - and, most importantly, the "analyzer" screen (the one with a 3D cube and Manderbolt) indeed shows the vertical stripes completely motionless (save for the moment when they slide off to make more space for the cube).

I'm using a new ATmega88, with the fuses programmed correctly (well, the video wouldn't be there otherwise), and the circuit was built on a breadboard.

Any hints?
Anonymous
Tue 9-Jun-2009 21:43

Enleth wrote:

Hello,

first, I must say that I'm really in awe, and that reading the craft source code was possibly the most educational AVR experience I've ever had.

However, I've got a problem with getting my own copy to work - basically, the video is there, perfectly stable and all correct, but there's no sound. I've already octuple-checked (is that even a word?) all the connections, resistor values, polarity of the capacitor and so on, and still I've got no clue as to why wouldn't it work. There's a silent "knock" in the speakers when the microcontroller kicks in after reset, some interference from the video signal can be heard (the sound fluctuates with the "waves" in the opening screen and changes completely witch each screen), but absolutely no signs of music - and, most importantly, the "analyzer" screen (the one with a 3D cube and Manderbolt) indeed shows the vertical stripes completely motionless (save for the moment when they slide off to make more space for the cube).

I'm using a new ATmega88, with the fuses programmed correctly (well, the video wouldn't be there otherwise), and the circuit was built on a breadboard.

Any hints?

Hi

I have also rebuilt craft, and it works perfectly for me. I think you forgot to program the eeprom from eeprom.raw. I tried uploading flash.hex only, and i got the same behaviour you described.

Try downloading both flash.hex and eeprom.raw to the avr, and it should work. I'm using AVRDude from the command line, and i noticed i have to upload both files at the same time. If you are using AVRISP mkii with avrdude, try something like

<code>
avrdude -c avrispmkII -P usb -p m88 -e -U flash:w:test.hex -U eeprom:w:eeprom.raw
</code>

I'm not sure the command above is 100% correct, but i think it works.

Good luck!
Enleth
Fri 12-Jun-2009 16:58
I think you forgot to program the eeprom from eeprom.raw. I tried uploading flash.hex only, and i got the same behaviour you described.

You got it right there - thanks. As always, the problem is both in the most obvious and the most obscure place at the same time.

Now, it works perfectly.
Anonymous
Sat 25-Jul-2009 16:24
Really impressive work! Found you during research for PAL Signals...
Anonymous
Wed 29-Jul-2009 21:54
Man you rocks!!! Reminded me oldschool times.
Anonymous
Mon 7-Sep-2009 12:41
one of the most powerfull projects i've ever seen!

i'm just fooling around with one square wave and a rgb led...
Anonymous
Thu 1-Oct-2009 23:59
Hi

I have rebuilt craft for the second time this evening, and i wanted to contribute with something as this project is amazing and i really appreciate the effort of making it open source. I have made a PCB using the open source software KiCad under Linux. Here is a link to the files needed to recreate it (most components are smd, but making this by hand should be easy as the resistors and capacitors are 0805 and the pcb is single-sided):

http://dl.getdropbox.com/u/1026013/Projects/Craft_PCB.zip

Included are the KiCad project files and some other files:

* 3d rendering of the top and bottom of the PCB as jpg.

* The schematic as ps and pdf.

* The copper layer as ps and pdf.

* The copper silkscreen as ps and pdf.

* The component silkscreen as ps and pdf.

The board is 48mm x 55mm.

Hope this helps someone, feel free to use it however you like. I could make the pcb smaller, but i did not have much time as i made everything this afternoon/evening.

Linus, feel free to add these files to the download section and to use the included schematic in the description if you like, as it is a bit easier to read than the ascii one.
Anonymous
Thu 26-Nov-2009 14:21
Should be even easier with the XMEGA which has multiple SPI channels + DMA.
lft
Linus Åkesson
Thu 26-Nov-2009 15:56
Should be even easier with the XMEGA which has multiple SPI channels + DMA.

True, but "easier" was not my intention. =)
hobgoblin
Ashley Fraser
Wed 9-Dec-2009 15:21
You sir are a genius, this has got to be the most impressive display I have ever seen on an 8 bit MCU, hell it's better than what I've seen some (most) much more powerful MCUs do.

I happened upon this page accidently as I have been spending the entire day trying to find enough documentation to do some VGA stuff and I have to say that I am glad I did, you made my day.
Anonymous
Sun 13-Dec-2009 09:32
Hey, great project. I've cloned your PCB but the Video doesn't work. Seems like Sync is broken. I've tried this with three monitors. Any idea? The colors seem to be right (they change) but no real video signal is visible.
Anonymous
Sun 13-Dec-2009 09:37
Another strange thing is: The music does only play if the monitor is connected..
Anonymous
Tue 15-Dec-2009 11:57
After circuit analysis I've found out that the 0V peak at the VGA-Sync Signals is acually at circa 1.7V. Are there any Port registers wrong and Pins not defined as output?
lft
Linus Åkesson
Mon 21-Dec-2009 09:27
After circuit analysis I've found out that the 0V peak at the VGA-Sync Signals is acually at circa 1.7V. Are there any Port registers wrong and Pins not defined as output?

There is a known error, namely that AVcc has been left floating in my design. Since AVcc powers port C, this will cause current limiting on the RGB outputs.

However, I haven't had any trouble with the sync levels. Have you verified that there are no cuts or shorts?
Anonymous
Tue 12-Jan-2010 10:27
So very good - keep up the good work

-Dingo_aus
Anonymous
Tue 19-Jan-2010 01:03
And there I was playing away on my Arduino; happy to get 32 leds to flash in the correct sequence.
Exceptional work. Well done!
Anonymous
Sun 4-Apr-2010 22:51
Adorable work!

One question: I also tried using the MOSI pin to generate a video signal, but after the 8th bit is shifted out, the MOSI line stays high for a short time, before the next byte gets shifted out. How did you solve this?

Markus
lft
Linus Åkesson
Tue 6-Apr-2010 13:47
I also tried using the MOSI pin to generate a video signal, but after the 8th bit is shifted out, the MOSI line stays high for a short time, before the next byte gets shifted out. How did you solve this?

I decided to live with it. The MOSI trick is used when displaying text, either statically or in the sine scroller. In the font, every character is eight pixels wide, and the extra delay after the eighth bit forms the space between characters. The pin is connected to the video signal in such a way as to make it white when low and transparent when high.
Anonymous
Sun 13-Jun-2010 03:09
Could you please make a parts list? I know the schematics include all parts, but still, it would make it easier to acquire all components.
Anonymous
Thu 17-Jun-2010 20:14
Hi, i have a little problem here with craft. some colours doesn't seem to be the correct ones, cyan is missing in the plasma (showing another shade of blue instead) or the first tunnel isn't coloured red and white (it's purple and violet) for an example. any idea? i checked the hardware a few times and it looks ok.
lft
Linus Åkesson
Tue 22-Jun-2010 17:29
Hi, i have a little problem here with craft. some colours doesn't seem to be the correct ones, cyan is missing in the plasma (showing another shade of blue instead) or the first tunnel isn't coloured red and white (it's purple and violet) for an example. any idea? i checked the hardware a few times and it looks ok.

Did you connect AVcc? In the original design, AVcc was left floating (by mistake), and this probably affects the amount of current that can be sourced from PORTC. Otherwise I really don't know.
Anonymous
Fri 25-Jun-2010 11:21

lft wrote:

Did you connect AVcc? In the original design, AVcc was left floating (by mistake), and this probably affects the amount of current that can be sourced from PORTC. Otherwise I really don't know.

At first I also connected the AVcc Pin, but then I disconnected it again since I found out that there's something wrong with the colours and I thought it could have something to do with AVcc but disconnecting it didn't change anything.

Anyway I also don't know what's the Problem here but I let you know what's wrong when I get it solved.
Anonymous
Tue 20-Jul-2010 12:25
Sinistra (sinistra92)

This is really amazing,
I am into digital electronics as well, therefore it's a mine of information for me.

Thank you for such a great avr project.
Anonymous
Fri 23-Jul-2010 09:08
Im surprised you did'nt build the screen yourself too.

Hate to admit it, but the only word I can think of: awesome!
Anonymous
Fri 23-Jul-2010 16:48
I am quite amazed, not only is your build incredible, the music is actually really awesome, props from me ;)
Anonymous
Mon 9-Aug-2010 12:45
Wow, this is way up there on my favorites list. True blue ribbon winner project. Excellent use of additional capabilities shift register.

The best I have seen so far video & audio with AVR with such minimal parts and no overclocking...

I'd wait for this to download over 300bps, :P
Anonymous
Sun 24-Oct-2010 03:32
For all you guys interested in prototyping your circuits on this kind of PCBs (often called "perfboards"), a quick google search gave me this two links:

DIY Layout Creator (written in Java -> Free)
http://www.synthdiy.com/show/?id=2489

Lochmaster
http://www.abacom-online.de/html/lochmaster.html

I'm currently testing Lochmaster, and I must say that it's way better than nothing. It is certainly limited but one shouldn't wish a full-featured suite for simple circuit prototyping.

These two taken from this site:
http://www.sphere.ws/blog/?p=139

I hope this links are useful.

- Netshark
Anonymous
Wed 3-Nov-2010 11:17
Hi linus good work !!!!

can i get the correct schematic as i a a begineer to micro controller i am unable to get the schematic which u have did in text format. i read the comments someone has given the schematic in eagle format but unfotunately io didnt found that. so can u or anyone else mail me the schematic
My mail id is azhar.karnalkar@gmail.com
thanks in advance. and a great work man.
Anonymous
Sat 13-Nov-2010 18:39
Way to go Linus! I really love the both the audio and video.

Just so you know, Craft is now the ringtone of my cellphone and Turbulence is the alarm tone :-)
Anonymous
Tue 7-Dec-2010 04:45
I'm thinking that you are not human.
And i am scared when i realize that 'bad' programming a modern processor to do the same thing can probably waste 100 times the same energy. buh...!!!
thank you!
i'm italian so i can't speak/write in good english. eheh bye.
Anonymous
Fri 17-Dec-2010 23:41
Hey, youre awesome!
And the Soundtrack of Craft is beautiful :)
Anonymous
Wed 29-Dec-2010 10:25
its really W O N D E R F U L)))) very nice
I am addicted to needlework and crafting too....check it out my site http://www.oxima-homemade.com/en.html
Anonymous
Fri 28-Jan-2011 03:16
all I can say is WOW
Anonymous
Sat 29-Jan-2011 21:08
Amazing! It sounds exactly like AY8910/12 chip in famous ZX Spectrum.
Anonymous
Tue 22-Feb-2011 15:09
Dude, you are awesome, I'm really amazed! Keep on creating amazing stuff like this!!
Anonymous
Sun 5-Jun-2011 07:01
Linus the names of 2 people very good with computers
Anonymous
Tue 12-Jul-2011 11:16
Fantastic project Linus, very inspiring. I have a spare '88 somewhere so I think I'm going to build one. Many thanks for sharing!
Anonymous
Tue 26-Jul-2011 01:40
Really impressive. I'll be showing this to friends at KTH (kth.se), and probably build one or two. On my main lab board I have an AT90USB chip, which has to run at 16MHz to support USB, so I'd guess that means lower horizontal resolution. I think an Xmega could be really impressive, using its DMA engine to output high resolution colour signals.
-- Yann Vernier / LoneTech
Anonymous
Tue 26-Jul-2011 01:42

lft wrote:

... would it be possible to create some kind of simple vga-driver for the MEGA88 in a way that you can set some graphic elements on the screen using a I²C or RS232 interface?
What I would like to see is a lib for the MEGA8. We just flash it and can do the following for example:
- setPixel(x,y,color)
- setCircle(x,y,radius, color, bfill)
- setText(x,y,cString, color, ...)
- other handy stuff

Hi! The main problem with this approach is that the chip would have to keep track of a frame buffer. 1 kB of RAM is not a lot. Even if we opt for a simple black and white bitmap, there would only be room for 128 x 64 pixels. One alternative would be to use a tiled display, but without external RAM it would still be very limited.

Once we start using external RAM, we can do lots of things, and that area has been explored by others in several projects.
Anonymous
Fri 29-Jul-2011 01:45
Thats astonishing work - cool music too!
Anonymous
Sat 31-Dec-2011 10:33
nihao! I'm a student from china.I am very interested in your work.Can you give me more details about all Data or the Electronic Components List,thank you this is my
gmail wkp1517@gmail.com. Thank you!!! >_<
Anonymous
Wed 4-Jan-2012 18:28
btw, i don't know if you know Uzebox, and what is your oppinion about this - http://uzebox.org - is this interesting enough for you coding something there as well?
tesla1980
Thomas
Thu 12-Jan-2012 11:20
Hello, i also build your craft before 3 Years now. Its just amazing. I have one problem : at the end its over and i wish to loop the programm , but i have no idea how to change the code and to compile it. Can you make this 4 me, please and send me via Email !?
Anonymous
Sat 11-Feb-2012 15:07
Wonderful project!
When did you do electronically?
Anonymous
Sun 12-Feb-2012 12:21
some 1 on mirc posted this today.. and I its so very AWESOME!!!!
this from 1 microcontroller. I feel tempted to just rebuild this as a standalone hehe
Did ya ever make more demo's on this hardware?
tesla1980
Thomas
Sun 12-Feb-2012 21:35
Please help me ! Can anyone tell me how to change the c - code to make that the whole program loops itself ? Where i must change the code. I`m absolutely a c-code noop - i have no idea ! PLZ HELP ME !
Anonymous
Tue 13-Mar-2012 12:40

tesla1980 wrote:

Please help me ! Can anyone tell me how to change the c - code to make that the whole program loops itself ? Where i must change the code. I`m absolutely a c-code noop - i have no idea ! PLZ HELP ME !

#include <stdio.h>

int main() {
printf("This text will be looped");
main();
}
Anonymous
Wed 21-Mar-2012 22:40

#include <stdio.h>

int main() {
printf("This text will be looped");
main();
}

Uuh, that's a really bad idea..
Anonymous
Mon 9-Apr-2012 21:09

tesla1980 wrote:

Can anyone tell me how to change the c - code to make that the whole program loops itself ? I`m absolutely a c-code noop!

There is absolutely no C-code in Craft. It's pure assembly language.

Try having a look at mainloop.S, there's a label called "mainloop", which is the central loop.
Now, to understand the code, you need to know a few things...

Registers:
r0,r1,r2,r3....r30,r31 are all registers. A register on the AVR contains a value between 0 and 255.
x, y, z:
x register is two registers, r26:r27 combined
y register is two registers, r28:r29 combined
z register is two registers, r30:r31 combined, and is the only register that can be used with LPM

Instructions:
lpm,lds,ldi: these are LoaD instructions. LPM=Load from Program Memory, LDS=LoaD from SRAM, LDI=LoaD Immediate value
ST=STore
STS=STore in SRAM
CP,CPC=ComPare,ComPare with Carry
BRxx=BRanch if condition xx. xx could be for instance CS (Carry Set), NE (Not Equal), EQ (EQual), CC (Carry Clear) and a few more.
RCALL=call some subroutine
RET=RETurn (from a subroutine)
JMP=JuMP to address
RJMP=Relative JuMP
IJMP=Indirect JuMP (jumps to the value of the Z-register, which is two registers, r30:r31 combined)
LSL=Logically Shift Left
LSR=Logically Shift Right
CBI=Clear Bit
SBI=Set Bit
AND=logical AND
OR=logical OR
EOR=logical Exclusive OR
ADD=ADD two registers
ADDI=ADD Immediate value to register
ADC=ADd with Carry
SUB=SUBtract two registers
SBC=SuBtract with Carry
SUBI=SUBtract Immediate value from register
OUT=change the value of a port
IN=read the value of a port

Only one instruction is allowed per line, execution is top->down.

Here's your job now: Go and figure out what's going on in the program. :)
If there are instructions, that I did not mention, you can search the Web.
You may find help in the full datasheet for the ATmega8, the datasheet can be downloaded from Atmel.com (remember: There are two versions, a short and a full, download the full version)
Anonymous
Tue 24-Apr-2012 04:57
I don't know how to use mkstory.c
So,lol,Help!SOS!
Thhhhhhhhhhhank you!
^ ^
Anonymous
Wed 20-Jun-2012 22:40
http://www.gammon.com.au/forum/?id=11608
Anonymous
Mon 3-Sep-2012 22:16
Is it possible to replace the 442 resistors with a more common value like 390 or 470?
mporshnev
Max Porshnev
Mon 19-Nov-2012 10:41

tesla1980 wrote:

Please help me ! Can anyone tell me how to change the c - code to make that the whole program loops itself ? Where i must change the code. I`m absolutely a c-code noop - i have no idea ! PLZ HELP ME !
I think it should be possible to modify firmware hex file and make it use microcontroller's watchdog after the main program end. The watchdog will restart the whole microcontroller. Or use more stupid way: pull reset low with an external hardware thing. :)

Is it possible to replace the 442 resistors with a more common value like 390 or 470?
Yes. Look at http://en.wikipedia.org/wiki/Resistor_ladder Keep in mind that DAC's output impedance should be low enough to drive 75 ohm load, that is the monitor input impedance. But not too low because microcontroller leg can't give much current.
Anonymous
Sun 6-Jan-2013 06:05
Looking forward to your next project, whatever it may be!
Have you dug into the XMega yet? It has serious juice and can overclock up to 64MHz easily.
I did a bitbanged NTSC color and sound system all in software using an XMega384...

https://www.youtube.com/watch?v=CXFOTpM2Jn4

XMega must be the greatest 8 bit micro yet!

Cheers,
Brad
Anonymous
Thu 28-Mar-2013 07:05
Good Job............
Anonymous
Fri 29-Mar-2013 21:41
Awesome demo!
I saw your code. Mega respect!
Anonymous
Sat 8-Jun-2013 03:44
Ironic how a famous musician did something nearly identical to this years ago.

Also something even more intriguing is that his name was displayed on the screen as well!

I'm glad that acid head is still getting his "wobbly legs" and licking windows.

Hail the Analord!
Anonymous
Sat 8-Jun-2013 03:45
Ironic how a famous musician did something nearly identical to this years ago.

Also something even more intriguing is that his name was displayed on the screen as well!

I'm glad that acid head is still getting his "wobbly legs" and licking windows.

Hail the Analord!
Anonymous
Tue 11-Jun-2013 05:09
Looking forward to your next project, whatever it may be!
Have you dug into the XMega yet? It has serious juice and can overclock up to 64MHz easily.
I did a bitbanged NTSC color and sound system all in software using an XMega384...

https://www.youtube.com/watch?v=CXFOTpM2Jn4

XMega must be the greatest 8 bit micro yet!

Cheers,
Brad


Please release your source i lové your work
I h
Anonymous
Sun 16-Jun-2013 10:18
I really want to buy You an Amiga 500, i'm sure that U can make a PS3 emulator on it! GENIUS!
gazliddon
Gaz Liddon
Fri 6-Sep-2013 13:26
Hiya :D

Big thank you this, I'm now taking faltering steps playing with microcontrollers and digital electronics because of the great write up you posted here :D

I have a question, not sure if you read this and answer them but:

What are you using timer B for? In boot.s It -looks- like it would act like a reset and looks like if enabled it'll trigger every 72 * 8 cycles (just over a lines worth). I'm new to this so couldn't figure our exactly what you're doing :D Were you using it as a watchdog during dev?

Ones again many thanks for making a project so inspirational to me :D
Anonymous
Sun 20-Oct-2013 10:28
Ultimate seriously i also gonna do this one.
Anonymous
Mon 16-Nov-2015 02:34
Aw this is in assembly (I have done assembly before, it's just gonna take a while for me to understand your code) any way it's awesome!
I am experimenting with a r2r dac myself with a atmega16. and trying to make a synth :).
AstronBnX
Reha Bicer
Sun 3-Jan-2016 15:55
You are crayz! This is awesome!
Anonymous
Mon 4-Jan-2016 21:12
"One display line takes 24 μs, and is followed by a 7.75 μs break called the horizontal blanking period"

I am confused here - every place i read about 640x480@60hz VGA timings, the display line takes 25.17 us, the front porch 0.94us - the actual sync itself (pin down) is 3.77us and the remaining back porch, 1,89 us. Im pressuming you are aiming at the standard 25.175 mhz ?

Also, in your code you are correcting for some jitter or missing timing-precision - is this because you use prescaling ?
lft
Linus Åkesson
Tue 5-Jan-2016 21:04
"One display line takes 24 μs, and is followed by a 7.75 μs break called the horizontal blanking period"

I am confused here - every place i read about 640x480@60hz VGA timings, the display line takes 25.17 us, the front porch 0.94us - the actual sync itself (pin down) is 3.77us and the remaining back porch, 1,89 us. Im pressuming you are aiming at the standard 25.175 mhz ?

Yeah, the standard allows for some deviation, so I picked some values that worked. Summing the values above, you get 31.77 μs for a standards-compliant scanline, but 31.75 μs in my implementation. At 20 MHz, each clock cycle is 0.05 μs, so it would not be possible to achieve 31.77 μs.

Also, in your code you are correcting for some jitter or missing timing-precision - is this because you use prescaling ?

The jitter correction is necessary because even though the interrupts fire at just the right moment, the CPU will complete the currently executing instruction before jumping to the interrupt handler. AVR instructions are 1, 2 or 3 cycles (and reading from EEPROM will hold off interrupts for 4 cycles).
Anonymous
Mon 28-Mar-2016 14:36
Hi!
Looking at the ASCII-drawing compared to the images of the craft, I see only 1 10uF capacitor, but there are two (seemingly) identical capacitors on the images of the 'real' craft?
I'm attempting to build one of these beauties, so I need to figure out what parts I need :-)
Amazing work, btw!
lft
Linus Åkesson
Tue 29-Mar-2016 22:44
Hi!
Looking at the ASCII-drawing compared to the images of the craft, I see only 1 10uF capacitor, but there are two (seemingly) identical capacitors on the images of the 'real' craft?
I'm attempting to build one of these beauties, so I need to figure out what parts I need :-)
Amazing work, btw!

You are right; I have forgotten to include the decoupling capacitor to the schematic. It's a 10 uF electrolytic that connects to Vcc on the plus side, and Gnd on the minus side. Its purpose is to stabilise the power supply against transients in the demand.
Anonymous
Wed 18-May-2016 19:31
Great stuff. Is the music inspired by the NES game Great Battle Cyber by chance?

https://youtu.be/c4DS-8IRLls?t=145
Seyedof
Ali Seyedof
Thu 2-Jun-2016 22:52

lft wrote:

Hi, i have a little problem here with craft. some colours doesn't seem to be the correct ones, cyan is missing in the plasma (showing another shade of blue instead) or the first tunnel isn't coloured red and white (it's purple and violet) for an example. any idea? i checked the hardware a few times and it looks ok.

Did you connect AVcc? In the original design, AVcc was left floating (by mistake), and this probably affects the amount of current that can be sourced from PORTC. Otherwise I really don't know.

Is AVcc mandatory while you are using PORTC for digital IO, not the ADC functionality? I guess AVcc is needed for A/D conversion and you don't need them while using PORTC as digital IO (which is the case with your impressive demo).
I'm trying to implement your demo on ATtiny13 as an even cheaper version, but with less color depth and no music:)
Great work dude
Anonymous
Mon 14-Aug-2017 08:43
I've seen craft for the first time. With mouth open I thougth: unbelievable !

JJ
Anonymous
Fri 1-Jun-2018 16:43
Is the music tracked?
Is it possible to rip it like a .mod or .ay music module?
Anonymous
Sat 4-May-2019 19:39
This microcomputer is so famous that it's emulated on MAME ( emulator that is mostly known for arcade emulation)
Anonymous
Mon 13-May-2019 18:19
This is absolutely the most impressive thing I've seen done with this type of micro controller. You have my respect good Sir!
Minecrafter
Wed 14-Aug-2019 14:39
Linus, can you make a standalone emulator of your various demos like Craft?
Minecrafter
Wed 14-Aug-2019 14:40

Minecrafter wrote:

Linus, can you make a standalone emulator of your various demos like Craft?
I meant an emulator for your various demos like Craft
Anonymous
Thu 29-Aug-2019 14:59
how do you made it?
Anonymous
Tue 12-Nov-2019 16:58
noorsun0035:

I see this project. i search a video generator with avr.
this is very nice.
but do this protect data is update?
the pic and schematic is low quality.
Unilein
Martin
Thu 20-Feb-2020 20:31
Really a great project! I am very impressed! I m going to build your demo just for fun. But it is really hard to get the DIP28 version of the Atmega88/20 MHz.

Could you compile your Version for the Atmega168 or the Atmega328? Until now I was not able to compile your code with the software I use (AVR Studio 7)

Thx & Greetz
Uni
Anonymous
Thu 4-Jun-2020 15:31
I have drawn the schematic in eagle, check it here as png:
http://www.bramsonderdelen.nl/vga_gen_m8.png
or as eagle sch:
http://www.bramsonderdelen.nl/vga_gen_m8.sch
contact me:
bram at atasco dot nl
what kind of transistor did you use?
Hi,
Links are broken!...
Anonymous
Tue 13-Oct-2020 03:01
the author should have drawn schematic more legibily using some circuit drawing software instead of this lousy ascii patterns

arun -
India
This minimalistic way of drawing goes with the minimal 'computer' approach. personnaly, I've really liked this ascii art. This a one more proof that the design is minimal AND powerful.
Anonymous
Tue 13-Oct-2020 03:45
This is really incredible !
Most impressive is .. 1K of ram. Not enough for a video buffer.
Amazing work !
Anonymous
Mon 28-Nov-2022 21:25
A friend has sent me the link, and I was impressed indeed (having done my analog schematics back in USSR childhood times, and rather none of assembly in my computer time, but I get the drift at least).

Greetings from Moscow, God bless!

Michael Shigorin / ALT Linux Team
Anonymous
Wed 28-Feb-2024 08:43
Nice job :)
Will it run on ATMEGA8 overclocked to 20MHz?
Any hardware/registers specifed only for ATMEGA88 are used there?