Go Down

Topic: Interfacing with an NTSC TV (Read 5180 times) previous topic - next topic

doctorwho8

[size=12][font=Times New Roman]
Hello!
About that code from the blog. It seems to be incomplete in places. Which code blob should I be using? Do you have a pastie for it someplace?

And for the code that I know works, I am getting either a squashed spiral of lines at first, or a big spiral of lines, instead of the pattern that you're displaying on your demonstration screens.
----
/me

[/font][/size]

drspectro

Both pieces of code on the DailyDuino blog are complete.  However they were created by stripping down the original Pong program.  So all they do is a demo screen.  There are a few comments and variables left from pong but they both work.  I used the original code "as is" and the "improved version" I posted there is complete.  I do recomend the second example I posted.  

Actually it looks like Phizones original code has an emoticon embeded in it and my improved code the "include" statement didnt display right.  There is a note from me right below the code with the correct include statement.  Other than that they are "complete"

Note that the "improved" code requires the FrequencyTimer2 library from the libraries page on this site.   Maybe thats what you are missing?  The first example on the DailyDuino page uses software delays.  However, the first example doesnt need the FrequencyTimer2 library.

The "medium res" code post is sort of messy in three chunks, but Phizone did download and test it from here.  I will see if I can post it somewhere as a complete chunk.

Regarding port numbers this is confusing and my example didnt make it any easier.  The picture in thread you started with showed the D2A convertor on PORTD.  The "grab code here" code used PORTB.  Phizones original Pong mod used PORTB pins 8-9.  

However for "Medium Res" I switched to PORTC pin 14-17.  I thought I had a problem with PORTB (I didnt) but by the time I got it working I was too lazy to switch it back (big sorry for that). PORTB should work just fine, but would take a bit of editing, both port name and pin numbers.

Finally the comments for "Medium Res" have a diagram of the D2A circuit it needs.  For any of the others, make sure you are using the diagram that goes with the code.  

Once you are sure you have the right D2A (and pins) for the code you are running, try tweaking the delay statements I mentioned earlier.   Be sure and let me know which code you are working with too....

drspectro

doctorwho8
If you were wondering about "digital 14-17"  the analog pins can also be used as digital pins see this thread (and its in the docs somewhere).

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1243531186/3#3

"Then you use the following from the Arduion reference section:

"The analog input pins can be used as digital pins w/ numbers 14 (analog input 0) to 19 (analog input 5). "
"

Michael Devine

I had a hard time getting this code to work.  It wasn't sync'ing, and I had to drop the delays down really far to get it to be stable.  Something like:
ntscDelayHSyncStart  3 us
ntscDelayBackPorch  1 us
ntscDelayFrontPorch  1 us
ntscDelayPerLine  2*21 us
ntscDelayVSync  25 us

Is it common to have this problem (not sync'ing -- screen is a rapidly moving mess of short horizontal lines) with the original values?  Does this mean my board is slower than standard?  Or that something else is slowing it?

> Is it possible that arduino timing has changed?

Perhaps delayMicroseconds was significantly changed over the past couple years?  I just compared 0007 and 0017... The only difference I see is the addition of a local variable and saving/restoring the interrupts SREG.  Just a few clock cycles I would think.

My specs:
- Duemilanove with ATmega328
- arduino version 0017

Also... i modified the code to allow interactive changing of the delay values, and then to allow 4x the precision in delay values.  I could post this messy code if anyone else has trouble with the "standard" delay values; let me know.

Thanks for the code and for any advice about why I'd need much smaller delays!

Go Up