MPMC module 3.1
MPMC module 3.1
MICROCONTROLLERS – UNIT 3
B Y S ON A L G U P TA
INSTRUCTIONS
• In other words, the processor, RAM, ROM, I/O ports, and timer are all
embedded together on one chip; therefore, the designer cannot add
any external memory, I/O, or timer to it.
• The fixed amount of on-chip ROM, RAM, and number of I/O ports in
microcontrollers makes them ideal for many applications in which cost
and space are critical.
• In many applications, for example a TV remote control, there is no
need for the computing power of a 486 or even an 8086
microprocessor because the space it takes, the power it consumes, and
the price per unit are much more critical considerations than the
computing power.
MICROCONTROLLER VERSUS GENERAL-
PURPOSE MICROPROCESSOR
• See Figure 2.
• Although the 8051 can have a maximum of 64K bytes of on-chip ROM,
many manufacturers have put only 4K bytes on the chip.
• The 8051 became widely popular after Intel allowed other
manufacturers to make and market any flavors of the 8051 they please
with the condition that they remain code-compatible with the 8051.
• This has led to many versions of the 8051 with different speeds and
amounts of on-chip ROM marketed by more than half a dozen
manufacturers.
OVERVIEW OF THE 8051 FAMILY
• With an 8-bit data type, any data larger than 8 bits must be broken
into 8-bit chunks before it is processed.
• Since there are a large number of registers in the 8051, we will
concentrate on some of the widely used general-purpose registers.
• The most widely used registers of the 8051 are A (accumulator), B,
R0, R1, R2, R3, R4, R5, R6, R7, DPTR (data pointer), and PC
(program counter).
• All of the above registers are 8 bits, except DPTR and the program
counter.
MOV INSTRUCTION
PIN DIAGRAM
PORT 0
• P3.0 and P3.1 are used for the RxD and TxD serial communication
signals.
• Bits P3.2 and P3.3 are set aside for external interrupts.
• Bits P3.4 and P3.5 are used for timers 0 and 1.
• Finally, P3.6 and P3.7 are used to provide the WR and RD signals of
external memories connected in 8031-based systems.
• In systems based on the 8751, 89C51, or DS89C4x0, pins 3.6 and 3.7
are used for I/O while the rest of the pins in port 3 are normally used
in the alternate function role.
TIME DELAY FOR 8051
• The 16-bit register of Timer 0 is accessed as low byte and high byte.
• The low-byte register is called TL0 (Timer 0 low byte) and the high-byte register is
referred to as TH0 (Timer 0 high byte).
• These registers can be accessed like any other register, such as A, B, R0, R1, or R2.
• For example, the instruction “MOV TL0,#4FH” moves the value 4FH into TL0, the low
byte of Timer 0.
• These registers can also be read like any other register.
TIMER 1 REGISTERS
• Timer 1 is also 16 bits, and its 16-bit register is split into two bytes,
referred to as TL1 (Timer 1 low byte) and TH1 (Timer 1 high byte).
• These registers are accessible in the same way as the registers of
Timer 0.
TMOD (TIMER MODE) REGISTER
• Both timers 0 and 1 use the same register, called TMOD, to set the
various timer operation modes.
• TMOD is an 8-bit register in which the lower 4 bits are set aside for
Timer 0 and the upper 4 bits for Timer 1.
• In each case, the lower 2 bits are used to set the timer mode and the
upper 2 bits to specify the operation.
• These options are discussed next.