I figure the one thing that the arduino is missing is a display. I'm short on cash so buying a display was out of the question. But i do have a PSone with a 5" LCD. I did a little search online and found a previous attempt at composite video on the arduino in the forums.
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1166667354/0
But it seam there where still problems with it. I then found this site.
http://dailyduino.com/archives/368
So i figured i'd give it a try and see how it went.
I can't say i understand even half of the code but it does work... to an extent. Problem i'm having, and the problem presented in the thread, is getting the V sync worked out. It displays what its designed to say on the screen but its rolling from bottom to top.
Maybe someone wiser then I can figure out what could be changed to get this to sync up.
//Adapted by phizone from:
//
//Arduino Tv framebuffer
//Alastair Parker
//2007
// Video out voltage levels
#define _SYNC 0x00
#define _BLACK 0x01
#define _GRAY 0x02
#define _WHITE 0x03
// dimensions of the screen
#define WIDTH 38
#define HEIGHT 14
//number of lines to display
#define DISPLAY_LINES 240
// update speed for the main loop of the game
#define UPDATE_INTERVAL 1
//video pins
#define DATA_PIN 8
#define SYNC_PIN 9
// the video frameBuffer
byte frameBuffer[WIDTH][HEIGHT];
// loop indices
byte index, index2;
// pal video line loop
byte line;
// current drawing line in framebuffer
byte newLine;
// if displaying the title
boolean showingTitle = true;
// draw a pixel to the buffer
void setPixel(byte x,byte y)
{
frameBuffer[x][y]= _WHITE;
}
void grayPixel(byte x, byte y)
{
frameBuffer[x][y]= _GRAY;
}
// draw a black pixel to the buffer
void clearPixel(byte x,byte y)
{
frameBuffer[x][y]= _BLACK;
}
//draw the title message
void drawArduinoPong()
{
//DAILY
setPixel(6,3);
setPixel(7,3);
setPixel(11,3);
setPixel(12,3);
setPixel(14,3);
setPixel(15,3);
setPixel(16,3);
setPixel(18,3);
setPixel(21,3);
setPixel(23,3);
setPixel(6,4);
setPixel(8,4);
setPixel(10,4);
setPixel(12,4);
setPixel(15,4);
setPixel(18,4);
setPixel(21,4);
setPixel(22,4);
setPixel(23,4);
setPixel(6,5);
setPixel(8,5);
setPixel(10,5);
setPixel(11,5);
setPixel(12,5);
setPixel(15,5);
setPixel(18,5);
setPixel(22,5);
setPixel(6,6);
setPixel(7,6);
setPixel(10,6);
setPixel(12,6);
setPixel(14,6);
setPixel(15,6);
setPixel(16,6);
setPixel(18,6);
setPixel(19,6);
setPixel(20,6);
setPixel(22,6);
//DUINO
setPixel(9,8);
setPixel(10,8);
setPixel(13,8);
setPixel(15,8);
setPixel(17,8);
setPixel(18,8);
setPixel(19,8);
setPixel(21,8);
setPixel(24,8);
setPixel(27,8);
setPixel(28,8);
setPixel(9,9);
setPixel(11,9);
setPixel(13,9);
setPixel(15,9);
setPixel(18,9);
setPixel(21,9);
setPixel(22,9);
setPixel(24,9);
setPixel(26,9);
setPixel(29,9);
setPixel(9,10);
setPixel(11,10);
setPixel(13,10);
setPixel(15,10);
setPixel(18,10);
setPixel(21,10);
setPixel(23,10);
setPixel(24,10);
setPixel(26,10);
setPixel(29,10);
setPixel(9,11);
setPixel(10,11);
setPixel(13,11);
setPixel(14,11);
setPixel(15,11);
setPixel(17,11);
setPixel(18,11);
setPixel(19,11);
setPixel(21,11);
setPixel(24,11);
setPixel(27,11);
setPixel(28,11);
}
// clear the screen
void clearScreen()
{
for (index = 0; index < WIDTH; index++)
for (index2=0;index2<=HEIGHT;++index2)
{
frameBuffer[index][index2] = _BLACK;
}
}
// the setup routine
void setup()
{
cli();
pinMode (SYNC_PIN, OUTPUT);
pinMode (DATA_PIN, OUTPUT);
digitalWrite (SYNC_PIN, HIGH);
digitalWrite (DATA_PIN, HIGH);
clearScreen();
drawArduinoPong();
}
void loop()
{
// iterate over the lines on the tv
for ( line =0;line< DISPLAY_LINES;++line)
{
// HSync
// front porch (1.5 us)
PORTB = _BLACK;
delayMicroseconds(1.5);
//sync (4.7 us)
PORTB = _SYNC;
delayMicroseconds(4.7);
// breezeway (.6us) + burst (2.5us) + colour back borch (1.6 us)
PORTB = _BLACK;
delayMicroseconds(0.6+2.5+1.6);
//calculate which line to draw to
newLine = line >>4;
delayMicroseconds(1);
//display the array for this line
// a loop would have been smaller, but it messes the timing up
PORTB = frameBuffer[0][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[1][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[2][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[3][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[4][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[5][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[6][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[7][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[8][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[9][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[10][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[11][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[12][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[13][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[14][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[15][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[16][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[17][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[18][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[19][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[20][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[21][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[22][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[23][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[24][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[25][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[26][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[27][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[28][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[29][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[30][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[31][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[32][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[33][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[34][newLine];
delayMicroseconds(1);
PORTB = frameBuffer[35][newLine];
delayMicroseconds(1);
// klugdge to correct timings
PORTB = frameBuffer[36][newLine];
PORTB=PORTB;
PORTB=PORTB;
PORTB=PORTB;
delayMicroseconds(2);
}
//vsync
PORTB = _SYNC;
// wait for the remainder of the sync period
delayMicroseconds(565);
}
I've tried to change the #define _SYNC 0x00 value but it doesn't seam to change anything. I'm pretty sure this is an issue with the hardware that we may not be able to overcome. But i sure do want to give it a try. This is a simple setup and could have allot of uses.
I think i'll start looking into the pin out of the playstation AV connection and see if i can go strait digital to the screen.