Sec 1323
Sec 1323
Sec 1323
1
1.1Evolution of Microprocessor:
It can be classified as following types
1.1.1First generation of processor: 4-bit Microprocessor
The first microprocessor was introduced in 1971 by Intel Corp. It was named Intel 4004 as it
was a 4 bit processor. It was a processor on a single chip. It could perform simple arithmetic and
logic operations such as addition, subtraction, Boolean AND & Boolean OR. It had a control unit
capable of performing control functions like fetching an instruction from memory, decoding it,
and generating control pulses to execute it. It was able to operate on 4 bits of data at a time. This
first microprocessor was quite a success in industry. Soon other microprocessors were also
introduced. Intel introduced the enhanced version of 4004, the 4040. Some other 4 bit processors
are International’s PPS4 and Toshiba’s T3472.
1.1.2Second generation of processor: 8-bit Microprocessor
The first 8 bit microprocessor which could perform arithmetic and logic operations on 8 bit
words was introduced in 1973 again by Intel. This was Intel 8008 and was later followed by an
improved version, Intel 8088. Some other 8 bit processors are Zilog-80 and Motorola M6800. 1.1.3
Third generation of processor: 16-bit Microprocessor
The 8-bit processors were followed by 16 bit processors. They are Intel 8086 and
80286. 1.1.4Fourth generation of processor: 32-bit Microprocessor
The 32 bit microprocessors were introduced by several companies but the most popular one is
Intel 80386.
1.1.5Fifth generation of processor: Pentium Series
Instead of 80586, Intel came out with a new processor namely Pentium processor. Its
performance is closer to RISC performance. Pentium was followed by Pentium Pro CPU.
Pentium Pro allows allow multiple CPUs in a single system in order to achieve multiprocessing.
The MMX extension was added to Pentium Pro and the result was Pentium II. The low cost
version of Pentium II is Celeron. The Pentium III provided high performance floating point
operations for certain types of computations by using the SIMD extensions to the instruction set.
These new instructions make the Pentium III faster than high-end RISC CPUs.
Interestingly Pentium IV could not execute code faster than the Pentium III when running at the
same clock frequency. So Pentium IV had to speed up by executing at a much higher clock
frequency.
2
Figure 1.1 8085 Microprocessor Architecture
Diagram
3
Figure 1.2 8085 Microprocessor Registers set
Accumulator (A):
Flags:
The ALU includes five flip-flops that are set or reset according to the result of an
operation. The microprocessor uses the flags for testing the data conditions.
They are Zero (Z), Carry (CY), Sign (S), Parity (P), and Auxiliary Carry (AC) flags. The most
commonly used flags are Sign, Zero, and Carry.
The stack pointer is also a 16-bit register used as a memory pointer. It points to a memory
location in R/W memory, called the stack.
The beginning of the stack is defined by loading a 16-bit address in the stack pointer.
Temporary Register:
• It is used to hold the data during the arithmetic and logical operations.
Instruction Register:
• When an instruction is fetched from the memory, it is loaded in the
instruction register.
Instruction Decoder:
• It gets the instruction from the instruction register and decodesthe
instruction. It identifies the instruction to be performed.
Serial I/O Control:
• It has two control signals named SID and SOD for serial data transmission.
It has three control signals ALE, RD (Active low) and WR (Active low) andthree status
signals IO/M(Active low), S0 and S1. The control word shown in table .1
RD (Active low) and WR (Active low) are used to indicate whether the operation is reading
the data from memory or writing the data into memory respectively.IO/M(Active low) is used
to indicate whether the operation is belongs to the memory or peripherals.
5
Table 1: Read/Write data
1.2.1 8085 System Bus
Typical system uses a number of busses, collection of wires, which transmit binary numbers, one
bit per wire. A typical microprocessor communicates with memory and other devices (input and
output) using three busses: Address Bus, Data Bus and Control Bus.
1.2.1.1 Address Bus:
The data bus is a group of eight lines used for data flow.
6
These lines are bi-directional - data flow in both directions between the MPU and memory and
peripheral devices.
The MPU uses the data bus to perform the second function: transferringbinary information.
The eight data lines enable the MPU to manipulate 8-bit data ranging from 00 to FF (28 = 256
numbers).
The largest number that can appear on the data bus is 11111111.
7
ALE (Output)- Address Latch Enable: It occurs during the first clock cycle of a machine state and
enables the address to get latched into the on chip latch of peripherals. The falling edge of ALE is
set to guarantee setup and hold times for the address information. ALE can also be used to strobe
the status information. ALE is never 3stated.
SO, S1 (Output)-Data Bus Status. Encoded status of the bus cycle shown in table
.2 Table .2 control word
S1 S0
00 HALT
0 1 WRIT
E
1 0 READ
1 1 FETC
H
8
The priority of these interrupts is ordered as shown above. These interrupts have a higher priority
than the INTR.
TRAP (Input)-Trap interrupt is a nonmaskable restart interrupt. It is recognized at the same time
as INTR. It is unaffected by any mask or Interrupt Enable. It has the highest priority of any
interrupt.
RESET IN (Input)- Reset sets the Program Counter to zero and resets the Interrupt Enable and
HLDA flipflops. None of the other flags or registers (except the instruction register) are affected
The CPU is held in the reset condition as long as Reset is applied. RESET OUT (Output)-
Indicates CPlJ is being reset. Can be used as a system RESET. The signal is synchronized to the
processor clock.
X1, X2 (Input)-Crystal or R/C network connections to set the internal clock generator X1 can also
be an external clock input instead of a crystal. The input frequency is divided by 2 to give the
internal operating frequency.
CLK (Output)-Clock Output for use as a system clock when a crystal or R/ C network is used as
an input to the CPU. The period of CLK is twice the X1, X2 input period.
IO/M (Output)-IO/M indicates whether the Read/Write is to memory or l/O Tristated during Hold
and Halt modes.
SID (Input)- Serial input data line The data on this line is loaded into accumulator bit 7 whenever
a RIM instruction is executed.
SOD (output)- Serial output data line. The output SOD is set or reset as specified by the SIM
instruction.
Vcc +5 volt supply.
Vss Ground Reference.
Copy the contents of the accumulator in MOV C,A 0100 1111 4FH
the register C.
10
These instructions are 1-byte instructions performing three different tasks. In the first instruction,
both operand registers are specified. In the second instruction, the operand B is specified and the
accumulator is assumed. Similarly, in the third instruction, the accumulator is assumed to be the
implicit operand. These instructions are stored in 8-bit binary format in memory; each requires one
memory location.
MOV rd, rs
rd <-- rs copies contents of rs into rd.
Coded as 01 ddd sss where ddd is a code for one of the 7 general registers which is the
destination of the data, sss is the code of the source register.
Example: MOV A,B
Coded as 01111000 = 78H = 170 octal (octal was used extensively in instruction design of
such processors).
ADD r
A <-- A + r
Two-Byte Instructions
In a two-byte instruction, the first byte specifies the operation code and the second byte
specifies the operand. Source operand is a data byte immediately following the opcode. For
example:
Task Opcode Operand Binary Hex
Code Code
Load an 8-bit data MVI A, Data 0011 1110 3E First Byte
byte in the
accumulator. Data Second Byte
Assume that the data byte is 32H. The assembly language instruction is written as
Mnemonics Hex code
The instruction would require two memory locations to store in memory. MVI
r,data r <--
data
Example: MVI A,30H coded as 3EH 30H as two contiguous bytes. This is an example of
immediate addressing.
ADI data
A <-- A + data
OUT port where port is an 8-bit device address. (Port) <-- A. Since the byte is not the data but
points directly to where it is located this is called direct addressing.
Three-Byte Instructions:In a three-byte instruction, the first byte specifies the opcode, and the
following two bytes pecify the 16-bit address.
11
and the third byte is the high-order address
opcode + data byte + data byte
For example:
Task Opcode Operand Binary code Hex Code
memory 0010
0000
location 20 Byte
2085H.
Third
Byte
This instruction would require three memory locations to store in memory. Three
byte instructions - opcode + data byte + data byte
LXI rp, data16
rp is one of the pairs of registers BC, DE, HL used as 16-bit registers. The two data bytes are
16-bit data in L H order of significance.
rp <-- data16
Example:
LXI H,0520H coded as 21H 20H 50H in three bytes. This is also immediate
addressing. LDA addr
A <-- (addr) Addr is a 16-bit address in L H order. Example: LDA 2134H coded as 3AH
34H 21H. This is also an example of direct addressing.
Instruction Set Classification
An instruction is a binary pattern designed inside a microprocessor to perform a specific function.
The entire group of instructions, called the instruction set, determines what functions the
microprocessor can perform. These instructions can be classified into the following five
functional categories: data transfer (copy) operations, arithmetic operations, logical operations,
branching operations, and machine-control operations.
Data Transfer (Copy) Operations
This group of instructions copy data from a location called a source to another location called
a destination, without modifying the contents of the source. In technical manuals, the term
data transfer is used for this copying function. However, the term transfer is misleading; it
creates the impression that the contents of the source are destroyed when, in fact, the
contents are retained without any modification. The various types of data transfer (copy) are
listed below together with examples of each type:
Types Examples
13
It is one of the best ways to understand to process of micro-processor/controller. With the help of
timing diagram we can understand the working of any system, step by step working of each
instruction and its execution, etc. It is the graphical representation of process in steps with respect
to time. The timing diagram represents the clock cycle and duration, delay, content of address bus
and data bus, type of operation ie. Read/write/status signals.
2. If the addressing mode is indirect then No. of machine cycles = No. of bytes + 1. Add +1
to theNo. of machine cycles if it is memory read/write operation.
3. If the operand is 8-bit or 16-bit address then, No. of machine cycles = No. of bytes +1.
The microprocessor requires instructions to perform any particular action. In order to perform
these actions microprocessor utilizes opcode which is a part of an instruction which provides
detail to microprocessor.shown in Figure 1.5
Figure 1. 5 Opcode Fetch Timing Diagram
14
Opcode fetch timing Operation:
➢ During T1 state, microprocessor uses IO/M(bar), S0, S1 signals are used to instruct
microprocessor to fetch opcode.
➢ During this operation 8085 transmits 16-bit address and also uses ALE signal for address
latching.
➢ At T2 state microprocessor uses read signal and make data ready from that memory
location to read opcode from memory and at the same time program counter increments
by 1 and points next instruction to be fetched.
➢ In this state microprocessor also checks READY input signal, if this pin is at low logic
level ie. '0' then microprocessor adds wait state immediately between T2 and T3.
➢ At T3, microprocessor reads opcode and store it into instruction register to decode it
further.
➢ During T4 microprocessor performs internal operation like decoding opcode and
providing necessary actions.
➢ The opcode is decoded to know whether T5 or T6 states are required, if they are not
required then the processor performs next operation.
15
Operation:
➢ During T1, A8-A15 contains higher byte of address. At the same time ALE is high.
Therefore Lower byte of address A0-A7 is selected from AD0-AD7.
➢ Since it is memory ready operation, IO/M(bar) goes low.
➢ During T2 ALE goes low, RD(bar) goes low. Address is removed from AD0-AD7 and
data D0-D7 appears on AD0-AD7.
➢ During T3, Data remains on AD0-AD7 till RD(bar) is at low signal.
Operation:
16
➢ During T2, ALE goes low, WR goes low and Address is removed from AD0-AD7 and
then data appears on AD0-AD7.
➢ Data remains on AD0-AD7 till WR islow.
17
➢ It is used to writ one byte into IO
device.
➢ It requires 3 T-States.
➢ During T1, the lower byte of address is duplicated into higher order
address bus A8-A15.
➢ ALE is high and A0-A7 address is selected from AD0-
AD7. o As it is an IO operation IO/M goeslow.
➢ During T2, ALE goes low, WR goes low and data appears on AD0-AD7 to write
data into IO device.
➢ During T3, Data remains on AD0-AD7 till WR islow.
2. Arithmetic Group
3. Logical Group
1.10.1 Data Transfer Instruction: Instructions, which are used to transfer data from one
register to another register, from memory to register or register to memory, come under
this group. Examples are: MOV, MVI, LXI, LDA, STA etc. When an instruction of data
transfer group is executed, data is transferred from the source to the destination without
altering the contents of the source. For example, when MOV A, B is executed the content
of the register B is copied into the register A, and the content of register B remains
unaltered. Similarly, when LDA 2500 is executed the content of the memory location
2500 is loaded into the accumulator. But the content of the memory location 2500 remains
unaltered.
i. MOV Rd, Rs
Move Data; Move the content of the from source register to destination register.
ii. MOV Rd, M -Move the content of memory register to destination register. iii.
MOV M, Rs. -Move the content of register to memory.
iv. MVI r, data. -Move immediate data to register.
v. MVI M, data- Move immediate data to memory.
vi. LXI rp, data 16- Load register pair immediate.
vii. LDA addr- Load Accumulator direct.
viii. STA addr- Store accumulator direct.
18
ix. .LHLD addr- Load H-L pair direct
x. SHLD addr- Store H-L pair direct
xi. LDAX rp. -LOAD accumulator indirect
xii. STAX rp- Store accumulator indirect
xiii. XCHG- Exchange the contents of H-L with D-E pair [H-L]
<--> [D-E].
The instruction DAA is used in the program after ADD, ADI, ACI, ADC, etc instructions.
After the execution of ADD, ADC, etc instructions the result is in hexadecimal and it is
placed in the accumulator. The DAA instruction operates on this result and gives the final
result in the decimal system. It uses carry and
19
auxiliary carry for decimal adjustment. 6 is added to 4 LSBs of the content of the
accumulator if their value lies in between A and F or the AC flag is set to 1. Similarly, 6 is
also added to 4 MSBs of the content of the accumulator if their value lies in between A
and F or the CS flag is set to 1. All status flags are affected. When DAA is used data
should be in decimal numbers.
1.10.3 Logical Instructions
i. ANA r. (AND register with accumulator) [A] [A] ^ [r].
ii. ANA M. (AND memory with accumulator). [A] [A] ^ [[H-L]].
iii. ANI data. (AND immediate data with accumulator) [A] [A] ^ data. iv.
ORA r. (OR register with accumulator) [A] [A] v [r].
v. ORA M. (OR memory with accumulator) [A] [A] v [[H-L]]
vi. ORI data. (OR immediate data with accumulator) [A] [A] v data. vii. XRA r.
(EXCLUSIVE – OR register with accumulator) [A] [A] v [r] viii. XRA M.
(EXCLUSIVE-OR memory with accumulator) [A] [A] v [[H-L]] ix. XRI data.
(EXCLUSIVE-OR immediate data with accumulator) [A] [A] v data.
x. CMA. (Complement the accumulator) [A] [A]
x. CMC. (Complement the carry status) [CS] [CS]
xi. STC. (Set carry status) [CS] 1.
xii. CMP r. (Compare register with accumulator) [A] – [r]
xiii. CMP M. (Compare memory with accumulator) [A] – [[H-L]]
xiv. CPI data. (Compare immediate data with accumulator) [A] – data.
xv. RLC (Rotate accumulator left) [An+1] [An], [A0] [A7],
[CS] [A7].
The content of the accumulator is rotated left by one bit. The seventh bit of the
accumulator is moved to carry bit as well as to the zero bit of the accumulator. Only CS
flag is affected.
xvi. RRC. (Rotate accumulator right) [A7] [A0], [CS] [A0], [An]
[An+1].The content of the accumulator is rotated right by one bit. The zero
bit of the accumulator is moved to the seventh bit as well as to carry bit. Only
CS flag is affected.
xvii. RAL. (Rotate accumulator left through carry) [An+1] [An], [CS] [A7], [A0]
[CS].
xviii. RAR. (Rotate accumulator right through carry) [An] [An+1], [CS] [A0], [A7]
[CS]
i. JMP addr (label). (Unconditional jump: jump to the instruction specified by the
address). [PC] Label.
ii. Conditional Jump addr (label): After the execution of the conditional jump
instruction the program jumps to the instruction specified by the address (label) if
the specified condition is fulfilled. The program proceeds further in the normal
sequence if the specified condition is not fulfilled. If the condition is true and
program jumps to the specified label, the execution of a conditional jump takes 3
machine cycles: 10 states. If condition is not true, only 2 machine cycles; 7 states
are required for the execution of the instruction.
a. JZ addr (label). (Jump if the result is zero)
20
b. JNZ addr (label) (Jump if the result is not zero)
iii. CALL addr (label) (Unconditional CALL: call the subroutine identified by the
operand)
CALL instruction is used to call a subroutine. Before the control is transferred to
the subroutine, the address of the next instruction of the main program is saved in
the stack. The content of the stack pointer is decremented by two to indicate the
new stack top. Then the program jumps to subroutine starting at address specified
by the label.
iv. RET (Return from subroutine)
v. RST n (Restart) Restart is a one-word CALL instruction. The content of the program
counter is saved in the stack. The program jumps to the instruction starting at
restart location.
24
SCHOOL OF BIO AND CHEMICAL ENGINNEERING
DEPARTMENT OF BIOMEDICAL ENGINEERING
Unit -II
1
2.1.Programmable peripheral Interface 8255(PPI)
The parallel input-output port chip 8255 is also called as programmable
peripheral input-output port. The Intel‟s 8255 is designed for use with Intel‟s 8-bit,
16-bit and higher capability microprocessors. It has 24 input/output lines which may
be individually programmed in two groups of twelve lines each, or three groups of
eight lines. The two groups of I/O pins are named as Group A and Group B. Each of
these two groups contains a subgroup of eight I/O lines called as 8-bit port and
another subgroup of four lines or a 4-bit port. Thus Group A contains an 8-bit port A
along with a 4-bit port C upper. The port A lines are identified by symbols PA0-PA7
while the port C lines are identified as PC4-PC7. Similarly, Group B contains an 8-
bit port B, containing lines PB0-PB7 and a 4-bit port C with lower bits PC0- PC3.
The port C upper and port C lower can be used in combination as an 8-bit port
C.Both the port C are assigned the same address. Thus one may have either three 8-
bit I/O ports or two 8-bit and two 4-bit ports from 8255. All of these ports can
function independently either as input or as output ports. This can be achieved by
programming the bits of an internal register of 8255 called as control word register
(CWR).
The 8-bit data bus buffer is controlled by the read/write control logic. The read/write
control logic manages all of the internal and external transfers of both data and control
words. RD , WR , A1, A0 and RESET are the inputs provided by the microprocessor to
the READ/ WRITE control logic of 8255. The 8-bit, 3-state bidirectional buffer is used
to interface the 8255 internal data bus with the external system data bus. This buffer
receives or transmits data upon the execution of input or output instructions by the
microprocessor. The control words or status information is also transferred through the
buffer. The signal description of 8255 are briefly presented as follows :
PA7-PA0: These are eight port A lines that acts as either latched output or buffered
input lines depending upon the control word loaded into the control word register.
PC7-PC4: Upper nibble of port C lines. They may act as either output latches or input
buffers lines. This port also can be used for generation of handshake lines in mode 1 or
mode
2
PC3-PC0 :These are the lower port C lines, other details are the same as PC7-PC4
lines.PB0-PB7 : These are the eight port B lines which are used as latched output lines or
buffered input lines in the same way as port A.
RD : This is the input line driven by the microprocessor and should be low to indicate
read operation to 8255.
WR : This is an input line driven by the microprocessor. A low on this line indicates
write operation.
CS : This is a chip select line. If this line goes low, it enables the 8255 to respond to RD
and WR signals, otherwise RD and WR signal are neglected. A1-A0 : These are the
address input lines and are driven by the microprocessor. These lines A1-A0 with RD ,
WR and CS from the following operations for 8255. These address lines are used for
addressing any one of the four registers, i.e. three ports and a control word register as
given in table below. In case of 8086 systems, if the 8255 is to be interfaced with lower
order data bus, the A0 and A1 pins of 8255 are connected with A1 and A2 respectively.
D0-D7 : These are the data bus lines those carry data or control word to/from the
microprocessor.
RESET : A logic high on this line clears the control word register of 8255. All ports are set as
input ports by default
3
2.2 Pins Details
Figure 2.2 Pin Diagram of 8255PPI
4
a) CS – Chipselect : A low on this PIN enables the communication between CPU and 8255.
b) RD (Read) – A low on this pin enables the CPU to read the data in the ports or the status word
through data bus buffer.
c) WR (Write) : A low on this pin, the CPU can write data on to the ports or on to the control
register through the data bus buffer.
d) RESET: A high on this pin clears the control register and all ports are set to the input mode
e) A0 and A1 (Address pins): These pins in conjunction with RD and WR pins control the
selection of one of the 3 ports.
• Group A and Group B controls : These block receive control from the CPU and issues
commands to their respective ports.
• Group A - PA and PCU (PC7 –PC4)
• Group B - PCL (PC3 – PC0)
• Control word register can only be written into no read operation of the CW register is allowed.
a) Port A: This has an 8 bit latched/buffered O/P and 8 bit input latch. It can be programmed in
3 modes – mode 0, mode 1, mode 2.
b) Port B: This has an 8 bit latched / buffered O/P and 8 bit input latch. It can be programmed in
mode 0, mode1.
c) Port C : This has an 8 bit latched input buffer and 8 bit out put latched/buffer. This port can be
divided into two 4 bit ports and can be used as control signals for port A and port B. it can be
programmed in mode 0.
1.2.1Modes of Operation of 8255
• These are two basic modes of operation of 8255. I/O mode and Bit Set-Reset mode (BSR). •
In I/O mode, the 8255 ports work as programmable I/O ports, while in BSR mode only port C
(PC0-PC7) can be used to set or reset its individual port bits.
• Under the I/O mode of operation, further there are three modes of operation of 8255, so as to
support different types of applications, mode 0, mode 1 and mode 2.
5
I/O Modes This mode is also called as basic input/output mode. This mode provides simple
input and output capabilities using each of the three ports. Data can be simply read from and
written to the input and output.
2.3 8251USART
Figure 2.3 Block diagram of the 8251 USART
The 8251 functional configuration is programmed by software. Operation between the 8251 and
a CPU is executed by program control. Table 1 shows the operation between a CPU and the
device. Table 2.1 Control Word
6
2.4 Control Words
There are two types of control word.
1. Mode instruction (setting of function)
2. Command (setting of operation)
2.4.1Mode Instruction
Mode instruction is used for setting the function of the 8251. Mode instruction will be in
"wait for write" at either internal reset or external reset. That is, the writing of a control word
after resetting will be recognized as a "mode instruction." Items set by mode instruction are as
follows:
• Synchronous/asynchronous mode
• Stop bit length (asynchronous mode)
• Character length
• Parity bit
• Baud rate factor (asynchronous mode)
• Internal/external synchronization (synchronous mode)
• Number of synchronous characters (Synchronous mode)
The bit configuration of mode instruction is shown in Figures 2 and 3. In the case of synchronous
mode, it is necessary to write one-or two byte sync characters. If sync characters were written, a
function will be set because the writing of sync characters constitutes part of mode instruction.
2.4.2 Command
Command is used for setting the operation of the 8251. It is possible to write a command
whenever necessary after writing a mode instruction and sync characters. Items to be set by
command are as follows:
• Transmit Enable/Disable
• Receive Enable/Disable
• DTR, RTS Output of data.
• Resetting of error flag.
• Sending to break characters
• Internal resetting
8
RD (Input terminal)
This is the "active low" input terminal which receives a signal for reading receive data and status
words from the 8251.
C/D (Input terminal)
This is an input terminal which receives a signal for selecting data or command words and status
words when the 8251 is accessed by the CPU. If C/D = low, data will be accessed. If C/D = high,
command word or status word will be accessed.
CS (Input terminal)
This is the "active low" input terminal which selects the 8251 at low level when the CPU
accesses. Note: The device won’t be in "standby status"; only setting CS = High. TXD (output
terminal)
This is an output terminal for transmitting data from which serial-converted data is sent out. The
device is in "mark status" (high level) after resetting or during a status when transmit is disabled.
It is also possible to set the device in "break status" (low level) by a command. TXRDY (output
terminal)
This is an output terminal which indicates that the 8251is ready to accept a transmitted data
character. But the terminal is always at low level if CTS = high or the device was set in "TX
disable status" by a command. Note: TXRDY status word indicates that transmit data character is
receivable, regardless of CTS or command. If the CPU writes a data character, TXRDY will be
reset by the leading edge or WR signal.
TXEMPTY (Output terminal)
This is an output terminal which indicates that the 8251 has transmitted all the characters and had
no data character. In "synchronous mode," the terminal is at high level, if transmit data characters
are no longer remaining and sync characters are automatically transmitted. If the CPU writes a
data character, TXEMPTY will be reset by the leading edge of WR signal. Note : As the
transmitter is disabled by setting CTS "High" or command, data written before disable will be
sent out. Then TXD and TXEMPTY will be "High". Even if a data is written after disable, that
data is not sent out and TXE will be "High".After the transmitter is enabled, it sent out. (Refer to
Timing
9
Chart of Transmitter Control and Flag Timing)
10
DSR (Input terminal)
This is an input port for MODEM interface. The input status of the terminal can be recognized
by the CPU reading status words.
DTR (Output terminal)
This is an output port for MODEM interface. It is possible to set the status of DTR by a
command.
CTS (Input terminal)
This is an input terminal for MODEM interface which is used for controlling a transmit circuit.
The terminal controls data transmission if the device is set in "TX Enable" status by a command.
Data is transmitable if the terminal is at low level.
RTS (Output terminal)
This is an output port for MODEM interface. It is possible to set the status RTS by a command.
Fig
2.5 Pin Diagram of 8251
11
2.6 DMA Controller
• The DMA I/O technique provides direct access to the memory while the microprocessor
is temporarily disabled.
• This chapter also explains the operation of disk memory systems and video systems that
are often DMA-processed.
• Disk memory includes floppy, fixed, and optical disk storage. Video systems
include digital and analog monitors.
2.6.1 Pin Details of DMA( 8237)
Figure 2.6Pin Diagarm of DMA
12
DMA controller sees a DMA request, it responds by performing one or many data transfers from
that I/O device into system memory or vice versa. Channels must be enabled by the processor for
the DMA controller to respond to DMA requests. The number of transfers performed, transfer
modes used, and memory locations accessed depends on how the DMA channel is programmed.
A DMA controller typically shares the system memory and I/O bus with the CPU and has both
bus master and slave capability.
In bus master mode, the DMA controller acquires the system bus (address, data, and control
lines) from the CPU to perform the DMA transfers. Because the CPU releases the system bus for
the duration of the transfer, the process is sometimes referred to as cycle stealing. In bus slave
mode, the DMA controller is accessed by the CPU, which programs the DMA controller's
internal registers to set up DMA transfers. The internal registers consist of source and destination
address registers and transfer count registers for each DMA channel, as well as control and status
registers for initiating, monitoring, and sustaining the operation of the DMA controller.
13
DMA Controller Operation Steps in a Typical DMA cycle
Device wishing to perform DMA asserts the processors bus request signal. 1. Processor
completes the current bus cycle and then asserts the bus grant signal to the device.
2. The device then asserts the bus grant ack signal.
3. The processor senses in the change in the state of bus grant ack signal and starts
listening to the data and address bus for DMA activity.
4. The DMA device performs the transfer from the source to destination address. 5. During
these transfers, the processor monitors the addresses on the bus and checks if any location
modified during DMA operations is cached in the processor. If the processor detects a cached
address on the bus, it can take one of the two actions: Processor invalidates the internal cache
entry for the address involved in DMA write operation
Processor updates the internal cache when a DMA write is detected
6. Once the DMA operations have been completed, the device releases the bus by
asserting the bus release signal.
Reference Books:
1.Ramesh S Gaonkar, Microprocessor Architecture, Programming and application with 8085, 4»
Edition, Penram International Publishing, New Delhi, 2000
2. Kennith J. Ayala, 8051 Microcontroller, Thomson, 2005.
3. Dougles V. Hall, Microprocessor and Interfacing, Tata MC Graw Hill Publication, 2.‹Edition,
1992.
4. Charless M. Gilmore, “Microprocessor Principle and application, McGraw Hill publication,
1995.
5. A.NagoorKani, Microprocessor & Microcontroller, Tata Mc Graw Hill, 3«Edition, 2012 6.
B. Ram, Fundamentals of Microprocessors and Microcomputers, Dhanpat Rai Publications,
2001.
14
UNIT- IIII
1
3.1 8086 Microprocessor Architecture
The bus interface unit is responsible for physical address calculations and a predecoding
2
instruction byte queue ( 6 bytes long).The bus interface unit makes the system bus signal
available for external devices.The 8086 addresses a segmented memory. The complete physical
address which is 20-bits long is generated using segment and offset registers, each 16-bits long.
1.1 Generation a Physical Address:
• The content of segment register (segment address) is shifted left bit-wise four times. • The
content of an offset register (offset address) is added to the result of the previous shift operation.
The segment register indicates the base address of a particular segment and CS, DS, SS and ES
are used to keep the segment address. The offset indicates the distance of the required memory
location in the segment from the base address, and the offset may be the content of register IP,
BP, SI, DI and SP. Once the opcode is fetched and decoded, the external bus becomes free while
the Execution Unit is executing the instruction. While the fetched instruction is executed
internally, the external bus is used to fetch the machine code of the next instruction and arrange it
in a queue called as predecoded instruction byte queue.This is a 6 byte long queue, works in
first-in first-out policy.While the opcode is fetched by the bus interface unit (BIU), the execution
unit (EU) executes the previously decoded instruction concurrently. The execution unit contains.
4
S- Sign Flag : This flag is set, when the result of any computation is negative. Z- Zero Flag: This
flag is set, if the result of the computation or comparison performed by the previous instruction is
zero.
P- Parity Flag: This flag is set to 1, if the lower byte of the result contains even number of 1‘s. C-
Carry Flag: This flag is set, when there is a carry out of MSB in case of addition or a borrow in
case of subtraction.
T- Tarp Flag: If this flag is set, the processor enters the single step execution mode. I- Interrupt
Flag: If this flag is set, the maskable interrupt are recognized by the CPU, otherwise they are
ignored.
D- Direction Flag: This is used by string manipulation instructions. If this flag bit is ‗0‘, the
string is processed beginning from the lowest address to the highest address, i.e., auto
incrementing mode. Otherwise, the string is processed from the highest address towards the
lowest address, i.e., auto incrementing mode.
AC-Auxilary Carry Flag: This is set, if there is a carry from the lowest nibble, i.e, bit three during
addition, or borrow for the lowest nibble, i.e, bit three, during subtraction. O- Over flow Flag:
This flag is set, if an overflow occurs, i.e, if the result of a signed operation is large enough to
accommodate in a destination register. The result is of more than 7-bits in size in case of 8-bit
signed operation and more than 15-bits in size in case of 16-bit sign operations, then the
overflow will be set.
0 0 Extra segment
6
0 1 Stack segment
1 0 Code or no segment
1 1 Data Segment
BHE / S7 The bus high enable (BHE) signal is used to indicate the transfer of data over the higher
order D15 D8 data bus. It goes low for the data transfer over D15 D8 and is used to derive chip
select of odd address memory bank or peripherals.
BH A0 Indication
E
0 0 Whole word
1 1 None
RD : Read : whenever the read signal is at logic 0, the data bus receives the data from the
memory or 0 devices connected to the system
READY :This is the acknowledgement from the slow devices or memory that they have
completed the data transfer operation. This signal is active high.
INTR: Interrupt Request: Interrupt request is used to request a hardware interrupt of INTR is held
high when interrupt enable flag is set, the 8086 enters an interrupt acknowledgement cycle after
the current instruction has completed its execution.
TEST : This input is tested by ―WAIT‖ instruction. If the TEST input goes low; execution will
continue. Else the processor remains in an idle state.
NMI- Non-maskable Interrupt: The non-maskable interrupt input is similar to INTR except that
the NMI interrupt does not check for interrupt enable flag is at logic 1, i.e, NMI is not maskable
internally by software. If NMI is activated, the interrupt input uses interrupt vector 2.
7
RESET: The reset input causes the microprocessor to reset itself. When 8086 reset, it restarts the
execution from memory location FFFF0H. The reset signal is active high and must be active for
at least four clock cycles.
CLK : Clock input: The clock input signal provides the basic timing input signal for processor
and bus control operation. It is asymmetric square wave with 33% duty cycle. Vcc 5V power
supply for the operation of the internal circuit
MN / MX : The minimum/maximum mode signal to select the mode of operation either in
minimum or maximum mode configuration. Logic 1 indicates minimum mode. 3.6 Minimum
Mode of 8086 :
INTA - Interrupt acknowledge: The interrupt acknowledge signal is a response to the INTR input
signal. The INTA signal is normally used to gate the interrupt vector number onto the data bus in
response to an interrupt request.
ALE- Address Latch Enable: This output signal indicates the availability of valid address on the
address/data bus, and is connected to latch enable input of latches.
DT / R : Data transmit/Receive: This output signal is used to decide the direction of date flow
through the bi-directional buffer. DT / R 1 indicates transmitting and DT / R 0 indicates
receiving the data.
DEN Data Enable: Data bus enable signal indicates the availability of valid data over the
address/data lines.
HOLD: The hold input request a direct memory access(DMA). If the hold signal is at logic 1, the
micro process stops its normal execution and places its address, data and control bus at the high
impedance state.
8
HLDA: Hold acknowledgement indicates that 8086 has entered into the hold state. 3.7
Maximum Mode of 8086:
S 2 , S1 , S0 - Status lines: These are the status lines that reflect the type of operation being carried
out by the processor.
These status lines are encoded as follows
Function
S2 S1 S0
0 0 0 Interrupt Acknowledge
0 0 1 Read o port
0 1 0 Write o port
0 1 1 Halt
1 0 0 Code Access
1 0 1 Read memory
1 1 0 Write memory
1 1 1 passive
LOCK : The lock output is used to lock peripherals off the system, ie, the other system bus
masters will be prevented from gaining the system bus.
QS1 and QS0 - Queue status: The queue status bits shows the status of the internal instruction
queue. The encoding of these signals is as follows
RQ / GT1 and RQ / GT 0 - request/Grant: The request/grant pins are used by other local bus
masters to force the processor to release the local bus at the end of the processors current bus
cycle. These lines are bi-directional and are used to both request and grant a DMA operation. RQ
/ GT 0 is having higher priority than RQ / GT1
Physical Memory Organization
In an 8086 based system, the 1Mbyte memory is physically organized as odd bank and even
bank, each of 512kbytes, addressed in parallel by the processor.
Byte data with even address is transferred on D7 D0 and byte data with odd address is transferred
on D15 D8 .The processor provides two enable signals, BHE and A0 for selecting of either even or
odd or both the banks.
BH A0 Indication
E
0 0 Whole word
1 1 None
The register CX is used default counter in case of string and loop instructions. The register BX is
used as offset storage for forming physical address in case of certain addressing modes.
DX register is a general purpose register which may be used as an implicit operand or destination
in case of a few instructions.
Segment Registers:
The 8086 architecture uses the concept of segmented memory. 8086 able to address to address a
memory capacity of 1 megabyte and it is byte organized. This 1 megabyte memory is divided
into 16 logical segments. Each segment contains 64 kbytes of memory. There are four segment
register in 8086
Code segment register (CS)
Data segment register (DS)
Extra segment register (ES)
Stack segment register (SS)
Code segment register (CS): is used fro addressing memory location in the code segment of the
memory, where the executable program is stored.
Data segment register (DS): points to the data segment of the memory where the data is stored.
Extra Segment Register (ES) : also refers to a segment in the memory which is another data
segment in the memory.
Stack Segment Register (SS): is used fro addressing stack segment of the memory. The stack
segment is that segment of memory which is used to store stack data.
While addressing any location in the memory bank, the physical address is calculated from two
parts:
• The first is segment address, the segment registers contain 16-bit segment base addresses,
related to different segment.
12
When direct memory address is supplied as part of the instruction is called direct addressing
mode.
MOV AX, [1234];
ADD AX, [1234];
Register Indirect Addressing mode
Here operand offset is given in a cpu register. Register used are BX, SI(source index),
DI(destination index), or BP(base pointer). BP holds offset w.r.t Stack segment, but SI,DI and
BX refer to data segment. For example
MOV [BX],AX;
ADD AX, [SI];
Indexed Addressing mode
Here operand offset is given by a sum of a value held in either SI, or DI register and a constant
displacement specified as an operand. For example
Lets take arrays as an example. This is very efficient way of accessing
arrays. My_array DB ‘1’, ‘2’, ‘3’,’4,’5’;
MOV SI, 3;
MOV AL, My_array[3];
So AL holds value 4.
Base Relative Addressing mode
Operand offset given by a sum of a value held either in BP, or BX and a constant offset
sepecified as an operand. For example
MOV AX,[BP+1];
JMP [BX+1];
Base Indexed
Here operand offset is given by sum of either BX or BP with either SI or DI. For example
MOV AX, [BX+SI]
JMP [BP+DI]
13
3.9 Maximum Mode and Minimum Mode
In the maximum mode, the 8086 is operated by strapping the MN/MX* pin
to ground. In this mode, the processor derives the status signals S2*, S1* and S0*. Another chip
called bus controller derives the control signals using this status information. In the maximum
mode, there may be more than one microprocessor in the system configuration. The other
components in the system are the same as in the minimum mode system. The general system
organization is as shown in the figure 4.
The basic functions of the bus controller chip IC8288, is to derive control signals like RD* and
WR* (for memory and I/O devices), DEN*, DT/R*, ALE, etc. using the information made
available by the processor on the status lines. The bus controller chip has input lines S2*, S1*
and S0* and CLK. These inputs to 8288 are driven by the CPU. It derives the outputs ALE,
DEN*, DT/R*, MWTC*, AMWC*, IORC*, IOWC* and AIOWC*. The AEN*, IOB and CEN
pins are specially useful for multiprocessor systems. AEN* and IOB are generally grounded.
CEN pin is usually tied to +5V.
14
Fig 3.4 Maximum Mode 8086 System
The significance of the MCE/PDEN* output depends upon the status of the IOB pin. If IOB is
grounded, it acts as master cascade enable to control cascaded 8259A; else it acts as peripheral
data enable used in the multiple bus configurations. INTA* pin is used to issue two interrupt
15
IORC*, IOWC* are I/O read command and I/O write command signals respectively. These
signals enable an IO interface to read or write the data from or to the addressed port. The
MRDC*, MWTC* are memory read command and memory write command signals respectively
and may be used as memory read and write signals. All these command signals instruct the
memory to accept or send data from or to the bus. For both of these write command signals, the
advanced signals namely AIOWC* and AMWTC* are available. They also serve the same
purpose, but are activated one clock cycle earlier than the IOWC* and MWTC* signals,
respectively. The maximum mode system is shown in fig. 4.
The maximum mode system timing diagrams are also divided in two portions as read (input) and
write (output) timing diagrams. The address/data and address/status timings are similar to the
minimum mode. ALE is asserted in T1, just like minimum mode. The only difference lies in the
status signals used and the available control and advanced command signals. The fig. 5 shows
the maximum mode timings for the read operation while the fig. 6 shows the same for the write
operation.
The read cycle begins in T1 with the assertion of ALE (Address latch enable ) and M/IO signal
for memory or input-output process. During the negative going edge of the signal ,the valid
address is latched on the local bus. The BHE or bus high enable and Ao signal addresses low ,
high or both bytes.
17
3.10.2Memory Write Timing Diagram :
Fig 3.6 Timing Diagram
18
3.10.3 IO Read Timing Diagram
Fig. 3.7 Memory Read Timing for IO Read
19
21
SCHOOL OF BIO AND CHEMICAL ENGINEERING
DEPARTMENT OF BIOMEDICAL ENGINEERING
UNIT -IV
1
4.1 8051 Microcontroller Architecture
• PC (Program Counter)
• Registers
All arithmetic and logical functions are carried out by the ALU. Addition, subtraction with carry,
and multiplication come under arithmetic operations.Logical AND, OR and exclusive OR (XOR)
come under logical operations.
A program counter is a 16-bit register and it has no internal address. The basic function of
program counter is to fetch from memory the address of the next instruction to be executed. The
PC holds the address of the next instruction residing in memory and when a command is
encountered, it produces that instruction. This way the PC increments automatically, holding the
address of the next instruction.
3
4.1.2 . Registers
Registers are usually known as data storage devices. 8051 microcontroller has 2 registers,
namely Register A and Register B. Register A serves as an accumulator while Register B
functions as a general purpose register. These registers are used to store the output of
mathematical and logical instructions. The operations of addition, subtraction, multiplication and
division are carried out by Register A. Register B is usually unused and comes into picture only
when multiplication and division functions are carried out by Register A. Register A also
involved in data transfers between the microcontroller and external memory.
8051 microcontroller also has 7 Special Function Registers (SFRs). They are: • Serial Port Data
Buffer (SBUF)
Synchronization among internal operations can be achieved with the help of clock circuits which
are responsible for generating clock pulses. During each clock pulse a particular operation will
be carried out, thereby, assuring synchronization among operations. For the formation of an
oscillator, we are provided with two pins XTAL1 and XTAL2 which are used for connecting a
resonant network in 8051 microcontroller device. In addition to this, circuit also consists of four
more pins.
Internal operations can be synchronized using clock circuits which produce clock pulses. With
each clock pulse, a particular function will be accomplished and hence synchronization is
achieved. There are two pins XTAL1 and XTAL2 which form an oscillator circuit which connect
to a resonant network in the microcontroller. The circuit also has 4 additional pins -
c) RST: Reset
4.1.4 ROM
A code of 4K memory is incorporated as on-chip ROM in 8051. The 8051 ROM is a non volatile
memory meaning that its contents cannot be altered and hence has a similar range of data and
program memory, i.e, they can address program memory as well as a 64K separate block of data
memory.
4.1.5 RAM
The 8051 microcontroller is composed of 128 bytes of internal RAM. This is a volatile memory
since its contents will be lost if power is switched off. These 128 bytes of internal RAM are
divided into 32 working registers which in turn constitute 4 register banks (Bank 0-Bank 3) with
each bank consisting of 8 registers (R0 - R7). There are 128 addressable bits in the internal
RAM.
PORT P0: When there is no external memory present, this port acts as a general purpose
input/output port. In the presence of external memory, it functions as a multiplexed address and
data bus. It performs a dual role.
PORT P1: This port is used for various interfacing activities. This 8-bit port is a normal I/O port
i.e. it does not perform dual functions.
PORT P2: Similar to PORT P0, this port can be used as a general purpose port when there is no
external memory but when external memory is present it works in conjunction with PORT PO as
an address bus. This is an 8-bit port and performs dual functions.
PORT P3: PORT P3 behaves as a dedicated I/O port
5
4.2.Instruction set of 8051
MOVX A,@DPTR Move external RAM (16-bit addr.) to A MOVX @Ri,AMove A to external
SUBB
A,@Ri
Adds the register to the accumulator
4.2.3 Logical
Instructions:
ANL A,direct AND direct byte to accumulator ANL A,@RiAND indirect RAM to accumulator
interrupt
not set
10
JNB bit,rel Jump if direct bit is not set
JBC bit,rel Jump if direct bit is set and clear bit Compare
direct byte to A and jump if not
CJNE A,direct,rel 4.2.5
Machine Control
Compare immediate to A and
CJNE A,#data,rel jump if not equal
equal
CJNE Rn,#data rel Compare immed. to reg. and jump if not equal
@Ri,#data,rel Compare immed. to ind. and jump if not
CJNE equal
NOP No operation
11
4.3.Register Set 8051
Figure
4.2 Register Format
4.3.2 Register B
The major purpose of this register is in executing multiplication and division. The 8051 micro
controller has a single instruction for multiplication (MUL) and division (DIV). If you are
familiar with 8085, you may now know that multiplication is repeated addition, where as
division is repeated subtraction. While programming 8085, you may have written a loop to
execute repeated addition/subtraction to perform multiplication and division. Now here in 8051
you can do this with a single instruction.
12
Ex: MUL A,B – When this instruction is executed, data inside A and data inside B is multiplied
and answer is stored in A.
Note: For MUL and DIV instructions, it is necessary that the two operands must be in A and B.
Note: Follow this link if you are interested in knowing about differences between a
microprocessor and microcontroller.
Register B is also byte addressable and bit addressable. To access bit o or to access all 8 bits (as
a single byte), physical address F0 is used. To access bit 1 you may use F1 and so on. Please
take a look at the picture below.
Note: Register B can also be used for other general purpose operations.
Port Registers
As you may already know, there are 4 ports for 8051. If you are unfamiliar of the architecture of
8051 please read the following article:- The architecture of 8051
So 4 Input/Output ports named P0, P1, P2 and P3 has got four corresponding port registers with
same name P0, P1, P2 and P3. Data must be written into port registers first to send it out to any
other external device through ports. Similarly any data received through ports must be read from
port registers for performing any operation. All 4 port registers are bit as well as byte
addressable. Take a look at the figure below for a better understanding of port registers.
13
Figure 4.4 Port Register Format
As the name indicates, this register is used for efficient power management of 8051 micro
controller. Commonly referred to as PCON register, this is a dedicated SFR for power
management alone. From the figure below you can observe that there are 2 modes for this
register :- Idle mode and Power down mode
RS0 D3 Register LSB of the register bank select bit. Look for
Bank explanation below this table.
select bit
0
Bit
No
2
3
5 6
16
7 C D7 Carry Is set if data is coming out of bit 7 of Acc
Y during an
Arithmetic
operation.
At a time registers can take value from R0,R1…to R7. You may already know there are 32 such
registers. So how you access 32 registers with just 8 variables to address registers? Here comes
the use of register banks. There are 4 register banks named 0,1,2 and 3. Each bank has 8
registers named from R0 to R7. At a time only one register bank can be selected. Selection of
register bank is made possible through PSW register bits PSW.3 and PSW.4, named as RS0 and
RS1.These two bits are known as register bank select bits as they are used to select register
banks. The picture will talk more about selecting register banks.So far we have discussed about
all major SFR’s in 8051. There many other still waiting! Please remember there are 21 SFR’s
and we have discussed only 9 specifically. The table below lists all other 12 SFR’s.
17
IP B8 Interrupt priority. Both bit addressing and byte addressing possible.
TCON 88 Timer control. Both bit addressing and byte addressing possible.
The 8051 has two timers: timer0 and timer1. They can be used either as timers or as counters.
Both timers are 16 bits wide. Since the 8051 has an 8-bit architecture, each 16-bit is accessed as
two separate registers of low byte and high byte. First we shall discuss about Timer0 registers.
Timer0 registers is a 16 bits register and accessed as low byte and high byte. The low byte is
referred as a TL0 and the high byte is referred as TH0. These registers can be accessed like any
other registers.
18
Timer1 registers is also a 16 bits register and is split into two bytes, referred to as TL1 and TH1.
Figure 4.8 Timer 2
TMOD (timer mode) Register: This is an 8-bit register which is used by both timers 0 and 1 to
set the various timer modes. In this TMOD register, lower 4 bits are set aside for timer0 and the
upper 4 bits are set aside for timer1. In each case, the lower 2 bits are used to set the timer mode
and upper 2 bits to specify the operation.
The second bit is C/T bit and is used to decide whether a timer is used as a time delay
generator or an event counter. If this bit is 0 then it is used as a timer and if it is 1 then it is used
as a counter.
In upper or lower 4 bits, the last bits third and fourth are known as M1 and M0 respectively.
These are used to select the timer mode.
Mode 1- It is a 16-bit timer; therefore it allows values from 0000 to FFFFH to be loaded into the
timer’s registers TL and TH. After TH and TL are loaded with a 16-bit initial value, the timer
must be started. We can do it by “SETB TR0” for timer 0 and “SETB TR1” for timer 1. After
the timer is started. It starts count up until it reaches its limit of FFFFH. When it rolls over from
FFFF to 0000H, it sets high a flag bit called TF (timer flag). This timer flag can be monitored.
When this timer flag is raised, one option would be stop the timer with the instructions “CLR
TR0“ or CLR TR1 for timer 0 and timer 1 respectively. Again, it must be noted that each timer
flag TF0 for timer 0 and TF1 for timer1. After the timer reaches its limit and rolls over, in order
to repeat the process the registers TH and TL must be reloaded with the original value and TF
must be reset to 0.
Mode0- Mode 0 is exactly same like mode 1 except that it is a 13-bit timer instead of 16-bit. The
13-bit counter can hold values between 0000 to 1FFFH in TH-TL. Therefore, when the timer
reaches its maximum of 1FFH, it rolls over to 0000, and TF is raised.
Mode 2- It is an 8 bit timer that allows only values of 00 to FFH to be loaded into the timer’s
register TH. After TH is loaded with 8 bit value, the 8051 gives a copy of it to TL. Then the
timer must be started. It is done by the instruction “SETB TR0” for timer 0 and “SETB TR1” for
timer1. This is like mode 1. After timer is started, it starts to count up by incrementing the TL
20
register. It counts up until it reaches its limit of FFH. When it rolls over from FFH to 00. It sets
high the TF
(timer flag). If we are using timer 0, TF0 goes high; if using TF1 then TF1 is raised. When Tl
register rolls from FFH to 00 and TF is set to 1, TL is reloaded automatically with the original
value kept by the TH register. To repeat the process, we must simply clear TF and let it go
without any need by the programmer to reload the original value. This makes mode 2 auto reload,
in contrast in mode 1 in which programmer has to reload TH and TL.
Mode3- Mode 3 is also known as a split timer mode. Timer 0 and 1 may be programmed to be in
mode 0, 1 and 2 independently of similar mode for other timer. This is not true for mode 3;
timers do not operate independently if mode 3 is chosen for timer 0. Placing timer 1 in mode 3
causes it to stop counting; the control bit TR1 and the timer 1 flag TF1 are then used by timer0.
TCON register- Bits and symbol and functions of every bits of TCON are as follows:
FfFi
21