8051 Fundaes

What are micro controllers?
A highly integrated microprocessor designed specifically for use in embedded systems
A microcontroller is a computer-on-a-chip optimised to control devices.

These are some of the definitions of a microcontroller or �C as we would refer to it from now on. We can conclude safely from the definitions above that a �C can be used to control a robot and manipulate its actions in various ways.

Bit by Bit
�Cs are classified according to the number of bits it can process at a time (eg: 8-bit, 16-bit, 32-bit). For all entry level applications an 8-bit �C usually suffices. For robotics too there is a host of 8-bit �Cs enough for all our applications.

RISC or CISC
RISC – Reduced instruction set computing
CISC � Complex instruction se computing

THE DIFFERENCE:
Suppose we need to multiply 2 and 6.
In a CISC core we generally would have an instruction like �Multiply 2,6�
But in a RISC core we wouldn�t have a multiply instruction. Instead we would have to add 2 to itself 6 times. This increases software complexity but reduces hardware complexity and gives higher throughput.

The BIG FIGHTWhich �C??

Choices galore: AVR, PICs, 8051s

?AVR series
:) RISC core, on chip ADC, PWM generator
:( Price slightly on the higher side, no free samples, Overkill for many applications

?PICs
:) Lots of variety, free samples delivered to your residence, feature rich

:( A bit complex to begin with

?8051 & variants
:) Easy to use, vast support, lots of variants for all types of applications, easy availability
:( Relatively slow.

Our choice � The 8051 variant 89V51RD2 from Philips Semiconductors. The reasons being
?8051 core
?Closely related to academic syllabus
?Easy availability
?In built bootloader

The P89V51RD2

8051 architecture

Features:
?80C51 Central Processing Unit
?5 V Operating voltage from 0 MHz to 40 MHz
?64 kB of on-chip Flash user code memory with ISP (In-System Programming) and IAP (In-Application Programming)
?Supports 12-clock (default) or 6-clock mode selection via software or ISP
?SPI (Serial Peripheral Interface) and enhanced UART
?PCA (Programmable Counter Array) with PWM and Capture/Compare functions
?Three 16-bit timers/counters
?Programmable watchdog timer

?Eight interrupt sources with four priority levels

80C51 CPU:
This is the heart of the �C. The place where all the computations take place. It contains the general purpose registers, the ALU etc.

Code Flash (64KB):
Flash is a non volatile form of storage. So it can be used to store the user program.

Data RAM (1KB):
RAM is a volatile memory. It can be accessed faster than flash. Hence it is used for storing program variables.

Port (0-3):
These are used for general I/O operations.

Eg: reading from switches, turning LEDs on.

Oscillator:
Generates clock frequency with the help of the crystal.

UART:
The CPU processes data in parallel. But parallel communication has its limitations with respect to the length of wire used to communicate. So for longer distances we use serial communication. The UART (Universal Asynchronous Receiver Transmitter) converts the parallel stream of data to serial and encapsulates it into a specific protocol.

SPI:

SPI (Serial Peripheral Interface) is another serial communication port. It can be used to communicate between �C and PC as well as between 2 or more �Cs in master/slave configuration.

Timer/Counter:

These are set of registers which can be incremented on either each clock cycle (Timer) or on the occurrence of an external event (Counter).
Eg: A stop watch is a Timer while an object counter is a counter

Interrupts:
An asynchronous input which changes the normal flow of execution of a program is called an interrupt.
Eg: You are reading a book, and your mom calls out to you to do some work. So you place a bookmark, do your mom�s work, come back and resume from where you left off.
Here mom is the interrupt, her work is the function that is supposed to be done when interrupt occurs and you reading the book is normal flow of execution of program.

Good 8051 references:
www.8052.com
C51 Primer

Books:
8051 Microcontroller and Embedded Systems by Muhammad Ali Mazidi, Janice Mazidi
The 8051 Microcontroller by Kenneth Ayala

Leave a Reply