[SOLVED] DAC resistor value calculation

so i need an 8bit DAC . the R2R resistor ladder is good . it gives 256 different voltage levels .
i need something like that but . now i have 8 pins for the DAC and a sync pin .
the sync pin is always HIGH while the DAC is being used .
so it's a sync pin and 8 pins . the total would be 9 pins but one of them is always on .
so if the sync pin is on HIGH and all the rest are LOW . the voltage output must be 0.3v or something around it .
if the sync pin is HIGH and all the 8 pins are also high , the voltage output must be 1.0v or something around it .

i need 256 voltage levels . the thing is , how can i calculate the resistor values ?

Look-up what 2R2 means... One resistor is twice the value of the other. There's a schematic on [u]this page[/u].

Make sure your load resistance is much higher than your resistor values so that your load doesn't screw-up the voltage dividers.

I don't get what you're doing with the sync pin... Does that tell you when the output is stable? If so, that could just be a delayed signal after you write the DAC value.

the voltage output must be 0.3v or something around it .
if the sync pin is HIGH and all the 8 pins are also high , the voltage output must be 1.0v or something around it .

What?

The DAC will give you the applied voltage in 256 equal steps.

This sounds like you are trying to generate a composite video signal. In which case you can not use a simple resistor to add in the sync pulses you need to use an open collector transistor to clamp the output of your D/A when your sinc signal is low. This will involve inverting your sync signal first.

An R-2R ladder works from supply to ground - you need stiff (regulated) voltage source for it
to work, so you can generate 0V..5V OK, but 0.3V to 1.0V isn't going to happen without some
way to generate stable 0.3 and 1.0 voltage rails.

Since you load is a constant 75 ohm, the normal way to do this is to use 8 resistors that
are in a powers-of-two relation. 1V at 75 ohm is 13.3mA, so you can use say 680, 1k3, 2k7, 5k6 etc,
which when switched from a 5V rail will max out at about 1V into 75 ohms.

For 8 bit accuracy you'll need a pair of 0.1% resistors per bit (two resistors can generate many
more values than the standard E24 resistor range) for the MSBs, backing off to 1% or 5% for
the LSBs. You also need to factor in the output impedance of the chip driving the resistors.

You are much better off just buying a video DAC!

Or sampling one (or two). AD has this part: http://www.analog.com/en/products/digital-to-analog-converters/da-converters/adv7125.html

yes , i am trying to generate a composite video signal .
-> DVDdough it just means that i need 256 voltage level where the lowest is 0.3v and the highest is 1.0v
->GrumpyMike i am using an AND gate logic chip . so i supply all the bits to a couple of chips and the sync pin to all the AND gates . if the sync pin is low , everything is low and the voltage is 0v .
->MarkT i dont think i can manage to get a VIDEO DAC here . so can i actually calculate the resistor values ?
and for the accuracy , it's ok it have a sum of more than just a single resistor for one value . i think i can get a decent accuracy .
->JoeN i dont think i can manage to get such a chip Bro ,thank you though

This link might help - only 6 bit though: Resistor values for 64 GreyScale VGA output from the Propeller — Parallax Forums

Good article.
Maths is included, so you can calculate your own 8-bit network.
Example assumes that the internal resistance of the micro is 27ohms.
I think Arduino is 40ohm, so you have to re-calculate anyway.
This might help.

Leo..

Thank you very much guys :smiley: , very useful links . but i still cant solve this ...
so the guy used resistors in power like 2R 4R 8R 16R .. and did feed them to the R,G,b rails which he connected all togeather.
the thing is here , i have the sync pin , that is always HIGH , and the sync pin must have a certain resistance to .
+someone once told me that , the RCA connection has a built in 75ohm rail ? is that correct ?
i cant still figure this out , since the sync pin is always high . like when the sync pin is also low the thing turns to 0v . the 0.3v voltage is generated through the sync pin while the rest are low .
cant quite figure still :confused: .

I think this will give you the desired waveform:

I hope my maths is correct :slight_smile: .

Other values of the resistors could give the same waveform.

The amplitude of the waveform will be very close to the digital 'high' voltage.

Yes, video signals are usually terminated with a 75ohm resistor.

RCA connection?, so not 15-pin VGA.

0.3volt sounds like the sync level of composite video.

Is this going to a TV as RGB, or as CVBS.
PAL, NTSC, SECAM.

Or into a VGA (computer) monitor.
What refresh rate.
Leo..

There is no such thing as a resistance rail. The input does have a terminating resistor however.

Home made R 2R 4R converters can not be pushed very far because of the tolerance and accuracy you need from the resistors.

I told you what to do in reply #2 why are you ignoring this? Unlike many of the posters here I have actually made a circuit like this, so I know what you need.

amine2:
->JoeN i dont think i can manage to get such a chip Bro ,thank you though

You never know until you try. The worst that will happen for you spending two minutes of your time will be no reply from them or a rejection notice.

Wawa:
Is this going to a TV as RGB, or as CVBS.
PAL, NTSC, SECAM?

Looks like it has to be monochrome video.

Ahhh, I see now.
OP is trying to generate a signal for his AD725.
The ladder has to output 714mV p-p into 25ohm (RGB), and the IC is making that into a composite video signal.
The "0.3volt" and several other things put me on the wrong foot.
So the ladder from post#9 won't work with the IC, because the IC has separate sync inputs.
Actually, why the AD725.
If you only want monochrome video, couldn't you just use a resistor network.
Leo..

WAWA . it's not an AD725 (i did work with that though , very easy because the sync is seperated)
here is the exact case , the protocol is PAL . i just need 256 levels of gray .
i am working with an RCA-jk lika i said .

Grumpy_Mike yeah man , but i could not understand you . i did read what you posted yet i couldn't figure the solution , can you simplify for my humble experience ?

thank you very much Archibald , thank you JoeN and thank you Mark .

Is your sync a composite sync? It needs to contain both the frame and the line sync pulses. You need also some blanking pulses to define the front and back porches, but maybe you want to try not using them.

Attached is a way to mix the video signal from the D/A with the sync signals. As I said you need an open collector transistor to pull the signal down to zero during the sync pules. When not in the sync region the brightness resistor ( pot or fixed ) holds the voltage at 0.3V and the 0 to 5V from the D/A is mixed in through a 1K. The circuit is AC coupled into the monitor. You could put a 75R across the collector / emitter of the transistor if you want to terminate the sending end but I don't think there is any need for it so I have not put it in the circuit.

If you do get composite blanking pulses then these need to be added into block the video.

composite video.png

thats some decently smart solution , that deserves a bucket load of karma .

i dont have blanking periods , just hsync .
the video works fine for now . inverting the sync pulse is simple in code . so for the D/A i can use the usual R2R resistor ladder right ? since its 0->5 volts ?

the thing is , i dont think the transistor is needed , because the sync is connected to some AND logic gate chips along side the 8 video pins (bits) . so when the sync is low , there is not input so the voltage would be 0v .
i will add the transistor though with a "NOT" chip from the sync just to make sure everything is fine . after that i will continue the circuit like you mentioned

so for the D/A i can use the usual R2R resistor ladder right ? since its 0->5 volts ?

Yes.

i dont think the transistor is needed , because the sync is connected to some AND logic gate chips along side the 8 video pins (bits) . so when the sync is low , there is not input so the voltage would be 0v .

Yes but when only the sync was high and all the other bits going into the D/A were low, then the output voltage would be zero not the 0.3V that you want to build the analogue signal on.