0% found this document useful (0 votes)
4 views9 pages

Assembly 8051 Programming

The document provides an introduction to assembly programming and compilers, explaining the roles of compilers and assemblers in translating high-level languages into machine code. It details instruction classification, addressing modes, and assembler directives, highlighting the efficiency and direct hardware control of assembly programming. Additionally, it contrasts assembly with C programming for the 8051 microcontroller, showcasing the ease of use in C with an example of LED blinking code.

Uploaded by

rohinic720
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views9 pages

Assembly 8051 Programming

The document provides an introduction to assembly programming and compilers, explaining the roles of compilers and assemblers in translating high-level languages into machine code. It details instruction classification, addressing modes, and assembler directives, highlighting the efficiency and direct hardware control of assembly programming. Additionally, it contrasts assembly with C programming for the 8051 microcontroller, showcasing the ease of use in C with an example of LED blinking code.

Uploaded by

rohinic720
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Introduction to Assembly

Programming and Compilers


• • Assembly is a low-level language closely tied
to machine code.
• • Compiler: Translates high-level languages (C,
C++) into machine code.
• • Assembler: Converts assembly language into
machine code.
Instruction Classification
• • Data Transfer – MOV, PUSH, POP
• • Arithmetic – ADD, SUB, MUL
• • Logical – AND, OR, XOR
• • Branch – JMP, CALL, RET
• • Control – NOP, HLT
Instruction Set
• • Collection of all instructions a CPU can
execute.
• • Example (8051): MOV A, #0x25 – Load 0x25
into Accumulator A.
Addressing Modes - Part 1
• • Immediate: Operand directly in instruction –
MOV A, #25H
• • Register: Operand in register – MOV A, R1
• • Direct: Memory address – MOV A, 30H
Addressing Modes - Part 2
• • Indirect: Address in register – MOV A, @R0
• • Relative: Offset from PC – SJMP +5
Assembler Directives
• • ORG: Set starting address – ORG 0000H
• • END: End of program – END
Assembly Programming Features
(with Example)
• • Efficient and fast
• • Direct hardware control
• • Precise register access

• Example:
• ORG 0000H
• MOV A, #0AH
• ADD A, #05H
• END
Introduction to 8051 Programming
in C
• • Easier to read/write than Assembly
• • Can use standard control structures
• • Access hardware using keywords like sbit
8051 C Code Example: LED Blinking
• #include <reg51.h>
• sbit LED = P1^0;

• void delay() {
• ...
• }

• void main() {
• while(1) {

You might also like