8051 Microcontroller Basics by Er. Swapnil V. Kaware
8051 Microcontroller Basics by Er. Swapnil V. Kaware
8051 Microcontroller Basics by Er. Swapnil V. Kaware
Presented By,
Er. Swapnil V. Kaware,
B.E. (Electronics), M.E. (Electronics)
[email protected]
Microcontroller Notes by Er. Swapnil V. Kaware ([email protected]) 2
Salient Features
(1). 8 bit microcontroller originally developed by Intel in
1980.
5
(16). It has four 8 bit ports, total 32 I/O lines.
Salient Features
(17). RAM, ROM, I/O ports, one serial port and timers are
all on-chip.
7
Internal Architecture
Oscillator Circuit:-
(6). In the 8051, the stack resides within the internal RAM,
rather than in external RAM.
12
Register banks in the 8051 Microcontroller
13
Special Function Registers
(1). ACC
(2). B
(3). PSW
(4). SP
(5). DPTR
(5). IP
(6). PMODE
(7). PCON
(8). TMODE
(9). TCON etc. 14
Special Function Registers
(1). 8051 has 21 special function registers (SFRs) at the top of internal
RAM from address 80H to FFH.
(2). Most of the addresses from 80H to FFH are not defined, except for 21
of them.
(3). Some SFR’s are both bit-addressable and byte addressable, depending
on the instruction accessing the register.
(5). All 8051 CPU registers, I/O ports, timers and other architecture
components are accessible in 8051 C through SFRs
15
Microcontroller Notes by Er. Swapnil V. Kaware ([email protected])
B Register
(1). B register or accumulator B is used along with the accumulator
for multiply and divide operations.
(2). MUL AB: multiplies 8 bit unsigned values in A and B. and leaves
the 16 bit result in A (low byte) and B (high byte).
17
Stack Pointer
(1). Stack pointer (SP) is an 8-bit register at address 81H.
(2). DPTR is a 16 bit register at addresses 82H (low byte) and 83H
(high byte).
(3). One of the most useful features of the 8051 is four bidirectional
I/O ports.
(4). Each port has an 8-bit latch in the SFR space as mentioned
earlier.
21
I/O Ports
(5). To reduce the overall package pin count, the 8051
employs multiple functions for each port.
(6). Each port also has an output drive and an input buffer.
(8). The four 8-bit I/O ports P0, P1, P2 and P3 each uses 8
pins.
23
PORT 0
(1). Port 0 is 8-bitbidirectional I/O port.
(2). Port 2 emits the high-order address byte during fetches from
external program memory and during accesses to external data
memory that use 16-bit addresses (MOVX @DPTR).
(3). The 8051 has two 16-bit registers that can be used as either
timers or counters.
30
TMOD (Timer/Counter Control Register)
31
SCON (Serial Port Control Register)
32
PCON (Power Mode Control Register)
33
Interrupts
• An interrupt is a special feature which Allows the 8051 to
provide the illusion of "multitasking,“ although in reality the
8051 is only doing one thing at a time. The word "interrupt" can
often be substituted with the word "event.“
2 TF0 000BH
3 IE1 0013H
4 TF1 001BH
5 SERIAL 0023H
36
Interrupt Priority (IP) SFR
37
Interrupt Enable (IE) SFR
38
For More Contents, do subscribe
to my channel on you tube as,
”Tech_Guru Swapnil
Kaware”
(Thanks For Watching)
Microcontroller Notes by Er. Swapnil V. Kaware ([email protected])