Building a Video-DAC

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Building a Video-DAC
by on (#143651)
I want to rebuild the DAC inside an Amstrad GX4000 videogame. The conversion in this system happens inside an IC which adds a noticable amout of blurriness to the picture so I'd like to replace the IC with an R2R-ladder. It's a 4-Bit-DAC, the video signals for Red, Green and Blue have 4 signal-lines labeled r0 to r3, g0 to g3 etc.

Here's what I see on the scope while the system is displaying a pure white screen on the input of the DAC-IC:
Image

R0 to R3 all look the same.
The Vpp is 4.92V, I need to build the R2R-ladder with a maximum output-level of 0.7V, that would be the correct input level for the THS7314 that I'm going to use for amping the signals.

I've never build a DAC before, I understand its concept and the function of a voltage-devider but I need some help please to calculate the values for R and R2.
Also in an R2R there should be an opamp I guess, I'm pretty lost because I wouldn't know which one would be suitable for my application.

Any help with this is very much appreciated, thanks guys.
Re: Building a Video-DAC
by on (#143690)
I don't know much about building DACs, but when I looked at Atari 2600 video mods, they almost always recommend to buffer the inputs before feeding them to the DAC or resistor ladder, to make the video cleaner. That might help your blurriness.
Re: Building a Video-DAC
by on (#143691)
IF your digital outputs can source enough current, the following DAC is simple and will work great. You don't even need the THS7314 to buffer the output:
Assuming 5V I/O:
Code:
LSb ----502----+----502----gnd
               |
              251
               |
2sb ----502----+
               |
              251
               |
4sb ----502----+
               |
              251
               |
MSb ----502----+-------> to composite input >----+
               |                                 |
              107                               75 is part of TV
               |                                 |
              gnd                               gnd

3.3V I/O: replace 502,251,107 with 332,166,137.

If your digital outputs can't handle the current (≈10mA), and you want to specifically use the THS7314, change 502,251,107 to (5V) 20k,10k,1.4k or (3.3V) 20k,10k,2.1k.
Re: Building a Video-DAC
by on (#143698)
Great input, thanks!
I think that'll make a good start, I'll report back when I get the chance to build and test the circuit and report back how it went.

Thanks again!!!
Re: Building a Video-DAC
by on (#144846)
@lidnariq

I finally built the circuit and tested it. I have something on the screen.... at least when I turn the brightness up real hard but I blame that on the ths-based pce-amp I used to test it.
Besides from that the picture is inverted.
Changing the order from LSB to MSB doesn't invert it back to normal.

Would be great if there was a solution for this.
Thanks again!!
Re: Building a Video-DAC
by on (#144858)
Arcade-TV wrote:
Besides from that the picture is inverted.
Sounds like you're using an inverter (74'04) instead of a buffer (either two 74'04 gates in series, or something like a 74'244).
That's probably why everything's so dark, too: The TV is measuring full white (instead of full black) and hoping to find things brighter than that.
Re: Building a Video-DAC
by on (#144873)
But actually looking at his scope trace, the data going into the DAC when it's a white screen uses negative logic (0=white). So you might need to invert all 4 bits with some 74xxx logic (or better suggestions?) before making your DAC.
Re: Building a Video-DAC
by on (#144876)
Ohhh, hey. Ooops. Yeah. That.
Re: Building a Video-DAC
by on (#144897)
You want to solve for R where a full-white value gets you 0.7v, and feed that to a fast enough op-amp to buffer it.

If you are just playing around try 680 for R, I used it for a quick and dirty DAC for a CPS1 board and it worked.
Re: Building a Video-DAC
by on (#144915)
mikejmoffitt wrote:
You want to solve for R where a full-white value gets you 0.7v, and feed that to a fast enough op-amp to buffer it.
The numbers in the ASCII art I gave satisfy that :p

Also, getting a rail-to-rail opamp is harder and more expensive, AND ones that can source ≈10mA are more expensive, and many consoles don't provide an negative power rail anyway. May as well just generate the right signal in the first place, rather than needing an opamp to buffer it.
Re: Building a Video-DAC
by on (#144925)
Guys, I'm almost there... Thanks for all the input so far!

I used 2x LS74HC04N to invert all the signals and it worked right away. I was stupid enough to use the suggested 1.4K for 5V without taking into consideration that my levels were 3.6V only - not a big deal, I used a 5K pot to adjust the levels while displaying a pure white screen until I reached exactly 0.7V which is the perfect level for the THS7314-input. Measuring the pot gave me 2.688KOhm, so I used 2.7K resistors and the video is absolutely crisp and vibrant.

I'm pretty much satisfied with the result (Jailbars gone, blur gone, levels are wonderful) but there is this one thing that bugs me...
When the screen fades I get a flickering, this is afaik directly related to the R2R-ladder because it creates "stairs" rather that "curves", do you know what I mean? Damn I wish I could explain better, sorry...
@Michael: I think I saw a video from your cps1-setup, and if I'm not mistaken you've had the very same issue when the screen faded to black, right?
Did you sort that out?

Anyways, it's been a fun ride till here, thanks again!
Re: Building a Video-DAC
by on (#144926)
Arcade-TV wrote:
the R2R-ladder because it creates "stairs" rather that "curves", do you know what I mean?
I assume by "curves" you mean something like this?
That's just the presence/absense of a lowpass filter on the output of the DAC. You oughtn't need it...
Even if you added one, its only effect would be to decrease horizontal sharpness; it should have no effect on vertical or temporal sharpness.

Quote:
When the screen fades I get a flickering
Do you mean "banding"? i.e. where the colors suddenly jump in brightness, and possibly with some color shift? If so, it's an intrinsic property of only using 12-bit color and I'm surprised you're seeing any difference with the new hardware: it really ought to be the same as before.

The only workaround I can think of is adding ½LSB noise. The noise should make the rest a lot less visible: add another stage to the DAC (increase it to 5 bits) and put a moderately-high-bandwidth noise source on the LSBs of all three DACs.
Re: Building a Video-DAC
by on (#144927)
Amazing what you know about all this stuff :shock:

Yes, the picture is absolutely different from what I've seen from the stock-hardware. I also notice a color-shift but I can't really tell what color it has shiftet to--- it highly depends on what is on the screen. The palette-test-program looks beautiful, the white screen looks damn white and black is black - but I can notice a lack of blue in some game logos that was definitely there before the mod.

Yeah, that picture shows what I meant, there seems to be no interpolation on the dac's output. You're right, I was doing this because I wanted to get rid of the horizontal blure so I can't add that now with a LP-filter...

I'll post some before/after-pics after the weekend, really need to get some sleep now :/

THANKS again!!!
Re: Building a Video-DAC
by on (#144939)
Arcade-TV wrote:
@Michael: I think I saw a video from your cps1-setup, and if I'm not mistaken you've had the very same issue when the screen faded to black, right?
Did you sort that out?


Nope, I just didn't factor in the "fade bits" which the CPS1 hardware has.

Are you sure your bits are all in the right order, and you didn't make a mistake with the resistors? If you can hook it up to a scope and feed it the output of a 4-bit counter, you should see a nice set of stairs.
Re: Building a Video-DAC
by on (#144956)
this is my current setup
Re: Building a Video-DAC
by on (#144966)
Nothing obviously wrong with that.
Re: Building a Video-DAC
by on (#144967)
since I socketed pretty much everything and made the connections interchangeble I was able to reverse the whole mod in less than a minute. I'll have to record some footage of what it looks like with the dac-ic and how it looks with the diy-dac.
I also reversed the lsb/msb-order but the colors were awefully off so at least I'm sure that I made the correct connections.
I'll try the timer-ic, good idea, maybe if I feed the original dac ic with that as well I might be able to see a difference between the outputs...