DIP Switches
DIP Switches have featured extensively in many systems especially where either addressing, unit configuration, or some such similar feature is needed. Prior to Windows 95 "Plug and Play", the only way to configure the base address of an add-on card was by using a dip switch bank.
DIP Switch banks are not as common as they used to be, however, they are still available for purchase and remain an uncomplicated way of introducing a "low-level" form of human-to-system interface to configure a unit.
DIP (Dual In-Line Package) Switches are available from a single switch to 20 or more. They are usually the same size as an equivalent IC holder and have tell-tale numbering and small white switches that move horizontally.
A 4-BIT or 4-Position lineart example is shown below to illustrate their operation.
- The "ON" or "closed" position is labeled on the surface of the set of switches
- Moving the switch into the "ON" position closes the circuit
- Moving the switch to the "OFF" or opposite position opens the circuit
- Moving the switches is best done using a small screw-driver along the lines of a "jeweler" set
- They are available in DIP Through Hole and SMT variants.
๏ปฟ
Implementation can be done in two ways,
- Used as a switch
- Used to represent data
When used in this manner, the switch may be used to configure a voltage level or power setting. For example, on the Radix DUO, the voltage selection is made using enabling the correct dip switch.
If used in conjunction with a microcontroller. the change in the setting can be read and used to configure a setting. In the code sample below, the PIN is held HI which is the OFF position. When the switch is moved to the on position the input is pulled to ground. As shown in the code sample below, this change can be used when the MCU is powered up to configure a setting.
When used to represent data, the bank of DIP switches would be read simultaneously; all the inputs would be read at the same time. When you recall your Base 2 or binary maths, then 2^0 = 1, 2^1 = 2, 2^2 = 4, ... , 2^7 = 128. Depending on which switches are enabled, you have a numerical value from 0 to 255 which can be selected.
The address value can be used for an ASK๏ปฟ-based system or an RS485 system. If you were implementing an ethernet system, then this 8-bit bank could be used to configure the last octet. for example 192.168.1.[AdrValu].
While a little "old school", DIP switches remain a useful technique for either configuring a setting or providing data in the form of an address. They are fairly cheap and readily available from most electronic suppliers.
Implementation for PCB design is simple using a standard DIP package according to the number of switches in the package you have chosen.