Microprocessor and Microcontroller Notes
Microprocessor and Microcontroller Notes
Microprocess Input
memory output
or
ALU
I/P CU O/P
M/M
Microprocessor
M/M O/P
Peripheral devices, A/D convertor,
Timer,
• Microprocessors operate in binary digits ,0 and 1 also known as bit. These digits
are represented in terms of electrical voltages in the machine. Generally 0
represents one voltage level and 1 represents another voltage level.
• Microprocessor as a CPU
1. Memory
2. Input
3. Output
4. Processor -> which consists of ALU, Register and CU
✓ The CPU contains various registers to store the data, the ALU to perform arithmetic
and logical operations, instruction decoders counter and control lines. The CPU
reads instructions form the memory and perform the task specified. It
communicates with input and output devices either to accept or to send the data.
these devices are also known as peripheral devices.
✓ The CPU is the primary and central player in communicating with devices such as
memory input and output. However, the timing of communication process is
controlled by the group of circuits called the control unit.
MEMORY
Microprocessor as INPUT
CPU
OUTPUT
Fig. Block Diagram of Microprocessor
• Organization of a microprocessors-based system
Input
output
System bus
ALU Register
Array
Control unit
Memory
RAM ROM
3. Control Unit (CU): The control unit provides the necessary timing
and control signal to all the operations in the microcomputer. It
controls the flow of data between microprocessors, the memory and
other peripherals.
The number of bits in a word for a given machine is fixed and words are formed
through various combinations of these bits. For example, a machine with a word
length of 8 bits can have 256 (28) combinations of 8 bit. The microprocessor
design engineer selects combinations of bits patterns and gives a specific
meaning to each combination by using electronic logic circuit this is called an
instruction.
Example:
• 1000 0000-> is an instruction that adds the number in the register called
B to the number in the accumulator and keeps the sum in the
accumulator.
• Assembly Language
For example,
1. INR A - INR stands for increment and A represents accumulator. This symbol
suggests the operation of incrementing the accumulator the content by 1
2. ADD B - ADD stands for addition and B represents the contents in register B. this
symbol suggests the addition of the content in register B and the content in
accumulator.
3.
• The complete set of 8085 mnemonics is called the 8085-assembly language and a
program written in these mnemonics is called an assembly language program.
The machine language and assembly language are microprocessor specific, and both are
considered as low-level languages.
B(8) C(8)
D(8) E(8)
H(8) L(8)
b).Programming Model
8 Bidirectional 16 Lines
D7 D6 D5 D4 D3 D2 D1 D0
S Z Ac P Cy
c). Flag Register
The 8085 processor uses the 16-bit address bus to send out memory addresses, the 8 bit
data bus to transfer data and the control bus for timing signals.
• Instruction Classification.
The 8085 instructions can be classified into the following 5 functional categories
1. Data transfer between the registers ex. Copy the content of register B
into register D.
2. Specific data byte to a register or a memory location ex. Load register B
with the data byte 32H.
3. Between a memory location and a register ex. From a memory location
2000H to register B
4. Data transfer between an input output device and the accumulator ex.
From an input keyboard to the accumulator.
✓ Arithmetic operations:
These instructions perform arithmetic operations such as Addition,
Subtraction, Multiplication -, increment, decrement
1. Addition:
Any 8-bit number or the contents of a register or the content of a memory
location can be added to the content of the accumulator and the sum is
stored in the accumulator.
2. Subtraction
Any 8-bit number or the content of the register or the content of a
memory location can be subtracted from the content of the accumulator
and the results stored in the accumulator.
3. Increment or decrement
The 8-bit content of a register or a memory location can be incremented or
decremented by 1. Similarly, the 16-bit content of a register pair such as
BC can be incremented or decremented by 1.
✓ Logical Operations:
These instructions perform various logical operations with the content of the
accumulator
1. AND, OR, XOR
Any 8-bit number or the content of a register or a memory location can be
logically ANDed, ORed, XORed with the content of the accumulator. The
results are stored in the accumulator.
2. Rotate
Each bit in the accumulator can be shifted either left or right to the next
position
3. Compare
Any 8-bit number or the content of the register or a memory location can
be compared for equality, greater then, or less than with the content of the
accumulator.
4. Complement
The content of the accumulator can be complemented all 0’s are replaced
by 1’s and all the 1’s are replaced by 0’s.
Examples
OR operator: ORA R
1. 1-byte instruction:
1-Byte instruction includes an opcode and the operand in the same byte.
For Examples:
2. 2-byte instruction
In a 2-byte instruction the first byte specifies the operation code, and
the second byte specifies the operand.
For Example:
3. 3-byte instruction:
In 3-byte instructions the first byte specifies the op-code, and the
following 2 bytes specify the 16-bit address.
For example:
Task Opcode Operand Binary Code Hex. Code
Move 32H to A LDA 2050H 0011 1010 3A -first byte
0011 0010 50 -2-byte
0010 0000 20 -3-byte
JMP 2085H 0011 0011 C3H -1- byte
1000 0101 85H2-byte
0010 0000 20H 3-byte
1. Address bus: 8085 has 16 address lines that are used as the address
bus. These lines are split into 2 segments.
a. A15 to A8
b. AD0 to AD7
The 8 signal lines (A15 to A8 ) are uni-directional and used for the
most significant bits called the higher order address of a 16-bit
address.
̅̅̅̅̅: Read operation: This is a read control signal (active low). This
2. 𝑹𝑫
signal indicates that the selected input and output or memory device is to
be read, and data are available only data bus.
3. ̅̅̅̅̅
𝑾𝑹: Write Operation: This is a write control signal (active low). This
signal indicates that the data on the data bus are to be written into a
selected memory or input output location.
̅ : This is a status signal used to differentiate between input output
4. IO/𝑴
and memory operations. When it is high, it indicates an input output
operation and when it is low, it indicates a memory operation.
̅ signal and it is used to
5. S1, S0: These status signals are similar to IO/𝑴
identify various operation .
• One of the signals, INTR (interrupt request) is identical to the INT interrupt
signal of 8080A microprocessor.
• The microprocessor acknowledges an interrupt by the ̅̅̅̅̅̅̅
𝐼𝑁𝑇𝐴 (interrupt
acknowledge) signal request.
a. INTR: (Interrupt Request):
This is used as a general-purpose interrupt. It is similar to INT signal of 8080A
processor.
b. ̅̅̅̅̅̅̅̅
𝑰𝑵𝑻𝑨: (Interrupt Acknowledge):
This is used to acknowledge an interrupt.
c. RST 7.5, 6.5, and 5.5: (Restart Interrupts):
These are vectored interrupts that transfers the program control to specific
memory location. They have higher priorities than the INTR. Among these three
the priority order is 7.5, 6.5 and 5.5.
d. TRAP interrupt:
This is a non-maskable interrupt and have the highest priority.
e. HOLD: This signal indicates that a peripheral such as a DMA (direct memory
access) controller is requesting the use of address and data buses.
f. HLDA: This signal acknowledges the HOLD request.
g. READY: This signal is used to delay the microprocessor read write cycle until
a slow responding peripheral is ready to send or accept the data.
h. ̅̅̅̅̅̅̅̅̅̅̅̅̅
𝐑𝐄𝐒𝐄𝐓 𝐈𝐍: When the signal on this pin goes low, the program counter is set to
zero, the buses are tri-stated, and the MPU is reset.
i. RESET OUT: This signal indicates that the MPU is being reset. the signal can
be used to reset other devices.
6. Serial input/ output ports: The 8085 has two signals to implements the serial
transmission.
1. SID
2. SOD
In serial transmission, data bits are sent over a single line, 1 bit at a time , such as
the transmission over telephone line.
• 8085 Interrupts
RST 0 0000H
RST 1 0008H
RST2 0010H
RST3 0018H
RST4 0020H
RST5 0028H
RST6 0030H
RST7 0038H
These are maskable interrupt and represented by vector location 003CH, 0034H
and 002CH.
• Hardware Interrupts
TRAP 0024H
8051-Microcontrollers
• It is an 8-bit microcontroller with 8-bit data bus and 16-bit address bus
• The 16-bit address bus can address a 64 K byte memory space and a separate 64
K byte of data memory space.
• The 8051 has 4K on chip ROM and 128 bytes of internal RAM.
• Besides internal RAM the 8051 has various special function registers such as the
accumulator, the B register and many other control registers.
• 34 8-bit general purpose registers.
• The ALU perform one 8-bit operation at a time.
• 2 16-bit counter timer
• 3 Internal interrupts
• Four 8-bit input output port
• Some 8051 chips come with UART for serial communication and ADC for analog
to digital conversion.
Microprocessor Microcontroller