Please help! Generating Composite video signals from scratch

Thread Starter

PauloConstantino

Joined Jun 23, 2016
266
Hi friends,

I have been scratching my head (and banging it too) for ages now trying to understand the cryptic sync signals for composite black and white video.

I want to generate simple black and white using composite, preferably PAL. But the more I read about it, the more confused I get!

What is the difference between interlaced and non interlaced? I don't want complications so I am looking to generate non interlaced. However I dont understand the difference very well. Does non interlace contain less lines in the screen ?

If I go for non-interlace, will I get only about 300 lines of video? And interlaced is around 600 ?

Can I get 600 with non interlaced? I heard some games on the ps2 uses non interlace.

Also, I have seen pictures here the scan is going diagonally across the screen rather than at the same horizontal level. Is that the beam going back to the original position or is it writing to the screen at such times? This is so weird. From one article I get the impression that the diagonal beam is writing. Here's a pic of what I mean:

Those diagonal beams, what are they doing there? There are so many of them. Are they writing or are they blank and going back?


I would appreciate if someone could help me to generate and understand these signals. I am desperate now.

Please help if you can

I have read many articles online but most are incomplete and are actually different. and I cant make sense of them combined.


Regards

Paul
 
Last edited:

dl324

Joined Mar 30, 2015
16,916
What is the difference between interlaced and non interlaced?
Non-interlaced, also called progressive scan, displays each line of information one after another. Interlaced does odd lines, then even.
Also, I have seen pictures here the scan is going diagonally across the screen rather than at the same horizontal level.
They're probably exaggerating the vertical offset caused by the ramp generator.
 

ErnieM

Joined Apr 24, 2011
8,377
Interlaced scanning means drawing the screen half at a time, first the even lines, then coming back to fill in the odd lines.

Generating 600 lines non interlaced would probably mean an adjustment if not redesign of the monitor so it progresses at half speed from top to bottom. So just what is the display you are using?

The diagonal lines on the figure are exaggerations. Vertically the scan point is slowly moving from top top bottom, so each horizontal line is actually slightly diagonal. The figure is a gross exaggeration, as the right side of one line (where it ends) should be even with the left side of the next scan (where it begins).
 

WBahn

Joined Mar 31, 2012
30,052
Whether you need to generate interlaced or non-interlaced is dictated by your monitor.

The reason that interlaced was used for so long was because if you displayed the entire image in one pass the top of the screen would be noticeably dimming by the time you go done. So they used two passes per frame (even and odd) so that the viewer didn't notice the dimming of one pass because the alternate pass was sufficiently recent so as to still be bright enough to fool the human eye.

I'm not too familiar with PAL, but the serration signals in NTSC are, indeed, pretty cryptic at first, particularly as far as why they are there. The reasons, IIRC since it's been well over a decade since I did anything with this, basically have to do with maintaining the injection lock on the oscillator during the blanking interval. But from the standpoint of the person generating the signal, you simply accept that they need to be there and you generate them. If you are doing this in software/firmware, this is pretty trivial.
 

AnalogKid

Joined Aug 1, 2013
11,038
While most interlaced video diagrams show an exaggerated tilt to the active portions of the scan lines, they are in fact slanted downward slightly from left to right. The beam is under the control of two independent sets of deflection coils around the neck of the picture tube. Vertically, the beam is moving downward at a constant rate, then is snapped back to the top rapidly. Horizontally it is moved left to right at a faster constant rate, then snapped back to the left rapidly. So while it is moving quickly left to right it also is moving slowly top to bottom, hence the slight downward resulting direction.

The equalizing pulses and the rest of the glop in the vertical interval comes from having slow vacuum tubes try to do fast pulse processing back in the 1930's. Then couldn't, so the composite sync waveform has what it took for analog frequency and timing detectors to find (reliably) the markers for when to do what.

And, technically, PAL is a color broadcast standard, whose real name is PAL-I. The mono-only component is called B or D.
http://www.ntsc-tv.com/ntsc-index-02.htm
https://en.wikipedia.org/wiki/Analog_television

ak
 

DickCappels

Joined Aug 21, 2008
10,170
In post #1 PauloConstantino wrote:
What is the difference between interlaced and non interlaced? I don't want complications so I am looking to generate non interlaced. However I dont understand the difference very well. Does non interlace contain less lines in the screen ?

