0% found this document useful (0 votes)
18 views11 pages

Dem Report On 8051 Microprocessor

The document discusses embedded systems and microcontrollers. It provides details about the 8051 microcontroller family, specifically the AT89C51 microcontroller. It describes the pin functions and special function registers of the AT89C51 microcontroller. It also discusses the basic registers of 8051 microcontrollers including the accumulator, R registers, program status word, stack pointer, data pointer, and serial data buffer.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views11 pages

Dem Report On 8051 Microprocessor

The document discusses embedded systems and microcontrollers. It provides details about the 8051 microcontroller family, specifically the AT89C51 microcontroller. It describes the pin functions and special function registers of the AT89C51 microcontroller. It also discusses the basic registers of 8051 microcontrollers including the accumulator, R registers, program status word, stack pointer, data pointer, and serial data buffer.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Introduction

We are living in the Embedded World. You are surrounded with many
embedded products and your daily life largely depends on the proper
functioning of these gadgets. Television, Radio, CD player of your living
room, Washing Machine or Microwave Oven in your kitchen, Card
readers, Access Controllers, Palm devices of your work space enable you
to do many of your tasks very effectively. Apart from all these, many
controllers embedded in your car take care of car operations between the
bumpers and most of the times you tend to ignore all these controllers.
Theoretically, an embedded controller is a combination of a piece of
microprocessor based hardware and the suitable software to undertake a
specific task.
These days designers have many choices in microprocessors/
microcontrollers. Especially, in 8 bit and 32 bit, the available variety
really may overwhelm even an experienced designer. Selecting a right
microprocessor may turn out as a most difficult first step and it is getting
complicated as new devices continue to pop-up very often.
In the 8 bit segment, the most popular and used architecture is Intel's 8031.
Market acceptance of this particular family has driven many
semiconductor manufacturers to develop something new based on this
particular architecture. Even after 25 years of existence, semiconductor
manufacturers still come out with some kind of device using this 8031 core.

pg. 1
8051 Microcontrollers:-

The AT89C51 is a low-power, high-performance CMOS 8-bit


microcomputer with 4 Kbytes of Flash Programmable and Erasable Read
Only Memory (PEROM). The device is manufactured using Atmel's high
density nonvolatile memory technology and is compatible with the
industry standard MCS-51Ô instruction set and pin out. The on-chip Flash
allows the program memory to be reprogrammed in-system or by a
conventional nonvolatile memory programmer. By combining a versatile
8-bit CPU with Flash on a monolithic chip, the Atmel AT89C51 is a
powerful microcomputer which provides a highly flexible and cost
effective solution to many embedded control applications.
The AT89C51 provides the following standard features: 4 Kbytes of
Flash, 128 bytes of RAM, 32 I/O lines, two 16-bit timer/counters, five
vector two-level interrupt architecture, a full duplex serial port, and on-
chip oscillator and clock circuitry. In addition, the AT89C51 is designed
with static logic for operation down to zero frequency and supports two
software selectable power saving modes. The Idle Mode stops the CPU
while allowing the RAM, timer/counters, serial port and interrupt system
to continue functioning. The Power down Mode saves the RAM contents
but freezes the oscillator.

pg. 2
8051 microcontroller Pin Diagram and
Pin Functions:-

pg. 3
ALE/PROG: Address Latch Enable output pulse for latching the low byte
of the address during accesses to external memory. ALE is emitted at a
constant rate of 1/6 of the oscillator frequency, for external timing or
clocking purposes, even when there are no accesses to external memory.
(However, one ALE pulse is skipped during each access to external Data
Memory.) This pin is also the program pulse input (PROG) during
EPROM programming.

PSEN: Program Store Enable is the read strobe to external Program


Memory. When the device is executing out of external Program Memory,
PSEN is activated twice each machine cycle (except that two PSEN
activations are skipped during accesses to external Data Memory). PSEN
is not activated when the device is executing out of internal Program
Memory.

EA/VPP: When EA is held high the CPU executes out of internal


