3rd Module 8051 - Microcontroller.

Slides:



Advertisements
Similar presentations
The 8051 MicroController In this module, we will be discussing the MCS-51 family of microcontroller, in particular the 8051, which is the generic IC representative.
Advertisements

Microprocessors A Beginning.
Chapter 18 The 8051 Microcontroller
Microprocessors and Interfacing
Class Addressing modes
Parul Polytechnic Institute
Autumn 2012C.-S. Shieh, EC, KUAS, Taiwan1 The 8051 Family Microcontroller Chin-Shiuh Shieh Department of Electronic Engineering.
Chapter 2 HARDWARE SUMMARY
8051 Core Specification.
The 8085 Microprocessor Architecture
Microprocessor and Microcontroller
Course Overview and The 8051 Architecture
I/O Unit.
MICRO PROCESSER The micro processer is a multipurpose programmable, clock driven, register based, electronic integrated device that has computing and decision.
 CPU: Central Processing Unit  I/O: Input /Output  Bus: Address bus & Data bus  Memory: RAM & ROM  Timer  Interrupt  Serial Port  Parallel Port.
LS R First Design Key board. A B Second Design A B C D CD B Key board Third Design.
Microcontroller 8051.
The 8051 Microcontroller architecture
Micro controllers A self-contained system in which a processor, support, memory, and input/output (I/O) are all contained in a single package.
ECE/CS-352: Embedded Microcontroller Systems Embedded Microcontroller Systems.
Microcontroller Intel 8051 [Architecture]. The Microcontroller Microcontrollers can be considered as self-contained systems with a processor, memory and.
CoE3DJ4 Digital Systems Design Hardware summary. Microprocessors vs. Microcontrollers Microprocessors are single-chip CPU used in microcomputers Microcontrollers.
Chapter 2 Introducing the PIC Mid-Range Family and the 16F84A The aims of this chapter are to introduce: The PIC mid-range family, in overview The overall.
8051 Micro controller. Architecture of 8051 Features of 8051.
Microcontrollers Class : 4th Semister E&C and EEE Subject Code: 06ES42
Microcontrollers. An embedded microcontroller is a chip which a computer processor with all it’s support functions (clocking and reset), memory, and i/O.
Intel 8051 Another family of microcontroller is the Intel 8051 family. The basic 8051 microcontroller has four parallel input/output ports, port 0, 1,
INTRODUCTION TO PIC MICROCONTROLLER. Overview and Features The term PIC stands for Peripheral Interface Controller. Microchip Technology, USA. Basically.
Introduction to Microprocessors - chapter3 1 Chapter 3 The 8085 Microprocessor Architecture.
Presented by Sadhish Prabhu
Architecture of the 8051 Microcontroller
Chapter Microcontroller
8051 Micro Controller. Microcontroller versus general-purpose microprocessor.
Kustanto,S.T.,M.EngECE/CS-352: Embedded Microcontroller Systems Embedded Systems By: Kustanto,S.T.,M.Eng.
HOME AUTOMATION USING PC DONE BY RAJESHKUMAR S SRI HARSHA D.
Prepared by:- Man Mohan Krishna ECE  Advance technology  Establishment 1999  Location chandigarh  Working area  Products  Key area of training.
HJD Institute of Technical Education & Research- Kera(Kutch) The 8051 Microcontroller architecture PREPARED BY: RAYMA SOHIL( )
80C51 Block Diagram 1. 80C51 Memory Memory The data width is 8 bits Registers are 8 bits Addresses are 8 bits – i.e. addresses for only 256.
DEPARTMENT OF ELECTRONICS ENGINEERING V-SEMESTER MICROPROCESSOR & MICROCONTROLLER 1 CHAPTER NO microcontroller & programming.
Embedded Microcontroller Systems
Microcontroller.
CHAPTER ADDRESSING MODES.
The 8085 Microprocessor Architecture
Embedded Microcontroller Systems
Classification of Instruction Set of 8051
Introduction to Micro Controllers & Embedded System Design Microprocessor/Microcontroller Department of Electrical & Computer Engineering Missouri University.
UNIT – Microcontroller.
8051 Microcontroller Features and its Applications
The 8085 Microprocessor Architecture
Introduction of microprocessor
An Introduction to Microprocessor Architecture using intel 8085 as a classic processor
Data bus CPU General Purpose microprocessor RAM ROM I/O Port Timer
Microcontroller Intel 8051
8051 MICROCONTROLLER MODULE IV
Source: Serial Port Source:
Introduction to Micro Controllers & Embedded System Design Microprocessor/Microcontroller Department of Electrical & Computer Engineering Missouri University.
(Electrical Engg 6th Semester)
Memory organization On- chip memory Off-chip memory
Introduction to Micro Controllers & Embedded System Design Addressing Mode Department of Electrical & Computer Engineering Missouri University of Science.
Microcontroller 8051 Made By: Arun Branch. 4th Sem. I&C Engg.
Unit – Microcontroller Tutorial Class - 2 ANITS College
8051 Microcontroller.
First Design Key board R L S.
Important 8051 Features On chip oscillator 4K bytes ROM 128 bytes RAM
UNIT-VIII 8051 Microcontroller Architecture Register set of 8051
The 8085 Microprocessor Architecture
Compiled by Dr. N.Shanmugasundaram, HOD, ECE Dept, SECE.
8051 ASSEMBLY LANGUAGE PROGRAMMING
Source: Serial Port Source:
Register sets The register section/array consists completely of circuitry used to temporarily store data or program codes until they are sent to the.
Presentation transcript:

