'R, 3R, 9R, 27R DAC'
recently someone asked if it was possible to use the fact that PIC pins
can be tri-stated to produce a different kind of DAC. (Using ideal
components of coures.) The answer is that it requires an inverting op-amp
with the +ve input at Vsupply/2.
If you then use a R-3R-9R-27R network to sink and source current it is
possible to get a reasonably linear response. (depending on how little
current the tri-state input sinks) Each output can occupy three states
Hi,Lo, or Tri. Here are the first few codes. Generating the remainder is
left as an exercise for the three-fingered student from Sirius.
MSB 2 3 LSB
(R) (3R) (9R) (27R)
0 Hi Hi Hi Hi
1 Hi Hi Hi Tri
2 Hi Hi Hi Lo
3 Hi Hi Tri Hi
4 Hi Hi Tri Tri
5 Hi Hi Tri Lo
6 Hi Hi Lo Hi
7 Hi Hi Lo Tri
8 Hi Hi Lo Lo
9 Hi Tri Hi Hi
It's probably not worth generating these codes from scratch, just use an 81
byte lookup table with one nibble containing the Port bits and the other the
P.S. The three fingered alien came from Sirius because everyone knows the
little green men come from Alpha Centauri ;-)
Keith Dowsett "Variables won't; constants aren't."
>If you then use a R-3R-9R-27R network to sink and source current it is
>possible to get a reasonably linear response. (depending on how little
>current the tri-state input sinks) Each output can occupy three states
>Hi,Lo, or Tri. Here are the first few codes. Generating the remainder is
>left as an exercise for the three-fingered student from Sirius.
Very nice use for base-3 math.
>P.S. The three fingered alien came from Sirius because everyone knows the
>little green men come from Alpha Centauri ;-)
I thought you were referring to somebody's typing style/ability! <G>
Andy Kunz - Montana Design - 409 S 6th St - Phillipsburg, NJ 08865
Hardware & Software for Industry & R/C Hobbies
"Go fast, turn right, and keep the wet side down!"
|> From: Andrew Warren <IX.NETCOM.COM> fastfwd
> Steve Hardy <MITVMA.MIT.EDU> wrote: PICLIST
> > given that each of 4 outputs can be in one of 3 possible states,
> > one could conjecture that it is possible to make a DAC with 3^4 =
> > 729 [sic] possible output levels. Is this possible in practice?
Yes, I'm suitably chastised. Somehow I pressed 3 cubed squared
not 3 squared squared. Serves me right for doing on a calculator
what I should have done in my head.
Well, Keith Dowsett <RPMS.AC.UK> got the answer that I was kdowsett
thinking of, and is attached below (with a few additional comments).
However, I don't think this is directly relevant to your attenuator
problem since the solution below is directed to merely producing a
voltage output. I think you really wanted a multiplying DAC. Of
course, you can use a voltage to control a separate attenuator.
What is happening here is that rather than binary, a numbering system
called 'balanced ternary' is being used. In balanced ternary, each
digit has the possible values -1, 0 or 1. D.E.Knuth goes into a little
detail in 'The Art of Computer Programming, Seminumerical Algorithms'.
With the DAC described by Keith, the digit values get weighted by a
power of 3 and fed to a current summing node whose voltage is
maintained at the 'zero' (Vcc/2) level. As far as I can see, the
following advantages accrue c/w 2's complement binary:
. Finer resolution for the same number of outputs.
. Equal numbers of +ve and -ve steps: symmetry.
. At mid-scale (i.e. zero) only the least significant digits
are changing. With binary, the MSB changes as
mid-scale is crossed, which requires the MSB resistor to
be trimmed accurately. This is a significant problem for
low-level audio signals.
. Untrimmed 1% E24 resistors seem to work out a bit nicer:
1, 3, 9.1, 27, 82 vs 1, 2, 3.9, 8.2, 16, 33, 62. This is
a pretty weak argument, I admit.
... and the following disadvantages:
. Require 3-state outputs
. If the summing node is not at Vcc/2 then the 'gain' is different
for +ve and -ve signals. This can add 2nd harmonic distortion.
. The program needs to convert from binary to balanced ternary,
then juggle the TRIS register and port correctly.
More... (looser matching)
- Last day of these posts
- In 1997
, 1998 only
- New search...