Program Memory (unless the Program Counter exceeds 0FFFH in the
80C51). Holding EA low forces the CPU to execute out of external
memory regardless of the Program Counter value. In the 80C31, EA must
be externally wired low. In the EPROM devices, this pin also receives the
programming supply voltage (VPP) during EPROM programming.

XTAL1: Input to the inverting oscillator amplifier.


XTAL2: Output from the inverting oscillator amplifier.

Port 0: Port 0 is an 8-bit open drain bidirectional port. As an open drain


output port, it can sink eight LS TTL loads. Port 0 pins that have 1s written
to them float, and in that state will function as high impedance inputs. Port
0 is also the multiplexed low-order address and data bus during accesses

pg. 4
to external memory. In this application it uses strong internal pull-ups
when emitting 1s. Port 0 emits code bytes during program verification. In
this application, external pull-ups are required.

Port 1: Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. Port
1 pins that have 1s written to them are pulled high by the internal pull-
ups, and in that state can be used as inputs. As inputs, port 1 pins that are
externally being pulled low will source current because of the internal
pull-ups.

Port 2: Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. Port
2 emits the high-order address byte during accesses to external memory
that use 16-bit addresses. In this application, it uses the strong internal
pull-ups when emitting 1s
.
Port 3: Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. It
also serves the functions of various special features of the 80C51 Family
as follows:
Port Pin Alternate Function
P3.0 RxD (serial input port)
P3.1 TxD (serial output port)
P3.2 INT0 (external interrupt 0)
P3.3 INT1 (external interrupt 1)
P3.4 T0 (timer 0 external input)
P3.5 T1 (timer 1 external input)
P3.6 WR (external data memory write strobe)
P3.7 RD (external data memory read strobe)

VCC: Supply voltage


VSS: Circuit ground potential

pg. 5
Special Function Registers

Accumulator:
ACC is the Accumulator register. The mnemonics for Accumulator-
Specific instructions, however, refer to the Accumulator simply as A.

B Register:
The B register is used during multiply and divide operations. For other
instructions it can be treated as another scratch pad register
.
Program Status Word:
The PSW register contains program status information as detailed in
Figure.

Stack Pointer:-
The Stack Pointer register is 8 bits wide. It is incremented before data is
stored during PUSH and CALL executions. While the stack may reside
anywhere in on-chip RAM, the Stack Pointer is initialized to 07H after a
reset. This causes the stack to begin at locations 08H.

Data Pointer:-

pg. 6
The Data Pointer (DPTR) consists of a high byte (DPH) and a low byte
(DPL). Its intended function is to hold a 16-bit address. It may be
manipulated as a 16-bit register or as two independent 8-bit registers.

Serial Data Buffer:-


The Serial Buffer is actually two separate registers, a transmit buffer and
a receive buffer. When data is moved to SBUF, it goes to the transmit
buffer and is held for serial transmission. (Moving a byte to SBUF is what
initiates the transmission.) When data is moved from SBUF, it comes
from the receive buffer.

Timer Registers Basic to 80C51:-


Register pairs (TH0, TL0), and (TH1, TL1) are the 16-bit Counting
registers for Timer/Counters 0 and 1, respectively.

Control Register for the 80C51:-


Special Function Registers IP, IE, TMOD, TCON, SCON, and PCON
contain control and status bits for the interrupt system, the
Timer/Counters, and the serial port. They are described in later sections.

pg. 7
Basic Registers:-
A number of 8052 registers can be considered "basic." Very little can be
done without them and a detailed explanation of each one is warranted to
make sure the reader understands these registers before getting into more
complicated areas of development.

The Accumulator:-
If you've worked with any other assembly language you will be familiar
with the concept of an accumulator register.
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 and is the most versatile register the 8052 has due to the
sheer number of instructions that make use of the accumulator. More than
half of the 8052's 255 instructions manipulate or use the Accumulator in
some way.
For example, if you want to add the number 10 and 20, the resulting 30
will be stored in the Accumulator. Once you have a value in the
Accumulator you may continue processing the value or you may store it
in another register or in memory.

The "R" Registers:-


