MPMC M5 Ktunotes - in
MPMC M5 Ktunotes - in
To
make a complete microcomputer system, adding other peripherals such as ROM, RAM,
decoders, drivers, and a number of I/O devices is necessary. In addition, special-purpose
devices, such as interrupt controllers, programmable timers, programmable I/O devices,
DMA controllers may be added to improve the capability and performance, and
flexibility of a microcomputer system.
● On the other hand, the microcontroller has built-in ROM, RAM, parallel I/O, serial I/O,
counters, and a clock circuit. It has on-chip peripheral devices which makes it possible to
have a single microcomputer system.
● A microcontroller does not require any additional interfacing ICs for operation and it
functions as a standalone system. The operation of a microcontroller is multipurpose.
Features of 8051
1. 4KB on-chip program memory (ROM/EPROM).
2. 128 bytes on-chip data memory.
3. Four register banks.
4. 64KB for each external ROM and external RAM addressability.
5. One-microsecond instruction cycle with 12MHz crystal.
6. 32 bidirectional I/O lines organized as four 8-bit ports.
7. Multiple modes, high-speed programmable serial port (UART).
8. 16-bit Timers/Counters.
9. Direct byte and bit addressability.
ARCHITECTURE OF 8051
Accumulator: The Accumulator, as its name suggests, is used as a general register to
accumulate the results of a large number of instructions. It can hold an 8-bit (1-byte) value.
‘B’ Register: The "B" register is very similar to the Accumulator in the sense that it may hold an
8-bit (1- byte) value. The "B" register is only used by two 8051 instructions: MUL AB and DIV
AB. Aside from the MUL and DIV instructions, the “B” register is often used as yet another
temporary storage register.
Program Status Word: The PSW register contains program status information. It is an 8-bit
flag register, out of 8-bits 6 bits are used and 2 bits are reserved. Out of 6 bits 4 bits are
conditional bits and 2 bits are used for selecting the register bank.
Format of PSW
● The 8051 has two types of memory and these are Program Memory and Data Memory.
Program Memory (ROM) is used to permanently save the program being executed, while
Data Memory (RAM) is used for temporarily storing data and intermediate results created
and used during the operation of the microcontroller.
● All 8051 microcontrollers have a 16-bit addressing bus and are capable of addressing 64
kb memory.
1. PROGRAM MEMORY:
● Program Memory (ROM) is used for the permanent saving of the program
(CODE) being executed. The memory is read-only. It is further divided
into internal (on-chip) and external ROM.
2. DATA MEMORY:
● 8051 supports 64 kb of external data memory from 0000H to FFFFH. This
memory can be accessed under the control of the register DPTR.
● RD’, WR’, CS’ signals are used while accessing external data memory.
● Internal data memory consists of two parts.
○ Lower 128 bytes from 00H to 7FH
○ Upper 128 bytes from 80H to FFH
1. Unconditional jump instructions: upon their execution, a jump to a new location from
where the program continues execution is executed.
The IP Register (Interrupt Priority Register) specifies which one of the existing interrupt sources
has higher and which one has lower priority. Interrupt priority is usually specified at the
beginning of the program. According to that, there are several possibilities:
1. If an interrupt of higher priority arrives while an interrupt is in progress, it will be
immediately stopped and the higher priority interrupt will be executed first.
2. If two interrupt requests, at different priority levels, arrive at the same time then the
higher priority interrupt is serviced first.
3. If both interrupt requests, at the same priority level, occur one after another, the one
which came later has to wait until the routine being in progress ends.
4. If two interrupt requests of equal priority arrive at the same time then the interrupt to be
serviced is selected according to the following priority list:
1. External interrupt INT0
2. Timer 0 interrupt
3. External Interrupt INT1
4. Timer 1 interrupt
5. Serial Communication Interrupt
For example -
ADD A, #77 Adds 77 (decimal) to A and stores in A
MOV DPTR, #1000H Moves 1000 (hexadecimal) to the data pointer
2. Register Addressing: This way of addressing accesses the bytes in the current register
bank. Data is available in the register specified in the instruction. The register bank is
decided by 2 bits of Processor Status Word (PSW).
For example -
ADD A, R0 Adds content of R0 to A and stores in A
For example -
MOV A, 088H Moves the content of SFR TCON to A (088H is the address
of special function register TCON in 8051)
For example -
MOV A, @R0 moves the content of the address pointed by R0 to A
For example -
RLA This instruction rotates accumulator left
6. Indexed Addressing: Only program memory can be accessed using this mode. It is
mainly used for look-up table manipulations.
For example -
MOVC A, @A+DPTR DPTR has the base address of LUT and A has the relative
(offset) address. The LUT content at the effective address
obtained by adding the base address and relative address is
moved to ACC (accumulator)