• Home
  • Articles
  • Basics
  • Components
  • Projects
  • Communications
  • MCQ

WatElectronics.com

You are here: Home / Electronics / 8051 Microcontroller Cheat Sheet

8051 Microcontroller Cheat Sheet

December 7, 2023 By WatElectronics

A concise set of notes which is used mainly for quick reference is known as a cheat sheet or crib sheet. These sheets were used by many students to prepare/ revise for their exam/test. The cheat sheet provides you with very useful data regarding a subject and helps you remember. This article provides brief information on the 8051 microcontroller cheat sheet which includes the information about the microcontroller.

1. Introduction:

  • The 8051 microcontroller is an 8-bit microcontroller with Harvard architecture.
  • Developed by Intel in 1980, widely used in embedded systems.

2. Architecture:

CPU:

  • 8-bit ALU (Arithmetic Logic Unit).
  • 16-bit PC (Program Counter) and DPTR (Data Pointer).
  • 8-bit registers (Accumulator, B register, and more).

Memory:

  • 128 Bytes of RAM (Data memory).
  • 4 KB of ROM/EPROM (Program memory).
  • On-chip data memory and external code memory support.

Clock:

  • Typically operates at 12 MHz.
  • Two 16-bit timers/counters (Timer 0 and Timer 1).

3. Instruction Set:

  • Over 100 instructions, including data transfer, arithmetic, logical, and control operations.
  • Instructions vary in length (1 to 3 bytes).

4. Registers:

  • Accumulator (A): Primary register for arithmetic and logic operations.
  • B Register: Used in multiplication and division.
  • Data Pointer (DPTR): 16-bit pointer for external data memory.
  • Program Counter (PC): 16-bit register for program memory addressing.

5. Interrupts:

  • Supports external hardware interrupts (INT0, INT1) and internal interrupts (Timer, Serial).
  • Interrupt enable and disable instructions (EI, DI).

6. I/O Ports:

  • Four parallel I/O ports (P0, P1, P2, P3).
  • Bit-addressable and byte-addressable ports.
  • P0 and P2 have internal pull-ups.

7. Serial Communication:

  • UART for serial communication (TXD, RXD).
  • 8-bit data, variable baud rate.

8. Timers/Counters:

  • Two 16-bit timers (Timer 0 and Timer 1).
  • Mode 1: 16-bit mode with auto-reload.
  • Mode 2: 8-bit mode with auto-reload.

9. Memory Organization:

  • Program memory (Code space): Addresses 0000H to FFFFH.
  • Data memory (RAM): Addresses 00H to 7FH.
  • Special Function Registers (SFRs): Addresses 80H to FFH.

10. Instruction Set Examples:

The 8051 microcontroller has a rich set of instructions, covering a wide range of operations including data transfer, arithmetic and logic operations, control flow, and more. Here is a list of some common instructions for the 8051 microcontroller:

Data Transfer Instructions:

  • MOV A, source: Move data from source to accumulator.
  • MOV destination, source: Move data from source to destination.
  • MOVC A, @A+DPTR: Move code byte from address A+DPTR to accumulator.

Arithmetic Instructions:

  • ADD A, source: Add source to accumulator.
  • ADD A, #data: Add immediate data to accumulator.
  • ADDC A, source: Add source and carry flag to accumulator.
  • SUBB A, source: Subtract source and borrow from accumulator.
  • INC destination: Increment the value at the destination.

Logical Instructions:

  • ANL A, source: Bitwise AND source with accumulator.
  • ORL A, source: Bitwise OR source with accumulator.
  • XRL A, source: Bitwise XOR source with accumulator.
  • CJNE A, data, label: Compare A with immediate data, jump if not equal.

Control Flow Instructions:

  • JMP address: Jump unconditionally to the specified address.
  • JC/JB/JNB/JNC/JZ/JNZ, label: Jump based on carry, bit, zero, or non-zero condition.
  • CALL address: Call subroutine at the specified address.
  • RET/RETI: Return from subroutine or interrupt.

