Bit Register Calculator – Bits, Fields & C Masks
NOVOBit register calculator for 8, 16 and 32-bit MCU registers: click bits, see hex, decimal, binary and octal, name bit fields and copy the C set/clear/mask code. Free.
Funciona 100% no seu navegador — o que você insere nunca é enviado nem armazenado nos nossos servidores.
Esta ferramenta ainda não está totalmente traduzida, por isso parte do texto continua em inglês. A ferramenta funciona da mesma forma em todos os idiomas.
Signed (two's complement): -91 · bits set: 4
Bits 15 and above use 1UL because int is only 16 bits on AVR. Need plain XOR/AND on long hex strings? Try the Bitwise Calculator; for any base conversion use the Number Base Changer.
Exemplos rápidos
Entradas típicas e os resultados que esta ferramenta gera.
Visão geral
Configuring a timer, UART or GPIO port usually means writing a register value built from several bits and multi-bit fields. This bit register calculator shows an 8, 16 or 32-bit register as a grid of clickable bits, keeps hexadecimal, decimal, binary and octal views in sync, and shows the signed value too.
Describe the register layout once, for example EN:0, MODE:2-1 and PRESC:7-4, and each field is coloured on the grid with its current value, which you can edit directly. The tool then writes the matching C: set, clear, toggle and test expressions for a bit, plus CMSIS-style _Pos and _Msk macros with read and write statements for every field.
It is aimed at embedded developers working from a datasheet register table. Everything runs in your browser.
Por que usar esta ferramenta?
- Click bits instead of converting by hand
- Hex, decimal, binary and octal stay in sync
- Named fields with editable values
- Copy-ready C masks and macros
- Free and runs entirely in your browser
Recursos
Clickable bit grid
Toggle any bit; rows are grouped per byte with bit numbers, so it fits on a phone.
Four bases
Type in hex, decimal, binary or octal and the other views update; underscores and 0x prefixes are accepted.
Named bit fields
Define fields as NAME:bit or NAME:hi-lo, see them coloured on the grid, and edit their values.
Shift and mask helpers
Set, clear or toggle bit n, shift left or right, invert, set all and clear all.
C code
reg |= (1u << n) style expressions plus _Pos/_Msk defines and field read/write statements.
AVR-safe literals
Uses 1UL for bit 15 and above, because int is only 16 bits on 8-bit AVR.
Como usar
Set the width
Choose 8, 16 or 32-bit and type the register name used in your code.
Enter or click
Type a value in any base or click bits on the grid to build it.
Name the fields
List the fields from the datasheet in Named bit fields, then read or edit their values in the table.
Copy the C
Copy the single-bit snippets or the field macros straight into your firmware.