Cheatsheets
8051 (MCS-51)
Registers, SFRs & ports, addressing modes, and common assembly instructions.
Visualize
8051 — bit-addressable port (P1)
SFRs like P1 are bit-addressable — flip one pin (SETB / CLR) without touching the others.
Tap a pin to toggle it, or run an instruction. SETB / CLR change one bit; MOV writes the whole byte.
pin high · bit-addressable SFR — flip any pin without touching the others.
30 entries
Registers & memory7
A (ACC)Accumulator — most arithmetic/logic uses it
BAux register (MUL / DIV)
R0–R7General registers — 4 banks selected by PSW RS1:RS0.
DPTR16-bit data pointer (external/code memory)
SPStack pointer (defaults to 0x07)
PSWProgram status word — CY, AC, RS1:RS0, OV, P
PCProgram counter (16-bit)
SFRs & ports6
P0–P3 (0x80/90/A0/B0)8-bit bidirectional I/O ports
TMOD / TCONTimer mode / control
TH0/TL0, TH1/TL1Timer 0 / 1 high & low bytes
SCON / SBUFSerial control / buffer (UART)
IE / IPInterrupt enable / priority
PCONPower control (idle, power-down, SMOD)
Addressing modes6
MOV A, #25hImmediate
MOV A, 30hDirect (internal RAM / SFR)
MOV A, R0Register
MOV A, @R0Indirect (R0/R1 point into RAM)
MOVC A, @A+DPTRCode memory (look-up tables)
MOVX A, @DPTRExternal data memory
Common instructions8
MOV / MOVX / MOVCMove (internal / external / code)
ADD, ADDC, SUBB, INC, DECArithmetic
MUL AB / DIV ABMultiply / divide A and B
ANL, ORL, XRL, CPL, RL, RRLogic & rotate
SETB / CLR bitSet / clear a bit (e.g. SETB P1.0)
JNB / JB / JC / JNCBit & carry conditional jumps
CJNE / DJNZCompare-and-jump / decrement-and-jump
ACALL / LCALL / RET / RETICall / return — RETI (not RET) ends an interrupt.
Programs & routines3
Blink an LED on P1.0Complete program: toggle a pin in a loop with a delay.
Timer 0 delayRecipe: a precise delay with Timer 0 (mode 1, 16-bit).
ISR (interrupt routine)Recipe: an external-interrupt service routine.