Techniques for connecting VGA card to television

In some cases is would be nice to be able to display VGA picture in the large TV screen. There are commercial adapaters for this purpose, but they tend to be quite expensive and the picture quality in less expensive ones leaves much to desire. One of the reasons why the picture after conversion looks bad is that the commercial units convert VGA signal to composite video which has quite severe bandwith limitations. For more ifromation about VGA to TV conversion basics, read the Computer Friends article Computer to TV.

My design is based on the idea that the RGB signal can be routed directly to the TV so that RGB to compostite video conversion in the converter and compostite video to RGB conversion inside the TV are avoided. In this way the picture quality is better and converter is simpler. The disadvantage of this is that your TV must have EURO-AV/SCART connector with RGB inputs to be usable with this circuit. You can't use this adapter to record VGA picture to VCR directly because VCR needs always composite video signal. Consumer VCRs are not able to handle RGB signals directly.

It is possible to get recordable video signal if you get external RGB to composite video somewhere and connect my circuit to it. Remeber that the timing signals in the video signal you are making must be exactly right or otherwise you might get sync problems, poor colors or no colors at all. For more information about recording computer pictures to VCR read my article How to record VGA signals to VCR. If you are designing your own circuit for this, check my list of useful video chip datasheets.

I have designed a circuit which outputs nice composite video signal which can be recorded to VCR, but this circuit is part of a commercial product and I can't give mote information on it here.

What needs to be done when connecting VGA to TV

Connecting VGA picture to TV does not seem to be an easy task because VGA and TV use different picture scan rates and resolutions.

VGA card modes and corresponding frequencies

Vert Res.      Horiz Freq    H Sync    Vert Freq    V Sync
                            Polarity               Polarity
350 lines      31.5 kHz      pos       70.07 Hz     neg
400 lines      31.5 kHz      neg       70.07 Hz     pos
480 lines      31.5 kHz      neg       59.95 Hz     neg
Those frequencies are used in standard VGA cards. Those whore are interrested in more timing details can check my VGA monitor signal timing page.

Higher frequencies are used in higher resolutions and when totally flicker free display is needed. You are sure to get the frequencies above when you set your monitor type to standard VGA in your graphics card configuration.

The frequencies should be something to suit your TV set:

TV System     total lines  horiz. freq.  vertical freq.  color freq.
NTSC (US)      525 lines    15.734 kHz      59.94 Hz      3.579 MHz
PAL (Europe)   625 lines    15.625 kHz      50.00 Hz      4.433 Mhz
SECAM (France) 625 lines    15.625 kHz      50.00 Hz      4.2 and 4.4 MHz
For more information about TV standards above read Info on the three color TV systems article by Steve Kittelsen. For those who are interrested in the exact timing details are adviced to check CCIR Report 624-4 / 1990. I have also a short description of PAL timings specification at my web pages for those who don't want to read the whole CCIR report.

Many modern televisions in Europe accept only PAL standard color video signals, but they have no problem in handling the frequencies of NTSC (US) system if the picture is feed to them through SCART connector RGB pins. The picture is both systems is originally interlaced, but TV sets also accept noninterlaced pictures but you loose half of the vertical resolution.

Different picture formats of TV and computer displays

All video monitors now have retrace blanking (the interval that the crt electron beam is shut off for retrace) that is shorter than the blanking from the camera. This means that the signal which the monitor *can* display contains all of the information fromt he camera. However, most video monitors, unlike computer displays, are set up to overscan so that some of the image goes off the edge of the tube. This is ok for watching tv shows but not for examining image data.

How to do the conversion

There are two ways of doing the scan rate conversion. First idea is to make a device which digitizes the whole VGA picture to it's internal memory and sends it out at the speed which is suitable for TV. This is how this is done in expensive commercial units. The advantage of this system is that this work with every software and computer which outputs VGA signal just by plugging the unit to VGA card. Normal VGA monitor can be used with this type of adapter ath the same time with the TV. The disadvantage is that this kind of circuit becomes complex and expensive. There is another disadvantage: you can't get smooth movement to the TV screen. Something which seems to move smoothly in the VGA screen does not move smoothly in TV screen because the framerate conversion makes movements "jerky". Because of those disadvantages this method is only suitable for showing business graphics, not interactive action games.

Another way to generate scan rates suitable for TV is to program VGA card to put out picture at the TV scan rates. VGA card is quite freely programmable video card and this kind of programming can be done quite well even using standard VGA card (some SuperVGA chipset has advanced functions for making interfacing to TV easier). For this purpose you need the suitable software to set the scanning frequencies of VGA card to suit to the TV you are using. The disadvantage of this is that you need suitable software driver and the driver must be loaded every time you use VGA to TV converter. The advantage of this approach is that the hardware becomes simple and inexpensive. Because the frame rate is converted directly on the VGA card, the graphic programs which sync themselves to VGA screen refresh sync to this new setup and output smoothly to the TV screen.

Problems in writing the VGA to TV driver

Normal VGA register set allows to make some limited changes to the VGA timing and normal VGA card has the necessary clock control registers to divide the pixel clock rate by two to make the horizonal scan rate to match the TV scan rate. Some fine tunign has to be also done to make the sync signal and border size to match the ones needed by TV.

If the horizonal sync frequnecy is halved then this means that the vertical sync frequency becomes also half of the original, which is not what we need. Because normal TV uses interlaced display with field rate of about same as VGA card (60 Hz field for NTSC TV and VGA uses 60 Hz frame rate in 480 line modes), the card has make so that is sends only half of the scanlines to TV at every fiels. In every VGA card it is possible to leave out every other scanline, which makes the screen visibla on TV, although some resolution in lost. Some modern SuperVGA chipsets have option for turning one interlacing, which usually gives better results, although you must write a specific driver for every chipset to support those chipset specific functions.

If the horizonal refresh rate is not suitable after leaving scanlines out or turning the interlacing on some other modiciations to VGA registers are needed. The vertical refresh rate is determined by the horizonal scan rate and total number of scanlines in one field (visible lines + border + sync signal). So by changing the size of the borders it is possible to adjust the vertical refresh rate (increasing border scanlines will decrease refresh rate).

Theoretically the drivers which use those methods should work woth every PC graphics card which claims VGA card compatibility. Infortunately in real life the situation is not this good. The problem is that common accelerated PC graphics cards are typically internally very diffent from the original VGA hardware and the original VGA card register functions are only emulated using some special hardware. The chipset makers usually claim 100% VGA compatibility, but they have obly implemented part of the VGA functionality right (the most often needed part). If all the rarely needed special video clockign modes are not implemented correctly the driver's don't work correctly. Sometimes all of those functions are implemented to the graphics card chipset VGA emulation but some of the registers have access controls (which give or deny access to some timing registers), so that if access is not granted to those registers then the driver does not work correctly (the access control is graphics chipset specific feature).

Problems with SuperVGA modes

SuperVGA modes are more problematic than standard VGA modes. When S-VGA graphics cards where introduced in the late 1980's. there where no industry standards. Each graphics chip manufacturer independently produced new modes and hardware to implement them. Software vendors where forced to implement vendor specific code to take advantage of S-VGA modes. Nowadays many biggest graphics card chip makers have tried minimize changes to the S-VGA implementation in order to maintain compatibility with existing software.

However, the dynamic nature of the PC industry forces change. Windows, OS/2 and other GUI environments has caused S-VGA cards to be phased out in favor of accelerator cards. There has also been a widespread adoption of the VESA VBE standard for S-VGA programming in the DOS environment. Both trends allow programmers to access graphics hardware through device independent API's which has greatly reduced the need to maintain backwards compatibility at the hardware level. Infortunately VESA VBE does not help much in writing the VGA to TV drivers because changinc the refresha rates still needs access to the VGA registers direcly (and quite often chipset specific features also). Meny manufacturers nowadays implement VBE functions through the accelerator hardware rather than through the 8 bit VGA hardware. The benefit is higher performance and greater access to memory. However, S-VGA software which relies on reading or "tweaking" VGA registers (like those VGA to TV driver) may fail.


Tomi Engdahl <[email protected]>