The "R" registers are sets of eight registers that are named R0, R1, through
R7. These registers are used as auxiliary registers in many operations. To
continue with the above example, perhaps you are adding 10 and 20. The
original number 10 may be stored in the Accumulator whereas the value

pg. 8
20 may be stored in, say, register R4. To process the addition you would
execute the command:
ADD A, R4
After executing this instruction the Accumulator will contain the value
30. You may think of the "R" registers as very important auxiliary, or
"helper", registers. The Accumulator alone would not be very useful if it
were not for these "R" registers.
The "R" registers are also used to store values temporarily. For example,
let’s say you want to add the values in R1 and R2 together and then
subtract the values of R3 and R4. One way to do this would be:
MOV A, R3 ; Move the value of R3 to accumulator
ADD A, R4 ; add the value of R4
MOV R5, A ; Store the result in R5
MOV A, R1 ; Move the value of R1 to Acc
ADD A, R2 ; add the value of R2 with A
SUBB A, R5 ; Subtract the R5 (which has R3+R4)
As you can see, we used R5 to temporarily hold the sum of R3 and R4.
Of course, this isn't the most efficient way to calculate (R1+R2) - (R3
+R4) but it does illustrate the use of the "R" registers as a way to store
values temporarily.
As mentioned earlier, there are four sets of "R" registers-register bank 0,
1, 2, and 3. When the 8052 is first powered up, register bank 0 (addresses
00h through 07h) is used by default. In this case, for example, R4 is the
same as Internal RAM address 04h. However, your program may instruct
the 8052 to use one of the alternate register banks; i.e., register banks 1,
2, or 3. In this case, R4 will no longer be the same as Internal RAM
address 04h. For example, if your program instructs the 8052 to use
register bank 1, register R4 will now be synonymous with Internal RAM
address 0Ch. If you select register bank 2, R4 is synonymous with 14h,
and if you select register bank 3 it is synonymous with address 1Ch.

pg. 9
The concept of register banks adds a great level of flexibility to the 8052,
especially when dealing with interrupts (we'll talk about interrupts later).
However, always remember that the register banks really reside in the first
32 bytes of Internal RAM.

The 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 implicitly by
two 8052 instructions: MUL AB and DIV AB. Thus, if you want to
quickly and easily multiply or divide A by another number, you may store
the other number in "B" and make use of these two instructions.
Aside from the MUL and DIV instructions, the "B" register are often used
as yet another temporary storage register much like a ninth "R" register.

The Program Counter:-


The Program Counter (PC) is a 2-byte address that tells the 8052 where
the next instruction to execute is found in memory. When the 8052 is
initialized PC always starts at 0000h and is incremented each time an
instruction is executed. It is important to note that PC isn't always
incremented by one. Since some instructions are 2 or 3 bytes in length the
PC will be incremented by 2 or 3 in these cases.
The Program Counter is special in that there is no way to directly modify
its value. That is to say, you can't do something like PC=2430h. On the
other hand, if you execute LJMP 2430h you've effectively accomplished
the same thing.
It is also interesting to note that while you may change the value of PC
(by executing a jump instruction, etc.) there is no way to read the value of
PC. That is to say, there is no way to ask the 8052 "What address are you
about to execute?" As it turns out, this is not completely true: There is one

pg. 10
trick that may be used to determine the current value of PC. This trick will
be covered in a later chapter.

The Data Pointer:-


The Data Pointer (DPTR) is the 8052ís only user-accessible 16-bit (2-
byte) register. The Accumulator, "R" registers, and "B" register are all 1-
byte values. The PC just described is a 16-bit value but isn't directly user-
accessible as a working register.
DPTR, as the name suggests, is used to point to data. It is used by a
number of commands that allow the 8052 to access external memory.
When the 8052 accesses external memory it accesses the memory at the
address indicated by DPTR.
While DPTR is most often used to point to data in external memory or
code memory, many developers take advantage of the fact that it's the only
true 16-bit register available. It is often used to store 2-byte values that
have nothing to do with memory locations.

pg. 11

You might also like