Introduction Difference between microcontroller and microprocessor Criteria for choosing a microcontroller Overview of 8051 microcontroller Inside

Similar documents
8051 hardware summary

MICROPROCESSOR AND MICROCOMPUTER BASICS

Flash Microcontroller. Architectural Overview. Features. Block Diagram. Figure 1. Block Diagram of the AT89C core

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC Microprocessor & Microcontroller Year/Sem : II/IV

MACHINE ARCHITECTURE & LANGUAGE

CoE3DJ4 Digital Systems Design. Chapter 4: Timer operation

Microcontroller Basics A microcontroller is a small, low-cost computer-on-a-chip which usually includes:

8-Bit Flash Microcontroller for Smart Cards. AT89SCXXXXA Summary. Features. Description. Complete datasheet available under NDA

Keil C51 Cross Compiler

8051 Serial Port. Crystal TXD. I/O Device RXD. Embedded Systems Peripherals

Flash Microcontroller. Memory Organization. Memory Organization

ASSEMBLY LANGUAGE PROGRAMMING (6800) (R. Horvath, Introduction to Microprocessors, Chapter 6)

Faculty of Engineering Student Number:

MICROPROCESSOR BCA IV Sem MULTIPLE CHOICE QUESTIONS

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2

(Refer Slide Time: 00:01:16 min)

Z80 Instruction Set. Z80 Assembly Language

8085 MICROPROCESSOR PROGRAMS

4 Character 5x7 LED Matrix Display

ELEG3924 Microprocessor Ch.7 Programming In C

Central Processing Unit (CPU)

AUTOMATIC NIGHT LAMP WITH MORNING ALARM USING MICROPROCESSOR

MICROPROCESSOR. Exclusive for IACE Students iacehyd.blogspot.in Ph: /422 Page 1

Quick Start Tutorial. Using the TASKING* Software Development Tools with the Intel 8x930 Family Evaluation Board

LSN 2 Computer Processors

The Central Processing Unit:

CHAPTER 7: The CPU and Memory

Instruction Set Architecture (ISA)

An Overview of Stack Architecture and the PSC 1000 Microprocessor

Instruction Set. Microcontroller Instruction Set. Instructions that Affect Flag Settings (1) The Instruction Set and Addressing Modes

Management Challenge. Managing Hardware Assets. Central Processing Unit. What is a Computer System?

C Programming. for Embedded Microcontrollers. Warwick A. Smith. Postbus 11. Elektor International Media BV. 6114ZG Susteren The Netherlands

Microprocessor & Assembly Language

Atmel 8051 Microcontrollers Hardware Manual

CHAPTER 4 MARIE: An Introduction to a Simple Computer

PART B QUESTIONS AND ANSWERS UNIT I

Hardware and Software Requirements

ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER

8031AH 8051AH 8032AH 8052AH NMOS SINGLE-CHIP 8-BIT MICROCONTROLLERS

Microcomputer Components SAB 80515/SAB 80C515 8-Bit Single-Chip Microcontroller Family

Introduction to Microcontrollers

Sécurité des cartes à puce

PROBLEMS (Cap. 4 - Istruzioni macchina)

CHAPTER 6: Computer System Organisation 1. The Computer System's Primary Functions

Microcontrollers A Brief History of Microprocessors

CPU Organization and Assembly Language

Instruction Set Design

Microtronics technologies Mobile:

Embedded Software development Process and Tools: Lesson-4 Linking and Locating Software

1 Classical Universal Computer 3

Modbus RTU Communications RX/WX and MRX/MWX

Parts of a Computer. Preparation. Objectives. Standards. Materials Micron Technology Foundation, Inc. All Rights Reserved

8051 MICROCONTROLLER COURSE

a storage location directly on the CPU, used for temporary storage of small amounts of data during processing.

İSTANBUL AYDIN UNIVERSITY

An Introduction to the ARM 7 Architecture