With interlaced PAL the the end of fields are signaled by the vertical sync pulse after 312.5 lines. If you change the timing to a whole number of lines you get non-interlaced, and for a given pair of horizontal and vertical frequencies you would have half the number of lines.

In post #1 PauloConstantino wrote:
If I go for non-interlace, will I get only about 300 lines of video? And interlaced is around 600 ?

That is correct. Note that up to about 8% of the lines generated may not be displayed depending upon the imaging system (CRT displays need a lot more blanking margin than do digital displays.)

In post #1 PauloConstantino wrote:
Also, I have seen pictures here the scan is going diagonally across the screen rather than at the same horizontal level. Is that the beam going back to the original position or is it writing to the screen at such times? This is so weird. From one article I get the impression that the diagonal beam is writing...

It seems weird, but it is true that the lines are diagonal with respect to the frame, but figure that the pitch is 1/625 of the picture height, so it is not detectable by eye.

In post #1 PauloConstantino wrote:
Those diagonal beams, what are they doing there? There are so many of them. Are they writing or are they blank and going back?

In the case of a CRT displays the beam in blanked prior to horizontal retrace and unblanked after the beam starts the next scan from the opposite side of the raster. Vertical retrace blanking is done similarly.

As an aside, non-interlace is often preferred for high resolution images because it eliminates some artifacts, such as crawling dots on vertical edges, which are the result of interlace.

Questions for you:

1. What kind of information do you want to put in the signal (Video, computer graphics, bar codes...)?

2. Where does this information come from (camera, microcontroller...)?

3. What kind of display do you plan to use?
 

WBahn

Joined Mar 31, 2012
30,052
In post #1 PauloConstantino wrote:
Also, I have seen pictures here the scan is going diagonally across the screen rather than at the same horizontal level. Is that the beam going back to the original position or is it writing to the screen at such times? This is so weird. From one article I get the impression that the diagonal beam is writing...

It seems weird, but it is true that the lines are diagonal with respect to the frame, but figure that the pitch is 1/625 of the picture height, so it is not detectable by eye.
Plus, at least in the old days, the camera did a similar scanning pattern and so the beam was putting the right information in the right place on the screen.

With today's imagers that is certainly not a given as they may operating in a snapshot mode or use a rolling reset or a couple of other options. The designers of systems take these things into account and consider what is important and what is not. In addition, a lot of things can be corrected in real-time post-processing of the data even before it comes off the imaging chip.
 

crutschow

Joined Mar 14, 2008
34,420
The reason that interlaced was used for so long was because if you displayed the entire image in one pass the top of the screen would be noticeably dimming by the time you go done
That's not the main reason.
Interlaced scanning is used to reduce the bandwidth for a given resolution and frame rate.
Interlaced scanning means the field rate is 1/2 the frame rate (thus a 50Hz frame rate has a 25Hz field rate).
This means the interlaced transmitted information bandwidth is 1/2 that required for a non-interlaced signal with the same frame rate.
 

Thread Starter

PauloConstantino

Joined Jun 23, 2016
266
In post #1 PauloConstantino wrote:
What is the difference between interlaced and non interlaced? I don't want complications so I am looking to generate non interlaced. However I dont understand the difference very well. Does non interlace contain less lines in the screen ?

With interlaced PAL the the end of fields are signaled by the vertical sync pulse after 312.5 lines. If you change the timing to a whole number of lines you get non-interlaced, and for a given pair of horizontal and vertical frequencies you would have half the number of lines.

In post #1 PauloConstantino wrote:
If I go for non-interlace, will I get only about 300 lines of video? And interlaced is around 600 ?

That is correct. Note that up to about 8% of the lines generated may not be displayed depending upon the imaging system (CRT displays need a lot more blanking margin than do digital displays.)

In post #1 PauloConstantino wrote:
Also, I have seen pictures here the scan is going diagonally across the screen rather than at the same horizontal level. Is that the beam going back to the original position or is it writing to the screen at such times? This is so weird. From one article I get the impression that the diagonal beam is writing...

It seems weird, but it is true that the lines are diagonal with respect to the frame, but figure that the pitch is 1/625 of the picture height, so it is not detectable by eye.

