Detailed Explanation about 8051 Programming in Assembly Language (2022)

The assembly language is a low-level programming language used to write program code in terms of mnemonics. Even though there are many high-levellanguages that are currently in demand, assembly programming language is popularly used in many applications.It can be used for direct hardware manipulations. It is also used to write the 8051 programming code efficiently with less number of clock cycles by consuming less memory compared to the other high-level languages.


Detailed Explanation about 8051 Programming in Assembly Language (1)

8051 Programming in Assembly Language

The assembly language is a fully hardware related programming language. The embedded designers must have sufficient knowledge on hardware of particular processor or controllers before writing the program. The assembly language is developed by mnemonics; therefore, users cannot understand it easily to modify the program.

Detailed Explanation about 8051 Programming in Assembly Language (2)

Assembly programming language is developed by various compilers and the “keiluvison” is best suitable for microcontroller programming development. Microcontrollers or processors can understand only binary language in the form of ‘0s or 1s’; An assembler converts the assembly language to binary language, and then stores it in the microcontroller memory to perform the specific task.

8051 Microcontroller Architecuture

The 8051 microcontroller is the CISC based Harvard architecture, and it has peripherals like 32 I/O, timers/counters, serial communication and memories. The microcontrollerrequires a program to perform the operations that require a memory for saving and to read the functions. The 8051 microcontroller consistsofRAM and ROM memories to store instructions.

Detailed Explanation about 8051 Programming in Assembly Language (3)

A Register is the main part in the processors and microcontrollers which is contained in the memory that provides a faster way of collecting and storing the data. The 8051 assembly language programming is based on the memory registers. If we want to manipulate data to a processor or controller by performing subtraction, addition, etc., we cannot do that directly in the memory, but it needs registers to process and to store the data. Microcontrollers contain several types of registers that can be classified according to their instructions or content that operate in them.

8051 Microcontroller Programs in Assembly Language

The assembly language is made up of elements which all are used to write the program in sequential manner. Follow the given rules to write programming in assembly language.

Rules of Assembly Language

  • The assembly code must be written in upper case letters
  • The labels must be followed by a colon (label:)
  • All symbols and labels must begin with a letter
  • All comments are typed in lower case
  • The last line of the program must be the END directive

The assembly language mnemonics are in the form of op-code, such as MOV, ADD, JMP, and so on, which are used to perform the operations.

Detailed Explanation about 8051 Programming in Assembly Language (4)

Op-code: The op-code is a single instruction that can be executed by the CPU. Here the op-code is a MOV instruction.

Operands: The operands are a single piece of data that can be operated by the op-code. Example, multiplication operation is performed by the operands that are multiplied by the operand.

Syntax: MUL a,b;

The Elements of an Assembly Language Programming:

  • Assembler Directives
  • Instruction Set
  • Addressing Modes

Assembler Directives:

The assembling directives give the directions to the CPU. The 8051 microcontroller consists of various kinds of assembly directives to give the direction to the control unit. The most useful directives are 8051 programming, such as:

  • ORG
  • DB
  • EQU
  • END

ORG(origin): This directive indicates the start of the program. This is used to set the register address during assembly. For example; ORG 0000h tells the compiler all subsequent code starting at address 0000h.

Syntax: ORG 0000h

Detailed Explanation about 8051 Programming in Assembly Language (5)

DB(define byte): The define byte is used to allow a string of bytes. For example, print the “EDGEFX” wherein each character is taken by the address and finally prints the “string” by the DB directly with double quotes.

Syntax:

ORG 0000h

MOV a, #00h
————-
————-
DB”EDGEFX”

Detailed Explanation about 8051 Programming in Assembly Language (6)

EQU (equivalent): The equivalent directive is used to equate address of the variable.

Syntax:

reg equ,09h
—————–
—————–
MOV reg,#2h

END:The END directive is used to indicate the end of the program.

Syntax:

reg equ,09h

(Video) Introduction to assembly language programming of 8051

—————–
—————–
MOV reg,#2h
END

Addressing Modes:

The way of accessing data is called addressing mode. The CPU can access the data in different ways by using addressing modes. The 8051 microcontroller consists of five addressing modes such as:

  • Immediate Addressing Mode
  • Register Addressing Mode
  • Direct Addressing Mode
  • Indirect Addressing Mode
  • Base Index Addressing Mode

