Skip to main content

8051 and 8086 Cheat Sheet


8051 and 8086 Cheat Sheet: 

8051 Microcontroller

Function

The 8051 is used for controlling embedded systems. It integrates CPU, memory, I/O ports, timers, and serial communication on a single chip. Commonly used in automation, robotics, and real-time control systems.

FeatureDetails
Type8-bit Microcontroller
ArchitectureHarvard Architecture
Memory4KB ROM, 128B RAM
I/O Ports4 Ports (P0–P3)
Timers2 Timers
Interrupts5 Interrupts

Important Instructions & Functions

InstructionFunction
MOV A, BCopies data from B to A
ADD A, R1Adds register R1 to accumulator
SUBB A, R2Subtract with borrow
INC AIncrement accumulator by 1
DEC R0Decrement register
ANL A, #dataBitwise AND
ORL A, #dataBitwise OR
XRL A, #dataBitwise XOR
SJMP labelShort jump (within range)
LJMP addrLong jump anywhere in memory
DJNZ R1, labelDecrement and jump if not zero
CJNE A, #data, labelCompare and jump if not equal

8051 Microcontroller Logical Instructions

1. CPL — Complement

CPL means invert all bits (NOT operation).

Syntax

CPL A

This flips every bit in accumulator A.

Example

Before:
A = 01010101

After:
A = 10101010

Bit Version

CPL P1.0

Changes:

  • 0 → 1
  • 1 → 0

for pin/bit P1.0.

2. ANL — AND Logical

Performs bitwise AND operation.

Syntax

ANL A,#0FH

Example

A      = 10101100
0FH    = 00001111
----------------
Result = 00001100

Stored back into A.

Common Use

Masking bits.

ANL A,#0F0H

Keeps upper 4 bits, clears lower 4 bits.

3. ORL — OR Logical

Performs bitwise OR operation.

Syntax

ORL A,#0FH

Example

A      = 10100000
0FH    = 00001111
----------------
Result = 10101111

Common Use

Setting bits to 1.

4. XRL — Exclusive OR Logical (XOR)

Performs XOR operation.

Syntax

XRL A,#0FFH

Example

A      = 10101010
0FFH   = 11111111
----------------
Result = 01010101

Common Use

  • Toggle bits
  • Encryption
  • Bit comparison

Address Changes / Memory Effect

These instructions modify the destination operand.

Example 1 — Register Change

MOV A,#55H
CPL A
Before:
A = 55H

After:
A = AAH

No memory address changes — only accumulator changes.

Example 2 — RAM Address Change

ANL 30H,#0FH

This modifies RAM location 30H.

Before:
RAM[30H] = 3CH

Binary:
00111100
AND
00001111
---------
00001100

After:
RAM[30H] = 0CH

So the contents at address 30H change.

Summary Table

Instruction Meaning Operation
CPL Complement NOT
ANL AND Logical AND
ORL OR Logical OR
XRL Exclusive OR Logical XOR

Boolean Symbols

Instruction Symbol
CPL ¬A
ANL A · B
ORL A + B
XRL A ⊕ B

Example Program

MOV A,#55H
ORL A,#0FH
XRL A,#0FFH
CPL A

Step-by-Step

55H = 01010101
ORL -> 01011111
XRL -> 10100000
CPL -> 01011111

Final Result

A = 5FH

8086 Microprocessor

Function

The 8086 is a general-purpose microprocessor used for executing programs. It separates execution into Bus Interface Unit (BIU) and Execution Unit (EU), enabling instruction pipelining and faster processing.

FeatureDetails
Type16-bit Microprocessor
Address Bus20-bit (1 MB memory)
Instruction Queue6-byte prefetch queue
SegmentsCS, DS, SS, ES

Important Instructions & Functions

InstructionFunction
MOV AX, BXTransfers data from BX to AX
ADD AX, BXAdds BX to AX
SUB AX, BXSubtracts BX from AX
MUL BXUnsigned multiplication
DIV BXDivision
INC AXIncrement AX
DEC BXDecrement BX
AND AX, BXBitwise AND
OR AX, BXBitwise OR
XOR AX, BXBitwise XOR
JMP labelUnconditional jump
JZ labelJump if zero flag = 1
JNZ labelJump if zero flag = 0
CALL addrCall procedure
RETReturn from procedure

8051 vs 8086 

Feature80518086
Main FunctionControl hardware (embedded)Execute programs
TypeMicrocontrollerMicroprocessor
Data Width8-bit16-bit
ArchitectureHarvardVon Neumann
UsageEmbedded systemsGeneral computing

People are good at skipping over material they already know!

View Related Topics to







Contact Us

Name

Email *

Message *

Popular Posts

Theoretical BER vs SNR for binary ASK, FSK, and PSK with MATLAB Code + Simulator

📘 Overview & Theory 🧮 MATLAB Codes 📚 Further Reading Bit Error Rate (BER) Equations In ASK, noise directly affects the signal amplitude, making it the most vulnerable since the data is carried in amplitude changes. In FSK, data is represented by frequency variations, and because noise typically impacts amplitude more than frequency, FSK is more robust than ASK. In PSK, data is encoded in the signal phase, and BPSK specifically uses 180-degree phase shifts, creating the greatest separation between signal points and therefore achieving the lowest bit error rate (BER) for the same power level. BER formulas for ASK, FSK, and PSK modulation schemes. ASK BER = 0.5 × erfc(0.5 × √SNR) FSK BER = 0.5 × erfc(√(SNR / 2)) PSK BER = 0.5 × erfc(√SNR) erfc / Q-func...

How to use MATLAB Simulink

