📖 How to Use
🎯 Getting Started
This tool simulates microcontroller registers and bitwise operations:
- Click bits in Register A or B to toggle them (0 → 1 or 1 → 0)
- Choose operation from the operator buttons (AND, OR, XOR, etc.)
- See results instantly in Register C with hex/decimal values
- Switch bit width between 8-bit and 16-bit modes
⚡ Bitwise Operations
- AND (&): Result bit is 1 only if both input bits are 1
- OR (|): Result bit is 1 if either input bit is 1
- XOR (^): Result bit is 1 if input bits are different
- NOT (~): Inverts all bits in Register A (ignores B)
- Left Shift (<<): Shifts bits left, fills with 0s on right
- Right Shift (>>): Shifts bits right, fills with 0s on left
🔧 Microcontroller Use Cases
- Set a bit: Use OR with a mask (e.g.,
PORTB | 0x04sets bit 2) - Clear a bit: Use AND with inverted mask (e.g.,
PORTB & ~0x04clears bit 2) - Toggle a bit: Use XOR with a mask (e.g.,
PORTB ^ 0x04toggles bit 2) - Check a bit: Use AND to isolate (e.g.,
if (PORTB & 0x04)checks bit 2)
📝 Quick Tips
- Hex values are prefixed with
0x(standard C notation) - In JavaScript bitwise ops, use
& 0xFFfor 8-bit mask or& 0xFFFFfor 16-bit - Shift operations respect the current bit width (overflow bits are discarded)
- Use the preset buttons to quickly load common bit patterns
Register A
0x00
0
Bitwise Operation
Select an operation to see the result
Register B
0x00
0
Result (Register C)
0x00
0
📝 C/Arduino Code Example
// Select an operation to see example code