Professional Documents
Culture Documents
An Introduction
Features & Applications
1
Microprocessor
Input Output
Device Microprocess Device
or
(acting as
Interrupt CPU) Timing
Handler Unit
Memories
Control Bus(6)
ALU
RAM
Clock
Read
CPU
Serial
oscillator Bus control I/O port
port
EA ALE
RST P0Rose
Prof. (Dr.) Anil P2 P1 P3 TXD* 33
RXD*
PSEN (Address/data)
SEMICONDUCTOR MEMORY: RAM AND
ROM
Programs and data are stored in memory. The variation of
computer memory are so vast,their accompanying terms so
plentiful, and technology breakthroughs so frequent, that
extensive and continual study is required to keep abreast of
the latest developments.the memory devices directly
accessible by the CPU consist of semiconductor ICs
(integrated circuits) called RAM and ROM.there are two
features that distinguish RAM and ROM: first, RAM is
read/write memory while ROM is read-only memory, and
second , RAM is volatile (the contents are lost when power
is removed), while ROM is non-volatile.
ACCUMULATOR (ACC): The accumulator resister (ACC or A) acts as
an operand resisters, in case of some instructions. This may either be implicit or
specified in the instruction. The ACC resister has been allotted an address in the
on-chip special function resister bank.
B REGISTER: This resister is used to store one of the operands for multiply
and divide instructions. In other instructions, it may just be used as a scratch pad.
This register is considered as a special function registers.
STACK POINTER (SP): This 8-bit wide resister is incremented before the
data is stored onto the stack using push or call instructions. This contains 8-bit
stack top address. The stack may be defined anywhere in the on-chip 128-byte
RAM.
DATA POINTER (DPTR): This 16-bit resister contains a higher
byte (DPH) and the lower byte (DPL) of a 16-bit external data RAM
address. It is accessed as a 16-bit resister or two 8-bit resisters as specified
above. It has been allotted two addresses in the special function resister
bank, for its two bytes DPH and DPL.
ALU: the arithmetic and logic unit performs 8-bit arithmetic and logical
operations over the operands held by the temporary resisters TMP1 and
TMP2. Users cannot access these temporary resisters.
IR
8051 EPROM
ALE
ADD DATA
The ALE signal pulses at a rate of 1/6 the on chip oscillator frequency and can be used
as a general purpose clock for the rest of the system. If 8051 is clocked from 12mhz
then ALE oscillate 2mhz.only exception is that during movx when one ALE pulse is
missed this pin is also used for programming i/p pulse for EPROM of the 8051
EA(EXTERNAL ACCESS)
It is I/P signal on pin 31 is generally tied high or low. If high the
8051/8052 execute program from internal ROM and if low programme
execute from external ROM (PSEN will be low). EA must be low for
8031/8032 since there is no on chip memory.if EA is low disable te
internal ROM and programme execute from EPROM. The EPROM
version of 8051 also use EA line for +21 volt supply for programming
the internal EPROM.
EA EPROM
ROM
RST (Reset)
I/P on pin 9 is the master reset for 8051.when the signal is brought high at least for
two machine cycles.8051 internal registers are loaded with appropriate value for an
orderly system start-up.
Summary
of the
8051 on-
chip data
memory
(RAM)
• Microcontroller implement separate memory space for code ( Program) and data
• Internal memory consist on chip RAM & ROM.
• Two main feature a) the registers and I/O ports are memory mapped and accessible
like any other memory location. b) the stack reside with in the internal RAM, rather
than external RAM.
• The active register bank may be altered by changing the register bank
Carry flag
TRANS: RETI
END
• SM2
– This enables the multiprocessing capability of
the 8051
Prof. (Dr.) Anil Rose 190
SCON Register (cont.)
• REN (receive enable)
– When it is high, it allows 8051 to receive data
on RxD pin
– If low, the receiver is disable
• TI (transmit interrupt)
– When 8051 finishes the transfer of 8-bit
character
• It raises TI flag to indicate that it is ready to
transfer another byte
• TI bit is raised at the beginning of the stop bit
Prof. (Dr.) Anil Rose 191
SCON Register (cont.)
• RI (receive interrupt)
– When 8051 receives data serially via RxD, it
gets rid of the start and stop bits and places
the byte in SBUF register
• It raises the RI flag bit to indicate that a byte has
been received and should be picked up before it is
lost
• RI is raised halfway through the stop bit
• SCON is a bit-addressable register
addr[0-11]
• Bus
entire wires collection along with their communication protocol.
• Protocol: rules for communicating over the wires. (low level HW protocols)
Prof. (Dr.) Anil Rose 223
Basic Terminology
• Port: the actual conducting device (metal) on the processor (or
memory) through which the signal is input to, or output from.
• We could use the term pin to refer to a port on a processor.
– Pin is also a term referring to the extending pins from the processor ( as
own IC package). They are designed to be plugged into a socket on a
printed-circuit board.
– Small metallic balls could be used rather than pins( if the processor is
packaged in its own IC ).
• If the processor coexists on a single IC with other processors and
memories, pads of metal are used in the IC.
data
data
tsetup tread
read protocol
tsetup twrite
write protocol
req req
data 15:8 7:0 addr/data addr data
data data
req 1 3
req 1 3
data 2 4 ack 2 4
data
taccess
1. Master asserts req to receive data 1. Master asserts req to receive data
2. Servant puts data on bus within time taccess 2. Servant puts data on bus and asserts ack
3. Master receives data and deasserts req 3. Master receives data and deasserts req
4. Servant ready for next request 4. Servant ready for next request
• A handshake protocol can adjust to a servant with varying response times, but it
could be slower, and need extra clock cycles and extra line.
Prof. (Dr.) Anil Rose 228
Control methods :strobe / handshake
compromise
Master req Servant
wait
data
req 1 3 req 1 4
wait wait 2 3
data 2 4 data 5
taccess taccess
1. Master asserts req to receive data 1. Master asserts req to receive data
2. Servant puts data on bus within time taccess 2. Servant can't put data within taccess, asserts wait ack
(wait line is unused) 3. Servant puts data on bus and deasserts wait
3. Master receives data and deasserts req 4. Master receives data and deasserts req
4. Servant ready for next request 5. Servant ready for next request
• It achieves both the speed of strobe protocol, and the varying response time tolerance of a
handshake protocol.
• The handshake only occurs if it necessary.
Prof. (Dr.) Anil Rose 229
The ISA bus protocol – Memory Access
• ISA:
ISA The Industry Standard Microprocessor Memory I/O Device
Architecture.
ISA bus
C1 C2 WAIT C3 C4
•
CYCLE
•
D[7-0]
/MEMR
A[19-0]
DATA
ADDRESS
CHRDY before the rising clock ALE
/MEMW
• They are two bus-based methods for microprocessor to communicate with peripherals.
• In standard I/O (I/O-mapped I/O), the bus includes an additional pin (M`/IO), to
include whether the access is to memory or peripheral.
• e.g., Bus has 16-bit address, all of them for memory addressing if M`/IO=0, and all of
them for I/O addressing if M`/IO=1.
• Memory-mapped I/O
– Requires no special instructions
• Assembly instructions involving memory like MOV and ADD
work with peripherals as well.
• Standard I/O requires special instructions (e.g., IN, OUT) to
move data between peripheral registers and memory.
• Standard I/O
– No loss of memory addresses to peripherals.
– Simpler address decoding logic in peripherals possible.
• When number of peripherals much smaller than address space
then high-order address bits can be ignored
– smaller and/or faster comparators.
D[7-0]
DATA
A[15-0] ADDRESS
ALE
/IOR
CHRDY
/ADV Data is
ready
addr <15…0> GO=0
GO=1 here!
/WE
/OE
ADSP=1, ADSP=1,
/CS1 and /CS2 ADSC=0 ADSC=1
S2 S3
ADV=1, OE=1, ADV=0, OE=0,
CS3 Addr = ‘Z’ GO=1 Addr = ‘Z’
data<31…0>
GO=1
GO=0
• Generates control signals to drive the TC55V2325FF memory chip in burst mode.
– Addr0 is the starting address input to device.
– GO is enable/disable input to device.
ISR
16: MOV R0, 0x8000
System bus
17: # modifies R0
... Dack
Dreq
DMA ctrl P1
...
100: instruction
0x000 ack
PC
101: instruction 0x800 req 0x8000
1
10 0
0
Iack2
246
Prof. (Dr.) Anil Rose
Arbitration Daisy-Chain Arbitration
• Peripherals connected as a chain
– Each peripheral has: req. output, ack. input, req. input, and ack. Output
• Add or remove peripherals without redesigning the system
• Peripherals at the end of chain could become intolerably slow.
• Isn’t supporting more advanced priority schemes
• If one peripheral stop, the other lose access
• Each peripheral must be daisy-chain aware
– Otherwise, external logic is used.
P
System bus
Peripheral1 Peripheral2
Inta
Ack_in Ack_out Ack_in Ack_out
Int Req_out Req_in Req_out Req_in 0
Processor-local bus
Peripheral bus