Instruction Set Architecture

COMPUTERS ORGANIZATION 2ND YEAR COMPUTE SCIENCE MANAGEMENT ENGINEERING JOSÉ GARCÍA RODRÍGUEZ JOSÉ ANTONIO SERRA PÉREZ

Microcontroller Based Infrared Tracking Device In 2D Motion

The x86 PC: Assembly Language, Design, and Interfacing 5 th Edition

Embedded. Engineer s. Development. Tool (EEDT 5.0)

A+ Guide to Managing and Maintaining Your PC, 7e. Chapter 1 Introducing Hardware

CHAPTER 2: HARDWARE BASICS: INSIDE THE BOX

Chapter 13. PIC Family Microcontroller

Z80 Microprocessors Z80 CPU. User Manual UM Copyright 2014 Zilog, Inc. All rights reserved.

Machine Architecture and Number Systems. Major Computer Components. Schematic Diagram of a Computer. The CPU. The Bus. Main Memory.

SHENZHEN JINGHUA DISPLAYS CO.,LTD.

Chapter 4 System Unit Components. Discovering Computers Your Interactive Guide to the Digital World

Logical Operations. Control Unit. Contents. Arithmetic Operations. Objectives. The Central Processing Unit: Arithmetic / Logic Unit.

what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored?

On Demand Loading of Code in MMUless Embedded System

Small Hardware Development and Prototyping Board for the SX28

AT89C Bit Microcontroller with 1 Kbyte Flash. Features. Description. Pin Configuration

Chapter 5 Instructor's Manual

Programming PIC Microcontrollers in PicBasic Pro Lesson 1 Cornerstone Electronics Technology and Robotics II

T.C. Yeditepe University. Department of Electrical-Electronics Engineering

Microprocessor or Microcontroller?

Chapter 1 Computer System Overview

Computers. Hardware. The Central Processing Unit (CPU) CMPT 125: Lecture 1: Understanding the Computer

Chapter 3: Computer Hardware Components: CPU, Memory, and I/O

Chapter 5, The Instruction Set Architecture Level

Microprocessor and Microcontroller Architecture

TWO WAY WIRELESS DATA MESSAGING SYSTEM IN RURAL AREAS USING ZIGBEE

1 PERSONAL COMPUTERS

Microcontroller Based Low Cost Portable PC Mouse and Keyboard Tester

DsPIC HOW-TO GUIDE Creating & Debugging a Project in MPLAB

Administrative Issues

DS1621 Digital Thermometer and Thermostat

Discovering Computers Living in a Digital World

ACTIVE INFRARED MOTION DETECTOR FOR HOUSE SECURITY SYSTEM MIOR MOHAMMAD HAFIIZH BIN ABD. RANI UNIVERSITI MALAYSIA PAHANG

TIMING DIAGRAM O 8085

Microcontrollers Figure 26-1 Objectives Key Words and Terms 26.1 OVERVIEW OF THE MICROCONTROLLER microcontroller

CPU Organisation and Operation

Chapter 01: Introduction. Lesson 02 Evolution of Computers Part 2 First generation Computers

8254 PROGRAMMABLE INTERVAL TIMER

Graded ARM assembly language Examples

Computer Architectures

24-Bit Analog-to-Digital Converter (ADC) for Weigh Scales FEATURES S8550 VFB. Analog Supply Regulator. Input MUX. 24-bit Σ ADC. PGA Gain = 32, 64, 128

c0003 A Simple PIC Application CHAPTER 3

The AVR Microcontroller and C Compiler Co-Design Dr. Gaute Myklebust ATMEL Corporation ATMEL Development Center, Trondheim, Norway

Transcription:

Introduction Difference between microcontroller and microprocessor Criteria for choosing a microcontroller Overview of 8051 microcontroller Inside the 8051

Inside the computer