In post #1 PauloConstantino wrote:
Those diagonal beams, what are they doing there? There are so many of them. Are they writing or are they blank and going back?

In the case of a CRT displays the beam in blanked prior to horizontal retrace and unblanked after the beam starts the next scan from the opposite side of the raster. Vertical retrace blanking is done similarly.

As an aside, non-interlace is often preferred for high resolution images because it eliminates some artifacts, such as crawling dots on vertical edges, which are the result of interlace.

Questions for you:

1. What kind of information do you want to put in the signal (Video, computer graphics, bar codes...)?

2. Where does this information come from (camera, microcontroller...)?

3. What kind of display do you plan to use?

Thank you for your thorough reply Dick. It seems strange because if the beam is going first horizontally and then back diagonally, and if it is the diagonal beam that writes, why isn't the horizontal beam that writes instead? Maybe the diagonal writing version is easier to implement it in hardware?

As for your questions, the information will come from an 8 bit computer that I am building using 74HC chips. The computer is "scattered" across various breadboards for now, and so will be the video generator for now. The information will be pixels.

The display that I plan to use for now is a small monochrome CRT tv that I bought for this purpose.

However.......

I have been looking at VGA signals, and they seem ultra easy to implement as there are no serrations sync signals like vsync in composite. Is VGA really that easy ? It seems like a relief to see those signals.
 

Thread Starter

PauloConstantino

Joined Jun 23, 2016
266
Also, if I may ask,

Should I build some sort of state machine in hardware in order to create the sync signals ?

The thing is that I am doing everything by hardware, although it need not be, but preferably it would be.

So my first thought is to make a finite machine to control when each sync will be output. Is this anywhere near a reasonable way of doing it ?

However I am not sure about the clock speed that this machine would need! Should it be half the period of a whole line ? So that the vertical serration signals, which are half a line in duration, will be output correctly ?
 

Thread Starter

PauloConstantino

Joined Jun 23, 2016
266
Friends,

also, I have read in a website that if and only if you are making interlaced video, you need the vertical "equalizing" pulses. Does this really mean we don't need them when making non interlace video ? That would be a nice relief

Here's the image that says this.

 

crutschow

Joined Mar 14, 2008
34,420
Should I build some sort of state machine in hardware in order to create the sync signals ?
I would think you could readily do it with a state machine but using an Arduino as referenced in post #2 may be easier.
However I am not sure about the clock speed that this machine would need! Should it be half the period of a whole line ? So that the vertical serration signals, which are half a line in duration, will be output correctly ?
For PAL the vertical sync frequency is 50Hz and the horizontal sync frequency is 1/625*1/25 = 15.625kHz (64μs sync period).
For interlace you change the horizontal sync point to the 1/2 point (32μs) on the last horizontal line of the frame.
All subsequent sync intervals then revert back to the 64μs period until the end of the next frame where the sync again occurs at 32μs.
That will give a two field interlace of the lines, giving one interlaced frame.
So that would mean your minimum clock frequency would be 1/32μs or 31.25kHz.
You will, however, need some additional timing circuits to generate the correct pulse period for each sync pulse and the equalizing pulses during the vertical retrace as shown below:

upload_2017-1-2_23-47-19.png
 

DickCappels

Joined Aug 21, 2008
10,170
In post #7 PauloConstantino wrote:
It seems strange because if the beam is going first horizontally and then back diagonally, and if it is the diagonal beam that writes, why isn't the horizontal beam that writes instead? Maybe the diagonal writing version is easier to implement it in hardware?

Both the forward scan and the retrace are slopped because the vertical scan is continuous. As you surmised, it was easier back in the days of vacuum tube cameras and TV sets to do it that way. The scan is sloping (not exactly what I would call diagonal) because the vertical sweep runs continuously. Stepping the vertical deflection would have added significantly to the cost of a television receiver. At least one industrial application of a tube type camera employed a scan method referred to as "pedestal scan" the vertical position was stepped from line to line, making the horizontal lines truly horizontal rather than pitched.

In post #7 PauloConstantino wrote:
I have been looking at VGA signals, and they seem ultra easy to implement as there are no serrations sync signals like vsync in composite. Is VGA really that easy ? It seems like a relief to see those signals.

