TVout Colors

TVout is great, but two colors at 128x96 gets a bit small after a while. Through other posts, I realize that it is impossible with the arduino's current speed and memory to get full 8-bit color (RGB). But using a DAC such as this one and the helpful breakdown of the NTSC protocol here, would it be possible to get 8-bit B+W (256 colors from white to gray?) At a the resolution mentioned above (128*96), we would need a total of 12288 bytes for the frame buffer, so if my code is not too long, could it work? I may not even need TVout...

baum

What if I used a smaller resolution, i.e. 30*40? How long is a "pixel time"?

Assuming a visible line length of about 52us, and 720 pixels to the line, about 72ns, or just a little longer than one instruction cycle at 16MHz.

The Arduino only has 2K of SRAM, so you don't have nearly enough memory to store 8 bits per pixel. Remember, the memory usage reported by the IDE when you upload is the flash memory for storing your program, not SRAM.

And as AWOL said, there's only so much time to read the pixel information and write to the DAC. At 128 pixels horizontal, there are only 5 instruction cycles available to do this work, and the current 1-bit output uses 3 cycles (then does a NOP for 2 cycles). In other words, there's not enough time to even do 2-bit video.

So decrease the output resolution and store the frame buffer in Flash.

Are you planning on using an external encoder for the colour information?

Probably a DAC of some sort so I needn't deal with the pseudo-DAC resistor network.

Probably a DAC of some sort

But how are you going to get the phasing of the sub-carrier correct?

You can't store the frame buffer in flash memory -- it's read-only.
baum, generating color composite video is just not going to happen on a $3 microcontroller.

Alright.

But how did those cheap plug-n-play pacman units do it?

Custom hardware

So something like an FPGA would be the way to go if I really wanted to do it?

Custom hardware

Yes, hardware designed for the purpose of generating video signals. The ATmega328 is not designed for that. It's a simple general purpose microcontroller.

there is this:

http://www.linusakesson.net/scene/phasor/index.php

OMG. That is awesome. Would any one who told me it was impossible like to comment on Linus' phasor?

:slight_smile:

I know about this demo and it is very impressive. It takes advantage of a particular feature of PAL, but is not possible with NTSC (North American TV standard). The memory constraints associated with storing an actual frame buffer (like if you were writing a game or something) are still real constraints. There are only 2K of SRAM in the Arduino.
Baum, if you think you can use these techniques to make a color version of TVout, then PLEASE do so! We'd all be very grateful! We aren't telling you not to try -- we are just informing you of the technology constraints that have made color frame buffer based composite output not possible. Prove us wrong by doing it!

particular feature of PAL

Please elaborate.

What is the difference between PAL and NTSC that makes color output possible?

Craft (his earlier demo) does color VGA and 4-channel sound on the 88:

http://www.linusakesson.net/scene/craft/index.php

I think the real answer for this is that to pull off color video -and- sound at the same time - you have to be an uber-demo coder like Mr. Akesson; this isn't going to happen on a 328 without pure AVR assembler coding, and lots of cycle counting (and code rearranging, etc). He likely isn't even using a frame buffer, for that matter (maybe a line buffer, like the Atari 2600 video chip).

Now - if somebody could build that code and burn a 328 (running at 20 MHz) and add some kind of interface to control it (then throw it all on a shield, of course) - then you'd have a good beginning of a nice video interface for the Arduino that went beyond the TVOut library...

:slight_smile:

Heh - just saw this one:

http://www.linusakesson.net/scene/bitbanger/index.php

ATtiny15 @ 1.6 MHz, 1K of flash, and 32 bytes of RAM!

VGA output (ok, 3 x 8 pixels - LOL - also "glitch video"), plus multi-channel sound...

I love the demoscene!

:slight_smile:

Please elaborate.

What is the difference between PAL and NTSC that makes color output possible?

Read about the project -- he explains it!
http://www.linusakesson.net/scene/phasor/index.php