RBC Input
Applies to: IOcan · Standalone controller. What this means
Overview
An RBC Input decodes a Reflected Binary Code — better known as Gray code — from a set of single-bit inputs into an ordinary integer.
Gray code is an encoding in which consecutive values differ by exactly one bit. Absolute rotary encoders and gear-position selectors use it because only one line changes at a time, so a reading taken while the switch is moving can never land on a wrong intermediate value.
Bit order: the first input in the list is bit 0 — the least significant. Each subsequent input is the next bit up. This is the opposite of the convention most encoder data sheets print, where the lines are listed most significant first, so the list usually has to be entered in reverse of how the sheet reads.
Gear-position selectors are the case this exists for. Shifter integration lists the levers already supported, and wiring concepts covers wiring a non-standard one.
Prerequisites
- One source input per encoder line — usually Digital Inputs. Create them first, with their filters off: the filter would turn each line into a one-cycle pulse and the decode would collapse to zero.
- Each source is read against the standard threshold: above 512 is a 1, anything else is a 0. A "non-zero" line is not necessarily a 1.
- The line order, from least significant to most significant.
Add it in the app
- Add a new input and choose RBC Input as the type.
- Give it a clear name (e.g.
Gear Position). - Add the bit inputs, least significant first.
- Step the switch through every position and check the decoded number in the datalogger. This is not a step to skip — a reversed list still decodes to plausible-looking numbers.
Settings reference
| Setting | Meaning | Unit | Range / values | Notes |
|---|---|---|---|---|
| Bit inputs | Ordered list of single-bit inputs | — | list of inputs | Position in the list is the bit weight: first entry is 1, second 2, third 4, and so on. An empty list raises fault 0x00A0; an unassigned entry raises 0x00A1 with its index. |
How the decode works
Each source contributes 2^index to a raw Gray value when it reads above 512.
That raw value is then converted to binary in the standard way: the most
significant bit is taken as is, and each lower bit is the running exclusive-or
of the bit above it with the next Gray bit. n lines decode to 0 … 2^n − 1.
Nothing validates that the pattern is a legal Gray code. A missing or stuck line produces a wrong number rather than a fault, which is why the walk-through in step 4 matters.
Common settings
RBC Input also uses the shared Name setting. See Common IO settings.
Example — three-line Gray-coded gear selector
A selector exposes three Gray-coded lines. Its data sheet labels them G2
(most significant), G1, G0.
- Create three Digital Inputs,
G0,G1,G2, filters off. - Type RBC Input, name
Gear Position. - Add the bit inputs in the order
G0,G1,G2— least significant first, which is the reverse of the data sheet's listing. - Move the selector through all eight positions and confirm the decoded value
steps
0…7and never skips.
Troubleshooting
- The number counts backwards, or jumps around: the list order is reversed. The first entry is the least significant bit.
- Always reads zero: the source inputs have their filters on, so each line is a one-cycle pulse rather than a level. Turn the filters off.
- One position is always wrong: check that line's source input on its own — a stuck bit is a wiring or threshold problem at the source, not here.
- Values jump by more than one between adjacent positions: the encoder is not Gray-coded, or a line is missing from the list.
- Fault
0x00A0or0x00A1: the list is empty, or an entry points at an input that does not exist — often one that itself failed to configure.
Related
- Digital Input — the per-line bit sources
- Mux Input — use the decoded number to select a value
- Analog Switch Input — read switch positions on one analog pin
- Fault codes