ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
UNIT II
8085 MICROPROCESSOR AND
8051 MICROCONTROLLER
MICROPROCESSOR
• It is a semiconductor component that
incorporates the functions of a central
processing unit (CPU) on a single integrated
circuit (IC) . i.e., the central processing unit (CPU)
built on a single IC is called microprocessor.
MICROPROCESSOR
• It is multipurpose, programmable and clock
driven,
• Register based electronic device that reads
binary instructions from a storage device called
memory,
• Accept binary data as input, process the data
according to the instruction and provides
results as output.
Functional Block diagram of
Microprocessor
ALU Register Array
Control
Microprocessor
Functional Block diagram of
Microprocessor
• ALU (Arithmetic and Logic Unit)
– It carries out arithmetic and logic operations on 8
bit word.
– Arithmetic operation – addition, subtraction ,
multiplication , division etc.,
– Logic operation - AND,OR,EX-OR
– The content of accumulator and temporary
register are the input to the ALU.
– ALU output is stored in accumulator
• Register array
– Register is a storage unit within the
microprocessor used to store the data, address of
instruction of any program.
– Microprocessor contained 6 general purpose
register it has 8- bit memory
– Registers are B,C,D,E,H and L
– To hold 16-bit data a combination of two 8-bit
registers can be used.
– The combination of two 8-bit registers is known as
Register Pair (BC, DE and HL).
– These Registers are used to store data temporarily
during execution of the program.
• Control Unit
– The timing and control unit acts as the brain of a
computer.
– It controls all operations of the CPU.
– It controls input, output and all other devices
connected to the CPU.
Evolution of Microprocessor
• First generation Microprocessor
– 1st Microprocessor, Intel 4004, a 4 bit PMOS
Microprocessor introduced in 1971 by the Intel
corporation, USA.
– It has limited memory
– An enhanced version of Intel 4004 is Intel 4040.
– e.g., Toshiba’s 73472, Rockwell International’s
PPS-4 National IMP-4 etc.,
Evolution of Microprocessor
• Second generation Microprocessor
– In 1972, Intel introduced 8- bit Microprocessor
named as Intel 8008, which also uses PMOS
technology.
– But this technology was slow and not compatible
with TTL logic
– In 1973, Intel introduced more powerful and fast
8- bit NMOS Microprocessor called Intel 8080
– Intel 8085 is the improved version of Intel 8080
• Third generation Microprocessor
– In 1978 Intel introduced a 16- bit Microprocessor
called Intel 8086.
– Other 16- bit Microprocessor are Intel 80186, Intel
80286, zilog’s z8000, Motorola’s 68000, 68010 etc.,
• Forth generation Microprocessor
– In 1985 Intel introduced a 32- bit Microprocessor
called Intel 60386
• Fifth generation Microprocessor
– Intel i860 is a 64 bit RISC microprocessor
Architecture of 8085
• Three main section
– ALU
– Timing and Control unit
– Set of register
ARCHITECTURE OF 8085
• ALU
– Addition, Subtraction, Logical AND,OR…etc
• Timing and Control Unit
– Controls the entire operation of the microprocessor
• Register
– 1- 8 bit Accumulator….i.e.-register A (ACC)
– 6-8 bit general purpose register (B,C,D,E,H & L)
– 1- 16 bit register –SP(Stack Pointer)
– 1 -16 bit –PC (Program Counter)
– Instruction register
– Temporary register
– Flag register
• Flag register
– Carry flag (CY) – it is set, If carry or borrow occurs
during the arithmetic operation.
– Parity flag (P) – it is set, if the result has even number
of it otherwise made 0.
– Auxiliary carry flag (AC) – Binary coded decimal
operations (BCD)
– Zero flag (z) – is set if the result becomes 0
– Sign flag (S) – is set if the result becomes –ve, if +ve, it
is set to 0
– 2 bit (don’t care )
Pin diagram
Signals in 8085
• 6 group of signals
• Address bus (A15-A8)-
– unidirectional
• Data bus (AD7-AD0)
– bi-directional both data and
address
• Control and Status signals
– ALE (Address Latch Enable)
– RD,WR,IO/M,S0,S1
• Power supply and Clock
frequency
– VCC +5
– VSS-Ground
– X1,X2
– CLK
• Externally initiated signals
– INTR
– INTA
– TRAP
– RST 7.5,RST6.5,RST 5.5
– READY
– HOLD
– RESET IN
– RESET OUT
– HLDA
• Serial I/O Ports
– SID
– SOD
ADRESSING MODES IN 8085
• Direct addressing
• Register addressing
• Register indirect addressing
• Immediate addressing
• Implicit addressing
• Direct addressing
– LDA 240H (Load register A with the contents of
memory location 240FH)
– STA 2400H (Store the content of the accumulator
in the memory location 2400H)
• Register addressing
– MOV B, D (move the content of register D to
register B)
– INX H (increment the content of [H-L] register pair
• Register indirect addressing
– LXI H, 2500H (Load H-L pair with 2500H)
– MOV A, B (move the content of the memory
location, whose address is in H-L pair(H-L Pair) to
accumulator)
– HLT (halt)
• Immediate addressing
– MVI A, 05 (Move 05 in register A)
– 3E, 05 (the code format of an instruction)
• Implicit addressing
– There are certain instruction which operate the
content of the accumulator.
– Such instruction do not require the address of the
operand
– CMA
– RAL
– RAR
Instruction sets 8085
• Data transfer group
• Arithmetic group
• Logical group
• Branch group
• Stack, I/O and Machine control group
Data transfer group
• MOV r1,r2
• MOV r, M (Move the content of memory to register)
• MOV M, r
• MVI r1, data (Move Immediate DATA to register)
• MVI M, data
• LDA data (Load accumulator direct)
• STA addr (store accumulator direct)
• XCHG (exchange the content of H-L with D-E pair)
• LHLD addr (Load HL pair direct)
• SHLD addr (Store HL pair direct)
• STAX xp ( store accumulator Indirect)
Arithmetic group
• ADD r
• ADD M
• ADI data
• ADC r
• ADC M
• SUB r
• SUB M
• SUI data
• SBB r
• SBB M
• INR r
• INR M
• DCR r
• DCR M
Logical group
• ANA r
• ANA M
• ANI data
• ORA r
• ORA M
• ORI data
• XRA r
• XRA m
• XRI data
• CMA (complement acc)
• CMC(complement carry)
• CMP r (compare)
• CMP M
• CPI data
• RLC (rotate)
• RRC
• RAL
• RAR
Branch group
• Two branch instruction
–Conditional
• The conditional branch instructions
transfer the program to the specified
label when certain condition is satisfied
–Unconditional
• The Unconditional branch instructions
transfer the program to the specified
label when certain condition is not
satisfied
• Conditional jumb addr (label)
– If the condition is true and the program jumps to
the specified label, the execution of a conditional
jump takes 3 machine cycles and 10 states
– If the condition is not true, only two machine
cycles and 7 states are required for the execution
of the instruction.
– JZ addr (label) [jump if the result is zero]
[PC] address (label), jump if z=0
Machine cycle – 2/3
States – 7/10
Addressing mode – Immediate
Flags - None
– JNZ addr [ jump if the result is not zero]
[PC] address (label), jump if z=1
– JC addr [ jump if there is a carry ]
[PC] address (label), jump if CS = 1
– JNC addr [ jump if there is no carry ]
[PC] address (label), jump if CS = 0
– JP addr [ jump if the result is plus)
[PC] address (label), jump if S = 0
– JM addr [ jump if the result is minus)
[PC] address (label), jump if S = 1
– JPE addr [ jump if even parity)
[PC] address (label), jump if P = 0
– JPE addr [ jump if odd parity)
[PC] address (label), jump if P = 1
• CALL addr (label)
– Call the subroutine identified by the operand
– CC addr (call subroutine if carry status CS=1)
– CNC addr (call subroutine if carry status CS=0)
– CZ addr (call subroutine if result is zero)
– CNZ addr (call subroutine if result is not zero)
– CP addr (call subroutine if result is plus)
– CM addr (call subroutine if result is minus)
– CPE addr (call subroutine if even parity)
– CPOE addr (call subroutine if odd parity)
• Unconditional
– RET(Return from Subroutine)
– CALL addr
– RSTn (Restart)
Stack ,I/O and Machine control Group
• PUSH rp [push the content of register pair to stack)
• PUSH PSW [push the program status to word]
• POP rp [pop the content of register pair which
was saved from the stack]
• POP PSW
• IN PORT
• OUT PORT
• EI (enable interrupts)
• DI(disable interrupts)
• HLT (halt)
• NOP( notion oper)
• RIM(read interrupts mask)
• SIM (set interrupts mask)
SIM(Set Interrupts Mask)
RIM (Read Interrupts Mask)
Timing diagram of 8085
• Opcode fetch cycle (4T or 6T)
• Memory Read cycle (3T)
• Memory write cycle (3T)
• I/O read cycle (3T)
• I/O write cycle (3T)
• Interrupt acknowledge (6T or 12T)
• Bus idle cycle (2T or 3T)
Opcode fetch cycle
Memory Read cycle
Memory write cycle
I/O read cycle
I/O write cycle
Microcontroller
• A Microcontroller is a small computer on a
single integrated circuit containing a processor
core, memory and programmable
input/output peripherals.
Block diagram of 8051
Features Microcontroller
• 8 bit CPU
• On chip oscillator
• 4Kb of ROM
• 128 bytes of RAM
• 21 special functions register
• 32 I/O lines
• 64 KB address space for external data memory
• 64 KB address space for program memory
• 2 16-bit timer/counter
20ME702– MECHATRONICS -UNIT-2.pptx
20ME702– MECHATRONICS -UNIT-2.pptx

More Related Content

20ME702– MECHATRONICS -UNIT-2.pptx

  • 1. UNIT II 8085 MICROPROCESSOR AND 8051 MICROCONTROLLER
  • 2. MICROPROCESSOR • It is a semiconductor component that incorporates the functions of a central processing unit (CPU) on a single integrated circuit (IC) . i.e., the central processing unit (CPU) built on a single IC is called microprocessor.
  • 3. MICROPROCESSOR • It is multipurpose, programmable and clock driven, • Register based electronic device that reads binary instructions from a storage device called memory, • Accept binary data as input, process the data according to the instruction and provides results as output.
  • 4. Functional Block diagram of Microprocessor ALU Register Array Control Microprocessor
  • 5. Functional Block diagram of Microprocessor • ALU (Arithmetic and Logic Unit) – It carries out arithmetic and logic operations on 8 bit word. – Arithmetic operation – addition, subtraction , multiplication , division etc., – Logic operation - AND,OR,EX-OR – The content of accumulator and temporary register are the input to the ALU. – ALU output is stored in accumulator
  • 6. • Register array – Register is a storage unit within the microprocessor used to store the data, address of instruction of any program. – Microprocessor contained 6 general purpose register it has 8- bit memory – Registers are B,C,D,E,H and L – To hold 16-bit data a combination of two 8-bit registers can be used. – The combination of two 8-bit registers is known as Register Pair (BC, DE and HL). – These Registers are used to store data temporarily during execution of the program.
  • 7. • Control Unit – The timing and control unit acts as the brain of a computer. – It controls all operations of the CPU. – It controls input, output and all other devices connected to the CPU.
  • 8. Evolution of Microprocessor • First generation Microprocessor – 1st Microprocessor, Intel 4004, a 4 bit PMOS Microprocessor introduced in 1971 by the Intel corporation, USA. – It has limited memory – An enhanced version of Intel 4004 is Intel 4040. – e.g., Toshiba’s 73472, Rockwell International’s PPS-4 National IMP-4 etc.,
  • 9. Evolution of Microprocessor • Second generation Microprocessor – In 1972, Intel introduced 8- bit Microprocessor named as Intel 8008, which also uses PMOS technology. – But this technology was slow and not compatible with TTL logic – In 1973, Intel introduced more powerful and fast 8- bit NMOS Microprocessor called Intel 8080 – Intel 8085 is the improved version of Intel 8080
  • 10. • Third generation Microprocessor – In 1978 Intel introduced a 16- bit Microprocessor called Intel 8086. – Other 16- bit Microprocessor are Intel 80186, Intel 80286, zilog’s z8000, Motorola’s 68000, 68010 etc., • Forth generation Microprocessor – In 1985 Intel introduced a 32- bit Microprocessor called Intel 60386 • Fifth generation Microprocessor – Intel i860 is a 64 bit RISC microprocessor
  • 11. Architecture of 8085 • Three main section – ALU – Timing and Control unit – Set of register
  • 13. • ALU – Addition, Subtraction, Logical AND,OR…etc • Timing and Control Unit – Controls the entire operation of the microprocessor • Register – 1- 8 bit Accumulator….i.e.-register A (ACC) – 6-8 bit general purpose register (B,C,D,E,H & L) – 1- 16 bit register –SP(Stack Pointer) – 1 -16 bit –PC (Program Counter) – Instruction register – Temporary register – Flag register
  • 14. • Flag register – Carry flag (CY) – it is set, If carry or borrow occurs during the arithmetic operation. – Parity flag (P) – it is set, if the result has even number of it otherwise made 0. – Auxiliary carry flag (AC) – Binary coded decimal operations (BCD) – Zero flag (z) – is set if the result becomes 0 – Sign flag (S) – is set if the result becomes –ve, if +ve, it is set to 0 – 2 bit (don’t care )
  • 16. Signals in 8085 • 6 group of signals • Address bus (A15-A8)- – unidirectional • Data bus (AD7-AD0) – bi-directional both data and address • Control and Status signals – ALE (Address Latch Enable) – RD,WR,IO/M,S0,S1 • Power supply and Clock frequency – VCC +5 – VSS-Ground – X1,X2 – CLK
  • 17. • Externally initiated signals – INTR – INTA – TRAP – RST 7.5,RST6.5,RST 5.5 – READY – HOLD – RESET IN – RESET OUT – HLDA • Serial I/O Ports – SID – SOD
  • 18. ADRESSING MODES IN 8085 • Direct addressing • Register addressing • Register indirect addressing • Immediate addressing • Implicit addressing
  • 19. • Direct addressing – LDA 240H (Load register A with the contents of memory location 240FH) – STA 2400H (Store the content of the accumulator in the memory location 2400H) • Register addressing – MOV B, D (move the content of register D to register B) – INX H (increment the content of [H-L] register pair
  • 20. • Register indirect addressing – LXI H, 2500H (Load H-L pair with 2500H) – MOV A, B (move the content of the memory location, whose address is in H-L pair(H-L Pair) to accumulator) – HLT (halt) • Immediate addressing – MVI A, 05 (Move 05 in register A) – 3E, 05 (the code format of an instruction)
  • 21. • Implicit addressing – There are certain instruction which operate the content of the accumulator. – Such instruction do not require the address of the operand – CMA – RAL – RAR
  • 22. Instruction sets 8085 • Data transfer group • Arithmetic group • Logical group • Branch group • Stack, I/O and Machine control group
  • 23. Data transfer group • MOV r1,r2 • MOV r, M (Move the content of memory to register) • MOV M, r • MVI r1, data (Move Immediate DATA to register) • MVI M, data • LDA data (Load accumulator direct) • STA addr (store accumulator direct) • XCHG (exchange the content of H-L with D-E pair)
  • 24. • LHLD addr (Load HL pair direct) • SHLD addr (Store HL pair direct) • STAX xp ( store accumulator Indirect)
  • 25. Arithmetic group • ADD r • ADD M • ADI data • ADC r • ADC M • SUB r • SUB M • SUI data • SBB r • SBB M • INR r • INR M • DCR r • DCR M
  • 26. Logical group • ANA r • ANA M • ANI data • ORA r • ORA M • ORI data • XRA r • XRA m • XRI data • CMA (complement acc) • CMC(complement carry) • CMP r (compare) • CMP M • CPI data • RLC (rotate) • RRC • RAL • RAR
  • 27. Branch group • Two branch instruction –Conditional • The conditional branch instructions transfer the program to the specified label when certain condition is satisfied –Unconditional • The Unconditional branch instructions transfer the program to the specified label when certain condition is not satisfied
  • 28. • Conditional jumb addr (label) – If the condition is true and the program jumps to the specified label, the execution of a conditional jump takes 3 machine cycles and 10 states – If the condition is not true, only two machine cycles and 7 states are required for the execution of the instruction.
  • 29. – JZ addr (label) [jump if the result is zero] [PC] address (label), jump if z=0 Machine cycle – 2/3 States – 7/10 Addressing mode – Immediate Flags - None
  • 30. – JNZ addr [ jump if the result is not zero] [PC] address (label), jump if z=1 – JC addr [ jump if there is a carry ] [PC] address (label), jump if CS = 1 – JNC addr [ jump if there is no carry ] [PC] address (label), jump if CS = 0
  • 31. – JP addr [ jump if the result is plus) [PC] address (label), jump if S = 0 – JM addr [ jump if the result is minus) [PC] address (label), jump if S = 1 – JPE addr [ jump if even parity) [PC] address (label), jump if P = 0
  • 32. – JPE addr [ jump if odd parity) [PC] address (label), jump if P = 1 • CALL addr (label) – Call the subroutine identified by the operand – CC addr (call subroutine if carry status CS=1) – CNC addr (call subroutine if carry status CS=0) – CZ addr (call subroutine if result is zero) – CNZ addr (call subroutine if result is not zero) – CP addr (call subroutine if result is plus) – CM addr (call subroutine if result is minus) – CPE addr (call subroutine if even parity) – CPOE addr (call subroutine if odd parity)
  • 33. • Unconditional – RET(Return from Subroutine) – CALL addr – RSTn (Restart)
  • 34. Stack ,I/O and Machine control Group • PUSH rp [push the content of register pair to stack) • PUSH PSW [push the program status to word] • POP rp [pop the content of register pair which was saved from the stack] • POP PSW • IN PORT • OUT PORT • EI (enable interrupts)
  • 35. • DI(disable interrupts) • HLT (halt) • NOP( notion oper) • RIM(read interrupts mask) • SIM (set interrupts mask)
  • 38. Timing diagram of 8085 • Opcode fetch cycle (4T or 6T) • Memory Read cycle (3T) • Memory write cycle (3T) • I/O read cycle (3T) • I/O write cycle (3T) • Interrupt acknowledge (6T or 12T) • Bus idle cycle (2T or 3T)
  • 44. Microcontroller • A Microcontroller is a small computer on a single integrated circuit containing a processor core, memory and programmable input/output peripherals.
  • 46. Features Microcontroller • 8 bit CPU • On chip oscillator • 4Kb of ROM • 128 bytes of RAM • 21 special functions register • 32 I/O lines • 64 KB address space for external data memory • 64 KB address space for program memory • 2 16-bit timer/counter