Another diversion - I'm going all round the houses here. Who would have thought that there could be so much to a few simple

resistors arranged in a network? This time I'm playing with the simulator.

When I did the hardware in a previous blog, I mentioned that the output of the resistor ladder needed to be buffered but

didn't actually say what the output resistance is. Given that we know the 'R' value - for my circuit I chose 4.7k - can we

say what the output resistance is analytically? Whilst you puzzle over that, as an alternative I'm going to do it the lazy

way by setting the simulator to measure it.

Here's the circuit again

I've placed a generator on the output, coupled to the output via a capacitor so that I can measure the ac voltage and

current with meters. The capacitor is large enough that, at the 10kHz I've got the generator set to, it looks like a short

circuit to ac, just helping me by removing whatever the DAC generated voltage is. The generator amplitude is set to 1mV, so

it's only a small perturbation. Once I've measured the voltage and current, I can then do some arithmetic to work out the

resistance that the generator is seeing as it back-drives the output (simple application of Ohm's Law).

To do this with TI-Tina I had to puzzle out the scripting. To do it, you select Post-processor from the Edit menu in the

waveform display window, tick Advanced Edit and enter the script. What wasn't obvious immediately was that this is Pascal

syntax, so I had to look for a reference on the web (the interpreter didn't like the divide by zero, so I need the IF

statement to avoid it, otherwise I could have just used the standard expression generator).

```{This is a template}
{Don't modify the functionname}
Function F(t);
Begin
IF (AM1(t)=0) THEN F:=0 ELSE F:=abs(VM1(t))/abs(AM1(t))
End;```

Here are the resulting waveforms for a DAC setting of 0x40. Ignoring the dip, when it's trying to divide by zero, it's

evident that the resistance is somewhere around 4.7k. What's interesting, though, is that however I arrange the DAC

switches I always see 4.7k.

Coming back to the analytical approach, that result makes sense. As far as ac is concerned, all the dc voltages can be

considered as having zero resistance between them , so we can consider all the switch connections to be going to ground

and solve for the resulting network. If we start at the bottom of the ladder and work up, we have 2R in parallel with 2R

giving R, that's in series with an R giving 2R, which is in parallel with a 2R giving R, and so on to the top where we

finally end up with a value of R, which matches what the simulator sees (phew!).

 That's from the point of view of simple theory. In this real circuit there are two things that take us away from the

ideal. Firstly, the switches are actually MOSFETs that have an rDS(on) of about 20R, which I should really be taking into

account. Secondly, the idea that the different voltage rails look like a short to ac depends on frequency and how the

decoupling behaves, but it's probably a plenty-good-enough approximation for what's happening in this case.

Part one: Arduino: R-2R Experiment

Part three: Arduino: R-2R: Buffer, Attenuate, and Filter

Part five: Arduino: R-2R: "Resistance is..."?

Part eight: Arduino: R-2R: Setting the Signal Amplitude