VGA might be a better choice. For one thing, the resolution is much higher, at least in the case of CRT. The fact that you have separate H and V sync signals would also make life a little easier.

In post #7 PauloConstantino wrote:
Should I build some sort of state machine in hardware in order to create the sync signals ?

If you go VGA or Super VGA (as opposed to an interlaced mode) you can get by with just a good stable oscillator and a divider that resets at the end of every frame. I guess that could be referred to as a state machine of sorts. You can count clock pulses or use analog one-shots (back to the stone age) to set your pulse widths.

I remember an RS-343 sync generator -like NTSC but for industrial non-interlaced use. There was a 2H crystal oscillator from which H and V timing was derived. Beyond counters to get down to V and H pulses, everything else was done with one-shots. That was back when the RTL was all the rage. Another used small EPROMs to store the more complicated sequence. If you go VGA you can simplify your life a lot.

In post #7 PauloConstantino wrote:
However I am not sure about the clock speed that this machine would need! Should it be half the period of a whole line ? So that the vertical serration signals, which are half a line in duration, will be output correctly ?

It all depends on what you want to do. With VGA 640 x 480 A 60 Hz you would start with a pixel clock and derive your horizontal timing from that and your vertical timing from the horizontal timing. The first question is how many pixels you want to display using the standard you can derive the number of pixels needed for front and back porch timing and for the sync pulses. Indeed, such a table is at yoru fingertips (or mouse tip, as it may be). http://tinyvga.com/vga-timing/640x480@60Hz

If you want interlaced, your raster timing would start with 2H. For non-inerlaced it would start with an H rate pulse.


In post #7 PauloConstantino wrote:
also, I have read in a website that if and only if you are making interlaced video, you need the vertical "equalizing" pulses. Does this really mean we don't need them when making non interlace video ? That would be a nice relief :p

As I recall equalizing pulses are there to restore the average sync level that could shift because of the serrations so that the sync stripper's output doesn't change during the vertical time, which might cause some squiggle at the top of the raster. Given that, you don't need to have the serrations and equalizing pulses in the case of not caring whether there is a squiggle at the top of the raster or by using VGA which does not require the H & V sync pulses to be mix, added, stripped off and separated.
 

WBahn

Joined Mar 31, 2012
30,052
That's not the main reason.
Interlaced scanning is used to reduce the bandwidth for a given resolution and frame rate.
Interlaced scanning means the field rate is 1/2 the frame rate (thus a 50Hz frame rate has a 25Hz field rate).
This means the interlaced transmitted information bandwidth is 1/2 that required for a non-interlaced signal with the same frame rate.
How is the field rate half the frame rate? If you have 50 frames that have to be transmitted in one second, then if you split each frame into two fields you have 100 fields that have to be transmitted in one second. In either case, the total number of lines transmitted each second remains the same. If a frame consists of X lines, then you need to transmit X lines of data in the amount of time allotted for one frame. What does it matter if you transmit them sequentially, all odd then all even, or randomly? You still need to transmit the same total number of lines in the same amount of time.

Now, if what you mean is that a non-interlaced image would need to be transmitted at a higher frame rate in order to avoid flicker and that interlacing allows for the use of a lower frame rate, then that is due to the fading of the phosphors that I mentioned since the flicker is mostly due to the phosphors being refreshed after they have faded noticeably. Interlacing reduces this because the phosphors in the adjacent lines are refreshed in half the time and so have fades a considerably less amount.
 

WBahn

Joined Mar 31, 2012
30,052
@RichardO (and a nonmember or two) has implemented NTSC video in a primitive PIC that played Pong (PIC-Pong) about 20 or 25 years ago. The DAC was just three resistors, if I remember. Hopefully he will join the thread as I think he could provide some really good insight and suggestions.
 

AnalogKid

Joined Aug 1, 2013
11,038
How is the field rate half the frame rate? If you have 50 frames that have to be transmitted in one second,
You don't. For broadcast standards B, D, and PAL-I, you have 25 frames per second, sent as 50 interlaced half-frames called fields.

And (a small digression), in color systems like NTSC and PAL there are two chroma fields for each monochrome field, so there are 100 chromanance 1/4 frames and 50 monochrome half-frames per second.

ak
 
Last edited:
Top