Immediate Addressing Mode:

In this addressing mode, the source must be a value that can be followed by the ‘#’ and destination must be SFR registers, general purpose registers and address. It is used for immediately storing the value in the memory registers.

Syntax:

MOV A, #20h //A is an accumulator register, 20 is stored in the A//
MOV R0,#15 // R0 is a general purpose register; 15 is stored in the R0 register//
MOV P0, #07h //P0 is a SFR register;07 is stored in the P0//
MOV 20h,#05h //20h is the address of the register; 05 stored in the 20h//

Ex:

MOV R0, #1
MOV R0, #20 //R0 <—R0[15]+20, the final value is stored in R0//

Detailed Explanation about 8051 Programming in Assembly Language (7)

Register Addressing Mode:

In this addressing mode, the source and destination must be a register, but not general purpose registers. So the data is not moved within the general purpose bank registers.

Syntax:

MOV A, B; // A is a SFR register, B is a general purpose register//
MOV R0, R1 //Invalid instruction, GPR to GPR not possible//

EX:

MOV R0, #02h
MOV A, #30h
ADD R0, A //R0<—R0+A, the final value is stored in the R0 register//

Detailed Explanation about 8051 Programming in Assembly Language (8)

Direct Addressing Mode

In this addressing mode, the source or destination (or both source and destination) must be an address, but not value.

Syntax:

MOV A,20h // 20h is an address; A is a register//
MOV 00h, 07h // both are addressed of the GPS registers//

Ex:

MOV 07h,#01h
MOV A, #08h
ADD A,07h //A<—A+07h the final value is stored in A//

Detailed Explanation about 8051 Programming in Assembly Language (9)

Indirect Addressing Mode:

In this addressing mode, the source or destination (or destination or source) must be a indirect address, but not a value. This addressing mode supports the pointer concept. The pointer is a variable that is used to store the address of the other variable. This pointer concept is only used for R0 and R1 registers.

Syntax:

MOVR0, #01h //01 value is stored in the R0 register, R0 address is 08h//
MOV R1, #08h//R1 is the pointer variable that stores address (08h) of R0 //
MOV 20h,@R1 //01 value is stored in the 20h address of the GP register//

(Video) 8051 Microcontroller Assembly Language Programming Steps - Microcontrollers and Its Applications

Detailed Explanation about 8051 Programming in Assembly Language (10)

Base Index Addressing Mode:

This addressing mode is used to read the data from the external memory or ROM memory. All addressing modes cannot read the data from the code memory. The code must read through the DPTR register. The DPTR is used to point the data in the code or external memory.

Syntax:

MOVC A, @A+DPTR //C indicates code memory//
MOCX A, @A+DPTR // X indicate external memory//
EX: MOV A, #00H //00H is stored in the A register//
MOV DPTR, #0500H //DPTR points 0500h address in the memory//
MOVC A, @A+DPTR //send the value to the A register//
MOV P0, A //date of A send to the PO registrar//

Instruction Set:

The instruction set is the structure of the controller or processor that provides commands to the controller to guide the controller for processing data. The instruction set consists of instructions, native data types, addressing modes, interrupt registers, exceptional handling and memory architecture. The 8051 microcontroller can follow CISC instructions with Harvard architecture. In case of the 8051 programming different types of CISC instructions include:

  • Data Transfer Instruction set
  • Sequential Instruction Set
  • Arithmetic Instruction set
  • Branching Instruction set
  • Loop Instrcution Set
  • Conditional Instruction set
  • Unconditional Instruction set
  • Logical Instruction set
  • Boolean Instruction set

Arithmetic Instruction Set:

The arithmetic instructions perform the basic operations such as:

  • Addition
  • Multiplication
  • Subtraction
  • Division

Addition:

ORG 0000h
MOV R0, #03H // move the value 3 to the register R0//
MOV A, #05H // move the value 5 to accumulator A//
Add A, 00H // addA value with R0 value and stores the result inA//
END

Multiplication:

ORG 0000h
MOV R0, #03H // move the value 3 to the register R0//
MOV A, #05H // move the value 5 to accumulator A//
MUL A, 03H // Multiplied result is stored in the Accumulator A //
END

Subtraction:

ORG 0000h
MOV R0, #03H // move the value 3 to register R0//
MOV A, #05H // move the value 5 to accumulator A//
SUBB A, 03H // Result value is stored in the Accumulator A //
END

Division:

ORG 0000h
MOV R0, #03H // move the value 3 to register R0//
MOV A, #15H // move the value 5 to accumulator A//
DIV A, 03H // final value is stored in the Accumulator A //
END

Detailed Explanation about 8051 Programming in Assembly Language (11)

Conditional Instructions

The CPU executes the instructions based on the condition by checking the single bit status or byte status. The 8051 microcontroller consists of various conditional instructions such as:

  • JB —>Jump below
  • JNB —> Jump if not below
  • JC —> Jump if Carry
  • JNC —>Jump if not Carry
  • JZ —>Jump if Zero
  • JNZ —> Jump if not Zero
Detailed Explanation about 8051 Programming in Assembly Language (12)

1. Syntax:

JB P1.0, label
– – – – – – – –
– – – – – – – –
Label: – – – – – – – –
– – – – – – – –
END

2. Syntax:

JNB P1.0, label
– – – – – – – –
– – – – – – – –
Label: – – – – – – – –
– – – – – – – –
END

3. Syntax:

JC, label
– – – – – – – –
– – – – – – – –
Label: – – – – – – – –
– – – – – – – –
END

4. Syntax:

JNC, label
– – – – – – – –
– – – – – – – –
Label: – – – – – – – –
– – – – – – – –
END
5. Syntax:

JZ, label
– – – – – – – –
– – – – – – – –
Label: – – – – – – – –
– – – – – – – –
END

6. Syntax:

JNZ, label
– – – – – – – –
– – – – – – – –
Label: – – – – – – – –
– – – – – – – –
END

Call and Jump Instructions:

The call and jump instructions are used to avoid the code replication of the program. When some specific code used more than once in different places in the program, if we mention specific name to code then we could use that name anywhere in the program without entering a code for every time. This reduces the complexity of the program. The 8051 programming consists of call and jump instructions such as LCALL, SJMP.

(Video) Simple programs of 8051 | Part-1/2 | Embedded Systems | Lec-6 | Bhanu priya

  • LCALL
  • ACALL
  • SJMP
  • LJMP

1. Syntax:

ORG 0000h
– – – – – – – –
– – – – – – – –
ACALL, label
– – – – – – – –
– – – – – – – –
SJMP STOP
Label: – – – – – – – –
– – – – – – – –
– – – – – – – –
ret
STOP:NOP

2. Syntax:

ORG 0000h
– – – – – – – –
– – – – – – – –
LCALL, label
– – – – – – – –
– – – – – – – –
SJMP STOP
Label: – – – – – – – –
– – – – – – – –
– – – – – – – –
ret
STOP:NOP

Detailed Explanation about 8051 Programming in Assembly Language (13)

Loop Instructions:

The loop instructions are used to repeat the block each time while performing the increment and decrement operations. The 8051 microcontroller consist two types of loop instructions:

  • CJNE —> compare and jump if not equal
  • DJNZ —> decrement and jump if not zero

1. Syntax:

of CJNE
MOV A, #00H
MOV B, #10H
Label:INC A
– – – – – –
– – – – – –
CJNE A, label

2. Syntax:

of DJNE

MOV R0, #10H
Label:– – – – – –
– – – – – –
DJNE R0, label
– – – – – –
– – – – – –
END

Logical Instruction Set:

The 8051 microcontroller instruction set provides the AND, OR, XOR, TEST, NOT and Boolean logic instructions for set and clears the bits based on the need in the program.

Detailed Explanation about 8051 Programming in Assembly Language (14)

1. Syntax:

MOV A, #20H /00100000/
MOV R0, #03H /00000101/
ORL A, R0 //00100000/00000101=00000000//

2. Syntax:

MOV A, #20H /00100000/
MOV R0, #03H /00000101/
ANL A, R0

3. Syntax:

MOV A, #20H /00100000/
MOV R0, #03H /00000101/
XRL A, R0

Shifting Operators

The shift operators are used for sending and receiving the data efficiently. The 8051 microcontroller consist four shift operators:

  • RR —> Rotate Right
  • RRC —>Rotate Right through carry
  • RL —> Rotate Left
  • RLC —>Rotate Left through carry

Rotate Right (RR):

In this shifting operation, the MSB becomes LSB and all bits shift towards right side bit-by-bit, serially.

Syntax:

MOV A, #25h
RR A

Detailed Explanation about 8051 Programming in Assembly Language (15)

Rotate Left (RL):

In this shifting operation, the MSB becomes LSB and all bits shift towards Left side bit-by-bit, serially.

Syntax:

MOV A, #25h
RL A

(Video) lec 25 - 8051 Assembly Language Programming

Detailed Explanation about 8051 Programming in Assembly Language (16)

RRC Rotate Right through Carry:

In this shifting operation, the LSB moves to carry and the carry becomes MSB, and all the bits are shift towards right side bit by bit position.

Syntax:

MOV A, #27h
RRC A

RLC Rotate Left through Carry:

In this shifting operation, the MSB moves to carry and the carry becomes LSB and all the bits shift towards left side in a bit-by-bit position.

Syntax:

MOV A, #27h
RLC A

Basic Embedded C Programs:

The microcontroller programming differs for each type of operating system. There are many operating systems such as Linux, Windows, RTOS and so on. However, RTOS has several advantages for embedded system development. Some of the Assembly level programming examples are given below.

LED blinking using with 8051 microcontroller:

  • Number Displaying on 7-segment display using 8051 microcontroller
  • Timer/Counter calculations and program using 8051 microcontroller
  • Serial Communication calculations and program using 8051 microcontroller

LED programs with 8051 Microcontrller

1. WAP to toggle the PORT1 LEDs

ORG 0000H
TOGLE: MOV P1, #01 //move 00000001 to the p1 register//
CALL DELAY //execute the delay//
MOV A, P1 //move p1 value to the accumulator//
CPL A //complement A value //
MOV P1, A //move 11111110 to the port1 register//
CALL DELAY //execute the delay//
SJMP TOGLE
DELAY: MOV R5, #10H //load register R5 with 10//
TWO: MOV R6, #200 //load register R6 with 200//
ONE: MOV R7, #200 //load register R7 with 200//
DJNZ R7, $ //decrement R7 till it is zero//
DJNZ R6, ONE //decrement R7 till it is zero//
DJNZ R5, TWO //decrement R7 till it is zero//
RET //go back to the main program //
END

Timer/Counter Calculations and Program using 8051 Microcontroller:

The delay is the one of the important factors in the application software development. The timers and counters are hardware components of the microcontroller, that are used in many applications to provide the accurate time delay with count pulses. Both the tasks are implemented by the software technique.

1. WAP to calculate the 500us time delay.

MOV TMOD, #10H //select the timer mode by the registers//
MOV TH1, #0FEH // store the delay time in higher bit//
MOV TL1, #32H // store the delay time in low bit//
JNB TF1, $ //decrement the value of the timer till it is zero//
CLR TF1 //clear the timer flag bit//
CLR TR1 //OFF the timer//

2. WAP to toggle the LEDs withthe 5 sec time delay

ORG 0000H
RETURN: MOV PO, #00H
ACALL DELAY
MOV P0, #0FFH
ACALL DELAY
SJUMP RETURN
DELAY: MOV R5, #50H //load register R5 with 50//
DELAY1: MOV R6, #200 //load register R6 with 200//
DELAY2: MOV R7, #229 //load register R7 with 200//
DJNZ R7, $ //decrement R7 till it is zero//
DJNZ R6, DELAY2//decrement R6 till it is zero//
DJNZ R5, DELAY1//decrement R5 till it is zero//
RET //go back to the main program //
END

3. WAP to count the 250 pulses using mode0 count0

Syntax:

ORG 0000H
MOV TMOD, #50H //select the counter//
MOV TH0, #15 //move the counting pulses higher bit//
MOV TH1, #9FH //move the counting pulses, lower bit//
SET TR0 //ON the timer//
JNB $ //decrement the count value till zero//
CLR TF0 //clear the counter, flag bit//
CLR TR0 //stop the timer//
END

Serial Communication Programming Using 8051 Microcontroller:

Serial communication is commonly used for transmitting and receiving the data. The 8051 microcontroller consist of UART/USART serial communication and the signals are transmitted and received by Tx and Rx pins. The UART communication transfers the data bit-by-bit serially. The UART is a half-duplex protocol that transfers and receives the data, but not at the same time.

1. WAP to transmit the characters to the Hyper Terminal

MOV SCON, #50H //set the serial communication//
MOV TMOD, #20H //select the timer mode//
MOV TH1, #-3 //set the baud rate//
SET TR1 //ON the timer//
MOV SBUF, #’S’ //transmit S to the serial window //
JNB TI, $ //decrement value of the timer till it is zero//
CLR RI // clear receive interrupt //
CLR TR1 //clear timer//

2. WAP to transmit the Receive the character by the Hyper Terminal

MOV SCON, #50H //set the serial communication//
MOV TMOD, #20H //select the timer mode//
MOV TH1, #-6 //set the baud rate//
SET TR1 //on the timer//
MOV SBUF, #’S’ //transmit S to the serial window //
JNB RI, $ //decrement value of timer till it is zero//
CLR RI // clear receive interrupt //
MOV P0, SBUF //send the SBUF register value to the port0//
CLR TR1 //clear timer//

This is all about the 8051 Programming in Assembly language in brief with example-based programs. We hope this adequate information on assembly language will be certainly helpful for the readers and we look forward for their valuable comments in the comment section below.

Comments are closed.

(Video) Lecture 11: 8051 Assembly Language Programming: Memory Block Transfer

FAQs

What is assembly language programming in 8051? ›

Assembly Language is a pseudo-English representation of the Machine Language. The 8051 Microcontroller Assembly Language is a combination of English like words called Mnemonics and Hexadecimal codes. It is also a low level language and requires extensive understanding of the architecture of the Microcontroller.

How do you program a microcontroller in assembly language? ›

And your circuits should be all set up and your picot or ICD. Or whatever you're using should all be

What is assembling and running an 8051 program? ›

Assembling and Running an 8051 Program

Editors like MS-DOS EDIT program that comes with all Microsoft operating systems can be used to create or edit a program. The Editor must be able to produce an ASCII file. The "asm" extension for the source file is used by an assembler in the next step.

How many instructions are there in 8051? ›

The microcontroller 8051 instructions set includes 110 instructions, 49 of which are single byte instructions, 45 are two bytes instructions and 17 are three bytes instructions. The instructions format consists of a function mnemonic followed by destination and source field. Data transfer group. Arithmetic group.

Where is assembly language used? ›

Assembly language is used to directly manipulate hardware, access specialized processor instructions, or evaluate critical performance issues. These languages are also used to leverage their speed advantage over high level languages for time-sensitive activities such as high frequency trading.

What do you mean by assembler directives in 8051? ›

Assembler directives tell the assembler to do something other than creating the machine code for an. instruction. In assembly language programming, the assembler directives instruct the assembler to. 1. Process subsequent assembly language instructions.

What is the structure of assembler explain in detail? ›

Assembler is a program for converting instructions written in low-level assembly code into relocatable machine code and generating along information for the loader. It generates instructions by evaluating the mnemonics (symbols) in operation field and find the value of symbol and literals to produce machine code.

What are the data types used in 8051 microcontroller? ›

Microcontroller 8051 has only one 8-bits data type and the size of each register is also 8 bits. The job of the programmer is to break down data larger than 8 bits [00 to FFH, or 0 to 255 in decimal] to be processed by the CPU. The data type used by the 8051 can be positive or negative.

What are examples of assembly language? ›

Example of assembly language

In this example of an assembly language, "1:" is the label which lets the computer know where to begin the operation. The "MOV" is the mnemonic command to move the number "3" into a part of the computer processor, which can function as a variable. "EAX," "EBX" and "ECX" are the variables.

Which is an advantage of assembly language? ›

Assembly language program runs faster. Writing of assembly language programming is easy. Assembly language program is portable. Assembly language program contains less instruction.

What are the different assembly languages? ›

Assembly language has four types:
  • RISC (Reduced Instruction-Set Computer)
  • DSP (Digital Signal Processor)
  • CISC: Complex Instruction Set Computer.
  • VLIW: Very Long Instruction Word.

What is the application of 8051? ›

Applications of 8051 Microcontroller

Home Applications (TVs, VCR, Video Games, Camcorder, Music Instruments, Home Security Systems, Garage Door Openers, etc.) Communication Systems (Mobile Phones, Intercoms, Answering Machines, Paging Devices, etc.) Office (Fax Machines, Printers, Copiers, Laser Printers, etc.)