Introduction to MATLAB Simulink MATLAB Simulink is a popular add-on of MATLAB. Here, you can use different blocks like modulator, demodulator, AWGN channel, etc. And you can do experiments on your own. Steps to Get Started 1. Go to the 'Simulink' tab at the top navbar of MATLAB. If not found, click on the add-on tab, search 'Simulink,' and then click on it to add. 2. Once you installed the simulation, click the 'new' tap at the top left corner. 3. Then, search the required blocks in the 'Simulink library.' Then, drag it to the editor space. 4. You can double-click on the blocks to see the input parameters. 5. Then, connect the blocks by dragging a line from one block's output terminal to another block's input. 6. If the connection is complete, click the 'run' tab in the middle of the top navbar. 7. After clicking on the run ...

OFDM Waveform with MATLAB Code (with Simulator)

  In OFDM (Orthogonal Frequency Division Multiplexing) , we transmit multiple orthogonal subcarriers simultaneously. Since the subcarriers are orthogonal , they do not interfere with each other, which is one of the main advantages of OFDM. Practically, OFDM converts a wideband signal into multiple narrowband orthogonal subcarriers. For typical wireless communication, if the signal bandwidth (or symbol duration) exceeds the coherence bandwidth of the channel, the signal experiences frequency-selective fading . Fading distorts the signal, making it difficult to recover the original information. By using OFDM, we transmit the same wideband signal across multiple orthogonal narrowband subcarriers, reducing the effect of fading. For example, if we want to transmit a signal of bandwidth 1024 kHz , we can divide it into N = 8 subcarriers . Each subcarrier is then spaced by: Δf = Total Bandwidth N = 1024 8 kHz...

MATLAB Code for Constellation Diagram of QAM configurations such as 4, 8, 16, 32, 64, 128, and 256-QAM

📘 Overview of QAM 🧮 4-QAM MATLAB 🧮 16-QAM MATLAB 🚀 Online Simulator 📂 Other Topics on Constellation Diagrams... ▼ 🧮 MATLAB Code for 4-QAM 🧮 MATLAB Code for 16-QAM 🧮 MATLAB Code for m-ary QAM 🧮 Simulator for m-ary PSK 🧮 Simulator for m-ary QAM 🧮 Overview of Energy per Bit (Eb / N0) 🧮 Simulator for ASK, FSK, and PSK Overview of QAM One of the best-performing modulation techniques is QAM [↗] . Here, we modulate the symbols by varying the carrier signal's amplitude and phase in response to the variation in the message signal (or voltage variation). So, we may say that QAM is a combination of phase and amplitude modulation. Additionally, it performs better than ASK or PSK [↗] . In fact, any constellation for any type of modulatio...

BER vs SNR for M-ary QAM, M-ary PSK, QPSK, BPSK, ...(MATLAB Code + Simulator)

Bit Error Rate (BER) & SNR Guide Analyze communication system performance with our interactive simulators and MATLAB tools. 📘 Theory 🧮 Simulators 💻 MATLAB Code 📚 Resources BER Definition SNR Formula BER Calculator MATLAB Comparison 📂 Explore M-ary QAM, PSK, and QPSK Topics ▼ 🧮 Constellation Simulator: M-ary QAM 🧮 Constellation Simulator: M-ary PSK 🧮 BER calculation for ASK, FSK, and PSK 🧮 Approaches to BER vs SNR What is Bit Error Rate (BER)? The BER indicates how many corrupted bits are received compared to the total number of bits sent. It is the primary figure of merit for a...

Constellation Diagrams of ASK, PSK, and FSK (with MATLAB Code + Simulator)

Constellation Diagrams: ASK, FSK, and PSK Comprehensive guide to signal space representation, including interactive simulators and MATLAB implementations. 📘 Overview 🧮 Simulator ⚖️ Theory 📚 Resources Definitions Constellation Tool Key Points MATLAB Code 📂 Other Topics: M-ary PSK & QAM Diagrams ▼ 🧮 Simulator for M-ary PSK Constellation 🧮 Simulator for M-ary QAM Constellation BASK (Binary ASK) Modulation Transmits one of two signals: 0 or -√Eb, where Eb​ is the energy per bit. These signals represent binary 0 and 1. BFSK (Binary FSK) Modulation Transmits on...

Online Simulator for ASK, FSK, and PSK

Try our new Digital Signal Processing Simulator!   •   Interactive ASK, FSK, and BPSK tools updated for 2025. Start Now Interactive Modulation Simulators Visualize binary modulation techniques (ASK, FSK, BPSK) in real-time with adjustable carrier and sampling parameters. 📡 ASK Simulator 📶 FSK Simulator 🎚️ BPSK Simulator 📚 More Topics ASK Modulator FSK Modulator BPSK Modulator More Topics Simulator for Binary ASK Modulation Digital Message Bits Carrier Freq (Hz) Sampl...

FastAPI Static Files – Overview

FastAPI Static Files Often, a web application needs to include resources that do not change, even when dynamic data is rendered. These resources are called static assets . Examples of static files include: Images ( .png , .jpg ) JavaScript files ( .js ) Stylesheets ( .css ) Installing Required Library To handle static files in FastAPI, you need the aiofiles library. pip install aiofiles Mounting Static Files FastAPI uses the StaticFiles class to serve static content. You mount a folder (usually named static ) so that all files inside it can be accessed via a URL. from fastapi import FastAPI from fastapi.staticfiles import StaticFiles app = FastAPI() app.mount("/static", StaticFiles(directory="static"), name="static") Example 1: Using an Image Place an image file (for example, fa-logo.png ) inside the static folder. main.py from fastapi import FastAPI, Request from fastapi.responses import HTMLRespon...