A rotary DIP switch turns to one of several stop positions and outputs that position as a coded value, most often BCD, which covers 0 to 9, or hexadecimal, which covers 0 to F. Engineers use it to set a device address, a channel, or a mode with one control that retains its mechanical setting when power is removed. Reading it means knowing the coding scheme, whether the code is real or complement, and how the common terminal connects to the coded output pins, commonly labeled 1, 2, 4, and 8 on BCD and hexadecimal versions, at each position. Swiclick builds coded rotary DIP switches including the KBM-16S sixteen-position hexadecimal type and the KBM05 series, with a 500-piece minimum and free samples. Tell us your position count and coding scheme and we will confirm the part.

16-position hex rotary DIP switch wiring diagram with binary weighted outputs

BCD, Hexadecimal, Gray, and Octal Coding

The coding scheme sets how a position maps to an output. BCD encodes the decimal digits 0 to 9 on four weighted lines. Hexadecimal extends that to 0 to F across sixteen positions. Gray code changes only one output bit between adjacent positions, which avoids a false intermediate value while the contact moves. Octal covers 0 to 7. Pick the scheme from the range of values you need and how the receiving circuit expects to read them, and confirm the exact scheme on the datasheet, since the same position count can be offered in more than one code.

Real Code Versus Complement Code

This is an easy point to misread. In a real code part, the common terminal connects to the weighted pins that make up the value, so position 3 connects pins 1 and 2. In a complement code part, the outputs are inverted, so the same position reads as the complement of the value unless your firmware inverts it back. Confirm whether the part is real or complement before you write the read routine, because the two give different port readings for the same knob position.

2.real code vs complement code rotary DIP switch reading comparison

Wiring It and Reading It Into an MCU

Wiring is straightforward once the code is known. Tie the common terminal to a reference, connect the coded outputs to input pins, and add a pull resistor on each line so an open contact reads a defined level. In firmware, read the input lines and reconstruct the value from the switch truth table. With four contiguous binary-weighted inputs this can be as simple as masking the relevant bits and shifting them into a value, but complement-code parts need the input polarity accounted for, and Gray-code parts need Gray-to-binary decoding. If a reading comes out inverted or incorrect, check for complement coding, Gray coding, or a swapped bit order before assuming the switch is faulty.

3.rotary DIP switch to MCU decoding flowchart for BCD hex complement Gray code

Top Adjust, Side Adjust, and Sealing

The actuation style decides how the setting is made in the field. A top-adjust part is set with a screwdriver from above; a side-adjust part is reached from the edge. Some parts turn continuously, others stop at each position with a detent. If the board is cleaned or the switch sees moisture, specify a sealed or process-washable variant, and keep process sealing separate from a field IP rating. Confirm the actuation and any sealing for the exact part number. Where the setting is a single choice a person makes and reads by eye, a multi-position slide switch can be a simpler alternative to a coded rotary.

Confirming a Rotary DIP

Swiclick is the switch brand of Wenzhou Gangyuan Electronics Co., Ltd. Send your position count, the coding scheme, whether you need real or complement output, the adjust style, and any sealing requirement, and we will confirm the closest coded rotary DIP part and the pin mapping to read it.

FAQ

What does a rotary DIP switch output? 

A coded value for its position, most often BCD (0 to 9) or hexadecimal (0 to F). The common terminal connects to coded output pins, commonly labeled 1, 2, 4, and 8 on BCD and hexadecimal versions, and the setting holds with no power.

What is the difference between BCD and hexadecimal rotary switches? 

BCD covers the decimal digits 0 to 9; hexadecimal covers 0 to F across sixteen positions. Pick by the range of values you need and how the receiving circuit reads them.

What is real versus complement code? 

In real code, the common connects to the weighted pins that make up the value. In complement code, the outputs are inverted. Confirm which one the part uses before writing the read routine, since they give different readings for the same position.

How do I read a rotary DIP switch with a microcontroller? 

Tie the common to a reference, connect the outputs to input pins with a pull resistor on each, then reconstruct the value from the switch truth table. Binary-weighted BCD or hex outputs can be a mask and shift; complement code needs the polarity handled, and Gray code needs Gray-to-binary decoding.

Can I set a rotary DIP switch without a tool? 

It depends on the part. Top-adjust and side-adjust types are usually set with a screwdriver, while some have a knob or wheel. Confirm the actuation style on the datasheet.

What is the minimum order and can I get samples? 

The minimum order is 500 pieces with free 1 to 50 pc samples. Send your position count and coding scheme and we will confirm the part.