Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
8051 Tutorial
#1

8051 Tutorial

[attachment=566]
Introduction

Despite it s relatively old age, the 8051 is
one of the most popular microcontrollers in use
today. Many derivative microcontrollers have since
been developed that are based on--and
compatible with--the 8051. Thus, the ability to
program an 8051 is an important skill for anyone
who plans to develop products that will take
advantage of microcontrollers.
Many web pages, books, and tools are
available for the 8051 developer.
I hope the information contained in this
document/web page will assist you in mastering
8051 programming. While it is not my intention that
this document replace a hardcopy book purchased
at your local book store, it is entirely possible that
this may be the case. It is likely that this document
contains everything you will need to learn 8051
assembly language programming. Of course, this
document is free and you get what you pay for so
if, after reading this document, you still are lost you
may find it necessary to buy a book.

Code Memory

Code memory is the memory that holds
the actual 8051 program that is to be run. This
memory is limited to 64K and comes in many
shapes and sizes: Code memory may be found
on-chip, either burned into the microcontroller as
ROM or EPROM. Code may also be stored
completely off-chip in an external ROM or, more
commonly, an external EPROM. Flash RAM is
also another popular method of storing a program.
Various combinations of these memory types may
also be used--that is to say, it is possible to have
4K of code memory on-chip and 64k of code
memory off-chip in an EPROM.
When the program is stored on-chip the
64K maximum is often reduced to 4k, 8k, or 16k.
This varies depending on the version of the chip
that is being used. Each version offers specific
capabilities and one of the distinguishing factors
from chip to chip is how much ROM/EPROM
space the chip has.

Register Banks

The 8051 uses 8 "R" registers which are
used in many of its instructions. These "R"
registers are numbered from 0 through 7 (R0, R1,
R2, R3, R4, R5, R6, and R7). These registers are
generally used to assist in manipulating values
and moving data from one memory location to
another. For example, to add the value of R4 to
the Accumulator, we would execute the following
instruction:

Bit Memory

The 8051, being a communicationsoriented
microcontroller, gives the user the ability
to access a number of bit variables. These
variables may be either 1 or 0.
There are 128 bit variables available to the
user, numberd 00h through 7Fh. The user may
make use of these variables with commands such
as SETB and CLR.
It is important to note that Bit Memory is
really a part of Internal RAM. In fact, the 128 bit
variables occupy the 16 bytes of Internal RAM
from 20h through 2Fh. Thus, if you write the value
FFh to Internal RAM address 20h you ve
effectively set bits 00h through 07h.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Powered By MyBB, © 2002-2024 iAndrew & Melroy van den Berg.