Hey guys, this is a follow up on this topic. It started in French, but I figured since NTSC is used mainly in America and in Japan, English might be better suited for the topic. The basic setup is the same as the Arduino pong and the other topic. So this is just my "port" of what these guys did. I did build mine with a "structure" to allow adding pal support to be able to switch modes easily in the code.
Disabling the interrupt timer
I haven't gotten my code to work with cli() and serial so you'll have to modify lib/target/arduino/wiring.c (MAKE A BACKUP) like such:
// enable timer 0 overflow interrupt #if defined(__AVR_ATmega168__) sbi(TIMSK0, TOIE0); #else sbi(TIMSK, TOIE0); #endif
/* // enable timer 0 overflow interrupt #if defined(__AVR_ATmega168__) sbi(TIMSK0, TOIE0); #else sbi(TIMSK, TOIE0); #endif */
That is... Sync to port 8 on the arduino and video to port 9. I use 900 and 300ohm resistors but it should change much anyway; these can be a little off.
Grab the latest version of the code.
Once you've uploaded the code, connect via serial (I use screen in the terminal) and wait for the uC to finish loading (you'll see "Mode:"). If everything went well there should be a dot in the middle of the TV. Now hit enter for usage. If you read through the code you will see there is a way of enabling "signal voltage mode" which allows you to debug your circuit.
There are a few things that are acting weird... I could really use some feedback.
- If you put the resolution higher the uC seems to crash (not enough ram?).
- Sometimes the uC acts as if the mode (output) had not been set properly. Re-uploading seemed to have fixed the problem when I've seen it.
There may be a timing issue while writing the first few lines.(EDIT: The issue has been fixed, see posts bellow)
- Going into signal mode sometimes seems to crash the uC (same behavior as the first issue)
I've tested these this with both a mega8 and mega168 (thanks to the USBTiny that appeared in my mailbox this morning and a little magic from its fairy) on the NG and under 0007 and 0009. Optimally this code would need to be ported to a version with interrupt support.
P.S. If that pastie ever goes down, here is a plain text mirror.
And the obligatory picture ^-^
(The flickering at the top seems to have been fixed – at least as best as I could) FIXED