On Thu, 2 Jul 1998, Alvin Tan wrote: > Could someone suggest whats the best way to replace 40 dip switches? I > have 10 preset settings that I require. Some have pull up resistors, > and some has Pull-down resistors, and some are just stright switches. > > Thank You in advance for taking some time to read this. > > > Alvin Tan > > mailto:Alvin_Tan@bc.sympatico.ca For pull-ups and pull-downs you can substitute PIC outputs directly. A pull-up is obtained by setting the pin to HIGH and then turning the tristate control to OUTPUT. To turn off, turn the tristate control to INPUT. For pull-low you need to output a LOW in the register bit and control the tristate as shown. If I understand what I think I understand with 'straight' switches, you can use either CD 4066 or CD 4052 analog multiplexers or relays depending on specs. There are also other more powerful analog switches to be had, but they cost an arm and a leg (intended for video applications mainly). Figure 1 PIC IO pin per item to be controlled. With 40 IO pins, you could use two PIC 64's or 66's, but they would be grossly under-used if only doing this. The other way to do this, is to use latching bus shift registers and build a daisy chain of them. This is a simple bus expander. This has nothing to do with PICs but it's a good general solution when many outputs are to be controlled at a slow rate. The registers that I use (by the bucketfull) when it comes to these things, are CD 4094 CMOS registers (and their functional complements, CD 4021s). These can be cascaded directly (w/o glue), have tristate outputs themselves, and are fast enough to be driven by a PIC at top speed. Thy require 3 wires from the PIC no matter how long the register. You have 8 CMOS outputs per chip used, tristate-able together (all 8). Depending on how many of your switches are 'straight through' ones, you could get away with a PIC 64 or 66 and one or two 4094s that would drive the analog switches. Of course you could use two 64s. hope this helps, Peter