Pages: 1 [2] 3 4   Go Down
Author Topic: Generating Composite Video  (Read 13621 times)
0 Members and 1 Guest are viewing this topic.
Kortrijk, Belgium
Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
> http://mitglied.lycos.de/polyxos/video.htm

Since Germany uses the PAL TV standard it might not work on NTSC equipment.


as this is black&white (and there is no burst involved, PAL=4.43Mhz, NTSC=3.38Mhz) it might work on some Tv's because 50Hz * 625 lines = 31250 lines in PAL and 60Hz * 525 lines = 31500 lines so there is only difference of 250 lines/sec, it all depends on the vertical sync of the TV.

if we can get to the asm source I think it would be easy to change the 50Hz into 60Hz and the 625 lines to 525 lines.

Erik
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think possibly the problem might be that the DigitalWrite command takes a few microseconds to work... maybe you could try using port registers to switch the outputs?

http://www.arduino.cc/playground/Code/BitMath#registers

You might need to add up the cycles that you're using to make sure you get exact timing...

Sorry if all of what I've said is total rubbish... this is just my guess at a possible solution
Logged

The Moon
Offline Offline
Newbie
*
Karma: 0
Posts: 10
I <3 ?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I think possibly the problem might be that the DigitalWrite command takes a few microseconds to work... maybe you could try using port registers to switch the outputs?

http://www.arduino.cc/playground/Code/BitMath#registers

You might need to add up the cycles that you're using to make sure you get exact timing...

Sorry if all of what I've said is total rubbish... this is just my guess at a possible solution

I've actually had a feeling that that's where my problem is and I've been trying to figure out just how to figure out how long digitalWrites take. This page might help out though, I'll try it later tonight.
Thanks!
Logged

"When skating on thin ice, our saftey is in our speed" - Ralph Waldo Emerson

0
Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah, the guy who did the pic pong counted each clock cycle- I'm hoping that the arduino's delay functions are accurate enough for this...  does anyone know of a way to delay a specific amount of cycles in code? If a specific amount can be delayed, and one knows how many cycles each instruction uses, you could get perfect timing this way I should have thought...

The arduino does seem to have quite a bit more processing power than the pic he used, so i'm hoping you could get some better game logic in there...

Keep us updated with your progress though, this is one of the things i want to try when i get my arduino! Roll on a wave of arduino based games I say!
Logged

The Moon
Offline Offline
Newbie
*
Karma: 0
Posts: 10
I <3 ?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

O.K. so after reading some about using the registers and applying it to some code I ended up with this


http://datablue.net/random/better_vid.AVI

Not perfect, but alot better than before!
This code still doesn't incorporate the vertical sync because I can't get the timing right. I think It might have something to do with the loop I'm using.

Code:
/* Composite Video Generation
 * ------------
 *
 * uses a 2-bit D-A converter to generate
 * voltages for composite video to RCA. This
 * code should generate continous white horizontal
 * lines to create a fullly white TV
 *
 * Created 18 December 2006
 * copyleft 2006 Kyle Granat <http://www.datablue.net>
 * http://arduino.cc
 *
 * based on Rickard Gunée's pic work
 * http://www.rickard.gunee.com/projects/video/pic/howto.php
 *
 * Register code from Cosine Kitty
 * http://www.arduino.cc/playground/Code/BitMath#registers
 */


void setup()
{
        // set pins 0 (serial transmit) and 2 and 3 as output,
        // but leave pin 1 (serial receive) as input
        // (otherwise serial port will stop working!) ...
        DDRD = B00001101;  // digital pins 7,6,5,4,3,2,1,0
        // Turn off digital output pins 2 and 3
        PORTD &= B00000011;   // turns off 2..7, but leaves pins 0 and 1 alone

}

void loop()
{
  
  
    PORTD = B00000000;    // sets out to 0V for sync pulse for 4 uS
    delayMicroseconds(1);
    delayMicroseconds(1);
    delayMicroseconds(1);
    delayMicroseconds(1);

    PORTD = B00000100;//sets out to .33V  for 'porch'
    delayMicroseconds(1);
    delayMicroseconds(1);
    delayMicroseconds(1);
    delayMicroseconds(1);
    delayMicroseconds(1);
    delayMicroseconds(1);
    delayMicroseconds(1);
    delayMicroseconds(1);

    PORTD = B00001100;   //sets out to 1V(White)
    delayMicroseconds(52);  


}
Logged

"When skating on thin ice, our saftey is in our speed" - Ralph Waldo Emerson

Florida, USA
Offline Offline
Full Member
***
Karma: 0
Posts: 146
meow!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

My guess is that you might have some problems because of timer interrupts (or other interrupts?) messing up your timing.  Just as an experiment, try adding this to the end of your setup():

    cli();   // disable interrupts

Of course, this will mess up all kinds of stuff you might want to add later, like serial port I/O, use of timers, delay(), millis(), etc.

I say this because I was surprised when I tried generating radio frequency energy and encountered an unexpected tone modulated on top of what was supposed to be a pure carrier wave.  See here:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1166896036
Logged

The Moon
Offline Offline
Newbie
*
Karma: 0
Posts: 10
I &lt;3 ?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
My guess is that you might have some problems because of timer interrupts (or other interrupts?) messing up your timing.  Just as an experiment, try adding this to the end of your setup():

    cli();   // disable interrupts

I disabled the interrupts but nothing noticable has changed. Thanks for the suggestion though.
Logged

"When skating on thin ice, our saftey is in our speed" - Ralph Waldo Emerson

0
Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I disabled the interrupts but nothing noticable has changed. Thanks for the suggestion though.

Any news?  smiley
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Here is a video overlay project using the ATmega8 [...]

http://www.knology.net/~gdion/videoverlay.html

Hi, do you understand what's Q1 specifications in that schematic?

Thanks,
Superware
Logged

The Moon
Offline Offline
Newbie
*
Karma: 0
Posts: 10
I &lt;3 ?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote

Any news?  smiley

Still working on it, though classes seem to be getting in the way :3
I might get a chance this weekend to tinker some more, but no real progress as of late.

Also q1 in the schematic is a pnp transtor. I'd imagine a 2n3906 would work fine.
Logged

"When skating on thin ice, our saftey is in our speed" - Ralph Waldo Emerson

0
Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm going to start work on an ASM version of this to get the timing exact.

How would I go about writing a block of ASM code in C? Would you just stick all the lines in an asm() ?
Logged

Netherlands
Offline Offline
Sr. Member
****
Karma: 0
Posts: 414
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Looking forward to any updates on this. Also, anyone knows if it would be possible to create a video overlay (OSD) with Arduino?
« Last Edit: March 19, 2007, 05:33:14 am by jds » Logged

Kortrijk, Belgium
Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Looking forward to any updates on this. Also, anyone knows if it would be possible to create a video overlay (OSD) with Arduino?

http://www.knology.net/~gdion/videoverlay.html
Logged

Netherlands
Offline Offline
Sr. Member
****
Karma: 0
Posts: 414
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank Erik,

That is a very valuable link!

Cheers,

JD
Logged

Poitiers (France)
Offline Offline
Full Member
***
Karma: 0
Posts: 136
Ca va j'vais le faire !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

hello,

  I had the same idea : http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1176757335.

  Now I'm giong to read your post, I have some timming pbroblems in interruption mode...

Logged

Cordialement,
Benoît ROUSSEAU

Pages: 1 [2] 3 4   Go Up
Jump to: