Skip to content

Main content

Microcontroller: Uart Parity Word Data Mask Tool

Extract UART data and an optional adjacent parity bit from an explicitly packed word, without asserting parity correctness or parsing start/stop bits.

Loading tool…

Description

Parse word as an unsigned decimal integer fitting dataBits plus any parity bit.

UART frames combine a start bit, data, optional parity, and stop duration. Baud rate and framing choices jointly determine time and overhead, while polarity and parity correctness are separate checks.

Parse word as an unsigned decimal integer fitting dataBits plus any parity bit.

When to use this tool

Use Microcontroller: Uart Parity Word Data Mask when you need one UART timing, framing, or field calculation.

How to use the tool and how it works

  1. Enter word, dataBits, parityPresent. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read result. Expand result to inspect the returned fields.

Parse word as an unsigned decimal integer fitting dataBits plus any parity bit. Mask the low 5-9 data bits; return the next bit when parityPresent, otherwise parityBit -1.1

Input fieldMeaning and unitsAccepted input
wordWordRequired. Text. Implementation limit: 8192 Unicode code points and 16384 UTF-16 code units.
dataBitsData BitsRequired. Safe integer.
parityPresentParity PresentRequired. Boolean.
Output fieldInterpretationReturned shape
resultResultRequired. Object.
result.dataWordData WordCalculated result member: string.
result.parityBitExtracted parity bit, or -1 when parity is absent.Calculated result member: number.
json
{
  "input": {
    "word": "257",
    "dataBits": 8,
    "parityPresent": true
  },
  "output": {
    "result": {
      "dataWord": "1",
      "parityBit": 1
    }
  }
}

Limitations and assumptions

  • The absent-parity -1 is a sentinel; parity correctness and serial bit ordering are not evaluated.
  • Outputs are nested inside result. Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
  • Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.

Alternative or Complementary methods

Confirm the device's supported frame format and clock budget, then inspect a measured serial waveform where needed.

References

  1. Calculation and input contract: microcontroller/uart-parity-word-data-mask — tool.io

Similar or alternative tools