Microprocessor CPU for Computers Commonly no RAM, ROM, I/O on CPU chip itself More versatile More costly General Purpose CPU Microcontroller A single-chip computer On-chip RAM, ROM, I/O ports... Example:Motorola s 6811, Intel s 8051, Zilog s Z8 and PIC 16X Less Versatile Less costly Special purpose CPU

Many chips on motherboard

Microcontrollers and microprocessors are widely used in embedded system products. An embedded product uses microcontroller or microprocessor to do one task and one task only. Example: Printer, camera, mouse etc. For this reason it optimizes the processors used for embedded systems. That s why this processor is known as high end embedded processor.

The need of the microcontroller based, whether 8 bit, 16 bit or 32 bit. Speed Packaging : DIP (Dual in line package), QFP (quad flat package) Power Consumption The amount of ROM and RAM chip The number of I/O pins and timer on chip Cost per Unit

1)8051 have 128 bytes of RAM 2) it consist of 16 bit address bus 3) ROM on 8051 is 4 Kbytes in size 4) it also consist of Two 16 bit Timer/ Counter 5) it consist of 16-bit program counter and data pointer

Register are used to store information temporarily an address pointing to the data to be fetched The most widely used registers A (Accumulator) For all arithmetic and logic instructions B, R0, R1, R2, R3, R4, R5, R6, R7 DPTR (data pointer), and PC (program counter)

In the early days of the computer, programmers coded in machine language, consisting of 0s and 1s Assembly language is referred to as a low level language [label:] Mnemonic [operands] [;comment] Directives (or pseudo-instructions) : Give directions to the assembler

1. First we use an editor to type a program having the extension asm. 2. The asm source file containing the program code created in step 1 is fed to an 8051 assembler. The assembler will produce an object file and a list file The extension for the object file is obj while the extension for the list file is lst. 3. The linker program takes one or more object code files and produce an absolute object file with the extension abs. 4. Next the abs file is fed into a program called OH (object to hex converter) which creates a file with extension hex that is ready to burn into ROM

The program counter is 16 bits wide. This means that it can access program addresses 0000 to FFFFH, a total of 64K bytes of code Program Counter has the value of 0000 when powered up.

ROM Address ORG 0H 0000 7D25 MOV R5,#25H 0000 7F34 MOV R7,#34H ; 0002 7400 MOV A,#0 ; 0004 2D ADD A,R5 ; 0006 2F ADD A,R7 ; 0007 2412 ADD A,#12H ; 0008 80EF HERE: SJMP HERE ; 000A END 000C

Define Byte ORG 500H DATA1: DB 28 ;DECIMAL (1C in Hex) DATA2: DB 00110101B ;BINARY (35 in Hex) DATA3: DB 39H ;HEX ORG 510H DATA4: DB 2591 ;ASCII NUMBERS ORG 518H DATA6: DB My name is Joe

Example: Use assembler directives to place constants 0FCH, 05H, 76H, 28D and character string SAM in consecutive program memory locations beginning from location 0050H ORG 0050H DB 0FCH, 05H, 76H, 28 DB SAM

ORG (origin) END EQU (equate) COUNT EQU 25 MOV R3, #COUNT

There are 128 bytes of RAM in the 8051 The 128 bytes are divided into three different groups

SP=07 PUSH A is invalid must be coded as PUSH 0E0H PUSH 1 ; pushes the register R1 onto the stack Popping :With every POP, the top byte of the stack is copied onto the register specified by the instruction. POP 3 ; POP stack into R3 POP 5

MOV R6,#25H MOV R1, #12H MOV R4, #0F3H PUSH 6 PUSH 1 PUSH 4

Example Write instruction to use the registers of bank 3, and load the same value 05H in the registers R0 to R3

MOV destination,source 8/16 MOVC A,@A+DPTR bit operation MOVX ; it is used for external memory access ADD A, source JNB P1.0, label JB P1.0, label CPL P1.0 Bit Instructions SETB P1.0 CLR P1.0 INC R0 DEC R0 DJNZ resister, label SJMP label Loop Instructions LCALL label

