Sunday, January 3, 2010

Initial NTSC test code

Hooking up an Arduino board to a TV requires very little hardware (a few resistors and an RCA plug), and there is a ton of stuff you can do with it.  Elsewhere on the web you can find implementations of Pong (for PAL at least... not sure about NTSC), and other large-pixel "frame buffer"-based NTSC display implementations.

I started with the hardware and software found here, and have been modifying it.

To get this program to work with arduino-0017 and a Duemilanove with ATmega328, I made the following timing changes:

#define _ntscDelayHSyncStart 3
#define _ntscDelayBackPorch 1
#define _ntscDelayFrontPorch 1
#define _ntscDelayPerLine (2*21)
#define _ntscDelayVSync 25

As well, rather than editing wiring.c or turning off all interrupts (sending serial commands requires one), I turned off only the one, in setup( ):

#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif

// Disable timer 0 overflow interrupt, for precise timing.
cbi(TIMSK0, TOIE0);

No comments:

Post a Comment