Orientation
To
8051Programming
Yogesh Misra Mody Institute of Technology & Science (Deemed University) Faculty of Engineering & Technology Sikar [Raj.]
Embedded System Structure
Sensor ADC Processor DAC Actuator
Essential Components Processor (P, C , DSP or ASIC) Sensor (it convert a physical quantity into electrical signal) Converters (ADC and DAC) Actuator (it transforms electrical energy into mechanical energy) Memory (On-chip / Off chip) Communication path with the interacting environment
DEVELOPMENT OF MICROPROCESSOR First Generation (1940-1956) Vacuum Tubes
First generation computers relied on machine language
Back section of ENIAC showing vaccum tubes The 1946 ENIAC computer used 17,468 vacuum tubes and consumed 150kW of power
DEVELOPMENT OF MICROPROCESSOR
Second Generation (1956-1963) Transistors
The transistor was invented in 1947 Vaccum tubes of first generation computer are now replaced by semiconductor devices. Second-generation computers moved from machine language to assembly languages.
DEVELOPMENT OF MICROPROCESSOR
Third Generation (1964-1971) Integrated Circuits
The first integrated circuit (IC) was developed in the 1950s by Jack Kilby of Texas Instruments and Robert Noyce of Fairchild Semiconductor.
Fourth Generation (1971-Present) Microprocessors
The microprocessor brought the fourth generation of computers, as thousands of integrated circuits were built onto a single silicon chip. The Intel 4004 chip, developed in 1971
INSIDE MICROPROCESSOR
ALU
Accumulator Flags
Address Lines
Timing & Control Unit
Data Lines
Program Counter
Stack Pointer
Timing & Control Signals
MICROPROCESSOR BASED SYSTEM
EXPANDED MICROPROCESSOR BASED SYSTEM
MEMORY
LANGUAGE
Machine Language: Instructions in binary form. Assembly language: Instructions in mnemonic form. High-Level language: Program is written using statements.
PROGRAMMING EXAMPLE
Program Explanation Hex Code Binary Code
MVI A , 04H
ADD B OUT 20 H HLT
A = 04H
A=A+ B Send the content of register A to output device whose address is 20H Stop
45H , 04H
59H , 05H 24H 29H , 20H 76H
01000101 00000100
01011001 00000101 00100100 00101001 00100000 01110110
MVI B , 05H B = 05H
PROGRAMMING EXAMPLE
Memory Address 0000H 0001H 0002H 0003H 0004H
Binary Information MVI A 04H MVI B 05H ADD B [01000101] [00000100] [01011001] [00000101] [00100100]
0005H
0006H 0007H 0008H
OUT
20 H HLT
[00101001]
[00100000] [01110110]
FFFFH
MICROCONTROLLER
First microcontroller
By Intel
In 1976
4 bit
8048
First 8 bit microcontroller by Intel was 8051 (reffered as MCS-51) in 1981
Pin Description
Vcc(+5volt) Pin - 40
Ground(0 volt) Pin-20
Pin Description
Port 0 from Pin-39 to pin-32
Dual functional Used to excess both data & address
Microcontroller 8051
Pin Description Port 1 from Pin-1 to pin-8
Used as I/O port
Pin Description
Port 2 from Pin-21 to pin-28
Used to excess address & as I/O port
Microcontroller 8051
Pin Description
Port 3 from Pin-10 to Pin-17
P3.0 RXD P3.1 TXD P3.2 IN T0 P3.3 IN T1 P3.4 T0 P3.5 T1 P3.6 WR P3.7 RD
Pin Description
External memory reset
crystal
Add. Latch enable
Program Store Enable
Tools for developing Assembly Language Programs
Integrated Development Environment
Development Processor Target Processor
Editor Program
Assembler Program Debugger
Loader / Linker Program
Editor
Program Source file (.a51)
Assembler
Object file (.obj), List file (.LST), check syntax errors
Linker
Hex file (.hex)
Loader
M I C R O C O N T R O L L E R
Demo of downloading of a program in microcontroller
AIM: Write a program for traffic light control. The microcontroller
AT89C51-20P is operated by a XTAL of frequency 11.0592 Mhz.
STEPS
GREEN
YELLOW
RED
ON
OFF
OFF
ON
ON
OFF
OFF
OFF
ON
OFF
ON
ON
P2.0 P2.1 P2.2 Reset XTAL2 XTAL2 GND
Pin no. 20 Pin no. 21 Pin no. 22 Pin no. 9 Pin no. 18 Pin no. 19 Pin no. 20
PINS OF INTEREST
Pin no. 40 Vcc
Pin no. 31 EA
Reset
A T 8 9 C 5 1
P2.2 RED
P2.1 YELLOW
P2.0 GREEN
HEX FILE :10000000B29012000780F97B207AFF79FFC055D0AB :0C00100055C055D055D9F6DAF2DBEE22CF :00000001FF
Red color hexadecimal number tells the loader how many bytes are in the line. (number of bytes in a line range from 00H to 10H) Blue color hexadecimal number is 16 bit ROM address where loader will load the first byte. Green color digits are either 00 or 10. 00 means is more line to come after this line. 01 means this is last line and the loading should stop after this line. Black Color this is hex code of the program Brown Color last byte in the line is checksum byte used for error checking
Thank You