3rd Module 8051 - Microcontroller

How is it different from a Microprocessor ?? General-purpose microprocessor CPU for Computers No RAM, ROM, I/O on CPU chip itself Data Bus CPU General-Purpose Micro-processor Serial COM Port I/O Port RAM ROM Timer Address Bus

Then What is a Microcontroller ? A smaller computer On-chip RAM, ROM, I/O ports... Example:Motorola’s 6811, Intel’s 8051, PIC 16X CPU RAM ROM A single chip Microcontroller Serial COM Port I/O Port Timer

Microprocessor vs. Microcontroller CPU is stand-alone, RAM, ROM, I/O, timer are separate designer can decide on the amount of ROM, RAM and I/O ports. expansive versatility general-purpose Microcontroller CPU, RAM, ROM, I/O and timer are all on a single chip fix amount of on-chip ROM, RAM, I/O ports Highly bit addressable for applications in which cost, power and space are critical single-purpose

EVOLUTION Flashback !!!! In the year 1976, Motorola created a Microprocessor chip called 6801 which replaced its brother 6800 with certain add-on chips to make a computer. This paved the way for the new revolution in the history of chip design and gave birth to a new entity called MICROCONTROLLER. The INTEL bagged the credit of producing the first Microcontroller 8048 with a CPU and 1K bytes of EPROM, 64 Bytes of RAM an 8-Bit Timer and 27 I/O pins in 1976.

Evolution contd… Then followed the most popular controller 8051 in the year 1980 with 4K bytes of ROM,128 Bytes of RAM , a serial port, two 16-bit Timers , and 32 I/O pins. The 8051 family has many additions and improvements over the years . The same INTEL introduced a 16 bit controller 8096 in the year 1982.

Later INTEL introduced 80c196 series of 16-bit microcontrollers for mainly industrial applications Microchip, another company has introduced a microcontroller PIC 16C64 an 8-bit in the year 1985. 32-bit microcontrollers have been developed by IBM and Motorola-MPC 505 is a 32-bit RISC controller of Motorola

EVOLUTION Flashback !!!! In the year 1976, Motorola created a Microprocessor chip called 6801 which replaced its brother 6800 with certain add-on chips to make a computer. This paved the way for the new revolution in the history of chip design and gave birth to a new entity called MICROCONTROLLER. The INTEL bagged the credit of producing the first Microcontroller 8048 with a CPU and 1K bytes of EPROM, 64 Bytes of RAM an 8-Bit Timer and 27 I/O pins in 1976.

Evolution contd… Then followed the most popular controller 8051 in the year 1980 with 4K bytes of ROM,128 Bytes of RAM , a serial port, two 16-bit Timers , and 32 I/O pins. The 8051 family has many additions and improvements over the years and remains a most soughtafter tool for todays circuit designers. The same INTEL introduced a 16 bit controller 8096 in the year 1982

Later INTEL introduced 80c196 series of 16-bit microcontrollers for mainly industrial applications Microchip, another company has introduced a microcontroller PIC 16C64 an 8-bit in the year 1985. 32-bit microcontrollers have been developed by IBM and Motorola-MPC 505 is a 32-bit RISC controller of Motorola

ARM Controllers In recent times ARM company (Advanced Risc machines) has developed and introduced 32 bit controllers which are highend application devices,especially communication devices like mobiles , ipods etc..

MCS-51 “Family” of Microcontollers Feature 8031 8051 8052 8751 ROM NO 4kB 8kB 4kB UV Eprom RAM (Bytes) 128 128 256 128 TIMERS 2 2 3 2 I/O PINS 32 32 32 32 SERIAL PORTS 1 1 1 1 INTERRUPT 6 6 8 6 SOURCES

Important Features of 8051 4K bytes ROM 128 bytes RAM Four 8-bit I/O ports Two 16-bit timers Serial interface 64K external code memory space 64K data memory space

“Original” 8051 Microcontroller Oscillator and timing 4096 Bytes Program Memory (ROM) 128 Bytes Data Memory (RAM) Two 16 Bit Timer/Event Counters Internal data bus 8051 CPU Programmable I/O Programmable Serial Port Full Duplex UART Synchronous Shifter 64 K Byte Bus Expansion Control Program memory – RAM or ROM? Data memory – RAM or ROM? subsystem interrupts External interrupts Parallel ports Address Data Bus I/O pins Control Serial Output Serial Input

Pin Description of the 8051 The 8051 is a 40 pin device, but out of these 40 pins, 32 are used for I/O. 24 of these are dual purpose, i.e. they can operate as I/O or a control line or as part of address or date bus.

8051 CPU Registers A (8-bit Accumulator) B (8-bit register for Mul &Div) PSW (8-bit Program Status Word) SP (8-bit Stack Pointer) PC (16-bit Program Counter) DPTR (16-bit Data Pointer)

Special Function Registers DATA registers CONTROL registers Timers Serial ports Interrupt system Analog to Digital converter Digital to Analog converter etc.. Addresses 80h – FFh Direct Addressing is used to access SFRs

List of Registers (*Denotes the SFRs)

Contd…

PSW REGISTER

PSW (Program Status Word, Addresses D0h, Bit-Addressable) The Program Status Word is used to store a number of important bits that are set and cleared by 8051 instructions. The PSW SFR contains the carry flag, the auxiliary carry flag, the overflow flag, and the parity flag. Additionally, the PSW register contains the register bank select flags which are used to select which of the "R" register banks are currently selected.

ACC (Accumulator, Addresses E0h, Bit-Addressable) The Accumulator is one of the most-used SFRs on the 8051 since it is involved in so many instructions. The Accumulator resides as an SFR at E0h, which means the instruction MOV A,#20h is really the same as MOV E0h,#20h. However, it is a good idea to use the first method since it only requires two bytes whereas the second option requires three bytes.

B (B Register, Addresses F0h, Bit-Addressable) The "B" register is used in two instructions: the multiply and divide operations. The B register is also commonly used by programmers as an auxiliary register to temporarily store values.

P0 (Port 0, Address 80h, Bit-Addressable) This is input/output port 0. Each bit of this SFR corresponds to one of the pins on the microcontroller. For example, bit 0 of port 0 is pin P0.0, bit 7 is pin P0.7. Writing a value of 1 to a bit of this SFR will send a high level on the corresponding I/O pin whereas a value of 0 will bring it to a low level.

SP (Stack Pointer, Address 81h) This is the stack pointer of the microcontroller. This SFR indicates where the next value to be taken from the stack will be read from in Internal RAM. If you push a value onto the stack, the value will be written to the address of SP + 1. That is to say, if SP holds the value 07h, a PUSH instruction will push the value onto the stack at address 08h.

DPL/DPH (Data Pointer Low/High, Addresses 82h/83h) The SFRs DPL and DPH work together to represent a 16-bit value called the Data Pointer. The data pointer is used in operations regarding external RAM and some instructions involving code memory. Since it is an unsigned two-byte integer value, it can represent values from 0000h to FFFFh (0 through 65,535 decimal).

PCON (Power Control, Addresses 87h) The Power Control SFR is used to control the 8051's power control modes. Certain operation modes of the 8051 allow the 8051 to go into a type of "sleep" mode which requires much less power. These modes of operation are controlled through PCON. Additionally, one of the bits in PCON is used to double the effective baud rate of the 8051's serial port.

TCON (Timer Control, Addresses 88h, Bit-Addressable) The Timer Control SFR is used to configure and modify the way in which the 8051's two timers operate. This SFR controls whether each of the two timers is running or stopped and contains a flag to indicate that each timer has overflowed.

TMOD (Timer Mode, Addresses 89h) The Timer Mode SFR is used to configure the mode of operation of each of the two timers. Using this SFR your program may configure each timer to be a 16-bit timer, an 8-bit autoreload timer, a 13-bit timer, or two separate timers.

TL0/TH0 (Timer 0 Low/High, Addresses 8Ah/8Ch) These two SFRs, taken together, represent timer 0. Their exact behavior depends on how the timer is configured in the TMOD SFR; however, these timers always count up. What is configurable is how and when they increment in value.

SCON (Serial Control, Addresses 98h, Bit-Addressable) The Serial Control SFR is used to configure the behavior of the 8051's on-board serial port. This SFR controls the baud rate of the serial port, whether the serial port is activated to receive data, and also contains flags that are set when a byte is successfully sent or received.

SBUF (Serial Control, Addresses 99h) The Serial Buffer SFR is used to send and receive data via the on-board serial port. Any value written to SBUF will be sent out the serial port's TXD pin. Likewise, any value which the 8051 receives via the serial port's RXD pin will be delivered to the user program via SBUF. In other words, SBUF serves as the output port when written to and as an input port when read from.

IE (Interrupt Enable, Addresses A8h) The Interrupt Enable SFR is used to enable and disable specific interrupts. The low 7 bits of the SFR are used to enable/disable the specific interrupts, where as the highest bit is used to enable or disable ALL interrupts. Thus, if the high bit of IE is 0 all interrupts are disabled regardless of whether an individual interrupt is enabled by setting a lower bit.

IP (Interrupt Priority, Addresses B8h, Bit-Addressable) The Interrupt Priority SFR is used to specify the relative priority of each interrupt. On the 8051, an interrupt may either be of low (0) priority or high (1) priority. An interrupt may only interrupt interrupts of lower priority. For example, if we configure the 8051 so that all interrupts are of low priority except the serial interrupt, the serial interrupt will always be able to interrupt the system, even if another interrupt is currently executing.

Addressing modes Immediate Addressing Direct Addressing MOV A,#20h Direct Addressing MOV A,30h Indirect Addressing MOV A,@R0 External Direct Addressing MOVX A,@DPTR External Indirect Addressing MOVC A,@A+DPTR

Immediate Addressing MOV A,#20h This instruction uses Immediate Addressing because the Accumulator will be loaded with the value that immediately follows; in this case 20 (hexidecimal). Immediate addressing is very fast since the value to be loaded is included in the instruction. However, since the value to be loaded is fixed at compile-time it is not very flexible.

Direct Addressing Direct addressing is so-named because the value to be stored in memory is obtained by directly retrieving it from another memory location. For example: MOV A,30h This instruction will read the data out of Internal RAM address 30 (hexadecimal) and store it in the Accumulator.

Indirect Addressing MOV A,@R0 This instruction causes the 8051 to analyze the value of the R0 register. The 8051 will then load the accumulator with the value from Internal RAM which is found at the address indicated by R0. For example, let’s say R0 holds the value 40h and Internal RAM address 40h holds the value 67h. When the above instruction is executed the 8051 will check the value of R0. Since R0 holds 40h the 8051 will get the value out of Internal RAM address 40h (which holds 67h) and store it in the Accumulator. Thus, the Accumulator ends up holding 67h.

External Direct Addressing MOVX A,@DPTR MOVX @DPTR,A As you can see, both commands utilize DPTR. In these instructions, DPTR must first be loaded with the address of external memory that you wish to read or write. Once DPTR holds the correct external memory address, the first command will move the contents of that external memory address into the Accumulator. The second command will do the opposite: it will allow you to write the value of the Accumulator to the external memory address pointed to by DPTR.

Instruction set Arithmetic instructions JUMP LOOP CALL instructions Time delay generations

Interfacing - sensors

LM 35 – Analog Sensor Celsius Sensor (10millivolts/Kelvin) MAX – 6576 – Digital Sensor

Interfacing - keyboard Keypads are a part of HMI or Human Machine Interface and play really important role in a small embedded system where human interaction or human input is needed. Martix keypads are well known for their simple architecture and ease of interfacing with any microcontroller.

Constuction of a keypad is really simple Constuction of a keypad is really simple. As per the outline shown in the figure below we have four rows and four columns. In between each overlapping row and column line there is a key.

Matrix Keypad

Interfacing with 8051