Register Move Instructions:

  • MOVX A, @DPTR: Move data from external RAM to accumulator.
  • MOVX @DPTR, A: Move data from accumulator to external RAM.

Bit Manipulation Instructions:

  • SETB bit: Set a specified bit.
  • CLR bit: Clear a specified bit.
  • CPL bit: Complement (invert) a specified bit.

Rotate and Swap Instructions:

  • RL A/RLC A: Rotate accumulator left with or without carry.
  • RR A/RRC A: Rotate accumulator right with or without carry.
  • SWAP A: Swap the nibbles in the accumulator.

Data Compare and Skip Instructions:

  • CJNE A, data, label: Compare A with immediate data, jump if not equal.
  • DJNZ destination, label: Decrement destination, jump if not zero.

Stack Operation Instructions:

  • PUSH source/POP destination: Push data onto or pop data from the stack.

Serial Communication Instructions:

  • MOV SBUF, A/MOV A, SBUF: Move data between accumulator and serial buffer.
  • MOV SCON, #data: Initialize serial communication control register.

External Memory Instructions:

  • MOVX A, @DPTR/MOVX @DPTR, A: Move data between accumulator and external RAM.

Miscellaneous Instructions:

  • NOP: No operation (used for timing purposes).
  • HALT: Halt the CPU until an interrupt occurs.

This is a subset of the 8051 instruction set. The actual instruction set may vary slightly depending on the specific variant of the 8051 microcontroller. 

  1. Special Function Registers (SFRs):
  • PCON: Power control register.
  • TCON: Timer control register.
  • SCON: Serial control register.
  • IP: Interrupt priority register.
  • IE: Interrupt enable register.
  1. Programming Tools:
  • Keil uVision, SDCC, and other compilers.
  • Flash programming tools for EPROM-based versions.

11. Special Function Registers (SFRs):

  • PCON: Power control register.
  • TCON: Timer control register.
  • SCON: Serial control register.
  • IP: Interrupt priority register.
  • IE: Interrupt enable register.

12. Programming Tools:

  • Keil uVision, SDCC, and other compilers.
  • Flash programming tools for EPROM-based versions.

Filed Under: Electronics Tagged With: 8051 microcontroller

Recent Posts

  • UM3561 IC : PinOut, Features, Specifications, Circuit, Working & Its Applications
  • MCP1640 IC : PinOut, Features, Specifications, Circuit, Working, Datasheet & Its Applications
  • LED Traffic Light Module : PinOut, Features, Specifications, Interfacing & Its Applications
  • KY-024 Hall Sensor : PinOut, Features, Specifications, Interfacing, Working & Its Applications
  • LM337 IC : PinOut, Features, Specifications, Circuit, Working, Datasheet & Its Applications
  • KY-017 Module : PinOut, Equivalent, Specifications, Interfacing, Working, Datasheet & Its Applications
  • PAM8302 IC : PinOut, Features, Specifications, Circuit, Working & Its Applications
  • KY-006 Module : PinOut, Features, Specifications, Interfacing, Working, Datasheet & Its Applications
  • MPU6050 Module : PinOut, Features, Specifications, Interfacing, Working & Its Applications
  • LMH1981 IC : PinOut, Features, Specifications, Circuit, Working, Datasheet & Its Applications
  • KY-010 Module : PinOut, Features, Specifications, Interfacing, Working, Datasheet & Its Applications
  • CD4060 IC : PinOut, Features, Specifications, Circuit, Working & Its Applications

Categories

  • Articles (20)
  • Basics (109)
  • Communications (54)
  • Components (229)
  • Digital Electronics (43)
  • Digital Signalling (3)
  • Electronics (225)
  • Embedded Systems (12)
  • Magnetism (5)
  • Microprocessors (3)
  • Modulation (1)
  • Projects (15)

Subscribe to Our Newsletter

Don’t miss these articles!

We don’t spam! Read our privacy policy for more info.

Check your inbox or spam folder to confirm your subscription.

Category

  • Electronics
  • Components
  • Digital Electronics
  • Embedded Systems
  • Projects

Copyright © 2025 · WatElectronics.com | Contact Us | Privacy Policy