The document discusses the addressing modes, instruction set, and assembly language programming of the 8051 microcontroller. It describes the five addressing modes of 8051 - immediate, direct, register, register indirect, and indexed addressing modes. It also explains some common arithmetic, logical, and other instructions like ADD, AND, OR, XOR, INC, DEC etc. and provides examples of using these instructions to manipulate data in registers and memory locations.
The document discusses the addressing modes and instruction set of the 8051 microcontroller. It describes the 5 addressing modes of the 8051 as immediate, register, direct, register indirect, and indexed. It then explains some example instructions from the arithmetic, logical, data transfer, branching/looping instruction groups of the 8051 instruction set.
The document describes the instruction set of the 8051 microprocessor. It is divided into 5 groups: arithmetic, logic, data transfer, boolean, and branching instructions. The arithmetic instructions include ADD, ADDC, DA for decimal adjust, and INC/DEC. Logic instructions include ANL, ORL, and SWAP. Data transfer instructions move data between registers and memory. Boolean instructions manipulate individual bits. Branching instructions include conditional jumps, calls, and returns.
This presentation discusses the Serial Communication features in 8051, the support for UART. It also discusses serial vs parallel communication, simplex, duplex and full-duplex modes, MAX232, RS232 standards
This document provides an overview of the four ports (P0, P1, P2, P3) on the 8051 microcontroller. It describes each port's structure, address, and how they can be configured as input or output ports. P0 is an 8-bit multi-function port that can generate the lower address and data bus. P1 is a single-bit simple I/O port. P2 is an 8-bit multi-function port that can generate the upper address bus. P3 is an 8-bit multi-function port with some pins having alternate functions like interrupts or serial communication. The document explains how to configure each port as an input by writing 1's to the port latch,
The document discusses the Universal Synchronous Asynchronous Receiver Transmitter (USART) which is a serial communication device. It describes the USART's synchronous and asynchronous communication modes and includes a block diagram and explanation of its transmitter, receiver, and pin sections. The USART receives parallel data from a microprocessor and transmits it serially or vice versa while including start/stop bits and potentially parity bits. It was commonly used to connect two microprocessor systems or for modem interfacing.
The 8085 microprocessor uses several addressing modes to specify the operands in instructions. These include implied, immediate, direct, register, and register indirect addressing modes. Implied addressing mode does not specify operands as they are implicit in the instruction. Immediate addressing mode embeds the operand in the instruction itself. Direct addressing directly specifies the memory location of the operand. Register addressing uses register operands. Register indirect addressing specifies the operand address using a register pair like the HL register.
The document discusses the addressing modes and instruction set of the 8051 microcontroller. It describes the 5 addressing modes of the 8051 as immediate, register, direct, register indirect, and indexed. It then explains some example instructions from the arithmetic, logical, data transfer, branching/looping instruction groups of the 8051 instruction set.
The document describes the instruction set of the 8051 microprocessor. It is divided into 5 groups: arithmetic, logic, data transfer, boolean, and branching instructions. The arithmetic instructions include ADD, ADDC, DA for decimal adjust, and INC/DEC. Logic instructions include ANL, ORL, and SWAP. Data transfer instructions move data between registers and memory. Boolean instructions manipulate individual bits. Branching instructions include conditional jumps, calls, and returns.
This presentation discusses the Serial Communication features in 8051, the support for UART. It also discusses serial vs parallel communication, simplex, duplex and full-duplex modes, MAX232, RS232 standards
This document provides an overview of the four ports (P0, P1, P2, P3) on the 8051 microcontroller. It describes each port's structure, address, and how they can be configured as input or output ports. P0 is an 8-bit multi-function port that can generate the lower address and data bus. P1 is a single-bit simple I/O port. P2 is an 8-bit multi-function port that can generate the upper address bus. P3 is an 8-bit multi-function port with some pins having alternate functions like interrupts or serial communication. The document explains how to configure each port as an input by writing 1's to the port latch,
The document discusses the Universal Synchronous Asynchronous Receiver Transmitter (USART) which is a serial communication device. It describes the USART's synchronous and asynchronous communication modes and includes a block diagram and explanation of its transmitter, receiver, and pin sections. The USART receives parallel data from a microprocessor and transmits it serially or vice versa while including start/stop bits and potentially parity bits. It was commonly used to connect two microprocessor systems or for modem interfacing.
The 8085 microprocessor uses several addressing modes to specify the operands in instructions. These include implied, immediate, direct, register, and register indirect addressing modes. Implied addressing mode does not specify operands as they are implicit in the instruction. Immediate addressing mode embeds the operand in the instruction itself. Direct addressing directly specifies the memory location of the operand. Register addressing uses register operands. Register indirect addressing specifies the operand address using a register pair like the HL register.
This document provides an overview of the 8051 microcontroller architecture. It describes the basic components of the 8051 including 4K bytes of internal ROM, 128 bytes of internal RAM, four 8-bit I/O ports, two timers/counters, one serial interface, and other features. It also discusses the different addressing modes for 8051 assembly language programming including immediate, register, direct, register indirect, and external direct addressing.
The document describes the ADC0808 analog to digital converter chip. It has an 8-channel multiplexer that selects which analog input signal to convert to digital. The conversion process takes 64 clock cycles to complete. The chip outputs the digital conversion result on 8 pins and has control signal pins for start, clock, output enable and end of conversion notification. It converts analog voltages to 8-bit digital numbers for use by digital devices like microprocessors.
The 8051 microcontroller has an 8-bit CPU, 4K ROM, 128 bytes RAM, two 16-bit timers, 32 I/O lines, and serial port. It uses an accumulator, B register, program status word and stack pointer along with arithmetic logic unit and instruction decoder to perform operations. The memory includes internal ROM, RAM, and external memory accessed via a 16-bit data pointer and program counter.
The document is a presentation on silicon controlled rectifiers (SCRs) given by five students. It introduces SCRs, explaining that they are power electronic devices that can convert AC to DC and control power to a load. The presentation describes the basic structure and operation of SCRs, including how applying a voltage to the gate terminal allows current to flow. It also covers the characteristics curve and applications of SCRs in areas like rectification, power supplies, motor controls and battery charging. In conclusion, SCRs are widely used power components due to their ability to easily switch high currents and their low cost.
This presentation discusses the support for interrupts in 8051. The interrupt types, interrupts versus polling etc are discussed. The register formats of IE, IP register are discussed. The concept of priority among the interrupts is discussed.
The Intel 8086 is a 16-bit microprocessor that can access up to 1 MB of memory. It has two main components: the Bus Interface Unit (BIU) handles bus operations like instruction fetching and memory access, while the Execution Unit (EU) decodes and executes instructions. The BIU contains registers for the code, data, extra, and stack segments as well as an instruction queue. The EU has registers for accumulation, base, count, data, pointers, and flags, and contains an ALU and decoder. It executes instructions from the queued bytes using a pipeline architecture.
The document describes the 8 addressing modes of the 8086 microprocessor. These are: 1) Immediate, where the operand is specified in the instruction itself. 2) Register, where operands are registers. 3) Direct memory, using a segment and offset address. 4) Register indirect, using a base register address. 5) Register relative, using a base register and displacement. 6) Base indexed, using a base and index register. 7) Relative indexed, using a base, index, and displacement. 8) Implied, where operands are implied and not specified.
Analog to Digital Converter (ADC) is a device that converts an analog quantity (continuous voltage) to discrete digital values.
The PIC microcontroller can be used in various electronic devices like alarm systems, electronic gadgets and computer control systems.
The stack in the 8085 microprocessor is a group of memory locations used for temporary storage of data during program execution. Data is stored and retrieved on a last-in, first-out basis. The PUSH instruction stores data in the stack by decrementing the stack pointer and copying register contents to memory. The POP instruction retrieves data from the stack by copying memory contents back to registers and incrementing the stack pointer. Common register pairs that can be pushed and popped include BC, DE, HL, and A and flags.
this ppt only for beginner who want to understand concept of Timer counter operation of LPC2148 step by step.
hope it may help u.
always welcoming ur suggestion.
The document discusses interfacing an analog to digital converter (ADC) chip, specifically the 0804 and 0808 chips, with a microcontroller. It explains that the ADC converts an analog voltage to an 8-bit digital value representing voltages from 0 to 255. It provides the initialization and timing steps to start a conversion by writing to the chip and read the digital output by reading from the chip once conversion is complete.
The document discusses various addressing modes and instructions of the 8051 microcontroller. It describes the five addressing modes - immediate, register, direct, register indirect and indexed. It explains each addressing mode in detail. It also explains the various instruction groups - data transfer, arithmetic, logical, boolean and branching instructions. It provides examples of instructions like MOV, ADD, ANL, JMP etc. and how they are used to manipulate data in the 8051.
The document summarizes the key features and pin functions of the 8051 microcontroller. It has 40 pins total, with 32 pins used as I/O across four 8-bit ports (P0, P1, P2, P3). Many pins have multiple functions, such as serving as address lines when accessing external memory but as port pins otherwise. The remaining pins include power (VCC, GND) and oscillator (XTAL1, XTAL2) connections as well as pins for reset (RST), program store enable (PSEN), address latch enable (ALE), and external access (EA).
This document discusses TRIACs and DIACs. TRIACs are bidirectional semiconductor switches that can control AC in a load. They consist of two SCRs connected in inverse parallel with a common gate. DIACs are also bidirectional semiconductor devices that can be switched from off to on with either polarity of applied voltage. They have no control terminal. Both devices exhibit avalanche breakdown and negative resistance characteristics. TRIACs are used for phase control and lamp switching. DIACs are primarily used to trigger TRIACs in applications like light dimmers and heat controls.
The document describes the static characteristics and forward characteristics of an SCR, which has three operational regions - a forward blocking state with low current and high voltage, a transition state where voltage increases past a threshold to allow a sharp increase in current and drop in voltage, and an on state with low voltage and high current flow. It also notes that in reverse bias, the SCR acts like a diode until the breakdown voltage is reached, allowing a large damaging reverse current.
The 8051 microcontroller has 40 pins that provide input/output capabilities. It has four 8-bit I/O ports (P0, P1, P2, P3) that allow connection to external devices. Unlike microprocessors, the 8051 has onboard I/O ports so no additional chips are needed. The I/O ports use circuits that allow pins to be individually configured as inputs or outputs using latches controlled by the microcontroller.
Interrupt programming with 8051 microcontrollerAnkit Bhatnagar
this ppt is related to the intrupts related to the 8051 microcontroller ..
topics are introduction to intrupts
intrerrupts vs pollings
difference between intrupts snd pollings
The document provides an introduction to microcontrollers, specifically focusing on the Intel 8051 microcontroller. It defines microcontrollers and distinguishes them from microprocessors by noting that microcontrollers contain peripherals like RAM, ROM, I/O ports and timers on a single chip, while microprocessors require external circuitry. It then describes the architecture and features of the Intel 8051 microcontroller, including its 4KB program memory, 128 bytes of data memory, 32 general purpose registers, two timers, interrupts and I/O ports. Development tools for microcontrollers like editors, assemblers, compilers and debuggers/simulators are also discussed.
The document discusses the addressing modes used by the Intel 8085 microprocessor. It explains that an instruction specifies an operation along with the source and destination addresses. The Intel 8085 supports 5 addressing modes: direct, register, register indirect, immediate, and implicit. Each mode is defined by how the source or destination operand address is specified in the instruction.
The document discusses the addressing modes and instruction set of the 8085 microprocessor. It describes the different addressing modes used in 8085 like immediate, register, memory direct, indirect and implied addressing. It also explains the classification of the 8085 instruction set based on functionality into data transfer, arithmetic, logical, branching, stack/IO and machine control instructions. Furthermore, it provides details about the one-byte, two-byte and three-byte instructions and gives examples of instructions from different categories.
The document discusses Assembly Language programming for the 8051 microcontroller. It describes how Assembly Language uses mnemonics to represent machine code instructions. It also explains key aspects of 8051 programming including registers, flags, memory organization, and assembler directives. Assembly Language requires knowledge of the CPU's instruction set and internal details. Programs are assembled into machine code before being run on the 8051.
The document discusses an agenda for a session on the 8051 microcontroller. It includes introductions to the 8051 microcontroller, its characteristics, pin diagram, programming languages including assembly and C, software used, and interfacing examples like LEDs, 7-segment displays, and LCDs. It also describes a project to interface a digital clock with a visitor counter.
This document provides an overview of the 8051 microcontroller architecture. It describes the basic components of the 8051 including 4K bytes of internal ROM, 128 bytes of internal RAM, four 8-bit I/O ports, two timers/counters, one serial interface, and other features. It also discusses the different addressing modes for 8051 assembly language programming including immediate, register, direct, register indirect, and external direct addressing.
The document describes the ADC0808 analog to digital converter chip. It has an 8-channel multiplexer that selects which analog input signal to convert to digital. The conversion process takes 64 clock cycles to complete. The chip outputs the digital conversion result on 8 pins and has control signal pins for start, clock, output enable and end of conversion notification. It converts analog voltages to 8-bit digital numbers for use by digital devices like microprocessors.
The 8051 microcontroller has an 8-bit CPU, 4K ROM, 128 bytes RAM, two 16-bit timers, 32 I/O lines, and serial port. It uses an accumulator, B register, program status word and stack pointer along with arithmetic logic unit and instruction decoder to perform operations. The memory includes internal ROM, RAM, and external memory accessed via a 16-bit data pointer and program counter.
The document is a presentation on silicon controlled rectifiers (SCRs) given by five students. It introduces SCRs, explaining that they are power electronic devices that can convert AC to DC and control power to a load. The presentation describes the basic structure and operation of SCRs, including how applying a voltage to the gate terminal allows current to flow. It also covers the characteristics curve and applications of SCRs in areas like rectification, power supplies, motor controls and battery charging. In conclusion, SCRs are widely used power components due to their ability to easily switch high currents and their low cost.
This presentation discusses the support for interrupts in 8051. The interrupt types, interrupts versus polling etc are discussed. The register formats of IE, IP register are discussed. The concept of priority among the interrupts is discussed.
The Intel 8086 is a 16-bit microprocessor that can access up to 1 MB of memory. It has two main components: the Bus Interface Unit (BIU) handles bus operations like instruction fetching and memory access, while the Execution Unit (EU) decodes and executes instructions. The BIU contains registers for the code, data, extra, and stack segments as well as an instruction queue. The EU has registers for accumulation, base, count, data, pointers, and flags, and contains an ALU and decoder. It executes instructions from the queued bytes using a pipeline architecture.
The document describes the 8 addressing modes of the 8086 microprocessor. These are: 1) Immediate, where the operand is specified in the instruction itself. 2) Register, where operands are registers. 3) Direct memory, using a segment and offset address. 4) Register indirect, using a base register address. 5) Register relative, using a base register and displacement. 6) Base indexed, using a base and index register. 7) Relative indexed, using a base, index, and displacement. 8) Implied, where operands are implied and not specified.
Analog to Digital Converter (ADC) is a device that converts an analog quantity (continuous voltage) to discrete digital values.
The PIC microcontroller can be used in various electronic devices like alarm systems, electronic gadgets and computer control systems.
The stack in the 8085 microprocessor is a group of memory locations used for temporary storage of data during program execution. Data is stored and retrieved on a last-in, first-out basis. The PUSH instruction stores data in the stack by decrementing the stack pointer and copying register contents to memory. The POP instruction retrieves data from the stack by copying memory contents back to registers and incrementing the stack pointer. Common register pairs that can be pushed and popped include BC, DE, HL, and A and flags.
this ppt only for beginner who want to understand concept of Timer counter operation of LPC2148 step by step.
hope it may help u.
always welcoming ur suggestion.
The document discusses interfacing an analog to digital converter (ADC) chip, specifically the 0804 and 0808 chips, with a microcontroller. It explains that the ADC converts an analog voltage to an 8-bit digital value representing voltages from 0 to 255. It provides the initialization and timing steps to start a conversion by writing to the chip and read the digital output by reading from the chip once conversion is complete.
The document discusses various addressing modes and instructions of the 8051 microcontroller. It describes the five addressing modes - immediate, register, direct, register indirect and indexed. It explains each addressing mode in detail. It also explains the various instruction groups - data transfer, arithmetic, logical, boolean and branching instructions. It provides examples of instructions like MOV, ADD, ANL, JMP etc. and how they are used to manipulate data in the 8051.
The document summarizes the key features and pin functions of the 8051 microcontroller. It has 40 pins total, with 32 pins used as I/O across four 8-bit ports (P0, P1, P2, P3). Many pins have multiple functions, such as serving as address lines when accessing external memory but as port pins otherwise. The remaining pins include power (VCC, GND) and oscillator (XTAL1, XTAL2) connections as well as pins for reset (RST), program store enable (PSEN), address latch enable (ALE), and external access (EA).
This document discusses TRIACs and DIACs. TRIACs are bidirectional semiconductor switches that can control AC in a load. They consist of two SCRs connected in inverse parallel with a common gate. DIACs are also bidirectional semiconductor devices that can be switched from off to on with either polarity of applied voltage. They have no control terminal. Both devices exhibit avalanche breakdown and negative resistance characteristics. TRIACs are used for phase control and lamp switching. DIACs are primarily used to trigger TRIACs in applications like light dimmers and heat controls.
The document describes the static characteristics and forward characteristics of an SCR, which has three operational regions - a forward blocking state with low current and high voltage, a transition state where voltage increases past a threshold to allow a sharp increase in current and drop in voltage, and an on state with low voltage and high current flow. It also notes that in reverse bias, the SCR acts like a diode until the breakdown voltage is reached, allowing a large damaging reverse current.
The 8051 microcontroller has 40 pins that provide input/output capabilities. It has four 8-bit I/O ports (P0, P1, P2, P3) that allow connection to external devices. Unlike microprocessors, the 8051 has onboard I/O ports so no additional chips are needed. The I/O ports use circuits that allow pins to be individually configured as inputs or outputs using latches controlled by the microcontroller.
Interrupt programming with 8051 microcontrollerAnkit Bhatnagar
this ppt is related to the intrupts related to the 8051 microcontroller ..
topics are introduction to intrupts
intrerrupts vs pollings
difference between intrupts snd pollings
The document provides an introduction to microcontrollers, specifically focusing on the Intel 8051 microcontroller. It defines microcontrollers and distinguishes them from microprocessors by noting that microcontrollers contain peripherals like RAM, ROM, I/O ports and timers on a single chip, while microprocessors require external circuitry. It then describes the architecture and features of the Intel 8051 microcontroller, including its 4KB program memory, 128 bytes of data memory, 32 general purpose registers, two timers, interrupts and I/O ports. Development tools for microcontrollers like editors, assemblers, compilers and debuggers/simulators are also discussed.
The document discusses the addressing modes used by the Intel 8085 microprocessor. It explains that an instruction specifies an operation along with the source and destination addresses. The Intel 8085 supports 5 addressing modes: direct, register, register indirect, immediate, and implicit. Each mode is defined by how the source or destination operand address is specified in the instruction.
The document discusses the addressing modes and instruction set of the 8085 microprocessor. It describes the different addressing modes used in 8085 like immediate, register, memory direct, indirect and implied addressing. It also explains the classification of the 8085 instruction set based on functionality into data transfer, arithmetic, logical, branching, stack/IO and machine control instructions. Furthermore, it provides details about the one-byte, two-byte and three-byte instructions and gives examples of instructions from different categories.
The document discusses Assembly Language programming for the 8051 microcontroller. It describes how Assembly Language uses mnemonics to represent machine code instructions. It also explains key aspects of 8051 programming including registers, flags, memory organization, and assembler directives. Assembly Language requires knowledge of the CPU's instruction set and internal details. Programs are assembled into machine code before being run on the 8051.
The document discusses an agenda for a session on the 8051 microcontroller. It includes introductions to the 8051 microcontroller, its characteristics, pin diagram, programming languages including assembly and C, software used, and interfacing examples like LEDs, 7-segment displays, and LCDs. It also describes a project to interface a digital clock with a visitor counter.
The document provides an introduction to 8051 assembly language programming. It discusses that CPUs can only work with binary but programming in 0s and 1s is tedious for humans. Assembly language was developed to provide mnemonics for machine code instructions and make programming faster and less error prone. It also summarizes key aspects of 8051 architecture like registers, memory allocation, timers and counters.
The document discusses timer programming for the 8051 microcontroller. It contains the following information:
- The 8051 has two timers/counters that can be used as timers to generate time delays or as event counters.
- Timers use 1/12 of the crystal frequency as the input clock. Registers like TH0, TL0, TMOD, and TCON are used to program and control the timers.
- Timer Mode 1 is a 16-bit timer mode where the TH and TL registers increment continuously until they roll over, setting the timer flag. Programming involves initializing the registers, starting the timer, and monitoring the flag.
This document provides an overview of programming the 8051 microcontroller in C. It discusses machine language, assembly language, and high-level languages. It then demonstrates how to create a hex file using a compiler, burn it to a microcontroller, and use ISP and a universal programmer. Several examples of 8051 C code are provided, including toggling port bits, using data types like unsigned char, delay loops, and reading/writing port values.
The document describes the architecture and instruction set of the 8051 microcontroller. It includes details about the memory map, internal data memory organization, special function registers, addressing modes, and common instructions. The 8051 has 4KB of on-chip ROM, 128 bytes of internal RAM, 21 special function registers, and supports operations on bytes, bits, and 16-bit data using various addressing modes like register, direct, indirect, and immediate addressing. Instructions allow data transfer, arithmetic, logic, and program control operations.
This document discusses various applications of embedded systems including temperature measurement using thermistors and linear temperature sensors like the LM35. It describes how to interface the LM35 temperature sensor with an 8-bit ADC0809 and microcontroller port for temperature readings. It also discusses controlling a stepper motor and interfacing it to port pins of a microcontroller. Finally, it explains interfacing a 2x16 LCD display and keyboard matrix to a microcontroller for input/output applications.
The document discusses the 8051 microcontroller. It describes the basic components of the 8051 including 4K bytes of internal ROM, 128 bytes of internal RAM, four 8-bit I/O ports, two 16-bit timers/counters, and one serial interface. It also provides details on the block diagram, important pins like ports and serial interface pins, and how to connect an external clock source to the 8051.
This document discusses various instructions for the 8051 microcontroller including DJNZ, INC, JB, JBC, JC, JMP, JNB, JNC, JNZ, JZ, LCALL, LJMP, MOV, and others. It was written by Prof. Anish Goel for the course Embedded Systems Programming Part - B.
This document discusses various instructions for programming the 8051 microcontroller including ACALL, ADD, ADDC, AJMP, ANL, CJNE, CLR, CPL, DA, DEC, and DIV. It was written by Prof. Anish Goel for an embedded systems course and provides descriptions of 19 different microcontroller instructions.
This document provides an overview of using the C programming language for 8051 microcontrollers. It discusses C basics, the compilation process, C extensions for 8051 features, in-line assembly, and interfacing C with hardware. Examples are provided for variables, operators, loops, decisions, functions, interrupts, accessing memory types, and converting analog sensor readings to real values in C. The document is intended for a microprocessors course teaching students how to program 8051 microcontrollers in C.
The document discusses the 8051 microcontroller. It begins with an introduction and table of contents. It then provides details about the 8051 including its block diagram, pin descriptions and functions, memory mapping, registers, stack, I/O port programming, timers, and interrupts.
- CY (carry flag) is set when there is a carry out from the D7 bit during addition/subtraction. It can be directly set or cleared.
- AC (auxiliary carry flag) is set if there is a carry from D3 to D4 during addition/subtraction. It is used for BCD operations.
- P (parity flag) reflects the number of 1s in the accumulator register. It is set if there is an odd number of 1s and cleared if there is an even number.
- OV (overflow flag) is set when a signed number operation result is too large, indicating overflow into the sign bit. It detects errors in signed arithmetic.
The document discusses programming timers and counters in the 8051 microcontroller. It describes the two timers/counters in the 8051, timer 0 and timer 1. It explains how to use the timers as timers or counters through settings in the TMOD register. The basic registers for the timers like TH0, TL0, TH1, TL1 are described. Programming examples are provided to illustrate how to set the timer values, start and stop the timers, and generate delays.
The document discusses various topics related to interfacing an 8051 microcontroller, including:
1. Serial communication between an 8051 and PC using RS-232 and a MAX232 chip.
2. Half-duplex and asynchronous serial communication modes.
3. Addressing modes of the 8051 including register, direct, indirect, and indexed addressing.
4. Instructions sets, registers, and programming of the 8051 microcontroller.
The document discusses programming the 8051 microcontroller. It can be programmed using low-level assembly language or high-level languages like C. Assembly language code is faster but more difficult to write and less portable, while C code is easier but slower. The document provides examples of adding two numbers in both C and assembly. It also discusses the 8051 instruction set, addressing modes, subroutines, and arithmetic operations.
The document discusses various aspects of 8051 assembly language programming including:
- The most commonly used 8-bit registers in the 8051 and the 16-bit program counter and data pointer registers.
- Examples of MOV and ADD instructions to move data between registers and perform arithmetic operations in the accumulator register.
- The steps required to assemble and run an 8051 program, including creating an assembly source file, assembling it to produce object and list files, and optionally linking files to run on a simulator.
- Memory allocation and usage in the 8051 including the 64KB program memory space accessed by the 16-bit program counter and RAM allocation for registers and stack.
This document discusses 8051 interrupt programming in assembly language. It contrasts interrupts with polling, explains interrupt service routines and the interrupt vector table. It lists the 6 interrupts of the 8051 and describes how to enable/disable interrupts and program timers and external hardware interrupts using interrupts. It also covers edge-triggered vs. level-triggered interrupts, serial communication interrupts, interrupt priority, and triggering interrupts via software. Examples are provided to demonstrate interrupt programming concepts.
7.1 Data types and time delay in 8051 C
7.2 I/O programming in 8051 C
7.3 Logic operations in 8051 C
7.4 Data conversion programs in 8051 C
7.5 Accessing code ROM space in 8051 C
7.6 Data serialization using 8051 C
microcontroller_instruction_set for ENGINEERING STUDENTSssuser2b759d
The document discusses the instruction set of microcontrollers. It describes that microcontrollers have instruction formats that specify the operation and operands. The 8051 microcontroller has 111 instructions divided into one-byte, two-byte, and three-byte instructions depending on the number of bytes needed to represent the instruction. The document outlines the different addressing modes and types of instructions including data transfer, arithmetic, logical, and program flow control instructions. It provides examples of common instructions and their operation.
The document discusses various aspects of the 8051 microcontroller such as instruction types, addressing modes, RAM space allocation, and instruction sets. It explains that 8051 instructions are divided into one-byte, two-byte, and three-byte instructions depending on the number of bytes required to represent them. It describes the five addressing modes - register, direct, indirect, immediate, and index. It also provides examples of different instruction types like data transfer, arithmetic, logical, and branching instructions.
The document discusses the five addressing modes of the 8051 microcontroller: immediate, register, direct, register-indirect, and indexed addressing modes. It provides examples and explanations of each mode. Immediate addressing uses data specified in the instruction. Register addressing uses source and destination registers. Direct addressing specifies the address of the data. Register-indirect addressing uses registers to point to memory locations. Indexed addressing forms an effective address by summing a base register and accumulator register.
The document discusses the addressing modes and instruction set of the 8051 microcontroller. It describes the 5 addressing modes of 8051 as immediate, register, direct, register indirect, and indexed addressing modes. It then explains each addressing mode in detail along with examples. The document also discusses the different categories of instructions in 8051 like arithmetic, logical, data transfer, and branching instructions. It provides examples of commonly used instructions from each category.
microprocessor and microcontroller notes pptmananjain543
The document discusses the addressing modes and instruction set of the 8051 microcontroller. It describes the 5 addressing modes of 8051 as immediate, register, direct, register indirect and indexed addressing modes. It then explains each addressing mode in detail along with examples. The document also discusses the different types of instructions in 8051 like arithmetic, logical, data transfer, branching and looping instructions along with examples.
The 8085 microprocessor is an 8-bit processor with 40 pins. It has multiplexed address and data lines and works on a 5V power supply. It provides 74 instructions with 5 addressing modes and can access 64KB of memory space. Some important pins include the address lines, data lines, read, write, interrupt, and I/O pins. It has arithmetic logic and register groups to perform operations on data stored in registers or memory. Common instructions include MOV, MVI, ADD, SUB, and others to transfer and manipulate data.
The document provides information about microcontrollers and the 8051 microcontroller family. It defines a microcontroller as a programmable digital processor with on-chip memory and peripherals. It then compares microcontrollers to microprocessors, noting that microcontrollers have on-chip memory and peripherals while microprocessors require external memory. The document proceeds to discuss the development and classification of microcontrollers like the Intel 4004 and 8051. It provides details on the architecture, memory structure, instructions, and I/O ports of the 8051 microcontroller.
The document classifies and describes the instruction set of the 8051 microcontroller. It discusses the different types of instructions including data transfer, logical, arithmetic, bit-level, rotate/swap, and jump/call instructions. It provides examples of instructions for moving data to and from memory, performing logical and arithmetic operations, manipulating bits, and rotating/swapping values. Details are given on addressing modes, registers, flags, and how the instructions interact with memory and I/O.
The instruction set of the 8051 microcontroller is classified into several categories based on the type of operations performed. These include data transfer instructions, byte-level logical instructions, arithmetic instructions, bit-level instructions, rotate and swap instructions, and jump and call instructions. Data transfer instructions move data between registers, memory, and I/O ports using various addressing modes. Byte-level logical instructions perform AND, OR, and XOR operations. Arithmetic instructions support operations like addition, subtraction, multiplication, and division. Bit-level instructions manipulate individual bits in registers and memory. Rotate and swap instructions rotate and rearrange bits and nibbles in the accumulator.
The instruction set of the 8051 microcontroller is classified into several categories based on the type of operations performed. These include data transfer instructions, byte-level logical instructions, arithmetic instructions, bit-level instructions, rotate and swap instructions, and jump and call instructions. Data transfer instructions move data between registers, memory, and I/O ports using various addressing modes. Byte-level logical instructions perform AND, OR, and XOR operations. Arithmetic instructions support operations like addition, subtraction, multiplication, and division. Bit-level instructions manipulate individual bits in registers and memory. Rotate and swap instructions rotate and rearrange bits and nibbles in the accumulator.
The document summarizes the instruction set of the 8051 microcontroller. It describes the different addressing modes including register, direct, indirect, immediate, relative, absolute, long and indexed addressing. It also explains the various instruction types such as arithmetic, logical, data transfer, boolean and program branching instructions. Examples are provided for different instructions like ADD, MOV, JMP etc. to illustrate how they work and affect processor registers.
This document provides an overview of microcontroller architecture and programming using the 8051 microcontroller. It discusses the objectives of studying the 8051 microcontroller, its programming model including instruction classification and addressing modes. It describes the different types of instructions like data transfer, arithmetic, logical, and branching instructions. It also discusses assembler directives like ORG, DB, END and provides examples of 8051 programming and interfacing techniques.
This document provides an overview of the instruction set for the 8051 microcontroller. It describes the 8 addressing modes - register, direct, indirect, immediate, relative, absolute, long, and indexed. It provides examples of instructions using each addressing mode, including their opcodes, machine code encoding, operations performed, and examples of usage. Common instructions for moving data, logical operations, and arithmetic are demonstrated for each addressing mode. The relative jumps, absolute jumps, and subroutine calls are also detailed.
The document provides information about the 8085 microprocessor. It begins with definitions of key terms like microprocessor, CPU, ALU, and bus. It then discusses the evolution of microprocessors from early 4-bit models to later 8-bit, 12-bit, and 16-bit models like the Intel 8085. The document details the architecture of the 8085, including its pin descriptions and addressing modes. It categorizes the instruction set into groups for data transfer, arithmetic, logical, branch, and machine control operations. Memory-mapped I/O is also introduced.
This document describes the instruction set of the 8051 microcontroller. It discusses the three types of instructions - single byte, double byte, and triple byte - based on the number of bytes needed to represent the instruction. It provides examples of different types of instructions, including data transfer, arithmetic, logical, logical bit, and program flow control instructions. Each instruction is defined by its mnemonic, description, and number of bytes.
The document discusses different addressing modes in 8051 microcontroller - immediate, register, direct, register indirect and indexed addressing. It provides examples of instructions using each addressing mode like MOV, ADD etc. and explains how the address is specified directly or indirectly using registers in each mode.
The document compares microprocessors and microcontrollers and provides details about the 8051 microcontroller architecture. It describes that microcontrollers contain a microprocessor, memory, I/O interfaces and peripheral devices while microprocessors only contain an ALU, control unit and registers. It then provides details about the 8051 architecture such as its ports, registers, memory organization, and instruction set which includes data transfer, arithmetic, logical and I/O instructions.
The document discusses different addressing modes used in 8051 microcontrollers. It describes 5 addressing modes - immediate, register, direct, indirect, and register specific. Immediate addressing uses a constant value in the instruction. Register addressing accesses the 8051's registers. Direct addressing accesses on-chip RAM or SFRs using an address. Indirect addressing uses registers R0/R1 to point to external memory locations. Register specific addressing refers directly to registers like the accumulator.
The document describes the instruction set of the Atmel 8051 microcontroller. It includes 3 tables that list the instructions, describing the operation, number of bytes in the instruction, and the oscillator period in cycles to execute the instruction. The tables provide a summary of arithmetic, logical, branch, and data transfer instructions available on the 8051 microcontroller.
This document provides an overview of microprocessors and the 8085 microprocessor. It discusses the evolution of microprocessors from early business calculators and home computers to modern devices. It then describes the internal architecture of the 8085 microprocessor, including its functional blocks like the ALU, registers, flags, and buses. Finally, it outlines the five generations of microprocessors and provides details on the pin configuration and functions of the 8085 microprocessor.
The 8051 microcontroller has an 8-bit architecture and uses 8-bit registers. It can process data larger than 8 bits by breaking it down. The DB directive is used to define byte-sized data in various formats. The ORG and EQU directives set the program origin and define constants, while END marks the end of an assembly file. The document also describes accessing individual I/O port bits and toggling or checking their states using instructions like SETB, XLR, JNB, and JB.
This document provides an overview of microprocessors and the 8085 microprocessor. It discusses the evolution of microprocessors from early business calculators and home computers to modern devices. It then describes the internal architecture of the 8085 microprocessor, including its functional blocks like the ALU, registers, flags, and buses. Finally, it outlines the five generations of microprocessors and provides details on the pin configuration and functions of the 8085 microprocessor.
The 8051 microcontroller has an 8-bit architecture and uses assembler directives like DB, ORG, and EQU to define data and constants. It allows individual bits of I/O ports to be accessed using instructions like SETB, CLR, JNB, and JB, enabling control of devices with bit-level granularity. Read-modify-write instructions also allow reading, modifying, and writing port values in a single operation.
The document discusses decimation in time (DIT) and decimation in frequency (DIF) fast Fourier transform (FFT) algorithms. DIT breaks down an N-point sequence into smaller DFTs of even and odd indexed samples, recursively computing smaller and smaller DFTs until individual points remain. DIF similarly decomposes the computation but by breaking the frequency domain spectrum into smaller DFTs. Both algorithms reduce the computational complexity of computing the discrete Fourier transform from O(N^2) to O(NlogN) operations.
RTLinux is a real-time operating system that allows real-time applications to run on top of Linux. It modifies the Linux kernel to add a virtual machine layer with a separate task scheduler that prioritizes real-time tasks over standard Linux processes. This enables RTLinux to support hard real-time deadlines. Programming in RTLinux involves creating modules that can be loaded and unloaded from the kernel using specific commands. Real-time threads and synchronization objects like mutexes are implemented using POSIX interfaces.
The document discusses I/O ports and timers in the 8051 microcontroller. It describes the four 8-bit I/O ports (Port 0, Port 1, Port 2, Port 3) that can be configured as inputs or outputs. It also discusses the two 16-bit timer/counters (Timer 0 and Timer 1), their associated registers (TMOD and TCON), and operating modes. The ports and timers provide capabilities for interfacing with external devices and generating time delays or counting events.
MOS and CMOS technologies are types of field-effect transistors. MOS transistors use a metal gate separated from a semiconductor channel by an oxide layer. There are two types of MOS transistors: nMOS with a negatively doped silicon channel and pMOS with a positively doped channel. CMOS circuits combine both nMOS and pMOS transistors to construct logic gates. CMOS circuits have low power dissipation, higher noise immunity, and higher fan-out compared to other logic families.
This document discusses different logic families including Resistor Transistor Logic (RTL), Diode Transistor Logic (DTL), Transistor-Transistor Logic (TTL), and Emitter Coupled Logic (ECL). It provides circuit diagrams and explanations of the working principles for each logic family. Key characteristics like fan-in, fan-out, propagation delay, noise immunity, and power dissipation are compared for each logic family.
This document discusses different types of non-linear circuits including clamping circuits, clippers, and peak detectors. Clamping circuits adjust the DC level of a waveform without changing its shape or amplitude. Clippers clip off portions of the input waveform above or below a reference voltage. Peak detectors track the input signal until detecting a peak value, then hold that value to provide voltage memory of the peak. Circuit diagrams and example waveforms are provided to illustrate the operation of these different non-linear circuits.
This document discusses different types of linked lists including single linked lists, double linked lists, circular linked lists, and circular double linked lists. It describes the basic operations that can be performed on linked lists such as creation, insertion, deletion, traversal, searching, concatenation, and display. It provides examples of how to insert and delete nodes from both single and double linked lists. The document also discusses recursive operations and advantages and disadvantages of using linked lists.
The document discusses arrays in data structures using C programming language. It defines what an array is and describes different types of arrays like one-dimensional, two-dimensional, and multi-dimensional arrays. It also explains array operations such as insertion, deletion, traversal, reversing, sorting, and searching. Additionally, it covers merging of arrays, arrays of pointers, and using arrays to represent polynomials.
Electromagnetic waves have different wavelengths and frequencies depending on their position in the electromagnetic spectrum. They all travel at the same speed of 300 million meters per second in a vacuum. Waves with longer wavelengths have lower frequencies while those with shorter wavelengths have higher frequencies. The higher the frequency, the higher the energy carried by the electromagnetic wave.
The document discusses satellite communications, including the basic components and orbits of communication satellites, how they are used to transmit signals, and some of their applications such as television, radio, and mobile phones. Key orbits discussed include LEO, MEO, and GEO orbits, and the advantages and disadvantages of each for communication purposes. The document also covers frequency allocation and some of the challenges of using satellites for communication.
This document provides an overview of electronics in daily life, including definitions of direct current (DC) and alternating current (AC). It discusses the basics of different types of currents and their sources. It also summarizes different types of batteries including primary (non-rechargeable), secondary (rechargeable), and fuel cells. Additional topics covered include electrical accessories like holders, fuses, switches, and regulators. The document concludes with sections on short circuits, electric shock prevention, and electric bulbs.
This document contains instructions for electronics experiments for first year BSc students. It lists 10 experiments including converting a meter to an ohmmeter, verifying Kirchoff's laws, measuring voltage and frequency using an oscilloscope, and verifying theorems like Thevenin's, Norton's and maximum power transfer. For each experiment, the aim, apparatus, circuit diagrams, observation tables and results are provided to help students perform the experiments.
This document discusses combinational logic circuits such as adders, subtractors, multipliers, decoders, and multiplexers. It provides circuit diagrams and truth tables for half adders, full adders, half subtractors, full subtractors, decoders, and multiplexers. It also describes how to build binary adders and subtractors using these basic components and how multiplication of binary numbers is performed.
The document discusses applications of operational amplifiers (op-amps). It describes how op-amps can be used to build integrator and differentiator circuits by using feedback networks incorporating resistors and capacitors. It also discusses how op-amps can be used to create active filters, including low-pass and high-pass filters, for filtering signals.
Digital logic gates and Boolean algebraSARITHA REDDY
The document discusses digital logic gates and Boolean algebra. It defines logic gates as electronic circuits that make logic decisions. Common logic gates include OR, AND, and NOT gates. Boolean algebra uses truth values of 0 and 1 instead of numbers, and has fundamental laws and operations for AND, OR, and NOT. Boolean algebra can be used to simplify logical expressions and save gates in digital circuit design.
Graphs are a non-linear data structure consisting of nodes (vertices) connected by links (edges). There are two main types: undirected graphs where edges are not ordered, and directed graphs where edges have direction from one node to another. Common graph terminology includes adjacent nodes, degrees, isolated nodes, sources, and different graph properties like being connected, complete, or having loops. Graph traversal algorithms like breadth-first search and depth-first search are used to systematically explore the structure of a graph.
This slide is special for master students (MIBS & MIFB) in UUM. Also useful for readers who are interested in the topic of contemporary Islamic banking.
it describes the bony anatomy including the femoral head , acetabulum, labrum . also discusses the capsule , ligaments . muscle that act on the hip joint and the range of motion are outlined. factors affecting hip joint stability and weight transmission through the joint are summarized.
Main Java[All of the Base Concepts}.docxadhitya5119
This is part 1 of my Java Learning Journey. This Contains Custom methods, classes, constructors, packages, multithreading , try- catch block, finally block and more.
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPRAHUL
This Dissertation explores the particular circumstances of Mirzapur, a region located in the
core of India. Mirzapur, with its varied terrains and abundant biodiversity, offers an optimal
environment for investigating the changes in vegetation cover dynamics. Our study utilizes
advanced technologies such as GIS (Geographic Information Systems) and Remote sensing to
analyze the transformations that have taken place over the course of a decade.
The complex relationship between human activities and the environment has been the focus
of extensive research and worry. As the global community grapples with swift urbanization,
population expansion, and economic progress, the effects on natural ecosystems are becoming
more evident. A crucial element of this impact is the alteration of vegetation cover, which plays a
significant role in maintaining the ecological equilibrium of our planet.Land serves as the foundation for all human activities and provides the necessary materials for
these activities. As the most crucial natural resource, its utilization by humans results in different
'Land uses,' which are determined by both human activities and the physical characteristics of the
land.
The utilization of land is impacted by human needs and environmental factors. In countries
like India, rapid population growth and the emphasis on extensive resource exploitation can lead
to significant land degradation, adversely affecting the region's land cover.
Therefore, human intervention has significantly influenced land use patterns over many
centuries, evolving its structure over time and space. In the present era, these changes have
accelerated due to factors such as agriculture and urbanization. Information regarding land use and
cover is essential for various planning and management tasks related to the Earth's surface,
providing crucial environmental data for scientific, resource management, policy purposes, and
diverse human activities.
Accurate understanding of land use and cover is imperative for the development planning
of any area. Consequently, a wide range of professionals, including earth system scientists, land
and water managers, and urban planners, are interested in obtaining data on land use and cover
changes, conversion trends, and other related patterns. The spatial dimensions of land use and
cover support policymakers and scientists in making well-informed decisions, as alterations in
these patterns indicate shifts in economic and social conditions. Monitoring such changes with the
help of Advanced technologies like Remote Sensing and Geographic Information Systems is
crucial for coordinated efforts across different administrative levels. Advanced technologies like
Remote Sensing and Geographic Information Systems
9
Changes in vegetation cover refer to variations in the distribution, composition, and overall
structure of plant communities across different temporal and spatial scales. These changes can
occur natural.
A review of the growth of the Israel Genealogy Research Association Database Collection for the last 12 months. Our collection is now passed the 3 million mark and still growing. See which archives have contributed the most. See the different types of records we have, and which years have had records added. You can also see what we have for the future.
This presentation includes basic of PCOS their pathology and treatment and also Ayurveda correlation of PCOS and Ayurvedic line of treatment mentioned in classics.
Strategies for Effective Upskilling is a presentation by Chinwendu Peace in a Your Skill Boost Masterclass organisation by the Excellence Foundation for South Sudan on 08th and 09th June 2024 from 1 PM to 3 PM on each day.
A workshop hosted by the South African Journal of Science aimed at postgraduate students and early career researchers with little or no experience in writing and publishing journal articles.
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...PECB
Denis is a dynamic and results-driven Chief Information Officer (CIO) with a distinguished career spanning information systems analysis and technical project management. With a proven track record of spearheading the design and delivery of cutting-edge Information Management solutions, he has consistently elevated business operations, streamlined reporting functions, and maximized process efficiency.
Certified as an ISO/IEC 27001: Information Security Management Systems (ISMS) Lead Implementer, Data Protection Officer, and Cyber Risks Analyst, Denis brings a heightened focus on data security, privacy, and cyber resilience to every endeavor.
His expertise extends across a diverse spectrum of reporting, database, and web development applications, underpinned by an exceptional grasp of data storage and virtualization technologies. His proficiency in application testing, database administration, and data cleansing ensures seamless execution of complex projects.
What sets Denis apart is his comprehensive understanding of Business and Systems Analysis technologies, honed through involvement in all phases of the Software Development Lifecycle (SDLC). From meticulous requirements gathering to precise analysis, innovative design, rigorous development, thorough testing, and successful implementation, he has consistently delivered exceptional results.
Throughout his career, he has taken on multifaceted roles, from leading technical project management teams to owning solutions that drive operational excellence. His conscientious and proactive approach is unwavering, whether he is working independently or collaboratively within a team. His ability to connect with colleagues on a personal level underscores his commitment to fostering a harmonious and productive workplace environment.
Date: May 29, 2024
Tags: Information Security, ISO/IEC 27001, ISO/IEC 42001, Artificial Intelligence, GDPR
-------------------------------------------------------------------------------
Find out more about ISO training and certification services
Training: ISO/IEC 27001 Information Security Management System - EN | PECB
ISO/IEC 42001 Artificial Intelligence Management System - EN | PECB
General Data Protection Regulation (GDPR) - Training Courses - EN | PECB
Webinars: https://pecb.com/webinars
Article: https://pecb.com/article
-------------------------------------------------------------------------------
For more information about PECB:
Website: https://pecb.com/
LinkedIn: https://www.linkedin.com/company/pecb/
Facebook: https://www.facebook.com/PECBInternational/
Slideshare: http://www.slideshare.net/PECBCERTIFICATION
Executive Directors Chat Leveraging AI for Diversity, Equity, and InclusionTechSoup
Let’s explore the intersection of technology and equity in the final session of our DEI series. Discover how AI tools, like ChatGPT, can be used to support and enhance your nonprofit's DEI initiatives. Participants will gain insights into practical AI applications and get tips for leveraging technology to advance their DEI goals.
This presentation was provided by Steph Pollock of The American Psychological Association’s Journals Program, and Damita Snow, of The American Society of Civil Engineers (ASCE), for the initial session of NISO's 2024 Training Series "DEIA in the Scholarly Landscape." Session One: 'Setting Expectations: a DEIA Primer,' was held June 6, 2024.
বাংলাদেশের অর্থনৈতিক সমীক্ষা ২০২৪ [Bangladesh Economic Review 2024 Bangla.pdf] কম্পিউটার , ট্যাব ও স্মার্ট ফোন ভার্সন সহ সম্পূর্ণ বাংলা ই-বুক বা pdf বই " সুচিপত্র ...বুকমার্ক মেনু 🔖 ও হাইপার লিংক মেনু 📝👆 যুক্ত ..
আমাদের সবার জন্য খুব খুব গুরুত্বপূর্ণ একটি বই ..বিসিএস, ব্যাংক, ইউনিভার্সিটি ভর্তি ও যে কোন প্রতিযোগিতা মূলক পরীক্ষার জন্য এর খুব ইম্পরট্যান্ট একটি বিষয় ...তাছাড়া বাংলাদেশের সাম্প্রতিক যে কোন ডাটা বা তথ্য এই বইতে পাবেন ...
তাই একজন নাগরিক হিসাবে এই তথ্য গুলো আপনার জানা প্রয়োজন ...।
বিসিএস ও ব্যাংক এর লিখিত পরীক্ষা ...+এছাড়া মাধ্যমিক ও উচ্চমাধ্যমিকের স্টুডেন্টদের জন্য অনেক কাজে আসবে ...
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
Unit ii microcontrollers final
1. Dr. C. SARITHA
DEPT. OF ELECTRONICS
UNIT II
Addressing modes, instruction set and assembly language
programming of 8051
ADDRESSING MODES OF 8051 :
The way in which the data operands are accessed by different instructions is known as the
addressing mode. There are various methods of denoting the data operands in the instruction.
The 8051 microcontroller provides five distinct addressing modes. They are
1. Immediate addressing mode
2. Register addressing mode
3. Direct Addressing mode
4. Register Indirect addressing mode
5. Indexed addressing mode
Immediate addressing mode : The addressing mode in which the data operand is a constant and
it is a part of the instruction itself is known as Immediate addressing mode. Normally the data
must be preceded by a # sign. This addressing mode can be used to transfer the data into any of
the registers including DPTR.
MOV A, # 27 H ; The data (constant) 27 is moved to the accumulator register
ADD R1, # 45 H ; Add the constant 45 to the contents of the accumulator
MOV DPTR, # 8245H ; Move the data 8245 into the data pointer register.
MOV P1, # 21 H ; Move the data 21H to port1
Direct addressing mode: The addressing mode in which the data operand is in the RAM
location (00 -7FH) and the address of the data operand is given in the instruction is known as
Direct addressing mode. The direct addressing mode uses the lower 128 bytes of Internal RAM
and the SFRs.
MOV R1, 42H ; Move the contents of RAM location 42 into R1 register
MOV 49H, A ; Move the contents of the accumulator into the RAM location 49
ADD A, 56H ; Add the contents of the RAM location 56 to the accumulator
Register addressing mode : The addressing mode in which the data operand to be manipulated
lies in one of the registers is known as register addressing mode.
MOV A, R0 ; Move the contents of the register R0 to the accumulator
1
2. Dr. C. SARITHA
DEPT. OF ELECTRONICS
ADD A, R6 ; Add the contents of R6 register to the accumulator
MOV P1, R2 ; Move the contents of the R2 register into port 1
MOV R5, R2 ; This is invalid. The data transfer between the registers is not
2
allowed.
Register Indirect addressing mode : The addressing mode in which a register is used as a
pointer to the data memory block is known as Register indirect addressing mode.
MOV A, @ R0 ; Move the contents of RAM location whose address is in R0 into
A (accumulator)
MOV @ R1, B ; Move the contents of B into RAM location whose address is
held by R1
When R0 and R1 are used as pointers, they must be preceded by @ sign
One of the advantages of register indirect addressing mode is that it makes accessing the
data more dynamic than static as in the case of direct addressing mode.
Indexed addressing mode : This addressing mode is used in accessing the data elements of
lookup table entries located in program ROM space of 8051.
MOVC A, @ A+DPTR
The 16-bit register DPTR and register A are used to form the address of the data element stored
in on-chip ROM. Here C denotes code. In this instruction the contents of A are added to the 16-
bit DPTR register to form the 16-bit address of the data operand.
Instruction Set of 8051:
The 8051 microcontroller provides the following groups of instructions.
1. Arithmetic instructions
2. Logical and Compare instructions
3. Single bit instructions
4. Loop, Jump and Call instructions
5. Data transfer instructions
Arithmetic instructions :
This group of operators perform arithmetic operations such as addition, subtraction,
multiplication and division etc. Arithmetic operations affect the flags, such as Carry Flag (CY),
Overflow Flag (OV) etc, in the PSW register.
3. Dr. C. SARITHA
DEPT. OF ELECTRONICS
3
ADD (Addition of two 8 bit numbers) :
ADD A, Source ; A = A + Source
ADD A, #data ; A= A + immediate data
ADD A, Rn ; A = A + [ Rn ]
ADD A, direct ; A = A + [Direct memory]
ADD A, @Rn ; A = A + [Memory pointed to by Rn]
The instruction ADD is used to add two operands. The destination operand is always in register
A while the source operand can be a register, immediate data or in memory.
Ex: ADD A, R1
ADD A,#23
ADDC (Addition of two 16 bit numbers with carry) :
ADDC A, Source ; A = A + Source + 1
ADDC A, #data ; A= A + immediate data + CY
ADDC A, Rn ; A = A + [ Rn ] + CY
ADDC A, direct ; A = A + [Direct memory] + CY
ADDC A, @Ri ; A = A + [Memory pointed to by Ri] + CY
The instruction ADDC (add with carry) is used to add two 16-bit numbers. It is used when a
carry is propagated from lower byte to higher byte.
Ex: ADDC A, R6
ADDC A, #45
Note : @Ri implies contents of memory location pointed to by R0 or R1 and Rn refers to
registers R0-R7 of the currently selected register bank.
DA (Decimal adjust for addition) :
DA A ; Adjust for BCD addition
This is a decimal adjust instruction. It adjusts the 8-bit value in ACC resulting from operations
like ADD or ADDC and produces two 4-bit digits (in packed Binary Coded Decimal (BCD)
format). Effectively, this instruction performs the decimal conversion by adding 00H, 06H, 60H
or 66H to the accumulator, depending on the initial value of ACC and PSW.
Ex: DA A
SUBB (Subtract with borrow) :
SUBB A, source ; A = A – source – CY
4. Dr. C. SARITHA
DEPT. OF ELECTRONICS
SUBB A, #data ; A= A - immediate data - CY
SUBB A, Rn ; A = A - [ Rn ] - CY
SUBB A, direct ; A = A - [Direct memory] - CY
SUBB A, @Ri ; A = A - [Memory pointed to by Ri] - CY
The SUBB subtracts the specified data byte and the carry flag together from the accumulator,
leaving the result in the accumulator.
Ex: SUBB A, R4
4
SUBB A, #65
MUL (Multiplication):
The 8051 microcontroller supports byte by byte multiplication only.
MUL AB ; A x B, place 16-bit result in A and B
In byte by byte multiplication, one of the operands must be in register A, and the second operand
must be in register B. After multiplication, the result is in the A and B registers, the lower byte
is in A and the upper byte is in B.
Ex: MUL AB ; A = lower byte, B = higher byte
DIV (Division) :
In the division of unsigned numbers, the 8051 supports byte over byte only.
DIV AB ; divide A by B
In dividing a byte by a byte, the numerator must be in register A and the denominator must be in
B. After the DIV instruction is performed, the quotient is in A and the remainder is in B.
Ex: DIV AB ; A = quotient and B = remainder
INC (Increment) :
INC A ; Increment A by 1 (A = A + 1)
INC Rn ; [Rn] = [Rn] + 1
INC @Ri ; [@Ri] = [@Ri] + 1
INC direct ; direct = direct + 1
This is used to increment the contents of the register by 1.
Ex: INC R1
INC DPTR
DEC (Decrement) :
DEC A ; Decrement A by 1 (A = A - 1)
5. Dr. C. SARITHA
DEPT. OF ELECTRONICS
DEC Rn ; [Rn] = [Rn] - 1
DEC @Ri ; [@Ri] = [@Ri] - 1
DEC direct ; direct = direct – 1
This is used to decrement the contents of the register by 1.
Ex: DEC R3
5
DEC DPTR
Logical instructions :
Logical instructions perform standard Boolean operations such as AND, OR, XOR, NOT
(compliment). Other logical operations are clear accumulator, rotate accumulator left and
right, and swap nibbles in accumulator.
AND (Logical AND):
ANL destination, source ; dest = dest AND source
ANL A, Rn ; A & [Rn]
ANL A, direct ; A & [direct memory]
ANL A, @Ri ; A & [memory pointed to by Ri]
ANL A, #data ; A & immediate data
ANL direct, A ; [direct] = [direct] & A
ANL direct, #data ; [direct] = [direct] & immediate data
This instruction will perform a logical AND on the two operands and place the result in the
destination. The destination is normally the accumulator. The source operand can be a register,
in memory, or immediate. The ANL instruction is often used to mask (set to 0) certain bits of an
operand.
Ex: ANL A, R1
ANL A, #45
OR (Logical OR):
ORL destination, source ; dest = dest OR source
ORL A, Rn ; A | [Rn]
ORL A, direct ; A | [direct memory]
ORL A, @Ri ; A | [memory pointed to by Ri]
ORL A, #data ; A | immediate data
ORL direct, A ; [direct] = [direct] | A
6. Dr. C. SARITHA
DEPT. OF ELECTRONICS
ORL direct, #data ; [direct] = [direct] | immediate data
This instruction will perform the OR operation on the two operands, and place the result in the
destination. The ORL instruction can be used to set certain bits of an operand to 1. The
destination is normally the accumulator. The source operand can be a register, in memory, or
immediate.
Ex : ORL A, R5
6
ORL A, #76
XOR (Logical XOR) :
XRL destination, source ; dest = dest XOR source
XRL A, Rn ; A ^| [Rn]
XRL A, direct ; A ^ [direct memory]
XRL A, @Ri ; A ^ [memory pointed to by Ri]
XRL A, #data ; A ^ immediate data
XRL direct, A ; [direct] = [direct] ^ A
XRL direct, #data ; [direct] = [direct] ^ immediate data
This instruction will perform the XOR operation on the two operands, and place the result in the
destination. The destination is normally the accumulator. The source operand can be a register,
in memory, or immediate.
Ex: XRL A, R3
XRL A, #32
CPL (Complement) :
CPL A ; Complement A
This instruction complements the contents of register A. The complement action changes the 0s
to 1s and 1s to 0s. This is also called 1’s complement.
Ex: CPL A
Rotate and Swap instructions :
In many applications there is a need to perform a bitwise rotation of an operand.
In the 8051 the rotation instructions RL, RR, RLC, and RRC are designed specifically for that
purpose. They allow a program to rotate the accumulator right or left. In the 8051, to rotate a
byte the operand must be in register A. There are two types of rotations. One is simple rotation
of the bits of A, and the other is a rotation through the carry.
7. Dr. C. SARITHA
DEPT. OF ELECTRONICS
7
Rotating the bits of A right and left :
RR A ; rotate right A
In rotate right, the 8 bits of the accumulator are rotated right one bit, and bit D0 exits from the
least significant bit and enters into D7 (most significant bit).
RL A ; rotate left A
In rotate left, the 8 bits of the accumulator are rotated left one bit, and bit D7 exits from the
(most significant bit) and enters into D0 (least significant bit).
Rotating through the carry :
RRC A ; rotate right through carry
In RRC A, as bits are rotated from left to right, they exit the LSB to the carry flag, and the carry
flag enters the MSB. In other words, in RRC A, the LSB is moved to CY and CY is moved to
the MSB. In reality, the carry flag acts as if it is part of register A, making it a 9-bit register.
RLC A ; rotate left through carry
In RLC A, as bits are shifted from right to left they exit the MSB and enter the carry flag, and the
carry flag enters the LSB. In other words, in RCL the MSB is moved to CY and CY is moved to
the LSB.
8. Dr. C. SARITHA
DEPT. OF ELECTRONICS
8
SWAP :
SWAP A
Another useful instruction is the SWAP instruction. It works only on the accumulator (A). It
swaps the lower nibble and the higher nibble. In other words, the lower 4 bits are put into the
higher 4 bits and higher 4 bits are put into the lower 4 bits.
Ex: SWAP A
Single Bit instructions (Boolean Variable instructions) :
One unique and powerful feature of the 8051 is single bit operation. Single bit instructions allow
the programmer to set, clear, move and complement individual bits of a port, memory or register.
CLR (Clear) :
CLR bit ; Clear the bit
CLR C ; Clear the carry
This instruction clears (set to 0) the specified bit indicated in the instruction. CLR instruction
can operate on the carry flag or any directly addressable bit.
Ex : CLR P2.1
CLR C
SETB (Set bit ) :
SETB bit ; Set the bit
SETB C ; Set the carry
This operation sets the specified bit to 1. SETB instruction can operate on the carry flag or any
directly-addressable bit.
Ex : SETB P1.3
SETB C
CPL (Complement ) :
CPL bit ; Complement the bit
CPL C ; Complement the carry
9. Dr. C. SARITHA
DEPT. OF ELECTRONICS
This operation complements the bit indicated by the operand. CPL instruction can operate on the
carry flag or any directly addressable bit.
Ex: CPL P2.1
9
CPL P2.2
JB (Jump on bit) :
JB bit, target ; Jump to target if bit = 1
This instruction jumps to the address indicated if the destination bit is 1, otherwise the program
continues to the next instruction. The bit tested is not modified.
Ex: JB ACC.7, target1
JB P1.2, target2
JNB (Jump on no bit) :
JNB bit, target ; Jump to target if bit = 0
This instruction jumps to the address indicated if the destination bit is 0, otherwise the program
continues to the next instruction. The bit tested is not modified.
Ex: JNB ACC.6, target1
JNB P1.3, target2
JBC (Jump on bit and clear the bit) :
JBC bit, target ; Jump to target if bit = 1, then clear the bit
If the source bit is 1, this instruction clears it and branches to the address indicated; else it
proceeds with the next instruction.
Ex: JBC P1.3, target1
JBC P1.2, target2
JC (Jump on carry) :
JC target ; Jump to target if CY = 1
This instruction branches to the address, indicated by the label, if the carry flag is set, otherwise
the program continues to the next instruction.
Ex: JC target1
JNC (Jump on no carry) :
JNC target ; Jump to target if CY = 0
This instruction branches to the address, indicated by the label, if the carry flag is not set,
otherwise the program continues to the next instruction.
10. Dr. C. SARITHA
DEPT. OF ELECTRONICS
10
Ex: JNC target1
ANL (AND Logic) :
ANL C,bit ; AND CY with bit and save it on CY
ANL C,/bit ; AND CY with inverted bit and save it on CY
This instruction ANDs the bit addressed with the carry bit and stores the result in the carry bit
itself. If the source bit is a logical 0, then the instruction clears the carry flag; else the carry flag
is left in its original value. If a slash (/) is used in the source operand bit, it means that the logical
complement of the addressed source bit is used, but the source bit itself is not affected.
Ex : ANL C,P2.7 ; AND carry flag with bit 7 of P2
ANL C,/OV ; AND with inverse of OV flag
ORL ( OR Logic) :
ORL C,bit ; OR CY with bit and save it on CY
ORL C,/bit ; OR CY with inverted bit and save it on CY
This instruction ORs the bit addressed with the carry bit and stores the result in the carry bit
itself. It sets the carry flag if the source bit is a logical 1; else the carry is left in its original
value. If a slash (/) is used in the source operand bit, it means that the logical complement of the
addressed source bit is used, but the source bit itself is not affected.
Ex: ORL C,P2.7 ; OR carry flag with bit 7 of P2
ORL C,/OV ; OR with inverse of OV flag
MOV ( Copy ) :
MOV b, C ; Copy carry status to bit location (CY = b)
MOV C, b ; copy bit location status to carry (b = CY)
The instruction loads the value of source operand bit into the destination operand bit. One of the
operands must be the carry flag; the other may be any directly-addressable bit.
Ex : MOV P2.3, C
MOV C, P3.3
Program branching instructions (LOOP, JUMP and CALL) :
Looping instructions :
Repeating a sequence of instructions a certain number of times is called a loop. In 8051 the loop
action is performed by the instruction “DJNZ reg, label”. In this instruction, the register is
11. Dr. C. SARITHA
DEPT. OF ELECTRONICS
decremented, if it is not zero, it jumps to the target address referred to by the label. Prior to the
start of the loop the register is loaded with the counter for the number of repetitions. Notice that
in this instruction both the register decrement and the decision to jump are combined into a
single instruction.
Ex: DJNZ R2, label
Jump instructions:
In 8051, the jump instructions are divided into two categories as conditional and unconditional.
Conditional jump instructions :
The conditional jump is a jump in which the control is transferred conditionally to the target
location. Some of the conditional jump instructions are tabulated below.
Instruction Action
JZ Jump if A = 0
JNZ Jump if A ≠ 0
DJNZ Decrement and jump if A ≠ 0
CJNE A,byte Jump if A ≠ byte
CJNE reg, #data Jump if byte ≠ #data
JC Jump if CY = 1
JNC Jump if CY = 0
JB Jump if bit = 1
JNB Jump if bit = 0
JBC Jump if bit = 1 and clear bit
JZ (Jump on zero) :
In this instruction the content of register A is checked. If it is zero, it jumps to the target address.
Ex: JZ target
JNZ (Jump on no zero) :
In this instruction the content of register A is checked. If it is not zero, it jumps to the target
address.
Ex: JNZ target
CJNE (Compare and jump if not equal ) :
The 8051 has an instruction for the comparision.
CJNE destination, source, relative address
11
12. Dr. C. SARITHA
DEPT. OF ELECTRONICS
In the 8051, the actions of comparing and jumping are combined into a single instruction called
CJNE ( compare and jump if not equal ). The CJNE instruction compares two operands, and
jumps if they are not equal. In CJNE, the destination operand can be in the accumulator or in
one of the Rn registers. The source operand can be in a register, in memory, or immediate.
Ex : CJNE A, #0FF, target
12
CJNE R1, #00, target
All conditional jumps are short jumps, meaning that the address of the target must be within -128
to +127 bytes of the contents of the PC.
Unconditional jump instructions :
The unconditional jump is a jump in which control is transferred unconditionally to the target
location. In the 8051, there are two unconditional jumps : LJMP (long jump) and SJMP (short
jump).
LJMP (Long jump) :
LJMP is an unconditional long jump. It is a 3-byte instruction in which the first byte is the
opcode, and the second and third bytes represent the 16-bit address of the target location. The 2-
byte target address allows a jump to any memory location from 0000 to FFFFH.
LJMP target ; Jump to target unconditionally
SJMP (Short jump) :
SJMP is an unconditional short jump. It is a 2-byte instruction in which the first byte is the op-code,
and the second byte represents the relative address of the target location. The relative
address ranges from 00 to FFH.
SJMP target ; Jump to target unconditionally
CALL instructions :
Another control transfer instruction is the CALL instruction, which is used to call a subroutine.
Subroutines are often used to perform tasks that need to be performed frequently. This makes a
program more structured in addition to saving memory space. In the 8051 there are two
instructions for call : LCALL (long call) and ACALL (absolute call).
LCALL (Long call) :
It is a 3-byte instruction. In which, the first byte is the op-code and the second and third bytes
are used for the address of the target subroutine. Therefore, LCALL can be used to call
subroutines located anywhere within the 64K byte address space of the 8051.
13. Dr. C. SARITHA
DEPT. OF ELECTRONICS
LCALL target ; Jump to subroutine located at target address
ACALL (Absolute call) :
It is a 2-byte instruction. In which, the first byte is the op-code and the second byte is used for
the address of the target subroutine. ACALL can be used to call subroutines located within 2K
bytes address.
ACALL target ; Jump to subroutine located at target address
RET (Return) :
When a subroutine is called, control is transferred to that subroutine, and the processor saves the
PC (program counter) on the stack and begins to fetch instruction from the new location. After
finishing execution of the subroutine, the instruction RET (return) transfers control back to the
caller. Every subroutine needs RET as the last instruction.
RET ; control returns to main program
13
Data transfer instructions :
Data transfer instructions are used to transfer data between an internal RAM location and
SFR location, without going through the accumulator. Data can also be transferred between
the internal and external RAM by using indirect addressing. The upper 128 bytes of data RAM
are accessed only by indirect addressing and the SFRs are accessed only by direct addressing.
MOV (Move):
MOV destination, source ; destination = source
This instruction moves the source byte into the destination location. The source byte is not
affected.
Ex: MOV Ri, direct ; Ri = [direct]
MOV Ri, #data ; Ri = 8-bit immediate data
MOV DPTR, #data 16 ; DPTR = 16-bit immediate data
MOVC :
MOVC A,@A+<base register> ; A = Code byte from [@A+<base register>]
This instruction moves a code byte from program memory into ACC. The effective address of
the byte fetched is formed by adding the original 8-bit accumulator contents and the contents of
the base register, which is either the data pointer (DPTR) or program counter (PC). 16-bit
addition is performed and no flags are affected. The instruction is useful in reading the look-up
14. Dr. C. SARITHA
DEPT. OF ELECTRONICS
tables in the program memory. If the PC is used, it is incremented to the address of the
following instruction before being added to the ACC.
Ex: MOVC A,@A + PC ; A = Code byte from [@A+PC]
MOVC A,@A + DPTR ; A = Code byte from [@A+DPTR]
14
MOVX :
MOVX destination, source ; destination = source
This instruction transfers data between ACC and a byte of external data memory. There are two
forms of this instruction, the only difference between them is whether to use an 8-bit or 16-bit
indirect addressing mode to access the external data RAM.
Ex : MOVX @DPTR, A ; External[@DPTR] = A
MOVX @Ri, A ; External[@Ri] = A
MOVX A, @DPTR ; A = Data byte from external ram [@DPTR]
MOVX A, @Ri ; A = Data byte from external ram [@Ri]
PUSH :
PUSH direct ; PUSH into stack
This instruction increments the stack pointer (SP) by 1. The contents of Direct, which is an
internal memory location or a SFR, are copied into the internal RAM location addressed by the
stack pointer.
Ex: PUSH 22h
PUSH 56h
POP :
POP direct ; POP form stack
This instruction reads the contents of the internal RAM location addressed by the stack pointer
(SP) and decrements the stack pointer by 1. The data read is then transferred to the Direct
address which is an internal memory or a SFR.
Ex: POP DPH
POP DPL
XCH :
XCH A, byte ; A = byte, byte = A
This instruction swaps the contents of ACC with the contents of the indicated data byte.
Ex : XCH A, Ri ; A = Ri, Ri = A
15. Dr. C. SARITHA
DEPT. OF ELECTRONICS
XCH A, direct ; A = direct, direct = A
XCH A, @Ri ; A = @Ri, @Ri = A
15
XCHD :
XCHD A, @Ri ; Exchange lower order digits
This instruction exchanges the low order nibble of ACC (bits 0-3), with that of the internal RAM
location pointed to by Ri register. The high order nibbles (bits 7-4) of both the registers remain
the same.
Ex: XCHD A,@R1
Time delay generation and calculation :
For the CPU to execute an instruction takes a certain number of clock cycles. In the 8051
family, these clock cycles are referred to as machine cycles. To calculate the time delay, we use
this machine cycles. In the 8051 family, the length of the machine cycle depends on the
frequency of the crystal oscillator connected to the 8051 system. The crystal oscillator along
with on-chip circuitry, provide the clock source for the 8051 CPU.
In the 8051, one machine cycle lasts 12 oscillator periods. Therefore, to calculate the
machine cycle, we take 1/12 of the crystal frequency, then take its inverse.
If the crystal frequency is 11.0592MHz, then
Frequency of the machine cycle = 11.0592MHz/12 = 921.6 KHz
Time period of the machine cycle = 1/921.6KHz = 1.085 μs
Delay calculation :
A delay subroutine consists of two parts 1) setting a counter and 2) a loop. Most of the time
delay is performed by the body of the loop.
MOV A, #55 ; Move the data 55h to A
AGAIN: MOV P1, A ; Move the contents of A to Port1
LCALL DELAY ; Call delay subroutine
CPL A ; Complement the contents of A
SJMP AGAIN ; Go to label AGAIN
DELAY: MOV R3, #0FF ; Move the data FFh to register R3
HERE: DJNZ R3, HERE ; Decrement R3, if R3≠0, then go to label HERE
RET ; Return to main program
16. Dr. C. SARITHA
DEPT. OF ELECTRONICS
We have the following machine cycles for each instruction of the DELAY subroutine.
Machine cycles No. of times the
16
Instruction is executed
DELAY: MOV R3, #0FF 1 1
HERE: DJNZ R3, HERE 2 255
RET 1 1
Therefore, we have a time delay of [(1x1) + (2x255) + (1x1)] x 1.085 μs = 555.52 μs
Another way to get a large delay is to use a loop inside a loop, which is also called a nested loop.
Machine cycles No. of times the
Instruction is executed
DELAY: MOV R5, #0FF 1 1
LOOP: MOV R3, #0FF 1 255
HERE: DJNZ R3, HERE 2 255
DJNZ R5, LOOP 2 255
RET 1 1
Therefore, we have a time delay of [(1x1) + (1x255) + (2x255) + (2x255) + (1x1) ] x 1.085 μs =
1277 x 1.085 μs = 1385.545 μs
Assembly language programs :
Addition :
MOV A, #DATA1 ; DATA1 is moved to A
MOV R1, #DATA2 ; DATA2 is moved to R1
ADD A, R1 ; Add DATA1 and DATA2 and place the result in A
MOV DPTR, #8500 ; Load the DPTR with 8500h
MOVX @DPTR, A ; Store the content of A in 8500h
LJMP 03 ; User break
INPUT :
DATA1 = 12h
DATA2 = 15h
RESULT :
8500h – 27h
17. Dr. C. SARITHA
DEPT. OF ELECTRONICS
17
Subtraction :
CLR C
MOV A, #DATA1 ; DATA1 is moved to A
MOV R1, #DATA2 ; DATA2 is moved to R1
SUBB A, R1 ; Subtract DATA1 - DATA2 and place the result in A
MOV DPTR, #8500 ; Load the DPTR with 8500h
MOVX @DPTR, A ; Store the content of A in 8500h
LJMP 03 ; User break
INPUT :
DATA1 = 25h
DATA2 = 15h
RESULT :
8500h – 10h
Multiplication :
MOV A, #DATA1 ; DATA1 is moved to register A
MOV B, #DATA2 ; DATA2 is moved to register B
MUL AB ; Multiply the contents of A and B
MOV DPTR, #8500 ; Load the DPTR with 8500h
MOVX @DPTR, A ; Store the content of A (lower byte) in 8500h
INC DPTR ; Increment the DPTR by 1 (i.e., 8501h)
MOV A,B ; Move the contents of B to A
MOVX @DPTR, A ; Store the content of B (higher byte) in 8501h
LJMP 03 ; User break
INPUT :
DATA1 = 02h
DATA2 = 15h
RESULT :
8500h – 30h (Lower byte)
8501h – 00h (Higher byte)
18. Dr. C. SARITHA
DEPT. OF ELECTRONICS
18
Division :
MOV A, #DATA1 ; DATA1 is moved to register A
MOV B, #DATA2 ; DATA2 is moved to register B
DIV AB ; Divide the contents of A by B
MOV DPTR, #8500 ; Load the DPTR with 8500h
MOVX @DPTR, A ; Store the content of A (Quotient) in 8500h
INC DPTR ; Increment the DPTR by 1 (i.e., 8501h)
MOV A,B ; Move the contents of B to A
MOVX @DPTR, A ; Store the content of B (Remainder) in 8501h
LJMP 03 ; User break
INPUT :
DATA1 = 95h
DATA2 = 10h
RESULT :
8500h – 09h (Quotient)
8501h – 05h (Remainder)
Largest Number :
MOV DPTR, #8500 ; Load the data pointer with 8500h
MOV R1, #05 ; Move 05h (count) to register R1
MOV B, #00 ; Move 00h to register B
LOOP3: MOVX A, @DPTR ; Move the first data byte to A (i.e.,8500h)
CJNE A, B, LOOP1 ; If A≠B, then go to label LOOP1
LOOP1: JC LOOP2 ; If A<B (CY = 1), then go to label LOOP2
MOV B, A ; Move the contents of register A to B
INC DPTR ; DPTR is incremented by 1
DJNZ R1, LOOP3 ; Decrement R1, if R1≠0, then go to label LOOP3
SJMP LOOP4 ; Jump to label LOOP4
LOOP2: INC DPTR ; DPTR is incremented by 1
DJNZ R1, LOOP3 ; Decrement R1, if R1≠0, then go to label LOOP3
LOOP4: MOV A, B ; Move the contents of register B to A
MOV DPTR, #8600 ; Load the DPTR with 8600h
19. Dr. C. SARITHA
DEPT. OF ELECTRONICS
MOVX @DPTR, A ; Move the contents of register A to 8600h
LJMP 03 ; User break
INPUT :
8500h – 23h
8501h – 43h
8502h – 56h
8503h – 12h
8504h – 34h
RESULT :
8600h – 56h
19
Smallest Number :
MOV DPTR, #8500 ; Load the data pointer with 8500h
MOV R1, #05 ; Move 05h (count) to register R1
MOV B, #0FF ; Move 00h to register B
LOOP3: MOVX A, @DPTR ; Move the first data byte to A (i.e.,8500h)
CJNE A, B, LOOP1 ; If A≠B, then go to label LOOP1
LOOP1: JNC LOOP2 ; If A>B (CY = 0), then go to label LOOP2
MOV B, A ; Move the contents of register A to B
INC DPTR ; DPTR is incremented by 1
DJNZ R1, LOOP3 ; Decrement R1, if R1≠0, then go to label LOOP3
SJMP LOOP4 ; Jump to label LOOP4
LOOP2: INC DPTR ; DPTR is incremented by 1
DJNZ R1, LOOP3 ; Decrement R1, if R1≠0, then go to label LOOP3
LOOP4: MOV A, B ; Move the contents of register B to A
MOV DPTR, #8600 ; Load the DPTR with 8600h
MOVX @DPTR, A ; Move the contents of register A to 8600h
LJMP 03 ; User break
INPUT :
8500h – 23h
8501h – 43h
8502h – 56h
20. Dr. C. SARITHA
DEPT. OF ELECTRONICS
20
8503h – 12h
8504h – 34h
RESULT :
8600h – 12h
Ascending order :
MOV R0, #05 ; Move the count 05h to register R0
LOOP3: MOV DPTR, #8500 ; Load the DPTR with 8500h
MOV A, R0 ; Move the contents of R0 to register A
MOV R1, A ; Move the contents of A to register R1
LOOP2: MOVX A, @DPTR ; Move the contents of DPTR to register A
MOV B, A ; Move the contents of A to register B
INC DPTR ; Increment the DPTR by 1
MOVX A, @DPTR ; Move the contents of DPTR to register A
CLR C ; Clear the Carry (CY = 0)
MOV R2, A ; Move the contents of A to register R2
SUBB A, B ; Subtract A – B, if A>B then CY=0 else CY=1
JNC LOOP1 ; If CY=0, then go to label LOOP1
MOV A, B ; Move the contents of A to register B
MOVX @DPTR, A ; Move the contents of A to DPTR
DEC DPTR ; Decrement the DPTR by 1
MOV A, R2 ; Move the contents of R2 to register A
MOVX @DPTR, A ; Move the contents of A to DPTR
LOOP1: DJNZ R1, LOOP2 ; Decrement R1 by1, if R1≠0, then go to LOOP2
DJNZ R0, LOOP3 ; Decrement R0 by 1, if R0≠0, then go to LOOP3
LJMP 03 ; Stop the execution
INPUT :
8500h – 23h
8501h – 43h
8502h – 56h
8503h – 12h
8504h – 34h
21. Dr. C. SARITHA
DEPT. OF ELECTRONICS
21
RESULT :
8500h – 12h
8501h – 23h
8502h – 34h
8503h – 43h
8504h – 56h
Descending order :
MOV R0, #05 ; Move the count 05h to register R0
LOOP3: MOV DPTR, #8500 ; Load the DPTR with 8500h
MOV A, R0 ; Move the contents of R0 to register A
MOV R1, A ; Move the contents of A to register R1
LOOP2: MOVX A, @DPTR ; Move the contents of DPTR to register A
MOV B, A ; Move the contents of A to register B
INC DPTR ; Increment the DPTR by 1
MOVX A, @DPTR ; Move the contents of DPTR to register A
CLR C ; Clear the Carry (CY = 0)
MOV R2, A ; Move the contents of A to register R2
SUBB A, B ; Subtract A – B, if A>B then CY=0 else CY=1
JC LOOP1 ; If CY=1, then go to label LOOP1
MOV A, B ; Move the contents of A to register B
MOVX @DPTR, A ; Move the contents of A to DPTR
DEC DPTR ; Decrement the DPTR by 1
MOV A, R2 ; Move the contents of R2 to register A
MOVX @DPTR, A ; Move the contents of A to DPTR
LOOP1: DJNZ R1, LOOP2 ; Decrement R1 by1, if R1≠0, then go to LOOP2
DJNZ R0, LOOP3 ; Decrement R0 by 1, if R0≠0, then go to LOOP3
LJMP 03 ; Stop the execution
INPUT :
8500h – 23h
8501h – 43h
8502h – 56h
22. Dr. C. SARITHA
DEPT. OF ELECTRONICS
22
8503h – 12h
8504h – 34h
RESULT :
8500h – 56h
8501h – 43h
8502h – 34h
8503h – 23h
8504h – 12h
Generation of a square wave :
HERE: SETB P1.0 ; Make P1.0 = 1
LACLL DELAY ; Call delay subroutine
CLR P1.0 ; Make P1.0 = 0
LCALL DELAY ; Call delay subroutine
SJMP HERE ; Go to label HERE
DELAY: MOV R3, #0FF ; Load R3 with FFh
LOOP: DJNZ R3, LOOP ; Decrement R3 by1 and if R3≠0 go to label LOOP
RET ; Return to main program
Generation of a rectangular wave :
HERE: SETB P1.0 ; Make P1.0 = 1
LACLL DELAY1 ; Call delay subroutine
CLR P1.0 ; Make P1.0 = 0
LCALL DELAY2 ; Call delay subroutine
SJMP HERE ; Go to label HERE
DELAY1: MOV R5, #0FF ; Load R5 with FFh
23. Dr. C. SARITHA
DEPT. OF ELECTRONICS
LOOP: MOV R6, #0FF ; Load R6 with FFh
HERE: DJNZ R6, HERE ; Decrement R6 by1 and if R6≠0 go to label HERE
DJNZ R5, LOOP ; Decrement R5 by1 and if R5≠0 go to label LOOP
RET ; Return to main program
DELAY2: MOV R3, #0FF ; Load R3 with FFh
LOOP: DJNZ R3, LOOP ; Decrement R3 by1 and if R3≠0 go to label LOOP
RET ; Return to main program
@@@
23