| HOWTO generate a PAL video screen on Arduino | |
|
[ Home ]
|
This page is dedicated to my works on the Arduino platform. This program generate a PAL Video screen 160x256 pixel, full of text (20x32 char) and left some time to do something else! This program use D0RX and D1TX pin on a arduino nano 3.0 (ATmega328), to see it you must connect 1 resistor to D0 (330ohm) and 1 resistor to D1 (1k ohm), this is the signal for you tv, take GND from arduino board. To download a program you must disconnect the resistor that interfere to your FTDI chip. Arduino IDE compile everything with -Os optimization for size not speed. I have a Makefile to compile with option -O2 optimization for speed, that is customized for Arduino-0018 for Mac but adaptable for other platforms. Go to the dir where is your pde file (in a dir that have the same name), and do a make. After you can do a make upload, see in the Makefile (that is done for Arduino-0018 on Mac OS X) to do the changes for your sistem. USART clk/4 mode is used to achieve a very fast pixel blasting!
ychar=(line-STARTLINE)&7; //offset in char
y=(line-STARTLINE)/8; //char per line
// blast the data to the screen
// We can load UDR twice because it is double-bufffered
buffer=tileset[screen[0+y*32]*8+ychar];
UDR0 = 0x00 ;
UCSR0B = _BV(TXEN0);
UDR0 = buffer ;
for(x=1;x<20;x++)
{
buffer=tileset[screen[x+y*32]*8+ychar];
while (!(UCSR0A & _BV(UDRE0))) ;
UDR0 = buffer ;
}
[ Home | Arduino ]
|