Introduction to microcontrollers
A micro-controller can be compared
to a small stand alone computer, it is a very powerful device,
which is capable of executing a series of pre-programmed tasks
and interacting with other hardware devices. Being packed in a
tiny integrated circuit (IC) whose size and weight is usually
negligible, it is becoming the perfect controller for robots or
any machines requiring some kind of intelligent automation. A
single microcontroller can be sufficient to control a small mobile
robot, an automatic washer machine or a security system. Any microcontroller contains a memory to store the program to be executed,
and a number of input/output lines that can be used to interact
with other devices, like reading the state of a sensor or controlling
8051-8052 Instruction Set
Instruction Set and Timing
In order to understand--and better make use of--the 8051, it is necessary to understand
some underlying information concerning timing.
If you've worked with any other assembly languages you will be familiar with the concept
of an Accumulator register.
Special Function Registers
The 8051 is a flexible microcontroller with a relatively large number of modes of operations. Your program may inspect and/or change the operating mode of the 8051 by manipulating the values of the 8051's Special Function Registers (SFRs).
Types of Memory
The 8051 has three very general types of memory. To effectively program the 8051 it is necessary to have a basic understanding of these memory types.
When an 8051 is first initialized, it resets the PC to 0000h. The 8051 then begins to
execute instructions sequentially in memory unless a program instruction causes the PC
to be otherwise altered. There are various instructions that can modify the value of
the PC; specifically, conditional branching instructions, direct jumps and calls, and
"returns" from subroutines. Additionally, interrupts, when enabled, can cause the
program flow to deviate from its otherwise sequential scheme.
The 8051 comes equipped with two timers, both of which may be controlled, set, read, and
configured individually. The 8051 timers have three general functions: 1) Keeping time
and/or calculating the amount of time between events, 2) Counting the events themselves,
or 3) Generating baud rates for the serial port.
8051 Tutorial: Addressing Modes
One of the 8051s many powerful features is its integrated UART, otherwise
known as a serial port. The fact that the 8051 has an integrated serial port means
that you may very easily read and write values to the serial port. If it were not
for the integrated serial port, writing a byte to a serial line would be a rather
tedious process requring turning on and off one of the I/O lines in rapid succession
to properly "clock out" each individual bit, including start bits, stop bits, and