Pages: [1] 2   Go Down
Author Topic: TVout Color - NTSC [upped new code - Oct. 04]  (Read 5078 times)
0 Members and 1 Guest are viewing this topic.
Japan
Offline Offline
Jr. Member
**
Karma: 16
Posts: 73
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi !
I have tried to generate NTSC color signal with an Arduino and some registers.



Hardware
https://picasaweb.google.com/117534855759200010314/ArduinoTVoutColorNTSC#5870797060544309458
Display 7 colors
https://picasaweb.google.com/117534855759200010314/ArduinoTVoutColorNTSC#5870799542950661026
The signal at 7 colors
https://picasaweb.google.com/117534855759200010314/ArduinoTVoutColorNTSC#5884519987867834162
Simulation for registers select
https://picasaweb.google.com/117534855759200010314/ArduinoTVoutColorNTSC#5870801524748013842
Colorburst signal
https://picasaweb.google.com/117534855759200010314/ArduinoTVoutColorNTSC#5884519959081339202

The code to generate Colorburst signal is written by assembly language like this.
Code:
#define OutBurst\
        "out 0x08,r18\n\t"\
        "out 0x08,r19\n\t"\
        "out 0x08,r20\n\t"\
        "out 0x08,r21\n\t"\

void CINT::SP_Txt( UH AddrGRP, UB Mode, UB Color )
{
    __asm__ __volatile(
        "mov r24,%2\n\t"        // r24:select color
        "mov r25,%1\n\t"        //                                          |
        "ldi r18,0\n\t"         // -40IRE                                   |           //V-Sync
        "out 0x08,r18\n\t"      // output H-Sync level (-40RE/0V)       +---+   //H-Synch 4.7us:67cycle
        "cpi r25,2\n\t"         // V-sync timing?   1cycle              |       1       1
        "brne NEXT\n\t"         // if not V-sync    1cycle/2cycle       |       2,3     1
        "jmp EXIT2\n\t"         // now V-sync
"NEXT:"
        "ldi r23,7\n\t"         // 0IRE                                 |       4
        "ldi r18,7\n\t"         // COLBST0                              |       5
        "ldi r19,3\n\t"         // COLBST1                              |       6
        "ldi r20,7\n\t"         // COLBST2                              |       7
        "ldi r21,11\n\t"        // COLBST3                              |       8
        "nop\n\t"               //                                      |       9
        "ldi r22,19\n\t"        // loop count                           |       10
"HS_LOOP:"                      // for H-Sync level keep
        "dec r22\n\t"           // 1cycle                              ||
        "brne HS_LOOP\n\t"      // 2/1      (1+2)*18+(1+1) = 56        ||       66
        
        "out 0x08,r23\n\t"      // 0IRE                                     |   1
        "out 0x08,r23\n\t"      // 0IRE                                     |   2
        "out 0x08,r23\n\t"      // 0IRE                                     |   3
        "out 0x08,r23\n\t"      // 0IRE                                     |   4
        "out 0x08,r23\n\t"      // 0IRE                                     |   5
        "out 0x08,r23\n\t"      // 0IRE                                     |   6

        "push r1\n\t"           //                                          |   7
        "push r16\n\t"          //                                          |   8
        "push r17\n\t"          //                                          |   9
        
        OutBurst                // No.1 Color Burst                        --
        OutBurst                // No.2                                    --
        OutBurst                // No.3                                    --
        OutBurst                // No.4                                    --
        OutBurst                // No.5                                    --
        OutBurst                // No.6                                    --
        OutBurst                // No.7                                    --
        OutBurst                // No.8                                    --
        OutBurst                // No.9                                    --
        

I want to display more characters per line.
So, I will continue to improve.

Thanks !

« Last Edit: October 04, 2013, 06:55:42 am by Nabe_RMC » Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 240
Posts: 24430
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That deserves a bucket-load of karma.
Sadly, I can only give one for now.
Nice work!
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Phoenix, Arizona USA
Offline Offline
Faraday Member
**
Karma: 36
Posts: 5519
Where's the beer?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This is great work to see! A couple of questions, though:

1. Will you be posting your work on this like you have for your arduino-vgaout display (https://code.google.com/p/arduino-vgaout/)?

2. By "NTSC" - do you mean Japan or USA? I know they are fairly similar, with minor differences (but I'm not an expert)...

The images and code you supplied give only the barest hint at what is possible (someone with a lot of experience in NTSC could probably take what you've posted so far here and make it work - but it wouldn't be easy for most). Regardless - bravo!
Logged

I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

Japan
Offline Offline
Jr. Member
**
Karma: 16
Posts: 73
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi! AWOL and cr0sh
Thank you for your replies.

Quote
1. Will you be posting your work on this like you have for your arduino-vgaout display (https://code.google.com/p/arduino-vgaout/)?
Yes, I will create new project "NTSC color wit Arduino" on Google code site.
If someone move this code, he needs more information.
But, I'm not ready for those documents.
So, I just uploaded here. (A_NTSC_Trial_20130524.zip)
https://code.google.com/p/arduino-vgaout/downloads/list
Please check this.

Quote
2. By "NTSC" - do you mean Japan or USA? I know they are fairly similar, with minor differences (but I'm not an expert)...
I live in Japan. and the code for the TV in Japan.
There is not much difference in NTSC-M and NTSC-J.
I think so and we can change the 0-IRE data of the code.
https://en.wikipedia.org/wiki/NTSC
Quote
Only Japan's variant "NTSC-J" is slightly different: in Japan, black level and blanking level of the signal are identical (at 0 IRE), as they are in PAL, while in American NTSC, black level is slightly higher (7.5 IRE) than blanking level. Since the difference is quite small,
But PAL's Color Sub Carrier is different.

Color Sub Carrier of NTSC is  3.579545NHz.
We make the colorburst signal to display with color composite.
[ColorBurst]
http://en.wikipedia.org/wiki/Colorburst
To make the composite color sigal, we need the crystal that the frequency is colorburst frequency x 4.
NTSC -> 3.57954MHz x 4 = 14.318MHz
we can get it easily.
http://bit.ly/ZNcU3S

This time, I used Arduino Uno.
I noticed the crystal for ATmega328P is the small one.
And I use Arduino IDE boot loader for 16MHz.
So, I had to be able to replace the crystal.
https://picasaweb.google.com/117534855759200010314/ArduinoTVoutColorNTSC
I will continue to improve the program.
And I will add more information every weekend.

Thanks! All

Nabe
Logged

Online Online
God Member
*****
Karma: 32
Posts: 506
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I tried something similar a few years ago - I also used a 14.318MHz crystal crystal. But I was using a Duemilanove, which was much easier as it already had a crystal oscillator for the 328P. All I needed to do was desolder the crystal and replace it with a socket, then I could change over the crystals easily.

I will see if I can find that Duemilanove, I think it is buried in my RepRap somewhere, and the 14.318MHz crystal, and see if I can get your code to work smiley
Logged


Online Online
God Member
*****
Karma: 32
Posts: 506
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Success smiley-grin Your code works well!



* ntsctext.jpg (175.29 KB, 800x607 - viewed 111 times.)

* ntscbars.jpg (109.42 KB, 800x564 - viewed 68 times.)
Logged


Offline Offline
Jr. Member
**
Karma: 0
Posts: 84
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Karma'd

I was looking to make a dirt cheap color bar generator as those online costs over $150. Your project will do nicely for checking old color TV to see if they are in operation or not.
Logged

Japan
Offline Offline
Jr. Member
**
Karma: 16
Posts: 73
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi! stimmer and wilykat
Thanks for your replies.

I also think that Duemilanove is suitable for this project.
Exchange of crystal makes easy Duemilanove than UNO.

I have tried to display simple graphic pattern.

There are sum bugs. And I am not satisfied with it.
So I will continue to improve.

---------------------------------------------------------------------------------------
The color is decided by the signal amplitude and the phase of color burst signal.
One color dot is generated by 4 commadns.
#define OutPixel\
        "out 0x08,r18\n\t"\
        "out 0x08,r19\n\t"\
        "out 0x08,r20\n\t"\
        "out 0x08,r21\n\t"\

In order to change a color, four commands are required as follows.
And in the meantime the modulation of the signal is stop.
#define SetColGrn\
        "ldi r18,9\n\t"\
        "ldi r19,13\n\t"\
        "ldi r20,27\n\t"\
        "ldi r21,23\n\t"\

« Last Edit: June 15, 2013, 08:53:27 pm by Nabe_RMC » Logged

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

right,Your project will do nicely for checking old color TV to see if they are in operation or not. 
Logged

Japan
Offline Offline
Jr. Member
**
Karma: 16
Posts: 73
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes. We can use old color TV.
And we can use LCD TV or monitor with composite input.
In Japan, analog television broadcasting was terminated 2 years ago.
So many CRT TV have discarded.

I tried to display simple graphics.
Arduino does not have enough RAM.
So, This is the limit for me at this stage.
I used LCD TV.
This is the latest achievements.


I changed the method of generating the sybchronization signal.
For synchronization signal simplified, this television seems to have determined that the signal is interlaced scan signal.
https://picasaweb.google.com/117534855759200010314/ArduinoTVoutColorNTSC#5893030025201887202
https://picasaweb.google.com/117534855759200010314/ArduinoTVoutColorNTSC#5893030134825134738

I will modify the code in this week.
Logged

Japan
Offline Offline
Jr. Member
**
Karma: 16
Posts: 73
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I tried using  an Arduino Duemilanove that has been used before.
The color of the resist is black.
https://picasaweb.google.com/117534855759200010314/ArduinoTVoutColorNTSC#5897513433131707874

I had used  the  original bootloader for 16MHz crystal.
So, after writing the code, I had to off the power and change the crystal to 14.31818MHz.
And to rewrite the code, I had to change the crystal to 16MHz.
It's a little bother.

I have examined how to rewrite the boot loader.

The C source and make files in that folder.
arduino-1.0.4\hardware\arduino\bootloaders\atmega

change "Makefile"
Code:
#atmega328: AVR_FREQ = 16000000L
atmega328: AVR_FREQ = 14318180L

add the define  "ATmegaBOOT_168.c"
Code:
#define EEWE 1

I used WinAVR to compilie the code.
http://sourceforge.net/projects/winavr/files/WinAVR/

And I used  avrdude-GUI to write the bootloader to Arduino Duemilanove.
http://www.geocities.jp/arduino_diecimila/bootloader/

I will continue to improve the program little by little.
Logged

Japan
Offline Offline
Jr. Member
**
Karma: 16
Posts: 73
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi All!

I had a lot trial and error in order to increase the number of characters displayed per line.
I came to be display in a stable 12 lines - 20 columns.
But it is not displayed correctly by the display.
Because it was too simplified synchronization signals
and for non-interlace signal.
I think so.
And I can to improve it may be.

CRT TV
http://twitpic.com/d9v6bt

LCD TV
http://twitpic.com/d9vabk

PC Monitor Compsite in
http://twitpic.com/d9vc4x

I will up the new code about one month later.
I will continue to diligently improvemnet.
Please wait a little more.




Logged

Offline Offline
Full Member
***
Karma: 2
Posts: 140
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Looks great !  smiley-eek
Logged

a][+ ascii express, 110/300 novation cat, xmodem

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 240
Posts: 24430
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
That deserves a bucket-load of karma.
Sadly, I can only give one for now.
Hmm, that seems not to be true for moderators, so here, have some more!
Truly, great work, keep it coming, thanks!
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Japan
Offline Offline
Jr. Member
**
Karma: 16
Posts: 73
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes!
To that bucket from this bucket...
Beaten with the horizontal sync signal...
8bit microcomputer is working hard! smiley

I upped new demo video and new code.
Video on YouTube
https://www.youtube.com/watch?v=ysMUZaUsUp0

I tried to start "TVout Color NTSC" project on google code.
But..
"...where is download tab?"
http://stackoverflow.com/questions/17120536/starting-a-project-on-google-code-where-is-download-tab

So, I upped the new code into Dropbox.
https://dl.dropboxusercontent.com/u/85872655/TVoutColor_20131004.zip

Does anyone
have any question or request?
Please post.

Best regards,
Nabe
« Last Edit: October 04, 2013, 06:52:10 am by Nabe_RMC » Logged

Pages: [1] 2   Go Up
Jump to: