Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1
Faculty of Engineering & Technology ©M. S. Ramaiah University of Applied Sciences
Lecture 29
Programming Model of 8051 and Pin
Details
Lecture delivered by:
Pranupa S
2
Faculty of Engineering & Technology ©M. S. Ramaiah University of Applied Sciences
Objectives
At the end of this lecture, student will be able to:
3
Faculty of Engineering & Technology ©M. S. Ramaiah University of Applied Sciences
Topics
• Typical Microcontrollers
• Criteria for selecting microcontroller
• Programming microcontroller
• Advantages of higher programming languages
• Pre-processor directives
4
Faculty of Engineering & Technology ©M. S. Ramaiah University of Applied Sciences
Introduction
Microcontroller is a smaller computer containing of on chip RAM,
ROM, I/O Ports. A good designer should always know what type of
controller to be used, there architecture, advantages, disadvantages,
way to reduce production cost and product reliability
5
Faculty of Engineering & Technology ©M. S. Ramaiah University of Applied Sciences
Typical Microcontrollers
• The most common microcontrollers are 8-bit.
6
Faculty of Engineering & Technology ©M. S. Ramaiah University of Applied Sciences
Criteria for Selecting Microcontroller
• Primary Criterion:
• All instructions that the microcontroller can recognize are together called
the Instruction set. 9
Faculty of Engineering & Technology ©M. S. Ramaiah University of Applied Sciences
Programming Microcontrollers
• The main advantage of this programming language is its simplicity,
i.e. each program instruction corresponds to one memory location
in the microcontroller
10
Faculty of Engineering & Technology ©M. S. Ramaiah University of Applied Sciences
Programming Microcontrollers (Contd.)
• Similar to assembly language, a specialized program in a PC called
compiler is in charge of compiling program into machine language.
11
Faculty of Engineering & Technology ©M. S. Ramaiah University of Applied Sciences
Programming Microcontrollers (Contd.)
• Example
12
Faculty of Engineering & Technology ©M. S. Ramaiah University of Applied Sciences
Advantages of Higher Programming languages
13
Faculty of Engineering & Technology ©M. S. Ramaiah University of Applied Sciences
Preprocessor is an Integral Part of the
Preprocessor Directive
• A C compiler and its function is to recognize and execute
preprocessor instructions.
• These are special instructions which do not belong to C language,
but are a part of software package coming with the compiler.
• Each preprocessor command starts with ‘#’. Prior to program
compilation, C compiler activates the preprocessor which goes
through the program in search for these signs
• In order to speed up the process of writing a program, these
commands and declarations are usually grouped in particular files
that can easily be included in the program using this directive
14
Faculty of Engineering & Technology ©M. S. Ramaiah University of Applied Sciences
Preprocessor Directive
15
Faculty of Engineering & Technology ©M. S. Ramaiah University of Applied Sciences
8051 pin details
16
Faculty of Engineering & Technology ©M. S. Ramaiah University of Applied Sciences
pins of 8051
Vcc(pin 40):
Vcc provides supply voltage to the chip
The voltage source is +5V
GND(pin 20):ground
XTAL1 and XTAL2(pins 19,18):
These 2 pins provide crystal input to external clock
RST(pin 9):reset
input pin and active high(normally low).
The high pulse must be high at least 2 machine cycles.
power-on reset.
Upon applying a high pulse to RST, the microcontroller will reset and all values in
registers will be lost.
Reset values of some 8051 registers
power-on reset circuit
17
Faculty of Engineering & Technology ©M. S. Ramaiah University of Applied Sciences
Summary
• A designer should always know the type of controller to be used,
based on architecture, way to reduce production cost and product
reliability
• Programming of microcontroller
• Advantage of using assembly programming languages is its
simplicity
• The preprocessor is an integral part of the preprocessor directive
• The 8051 IC contains 40 pins
18
Faculty of Engineering & Technology ©M. S. Ramaiah University of Applied Sciences