What are the advantages of 8051 microcontroller? ›

i )Low time required for performing operation. ii)The processor chips are very small and flexibility occurs. iii)Due to their higher integration, cost and size of the system is reduced. iv)The microcontroller is easily to interface additional RAM, ROM and I/O ports.

What is the frequency of 8051 microcontroller? ›

This microcontroller works on a +5V dc power source. As it has on-chip clock circuit, so we need only the crystal oscillator between the pin XTAL1 and XTAL2 with two additional capacitors. As we have mentioned that the general clock frequency is 12MHz, but some other version of 8051 uses 20MHz crystal oscillator.

What are 5 types of instruction operations? ›

Examples of operations common to many instruction sets include:
  • Data handling and memory operations.
  • Arithmetic and logic operations.
  • Control flow operations.
  • Coprocessor instructions.
  • Number of operands.

How many interrupts are there in 8051? ›

8051 has 5 interrupt signals, i.e. INT0, TFO, INT1, TF1, RI/TI. Each interrupt can be enabled or disabled by setting bits of the IE register and the whole interrupt system can be disabled by clearing the EA bit of the same register.

What is types of instruction? ›

A computer must have the following types of instructions: Data transfer instructions. Data manipulation instructions. Program sequencing and control instructions. Input and output instructions.

How many types of assembly are there? ›

There are three types of assemblies: Private assemblies. Shared assemblies. Satellite assemblies.

Why is it called assembly language? ›

The Name Derives from the Program/Process Created to Read it

"In the very early days of computing, programmers wrote code in binary machine instructions and entered it into the computer through a bank of toggle switches. This was tedious, to say the least.

What are the uses of assembly? ›

Today, assembly language is still used for direct hardware manipulation, access to specialized processor instructions, or to address critical performance issues. Typical uses are device drivers, low-level embedded systems, and real-time systems (see § Current usage).

What is an assembly language directive? ›

Directives are instructions to the assembler, specifying an action to be taken during the assembly process. One important use of directives is declaring or reserving memory variables. In addition, directives are used to break up the program into sections.

What do you mean by assembler directives explain in detail? ›

Assembler directives supply data to the program and control the assembly process. Assembler directives enable you to do the following: Assemble code and data into specified sections. Reserve space in memory for uninitialized variables. Control the appearance of listings.

What do you mean by assembler directives in microcontroller? ›

Assembler directives are directions to the assembler to take some action or change a setting. Assembler directives do not represent instructions, and are not translated into machine code.

Which data structure is used in assembler? ›

The Label Table Data Structure. The assembler reads the P-code source statements from the prd file and assembles these statements generating machine code which is left in the code array. The label table is generated by the assembler in order to look after label definitions and forward references.

What is statement in assembly language? ›

An x86 assembly language program consists of one or more files containing statements. A statement consists of tokens separated by whitespace and terminated by either a newline character (ASCII 0x0A) or a semicolon (;) (ASCII 0x3B).

What is the difference between compiler and assembler? ›

The difference between compiler and assembler is that a compiler is used to convert high-level programming language code into machine language code. On the other hand, an assembler converts assembly level language code into machine language code. Both these terms are relevant in context to program execution.

What is SBIT data type? ›

The sbit type provides access to bit-addressable SFRs and other bit-addressable objects. For example: sbit EA = 0xAF; This declaration defines EA as the SFR bit at address 0xAF. On the 8051, this is the enable all bit in the interrupt enable register.

What are data types in microcontroller? ›

Data Types in 8051 Embedded C
Data typeBitsValue range
signed char8-128 to +127
unsigned char80 to 255
enum8 or 16-128 to +127 or -32768 to +32767
signed short16-32768 to +32767
10 more rows
15 Dec 2016

What is character size integer? ›

Windows 64-bit applications
NameLength
char1 byte
short2 bytes
int4 bytes
long4 bytes
13 more rows

What are assembler directives in 8051? ›

Assembler directives tell the assembler to do something other than creating the machine code for an. instruction. In assembly language programming, the assembler directives instruct the assembler to. 1. Process subsequent assembly language instructions.

Which language is used in microprocessor? ›

Microprocessors are typically programmed using semi-English-language statements (assembly language). In addition to assembly languages, microcomputers use a more understandable human-oriented language called high-level language.