PUSH 3 POP 3

Open drain is a term used for MOS chips in the same way that open collector is used for TTL chips

Example 1 Write the following programs. Create a square wave of 50% duty cycle on bit 0 of port1.

Example 2 Write a program to perform the following: (a) Keep monitoring the P0.1 bit until it becomes high (b) When P0.1 becomes high, read the data from port1 (c) Send a high-to-low (H-to-L) pulse to P0.2 Example 3 Assume that bit P2.3 is an input and represents the condition of an oven. If it goes high, it means that the oven is hot. Monitor the bit continuously. Whenever it goes high, send a high-to-low pulse to port P1.5 to turn on a buzzer.

Example 4 A switch is connected to pin P1.7. Write a program to check the status of SW and perform the following: (a) If SW=0, send letter N to P2 (b) If SW=1, send letter Y to P2 Example 5 A switch is connected to pin P0.1. Write a program to check the status of SW and perform the following: (a) If SW=1, send high to low pulse to activate a siren connected to pin P1.7 Use the carry flag to check the switch status.

Immediate Register Direct Register Indirect Indexed

The entire 128 bytes of RAM can be accessed The register bank locations are accessed by the register names MOV A,4 ; MOV A,R4 Contrast this with immediate addressing mode MOV R0,40H ; MOV 56H,A

The source operand is a constant The immediate data must be preceded by the pound sign, # Can load information into any registers, including 16-bit DPTR register DPTR can also be accessed as two 8-bit registers, the high byte DPH and low byte DPL

MOV A,#25H ; MOV R4,#62 ; MOV B,#40H ; MOV DPTR,#4521H ; MOV DPL,#21H ; MOV DPH,#45H ; ;illegal!! Value > 65535 (FFFFH) MOV DPTR,#68975

MOV A,R0 ; MOV R2,A ; ADD A,R5 ; ADD A,R7 ; MOV R6,A The source and destination registers must match in size MOV DPTR,A will give an error MOV DPTR,#25F5H MOV R7,DPL MOV R6,DPH The movement of data between registers is not allowed MOV R4,R7 is invalid

A register is used as a pointer to the data Only register R0 and R1 are used for this purpose When R0 and R1 hold the addresses of RAM locations, they must be preceded by the @ sign MOV A,@R0 ; MOV @R1,B

Q. Write a program to copy the value 55H into RAM memory locations 40H to 41H using (a) direct addressing mode, (b) register indirect addressing mode without a loop, and (c) with a loop

Q. Write a program to clear 16 RAM locations starting at RAM address 60H

Indexed addressing mode is widely used in accessing data elements of look-up table entries located in the program ROM The instruction used for this purpose is MOVC A,@A+DPTR Use instruction MOVC, C means code

Q. The word SAM is to be burned in the flash ROM location starting from 0400H. Write a program to do this and to read this data into internal RAM locations starting from 60H.

Sol. ORG 0000H ; MOV DPTR,#0400H ; CLR A ; MOVC A,@A+DPTR ; MOV 60H,A ; INC DPTR ; CLR A ; MOVC A,@A+DPTR ; MOV 61H,A ; INC DPTR ; CLR A ; MOVC A,@A+DPTR ; MOV 62H,A ; Here: SJMP HERE ;stay here ;Data is burned into code space starting at 400H ORG 400H MYDATA:DB USA END ;

Write a program to get the x value from P1 and send x 2 to P2, continuously

Solution: ORG 0 MOV DPTR,#300H ; MOV A,#0FFH ; MOV P1,A ; BACK:MOV A,P1 ; MOV A,@A+DPTR ; MOV P2,A ; SJMP BACK ; ORG 300H XSQR_TABLE: DB 0,1,4,9,16,25,36,49,64,81 END