Presentation 2
Presentation 2
M I C RO C O N T RO L L E R
PREVIOUS YEAR
SUBJECTIVE
(22-25)
4M ARKS (2 022 )
1:- WRITE THE DIFFRENT ADDRESSING MODES OF 8085 MICROPROCESSOR. EXPLAIN ANY TWO.
ANS:- THE DIFFERENT ADDRESSING MODES OF THE 8085 MICROPROCESSOR:
1. IMMEDIATE ADDRESSING
2. DIRECT ADDRESSING
3. INDIRECT ADDRESSING
4. REGISTER ADDRESSING
5. REGISTER INDIRECT ADDRESSING
6. STACK ADDRESSING
7. INDEXED ADDRESSING
NOW; EXPLAIN TWO ADDRESSING MODES:
1. IMMEDIATE ADDRESSING
- SYNTAX: OPCODE #DATA
- EXAMPLE: MVI A, #05H (MOVE 05H INTO ACCUMULATOR)
- OPERATION: THE DATA IS EMBEDDED IN THE INSTRUCTION ITSELF.
2. DIRECT ADDRESSING
- SYNTAX: OPCODE ADDRESS
- EXAMPLE: MOV A, 2050H (MOVE DATA FROM 2050H TO ACCUMULATOR)
- OPERATION: THE MEMORY ADDRESS IS SPECIFIED DIRECTLY IN THE INSTRUCTION.
2. Explain in brief the function of DPTR in 8051 micro controller?
Ans:- In the 8051 microcontroller, the Data Pointer (DPTR) is a 16-bit register that plays a crucial
role in data transfer and memory addressing.
Functions of DPTR:
1. Memory Addressing: DPTR holds the 16-bit memory address for data transfer.
2. Data Transfer: DPTR facilitates data transfer between registers and memory.
3. Indirect Addressing: DPTR enables indirect addressing mode.
Operations:-
1. Immediate Addressing
2. Direct Addressing Other addressing modes:
3. Indirect Addressing
4. Register Addressing - Indirect Addressing: MOV A, @R0 (Move data from address in
5. Register Indirect Addressing R0 to Accumulator)
6. Indexed Addressing - Register Addressing: MOV A, B (Move data from B to A)
7. Stack Addressing - Register Indirect Addressing: MOV A, @DPTR (Move data
from address in DPTR to Accumulator)
Let's explain two addressing modes: - Indexed Addressing: MOV A, 20H + A (Move data from 20H +
Accumulator to Accumulator)
1.Immediate Addressing - Stack Addressing: PUSH ACC (Push Accumulator onto stack)
- Syntax: MOV A, #data
- Example: MOV A, #0FH (Move 0FH into Accumulator)
- Operation: The data is embedded in the instruction itself.
2.Direct Addressing
- Syntax: MOV A, addr
- Example: MOV A, 20H (Move data from 20H to Accumulator)
- Operation: The memory address is specified directly in the instruction.
9. Explain in brief evolution of micro controller.
Ans:- brief evolution of microcontrollers: • Sixth Generation (2005-Present)
• First Generation (1971-1975) 1. ARM Cortex-M3 (2006): 32-bit, high-performance
1. Intel 4004 (1971): First microprocessor 2. 100 MHz, 512 KB memory
2. 4-bit, 740 kHz, 1 KB memory 3. Integrated DSP, USB, Ethernet
• Second Generation (1975-1980) • Current Trends
1. Intel 8048 (1977): First microcontroller 1. IoT-focused microcontrollers
2. 8-bit, 11 MHz, 1 KB memory 2. Low-power consumption
3. Integrated peripherals (timers, I/O) 3. Integration of AI, machine learning
• Third Generation (1980-1985) 4. Wireless connectivity (Wi-Fi, Bluetooth)
1. Intel 8051 (1980): Popular 8-bit microcontroller 5. Secure boot, encryption
2. 12 MHz, 4 KB memory • Key players:
3. Expanded peripherals (serial communication, interrupts) 1. Intel
• Fourth Generation (1985-1995) 2. Microchip
1. Motorola 68HC11 (1984): 8-bit microcontroller 3. Texas Instruments
2. 16 MHz, 16 KB memory 4. STMicroelectronics
3. On-chip EEPROM, ADC 5. NXP Semiconductors
• Fifth Generation (1995-2005) 6. ARM Holdings
1. Microchip PIC16C84 (1994): Low-cost, high-performance
2. 20 MHz, 16 KB memory
3. Flash memory, I2C, SPI
10. Explain the following instruction in 8051 micro controller.SUBB, ADDC, SJMP, and LCALL.
Ans:- SUBB (Subtract with Borrow) • LCALL (Long Call)
- Syntax: SUBB A, Rn (Rn = Register) - Syntax: LCALL addr (addr = 16-bit address)
- Operation: A = A - Rn - Borrow - Operation: PC = addr
- Description: Subtracts the contents of register Rn and the borrow flag from - Description: Unconditionally calls a subroutine
the Accumulator (A). located at the specified 16-bit address.
- Example: SUBB A, B (Subtract B and borrow from A) - Example: LCALL SUB_ROUTINE (Call
SUB_ROUTINE)
• ADDC (Add with Carry)
- Syntax: ADDC A, Rn (Rn = Register) • Additional Information
- Operation: A = A + Rn + Carry - All instructions are 1-3 bytes long.
- Description: Adds the contents of register Rn and the carry flag to the - Rn can be any of the 8051 registers (A, B, C,
Accumulator (A). D, E, H, L).
- Example: ADDC A, B (Add B and carry to A) - Offset is a signed 8-bit value.
- Addr is a 16-bit address.
• SJMP (Short Jump)
- Syntax: SJMP offset (offset = -128 to 127) • Flags Affected
- Operation: PC = PC + offset - SUBB: CY (Carry), AC (Auxiliary Carry), OV
- Description: Unconditionally jumps to a location within 128 bytes of the (Overflow)
current program counter (PC). - ADDC: CY, AC, OV
- Example: SJMP LABEL (Jump to LABEL) - SJMP: None
- LCALL: None
6 MARKS
1. Draw and explain the Architecture of 8085 microprocessor.
ANS:- The 8085 microprocessor is an 8-bit microprocessor developed by Intel in the mid-1970s. It is capable
of addressing 64KB of memory and has a 16-bit address bus. Here is a basic architecture diagram of the 8085
microprocessor:
Explanation of the 8085 2. Registers:- 6. Memory Organization:-
microprocessor architecture:- - Accumulator (A)
- Flag Register (F) - Program Memory (up to 64 KB)
Block Diagram: - General Purpose Registers (B, C, D, E, - Data Memory (up to 64 KB)
H, L) - Stack Memory
1. Arithmetic Logic Unit (ALU) - Stack Pointer (SP)
2. Registers - Program Counter (PC) 7. Input/Output (I/O) System:-
3. Instruction Decoder - 40 pins for I/O operations
4. Control Unit 3. Instruction Decoder:- - Supports 256 I/O devices
5. Bus System
6. Memory Organization - Decodes instructions 8. Interrupt Control:-
7. Input/Output (I/O) System - Generates control signals
8. Interrupt Control - 5 interrupt inputs
4. Control Unit:- - RST 7.5, RST 6.5, RST 5.5, TRAP,
Components:- INTR
- Manages data transfer
1. Arithmetic Logic Unit (ALU):- - Generates control signals Signal Flow:-
- Handles interrupts
- 8-bit ALU 1. Instruction Fetch
- Performs arithmetic and logical 5. Bus System:- 2. Instruction Decode
operations - Address Bus (16-bit) 3. Operand Fetch
- Flags: CY (Carry), P (Parity), Z (Zero), S - Data Bus (8-bit) 4. Execution
(Sign) - Control Bus 5. Data Store
Key Features:
8085 Instruction Set:
- 8-bit processor
- 4.77 MHz clock speed - 78 instructions
- 64 KB memory address space - 1-3 byte instructions
- Single +5V power supply - Supports various addressing modes.
- Low power consumption
Applications:
- Embedded systems
- Industrial control
- Consumer electronics
- Robotics
- 40 pins
- Divided into:
- Address pins (A0-A15)
- Data pins (D0-D7)
- Control pins (RD, WR, IO/M, etc.)
- Power and Ground pins
2. Describe the various classification of 8051 instruction set.
ANS:- The 8051 instruction set can be classified into several categories:
5. Bit Manipulation Instructions
1. Data Transfer Instructions
- Perform bit-level operations
- Move data between registers, memory, and Accumulator
- Examples: SETB, CLR, MOV C
- Examples: MOV, MOVC, MOVX
6. I/O Instructions
2. Arithmetic Instructions
- Input/Output operations
- Perform arithmetic operations
- Examples: MOVX, MOVC
- Examples: ADD, SUBB, MUL, DIV
7. Stack Operations
3. Logical Instructions
- Push and pop data from the stack
- Perform bitwise logical operations
- Examples: PUSH, POP
- Examples: AND, ORL, XRL
8. Miscellaneous Instructions
4. Control Transfer Instructions
- NOP (No Operation), RESET, etc.
- Unconditional jumps, conditional jumps, and subroutine calls
- Examples: JMP, JZ, JNC, LCALL, RET
Instruction Classification by Operand Type
The 8051 instruction set consists of 111 instructions, each with its own opcode, operand type, and execution time.
3. Draw the pin diagram of 8085 microprocessor and explain in brief.
ANS:- The pin diagram of the Intel 8085 microprocessor shows the various pins and their functions, including:-
• Power supply: The Vcc pin provides a +5V power supply voltage.
• It has an operating voltage of 5V and a clock frequency between 500KHz and 3MHz.
• The 8085 uses a multiplexed address/data bus to maximize the functions on the available pins.
• The 8085 requires an 8-bit address latch, so Intel manufactured several support chips with an address latch built in.
• The 8085 was introduced in March 1976 and was Intel's last 8-bit microprocessor.
4.Draw block diagram of 8051 microcontroller. Explain function of each block.
2. Memory Organization
4. Timer/Counter
5. Serial Communication
6. Interrupt Control
7. Oscillator Circuit
Function of Each Block: 6. Interrupt Control:
- 5 interrupt sources (External, Timer 0, Timer 1, Serial, and Internal)
1. Central Processing Unit (CPU): - Prioritizes and handles interrupts
- Executes instructions
- Performs arithmetic and logical operations 7. Oscillator Circuit:
- Manages data transfer - Generates clock signal for CPU operation
- External crystal or ceramic resonator required.
2. Memory Organization:
- 4 KB On-Chip Program Memory (ROM) Additional Features:
- 128 Bytes On-Chip Data Memory (RAM)
- External Memory Interface (up to 64 KB) - Low power consumption
- Single +5V power supply
3. Input/Output (I/O) Ports: - 80/40 pins DIP/PLCC package
- 4 ports (P0, P1, P2, P3) for I/O operations
- 40 pins for I/O connectivity Applications:
4. Timer/Counter: - Embedded systems
- 2 timers (Timer 0, Timer 1) - Industrial control
- Counts external events or generates time delays - Consumer electronics
- Robotics
5. Serial Communication: - Automotive systems
- Serial Communication Interface (SCI)
- Supports asynchronous serial communication
5. Draw and explain pin diagram of 8051 micro controller.
• Oscillator Circuit:
- XTAL1 (Crystal input): Pin 19
- XTAL2 (Crystal output): Pin 18
6. A). Describe the function of SFRs.
List of SFRs:
ANS:- Special Function Registers (SFRs) in 8051 microcontroller: 16. TH0 (Timer 0 High)
17. TH1 (Timer 1 High)
Description: 18. SCON (Serial Control)
19. SBUF (Serial Buffer)
SFRs are a set of 21 registers that provide control and status information 20. IE (Interrupt Enable)
for various 8051 microcontroller functions. 21. IP (Interrupt Priority)
Interrupts
Key Considerations
- Receive Interrupt (RI)
- Transmit Interrupt (TI) - Baud rate matching between devices
- Data format consistency
- Interrupt handling
7. Describe various timers / counters in 8051 micro controller with the help of neat diagram.
ANS:- The 8051 microcontroller has two timers/counters, Timer 0 and Timer 1, which can operate in various modes.
Timer/Counter Operations
Mode 3 of Timer/Counter
Mode 3 is different for Timer0 and Timer1. When the Timer0 is working in mode 3,
the TL0 will be used as an 8-bit timer/counter. It will be controlled by the standard
Timer0 control bits, T0 and INT0 inputs. The TH0 is used as an 8-bit timer but not
the counter.
8.Explain Harvard architecture in micro contoller.
ANS:- Harvard Architecture in Microcontrollers:
Overview
Harvard Architecture Components
Harvard architecture is a computer architecture that separates the memory
1. Program Memory (PM):
spaces for program instructions and data. This design improves performance,
- Stores program instructions
security, and efficiency.
- Typically ROM, EPROM, or Flash
2. Data Memory (DM):
Key Features
- Stores data variables
- Typically RAM
1. Separate Program Memory (PM) and Data Memory (DM)
3. Program Counter (PC):
2. Independent buses for PM and DM
- Keeps track of current instruction
3. Program Counter (PC) and Data Pointer (DP) registers
address
4. Instruction and Data caches (optional)
4. Data Pointer (DP):
- Points to current data location
Advantages
5. Instruction Decoder:
- Decodes program instructions
1. Improved performance: Separate buses reduce memory contention
6. Arithmetic Logic Unit (ALU):
2. Enhanced security: Program memory is protected from data corruption
- Performs arithmetic and logical
3. Increased efficiency: Reduced memory access conflicts
operations
4. Simplified debugging: Separate memory spaces ease debugging
Microcontroller Implementation:-
Programming Considerations
Overview
Example Code
assembly
; Configure P0 as output
MOV P0, #0xFF ; Set all pins high
; Read P1 pins
MOV A, P1 ; Read P1 into Accumulator
10.Write an assembly language program to find the largest number in a data array.
(4MARKS)2023.
1.Discuss the evolution of microprocessor in brief.
ANS:- The evolution of microprocessors has transformed computing, enabling smaller, faster, and more powerful
devices.
Generations:-
INCA Instruction:
Example:
INCA is an assembly language instruction in 8051
microcontroller that increments the value in the Accumulator
(A) by 1. MOV A, #0FH ; Load 0FH into Accumulator
INCA ; Increment Accumulator (A = 10H)
Syntax: INCA
Operation: A = A + 1
Flags Affected:
SCON is a Special Function Register (SFR) in 8051 microcontroller that controls serial
communication.
Example:
The 8051 microcontroller has four power-saving modes to reduce power - Use instructions: IDL, POWER DOWN, or
consumption: STOP CLOCK
- Configure Power Control Register (PCON)
1. Idle Mode:
Benefits:
- CPU halted, peripherals active
- Power consumption: 20-50% of normal operation - Reduced power consumption
- Exit: External interrupt or hardware reset - Increased battery life
- Improved system efficiency
1. Power Down Mode (Power-Off Mode):
Applications:
- CPU halted, peripherals disabled
- Power consumption: 1-10% of normal operation - Battery-powered devices
- Exit: External interrupt or hardware reset - Low-power embedded systems
- IoT devices.
1. Stop Clock Mode:
- Oscillator stopped, CPU halted
- Power consumption: minimal (near zero)
- Exit: External reset or oscillator restart
7.Write down the diffrent control pins of 8085 microprocessor and discuss the use of each single pin.
Overview
```Key Components*
1. CPU: 8-bit ALU, 8-bit Registers (A, B, C, etc.)
2. Program Memory: 4KB on-chip ROM, expandable to 64KB
3. Data Memory: 128 bytes on-chip RAM
4. Stack Memory: 256 bytes
5. I/O Ports: 32 pins (4 ports: P0, P1, P2, P3)
6. Timer/Counter: 2 x 16-bit timers (Timer 0, Timer 1)
7. Serial Communication: UART (Universal Asynchronous Receiver-
Transmitter)
Features
Applications
1. 12 MHz clock speed
2. 64 KB program memory address space 1. Embedded systems
3. 128 bytes data memory 2. Robotics
4. 32 I/O pins 3. Industrial control
5. 2 timers 4. Automotive systems
6. Serial communication 5. Consumer electronics
7. Low power consumption
Programming
1. Assembly language
2. C programming
3. Keil, SDCC, and other compilers
3.Discuss diffrent version of microcontroller with their specification.
ANS:-Microcontrollers (MCUs) have evolved significantly, with various versions offering improved performance, features,
and power efficiency. Here's a discussion on different versions of microcontrollers, their specifications, and applications:
8-bit Microcontrollers
1. Intel 8051
16-bit Microcontrollers
- 8-bit CPU, 4KB ROM, 128B RAM
- 12 MHz clock speed
1. Intel 8096
- 32 I/O pins
- 16-bit CPU, 16KB ROM, 256B RAM
- Applications: Industrial control, robotics
- 16 MHz clock speed
- 64 I/O pins
2. AVR ATmega328P (Arduino Uno)
- Applications: Industrial control, medical devices
- 8-bit CPU, 32KB Flash, 2KB SRAM
- 20 MHz clock speed
2. MSP430F149 (Texas Instruments)
- 23 I/O pins
- 16-bit CPU, 60KB Flash, 2KB SRAM
- Applications: DIY projects, robotics, IoT
- 8 MHz clock speed
- 48 I/O pins
3. PIC16F877A (Microchip)
- Applications: Low-power devices, IoT
- 8-bit CPU, 14.3KB Flash, 368B RAM
- 20 MHz clock speed
- 33 I/O pins
- Applications: Industrial control, automotive
32-bit Microcontrollers Specialized Microcontrollers
An interrupt is a signal to the microcontroller that an event has occurred, requiring immediate
attention. It temporarily suspends the normal execution of the program, executes a specialized
routine (Interrupt Service Routine, ISR), and then returns to the main program.
Interrupt Types:
8051 Microcontroller Interrupts:
1. External Interrupts (IE0, IE1):
The 8051 has five interrupt sources, each with a unique priority level.
- Triggered by external events (e.g., button press).
| Interrupt Source | Priority Level | Vector Address | - IE0 has higher priority than IE1.
| --- | --- | --- |
| External Interrupt 0 (IE0) | Highest | 0003H | 2. Timer Interrupts (TF0, TF1):
| Timer 0 Overflow (TF0) | Medium | 000BH |
| External Interrupt 1 (IE1) | Medium | 0013H | - Generated when timer/counter overflows.
| Timer 1 Overflow (TF1) | Medium | 001BH | - Used for timing, counting, and waveform generation.
| Serial Interrupt (RI/TI) | Lowest | 0023H |
3. Serial Interrupt (RI/TI):
Types of SFRs:
Accessing SFRs:
1. Control Registers (e.g., IE, IP)
2. Status Registers (e.g., PSW, SCON) 1. Direct addressing
3. Data Registers (e.g., SBUF, ACC) 2. Indirect addressing
4. Timer/Counter Registers (e.g., TL0, TH0)
Importance: SFRs play a crucial role in 8051
Key Features: programming, allowing efficient control and
monitoring of peripheral functions.
1. Control peripheral functions (timers, serial communication, etc.)
2. Provide status information (interrupts, flags, etc.)
3. Used for data transfer and manipulation
Examples of SFRs:
1. P0 (Port 0)
2. SP (Stack Pointer)
3. IE (Interrupt Enable)
4. SCON (Serial Control)
C).Here are short notes on RAM and ROM of 8051
ROM (Read-Only Memory)
architecture:
RAM (Random Access Memory)
Definition: ROM is a non-volatile memory that stores
program code permanently.
Definition: RAM is a volatile memory that stores data
temporarily.
8051 ROM Features:
8051 RAM Features:
1. 4KB of internal ROM
2. Stores program code and constants
1. 128 bytes of internal RAM
3. Non-volatile (retains data when power off )
2. Divided into four banks (32 bytes each)
4. Accessible using code memory addressing
3. Accessible using direct or indirect addressing
4. Stores variables, stack, and program data
Types of ROM:
Types of RAM:
1. Internal ROM (4KB)
2. External ROM (up to 64KB)
1. Internal RAM (128 bytes)
2. External RAM (up to 64KB)
Key Features:
Key Features:
1. Non-volatile (retains data when power off )
1. Volatile (loses data when power off )
2. Slow write time (during programming)
2. Fast access time
3. Used for program storage and execution
3. Used for data manipulation and storage
4MARKS(2024)
1.Compare von neumann and hardward architecture.
Advantages:
The 8085 microprocessor has a total of 246 instructions, classified into the following groups:
3. Logical Group
1. Data Transfer Group
- MOV (Move) - ANA (And)
- MVI (Move Immediate) - ORA (Or)
- LXI (Load Register Pair Immediate) - XRA (Xor)
- LDAX (Load Register Indirect) - CMP (Compare)
- STAX (Store Register Indirect) - CMA (Complement)
- XCHG (Exchange) Performs bitwise logical operations.
Transfers data between registers, memory, and I/O devices.
4. Control Group
2. Arithmetic Group - JMP ( Jump)
- ADD (Add) - JC (Jump if Carry)
- SUB (Subtract) - JNC (Jump if No Carry)
- INR (Increment) - JZ (Jump if Zero)
- DCR (Decrement) - JNZ (Jump if Not Zero)
- MUL (Multiply) - CALL (Call Subroutine)
- DIV (Divide) - RET (Return)
Performs arithmetic operations. Controls program flow.
5. Branching Group 7. Miscellaneous Group
- PUSH (Push)
- POP (Pop)
- OUT (Output)
- IN (Input)
- XTHL (Exchange Top of Stack and HL)
1. Saves context
2. Executes interrupt handling code
3. Restores context
4. Returns from interrupt (RET or REti)
1. EI (Enable Interrupts)
2. DI (Disable Interrupts)
3. SIM (Set Interrupt Mask)
4. RIM (Read Interrupt Mask)
5. RST (Restart)
assembly
; Addition of two 8-bit hexadecimal numbers assembly
; Addition of two 8-bit hexadecimal numbers
ORG 0000H ; Origin at 0000H
ORG 0000H ; Origin at 0000H
LXI H, 0000H ; Initialize HL pair with 0000H
MVI A, 0AH ; Load accumulator with first number (0AH) MVI A, 0AH ; Load accumulator with first
MVI B, 05H ; Load register B with second number (05H) number (0AH)
ADD B ; Add contents of B to A MVI B, 05H ; Load register B with second
MOV H, A ; Move result to HL pair (low byte) number (05H)
MVI L, 00H ; Clear high byte of HL pair ADD B ; Add contents of B to A
HLT ; Halt program HLT ; Halt program
END END
Explanation:
2. MVI A, 0AH: Loads the accumulator (A) with the first number (0AH).
5. MOV H, A and MVI L, 00H: Stores the result in the HL register pair (low byte).
Input:
- First number: 0AH (10 decimal)
- Second number: 05H (5 decimal)
Output:
- Result: 0FH (15 decimal)
Timer/Counter Modes:
Mode 0 Configuration:
1. Mode 0: 13-bit Timer/Counter
1. TMOD (Timer Mode) register: Set bit 0 and 1 to 0
2. Mode 1: 16-bit Timer/Counter
(TMOD = 00xx xxxx)
3. Mode 2: 8-bit Auto-Reload Timer/Counter
2. TCON (Timer Control) register: Set bit 4 (TF0) to 0
4. Mode 3: Split Timer/Counter
Mode 0 Operation:
Mode 0 Operation (13-bit Timer/Counter)
1. Counter increments every clock cycle (Fosc/12)
In Mode 0, the timer/counter operates as a 13-bit timer/counter.
2. When counter overflows (reaches FFFFH), TF0 flag is
set
Key Features:
3. Overflow interrupt is generated if enabled (IE.0 = 1)
1. 13-bit counter (TH0 and TL0)
2. External clock source (optional)
3. Internal clock source (Fosc/12)
4. Overflow interrupt generated when counter overflows
Timer/Counter Registers:
Example Code:
1. TH0 (Timer 0 High Byte)
2. TL0 (Timer 0 Low Byte)
assembly
3. TMOD (Timer Mode)
; Mode 0 Timer/Counter example
4. TCON (Timer Control)
5. IE (Interrupt Enable)
ORG 0000H
; Initialize Timer 0
MOV TMOD, #00H ; Mode 0
In Mode 0, the timer/counter operates as a 13-bit counter,
MOV TH0, #0FFH ; Initial value
incrementing every clock cycle. When the counter overflows, an
MOV TL0, #0FFH
interrupt is generated.
SETB TR0 ; Start timer
END
2.Explain serial communication and its diffrent modes in microcontroller 8051.
ANS:- Serial Communication in 8051 Microcontroller Mode 2: 9-bit UART Mode
Serial communication is a method of transmitting data one bit at 1. 9-bit serial transmission (1 start bit, 8 data bits, 1
a time, sequentially, over a communication channel. stop bit)
2. Internal baud rate generation
Serial Communication Modes in 8051: 3. Full-duplex communication
The 8051 microcontroller supports three serial communication Mode 3: 9-bit UART Mode with Fixed Baud Rate
modes:
1. 9-bit serial transmission (1 start bit, 8 data bits, 1
Mode 0: Shift Register Mode stop bit)
2. Fixed baud rate (1/32 of oscillator frequency)
1. 8-bit serial transmission
2. External clock source Serial Communication Registers:
3. No baud rate generation
1. SCON (Serial Control Register)
Mode 1: 8-bit UART Mode 2. SBUF (Serial Buffer Register)
3. PCON (Power Control Register)
1. 8-bit serial transmission
2. Internal baud rate generation
3. Full-duplex communication
Serial Communication Parameters:
1. Baud Rate
2. Data Bits (8 or 9)
3. Stop Bits (1 or 2)
4. Parity (Even, Odd, or None)
``assembly Explanation:
; Subtraction program
1. ORG 0000H: Sets the origin address to 0000H.
ORG 0000H
2. MOV A, #98H: Loads the accumulator (A) with 98H.
; Load operands
MOV A, #98H ; Load 98H into accumulator 3. MOV B, #23H: Loads register B with 23H.
MOV B, #23H ; Load 23H into register B
4. SUBB A, B: Subtracts B from A with borrow.
; Subtract B from A
SUBB A, B ; Subtract B from A with borrow 5. MOV R0, A: Stores the result in register R0.
- Accumulator (A)
- Register B
- Register R0
A Pulse Width Modulator (PWM) is a digital technique used to 1. Power control (motor speed, LED brightness)
generate a pulse wave with variable width, allowing control over 2. Audio amplification
the average power delivered to a load. 3. DC-DC conversion
4. Class-D amplifiers
Key Features: 5. Lighting control
6. Heating control
1. Variable pulse width 7. Servo motor control
2. Fixed frequency PWM in Microcontrollers:
3. Digital control
Most microcontrollers have built-in PWM modules.
How PWM Works:
8051 PWM Example:
1. Compare a reference signal with a triangle/sawtooth wave.
2. Generate a pulse when the reference signal exceeds the The 8051 has two 16-bit timer/counter registers
triangle/sawtooth wave. (Timer 0 and Timer 1) that can be used for PWM
3. Pulse width determined by reference signal amplitude. generation.
Configuration:
Benefits:
1. Set timer mode to Mode 2 (PWM mode)
1. High efficiency
2. Load timer value with desired pulse width
2. Low power consumption
3. Enable PWM output
3. Precise control
Example Code (8051): 4. Flexibility