EMBEDDED TOOLKIT
SYSTEMS R&D // DEV_TOOLS SUITE
Tools (65)
bitfield editor
SYSTEM ONLINE
HEX: 0x00000000
3124231615870
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Field Creator (Bitfields)
Bits:to
MODE[3:0]
ENABLE[8:8]
PRESCALER[23:16]
Value Management
MODEMax: 15
Dec:Hex:0x0
ENABLEMax: 1
Dec:Hex:0x0
PRESCALERMax: 255
Dec:Hex:0x0
📖 How to use Bitfield Editor?
Bitfield Editor is a tool that facilitates mapping hardware registers (e.g., in STM32, ESP32 microcontrollers) to C language structures. It allows you to visually define which bits correspond to specific flags and automatically converts them into ready-to-use code.
1. Field Creator (Defining Masks)
- Enter the field name (e.g.,
UART_EN). - Enter the bit range from the datasheet, e.g., from
12to15. - Click "Add". In the upper preview (Memory Map), these bits will be marked with a unique color.
- The tool ensures that fields do not overlap.
2. Value Management (Calculator)
- In the right column, enter the target value for a given field.
- If the field has 4 bits (e.g., 12 to 15), the maximum value is
15 (0xF). - Changing the value on the fly recalculates the main Hex (register at the top), placing the bits in the correct place (Shift). It saves you from calculating in your head:
val << 12.
3. Generating C Code
At the very bottom, clean C code is generated on the fly (so-called Bit-Fields). The script automatically detects memory "holes" between your fields and fills them with RESERVED_x variables, ensuring perfect alignment of the structure to the hardware register. Additionally, safe macros _Pos (Position) and _Msk (Mask) are generated, popular in CMSIS/HAL libraries.