Myke Predko wrote: > Hiya, G'day! > I just sent this reply back to Paul directly when I meant to send it > to the entire list: No worries, I caught both, will forward to the list only. >> Three output states for each resistor makes nine, enough for quite >> detailed analogue sound output. > Paul, could you explain how to do this with a Resistor ladder? The > Best that I can do is n + 1 (where "n" is the Number of Resistors): * diagram of rather assymetric circuit bearing * * negligible resemblance to R-2R ladder! * Your circuit is a little confused. Let me propose again the use of two outputs, each with a resistor to a common output point (coupled to the LM386 by a capacitor) which is the centre point of an equal voltage divider between Vcc and ground. I specify that the resistors from the PIC outputs are related in a 3 to 1 ratio, and the values in the voltage divider are each equal to the lesser value of the other. Vcc | | R | | DC Block o1 |----R-----+------||--- Output | | | | o2 |----3R----+-- "common point" | | | R | Gnd If neither PIC output is enabled, the common voltage is ¸Vcc. If the output coupled to the lesser resistor is enabled in either direction, it delivers a voltage bias of Vcc/6 to the common point in that direction, while the other output produces a third of this bias in whichever direction. Calling this lesser bias increment "i" and referring this to ¸Vcc, the effects of the two outputs are: o1 Gnd O/C Vcc Nine states in total, four positive Gnd -4i -i +2i and four negative increments relative o2 O/C -3i 0 +3i to the zero point. If you REALLY want Vcc -2i +i +4i twenty-seven states, use a third output. Even a four bit (81 state) system would fit really nicely packed in a byte using the SWAPF instruction to extract first the port, then the TRIS value, and a lookup table might of course be used to read such values from a "phase" or syllable table. Something tells me an "R-3R" ladder would also be usable for this task. For the moment though, stock resistor values are sufficiently accurate. > Now, I suppose that multiple Outputs could be turned on to get > parallel resistances, but I would be concerned about this with uneven > current drive capabilities with different pins. I wouldn't! The PIC "Maximum Current Sunk" by an output pin being quoted as 20mA (though this is actually a maximum safe rating rather than a claimed drive ability) at 5V suggests an output impedance of 250 ohms. Since the input impedance of the LM386 is about 250k, the "R" above should be picked in the order of 270k (giving 3R a convenient value of 820k) and the current drive capability of the PIC pins is trivial. > This method would make it very hard to calculate the actual Voltage > Outputs. That's what scientific calculators or PCs are for! Cheers, Paul B.