What is PSW in 8051 microcontroller? ›

The Program Status Word (PSW) contains status bits that reflect the current CPU state. The 8051 variants provide one special function register called PSW with this status information. The 251 provides two additional status flags, Z and N, that are available in a second special function register called PSW1.

What is DJNZ in 8051? ›

The DJNZ instruction decrements the byte indicated by the first operand and, if the resulting value is not zero, branches to the address specified in the second operand.

What are 8051 data types? ›

Microcontroller 8051 has only one 8-bits data type and the size of each register is also 8 bits. The job of the programmer is to break down data larger than 8 bits [00 to FFH, or 0 to 255 in decimal] to be processed by the CPU. The data type used by the 8051 can be positive or negative.

What is assembler in microcontroller? ›

An assembler is a program that translates symbolic code (assembly language) into executable object code. This object code can be executed with a 80C51-compatible microcontroller.

What is the function of assembler directives? ›

Assembler directives supply data to the program and control the assembly process. Assembler directives enable you to do the following: Assemble code and data into specified sections. Reserve space in memory for uninitialized variables.

What is assembly language example? ›

Example of assembly language

In this example of an assembly language, "1:" is the label which lets the computer know where to begin the operation. The "MOV" is the mnemonic command to move the number "3" into a part of the computer processor, which can function as a variable. "EAX," "EBX" and "ECX" are the variables.

How microcontroller is programmed? ›

Programming environments

Microcontrollers were originally programmed only in assembly language, but various high-level programming languages, such as C, Python and JavaScript, are now also in common use to target microcontrollers and embedded systems.

How do you write assembly language program? ›

Thus writing a program in assembly language has advantages over writing the same in a machine language. Assembly language programs are platform dependent. Mnemonics in one architecture, may not work in another architecture. This is because each architecture has got a dedicated set of mnemonics.

What is TMOD and TCON? ›

Counters and Timers in 8051 microcontroller contain two special function registers: TMOD (Timer Mode Register) and TCON (Timer Control Register), which are used for activating and configuring timers and counters.

What are the applications of 8051 microcontroller? ›

Applications of 8051 Microcontroller

Home Applications (TVs, VCR, Video Games, Camcorder, Music Instruments, Home Security Systems, Garage Door Openers, etc.) Communication Systems (Mobile Phones, Intercoms, Answering Machines, Paging Devices, etc.) Office (Fax Machines, Printers, Copiers, Laser Printers, etc.)

What is the size of ROM in 8051? ›

Program Memory: in the classic 8051, this is a 64KB space called CODE. Typically, this region is a ROM space that used for the program code and constants. With the BL51, the physical program code memory can be expanded to 32 code banks with 64KB each.

How many 8bit ports are there in 8051 microcontroller? ›

Microprocessor 8085

8051 microcontrollers have 4 I/O ports each of 8-bit, which can be configured as input or output. Hence, total 32 input/output pins allow the microcontroller to be connected with the peripheral devices.

What is CLR C in 8051? ›

The CLR instruction sets the specified destination operand to a value of 0.

Videos

1. 8051 | Programming Part 1 | Bharat Acharya Education
(Bharat Acharya Education)
2. 8051 - Assembly Language Programmes - Addition / Subtraction/ Multiplication / Division
(Padmasri Naban)
3. #11 First 8051 Assembly Language Program
(Vooi Yap - Embedded Systems Education)
4. Lecture 22: 8051 Assembly Language Program for Serial Communication
(Study Microcontrollers)
5. 8051 Programming- Steps of Assembly Language Program
(Career Sochh)
6. Assembly Language programming 8051 Micro controller - Two numbers addition
(a learning room)

Top Articles

Latest Posts

Article information

Author: Barbera Armstrong

Last Updated: 11/13/2022

Views: 5343

Rating: 4.9 / 5 (59 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Barbera Armstrong

Birthday: 1992-09-12

Address: Suite 993 99852 Daugherty Causeway, Ritchiehaven, VT 49630

Phone: +5026838435397

Job: National Engineer

Hobby: Listening to music, Board games, Photography, Ice skating, LARPing, Kite flying, Rugby

Introduction: My name is Barbera Armstrong, I am a lovely, delightful, cooperative, funny, enchanting, vivacious, tender person who loves writing and wants to share my knowledge and understanding with you.