What are real code and complementary code in rotary DIP switches?

Question:

What are real code and complementary code in rotary DIP switches?

Block

Answer:

There are two types of rotary DIP switch output methods: real codes and complementary codes. Most codes are real codes (positive logic), but the opposite codes are complementary. The codes are selected according to the circuit design at microcontroller input.

Block

Explanation:

Omron rotary DIP switches have a 4-bit signal output, and the real and complementary code outputs are below. Our rotary DIP switches have both output codes for A6A, while other rotary DIP switches have only real codes.

Output Codes

image

For more details, visit A6A Datasheet.

Block

Quick tips

A6A, sealed type (equivalent to IP64) model, is resistant to solder flux and dust intrusion, with the following knob varieties.


Product category

Switches DIP Switches


Classification

Usage, Applications


Related keywords

Rotary DIP Switch
Real Code
Complementary Code
10-Position
16-Position
Sealed Type
IP64
Ingress Protection
Solder Flux

Block

Please visit the link below to see this product category on the Digi-Key website
Switches | DigiKey Electronics


This FAQ has been brought to you courtesy of




Please click the link below to view the original FAQ

What are real code and complementary code in rotary DIP switches? | FAQ | OMRON Device & Module Solutions - Americas

Those various codes are mostly a historic / confusing thing today. They used to be more important decades ago, when swiches were connected to hardwired logic. Whether a switch common was connected to gnd or vcc, or what was the required functionality, changed the required code unless another ic (a set of inverters) was added. Nowadays the different codes are easy to adopt in software, and I’ve sometimes even coded somewhere a bit that lets easily select the code in the swithches, based on what is available at the manufacturing day. May be easier to turn that bit in the sw than wait another 2 months for swithces with a different code.

1 Like

Good points, timo.

Thank you for the inspiration for this related post.

I agree that the actual device isn’t too important as it is easy to change the values in the code. However, at a system level the complementary switch may be better as it provides positive logic input to the microcontroller. That is assuming internal pull-up resistors are used. Less mental work and faster troubleshooting.

Then again, as you suggested, a single bit or zero-Ohm jumper will keep the production line running.

Have a good weekend,

APDahlen