Shop OBEX P1 Docs P2 Docs Learn Events
Propeller VGA to TV scan converter? — Parallax Forums

Propeller VGA to TV scan converter?

Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
edited 2009-10-07 07:51 in Propeller 1
Is it possible to somehow read the RGB of VGA output and so some type of scan conversion
to NTSC composite video or is the signal too analog at that point?

OBC

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?

Visit the: The Propeller Pages @ Warranty Void.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-06 14:28
    It's not really practical because there's too much data coming in too fast for a Propeller. The signal is analog, but you can get fast analog to digital converters.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2009-10-06 14:35
    I suspected as much, but I'm just trying to push as much of the workload for the current project onto the Propeller.


    Thanks Mike

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
  • ericballericball Posts: 774
    edited 2009-10-06 15:57
    Getting the data into the Propeller (and between COGs) is the first challenge. For 640x480 you're looking at ~25MHz sampling.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Composite NTSC sprite driver: Forum
    NTSC & PAL driver templates: ObEx Forum
    OnePinTVText driver: ObEx Forum
  • VIRANDVIRAND Posts: 656
    edited 2009-10-07 07:51
    I once did it naively in ... probably 1992 ... in analog.
    Surprised it worked at all since I didn't have a HF scope then and probably had very slow chips.
    I don't know how many different modes there are but there was double line rate (31500 per frame?) at 60 Hz,
    which I handled by blanking out every other line and putting a sync in the middle of it,
    which of course made the TV image look like a sheet of paper obviously less wide than the screen.

    Initial ideas for a Propeller version:
    Modify a VGA driver OB to sync to VGA input if possible and also control some external logic.
    Use TV and GRAPHICS object, perhaps with the 6.25 Mhz crystal.
    External logic is shift registers or FIFO's. Not yet sure about exact config but they should sample the RGB of the VGA
    and somehow stretch it. Maybe by getting it into the ONSCREEN_BUFFER.

    TV.spin probably does 640x480 or 1280x480 in mono.
    Here may be a trick.
    If there is an artificial chroma (vertical lines near sync same period as 3.579545 times 3, separated by 2 black lines),
    then every third line should be green and the adjacent ones wouldbe close to red and blue, that is artifacting consistent
    with RGB to NTSC chroma phase conversion, hypothetically.

    Transistors may be usable as level detectors, and diodes for conversion to binary.
    I do not have comparators fast enough for 25Mhz but if I did then I'd use a fast version of LM339
    to detect the 4 gray levels and diodes to encode them to binary somehow into the shift registers,
    maybe 6 shift registers wired to 18 PIO pins, which could grab 3 pixel-graylevels at a time,
    24 PIO pins maybe neater.

    All 6 shift registers together hold 8 pixels at a time, but not enough prop pins to get that many.
    2 regs for each R G B channel = 4 gray levels per color = 2 bits per color.
    Remember that the colors are time division multiplexed or 3-phased artifacts already
    so the "gray levels of color" should logically be gray levels of gray if not for the
    3 phase chroma artifact idea, which should always provide 32 colors on the TV
    with the 8 possible artifact colors and just the 4 possible luminances palette.
    Remember the video generator only has a few gray levels and the driver allows only 4 palette colors,
    but we artifacted the colors so we use a palette of gray levels.

    Needs to get 3 (or 4) sets of pixels at a time because one pixel at a time goes by
    way too fast, and each one is the 6 shift register outputs whose inputs are from
    the level detectors. Timing seems hard, since it might not be possible to load
    pixels (4 would be NICE but uses 24 pins) every WAITVID with the TV driver
    being otherwise used normally. Wrong. Maybe the VGA driver could be retimed to
    get the pixels with it's WAITVID since it is not outputting VGA just syncing to it.
    It only has to do so for half a NTSC line since there are 2 VGA lines per NTSC line.

    This is starting to give me a headache. I can't remember what I might have forgotten
    except maybe not clearly describing the logic enough. But the TV.spin and GRAPHICS
    ONSCREEN_BUFFER should be able to output converted VGA this way. Interlacing is
    possible to get almost the 480 lines, which some may be offscreen on some TV's.

    Likely problems with this idea: Jittery timing.
    The pixel clock must be 3 times the chroma frequency in order for my idiosynchratic
    interpretation of 3-phase RGB chroma from triples of graylevel vertical line artifacts
    to work. It seems most unlikely to synchronize with the VGA but color problems
    would result from failure of the artificial chroma timing scheme to make gray lines of pixels
    appear RGBRGBRGBRGBRGBRGBRGB across the screen. Actually in that particular case
    they should and would be gray, and RG would be yellow, and RB would be magenta,
    on TV as on VGA.

    This process, how could I say it with less words, but the Propeller isn't really doing much at all but
    sampling multiple VGA pixels from shift registers and putting them in the buffer of the TV drivers,
    and trying to keep all in sync. There's really no DSP code but the ol' TV and GRAPHICS driver objects.
    If this works, it works just like my old analog version except it
    conveniently fills the whole TV screen instead of just hiding odd lines that go by twice as fast in
    VGA as TV. Now if this works at all, and only timing can fail I think... if not, if you don't mind having only
    9 colors, use only 3 shift registers and forget about the primitive ADC and the logic I haven't
    fully thought out for the 2-bit binary outputs, then it's easy to sample twice the VGA pixels if necessary.
    If the TV colors don't match the VGA very well, I hope there is a good old TINT knob somewhere on or in the TV.
    My thinking is that the chromaburst sync is nearly green phase So the other two phases must be nearly
    red and blue phases. Normally the chroma phases are described as only 2 in quadrature which aren't even supposed
    to be ordinary colors, yet they are added and subtracted from the brightness carrier to get color signals
    to feed to the old red green and blue cathode ray guns.

    It seems like a little headache for one VGA mode, when they have chips that do several modes well.

    Post Edited (VIRAND) : 10/7/2009 8:18:20 AM GMT
Sign In or Register to comment.