By H.V.Rama Krishna Murthy Sse/Elec
By H.V.Rama Krishna Murthy Sse/Elec
Inside a Microprocessor How it thinks Computer Memory How it stores data Program Instructions Tell it what to do
OPERAND A
RESULT
OPERAND B CONTROL
FETCH
DECODE
EXECUTE
Instruction #1
FETCH
DECODE
EXECUTE
Instruction #2
Instruction #1
FETCH
DECODE
EXECUTE
Instruction #3
Instruction #2
Instruction #1
MICROPROCESSOR
System Bus
SYSTEM BUS
MEMORY CHIPS
Scratch Pad Stores Data and Programs During Execution Only Retains Data While Powered On
1.1 Introduction to 8085 1.2 Microprocessor architecture 1.3 Instruction set 1.4 Addressing modes
The first microprocessor was introduced in 1970 by Intel (named 4004). It ran at the speed of 108KHz. Four years later, Intel created the 8080 running at just over 2 Mhz.
This microprocessor was used on the world's firs personal computer, named Altair. Also at this time, IBM started researching for their microprocessor, called POWER (Performance Optimization With Enhanced RISC).
Control Unit Arithmetic Logic Unit Registers Accumulator Flags Program Counter (PC) Stack Pointer (SP) Instruction Register/Decoder Memory Address Register General Purpose Registers Control Generator Register Selector Microprogramming
BASED ON FUNCTIONS Data Transfer Instructions Arithmetic Instructions Logical Instructions Branch Instructions Machine Control BASED ON LENGTH One-word or 1-byte instructions
Arithmetic operations (ADD, SUB, INR, DCR) Logic operations Branching operations (JMP, CALL, RET)
Implied Addressing:
The addressing mode of certain instructions is implied by the instructions function. For example, the STC (set carry flag) instruction deals only with the carry flag, the DAA (decimal adjust accumulator) instruction deals with the accumulator. Register Addressing: Quite a large set of instructions call for register addressing. With these instructions, specify one of the registers A through E, H or L as well as the operation code. With these instructions, the accumulator is implied as a second operand. For example, the instruction CMP E may be interpreted as 'compare the contents of the E register with the contents of the accumulator. Most of the instructions that use register addressing deal with 8bit values. However, a few of these instructions deal with 16-bit register pairs. For example, the PCHL instruction exchanges the contents of the program counter with the contents of the H and L registers.
Immediate Addressing: Instructions that use immediate addressing have data assembled as a part of the instruction itself. For example, the instruction CPI 'C' may be interpreted as compare the contents of the accumulator with the letter C. When assembled, this instruction has the hexadecimal value FE43. Hexadecimal 43 is the internal representation for the letter C. When this instruction is executed, the processor fetches the first instruction byte and determines that it must fetch one more byte. The processor fetches the next byte into one of its internal registers and then performs the compare operation. Direct Addressing: Jump instructions include a 16-bit address as part of the instruction. For example, the instruction JMP 1000H causes a jump to the hexadecimal address 1000 by replacing the current contents of the program counter with the new value 1000H. Instructions that include a direct address require three bytes of storage: one for the instruction code, and two for the 16-bit address
Register Indirect Addressing: Register indirect instructions reference memory via a register pair. Thus, the instruction MOV M,C moves the contents of the C register into the memory address stored in the H and L register pair. The instruction LDAX B loads the accumulator with the byte of data specified by the address in the B and C register pair.
Embedded Systems
Operations managed behind the scenes by
a microcontroller
Microcontroller (MCU)
An integrated electronic computing device
Support Devices
Timers A/D converter
Serial I/O
All components connected by common communication lines called the system bus.
26
330_01
27
330_01
28 330_01
A group of electronic circuits fabricated on a semiconductor chip that can read binary instructions written in memory and process binary data according to those instructions CPU and MPU
A semiconductor storage device consisting of registers that store binary bits Two major categories
Read/Write
Input devices such as switches and keyboards provide binary information to the microprocessor Output devices such as LEDs, video screens, and printers receive information from the microprocessor
30
330_01
31
330_01
The MPU communicates with memory and I/O using the system bus consisting of:
Address bus: unidirectional and carries
memory and I/O addresses Data bus: bidirectional; transfers binary data and instructions between MPU and memory and I/O Control lines: Read and Write timing signals asserted by MPU
32 330_01
33
330_01
34
330_01
Description
Processor
Add reg B to Acc Intel 8085 Add Reg R0 to Acc Intel 8051
machine instructions Efficient in execution and use of memory; machine-specific and not easy to troubleshoot
36
330_01
(such as English)
machine independent easy to write and troubleshoot requires large memory and less efficient in execution
37
330_01
Unsigned Integers: All eight bits (Bit7 to Bit0) represent the magnitude of a number
Range 00 to FF in Hex and 0 to 255 in
decimal
38
330_01
Signed Integers: Seven bits (Bit6 to Bit0) represent the magnitude of a number.
The eighth bit (Bit7) represents the sign of a
number. The number is positive when Bit7 is zero and negative when Bit7 is one. Positive numbers: 00 to 7F (0 to 127) Negative numbers: 80 to FF (-1 to -128) All negative numbers are represented in 2s complement
39 330_01
four, and each group represents a decimal digit from 0 to 9 Four-bit combinations from A through F in Hex are invalid in BCD numbers
Example: 0010 0101 represents the binary coding of the decimal number 25 which is different in value from 25H.
40 330_01
combinations (00 to 7F) Represents English alphabet, decimal digits from 0 to 9, symbols, and commands
41
330_01
System hardware
Includes discrete components such as a
System software
A group of programs that monitors the
42
330_01
43
330_01
Includes microprocessor, memory, I/O ports, and support devices (such as timers) on a single semiconductor chip Buses are generally not available to a system designer I/O ports are generally multiplexed and can be programmed to perform different functions
44 330_01
45
330_01