ENE 334 Microprocessors

Similar documents
The Microcontroller. Lecture Set 3. Major Microcontroller Families. Example Microcontroller Families Cont. Example Microcontroller Families

Lecture 5. EEE3410 Microcontroller Applications Department of Electrical Engineering Assembly Language Programming (1)

8051 Microcontroller

8051 Instruction Set

MICROCONTROLLER UNIT 1

8051 Microcontroller

Figure Programming model

Memory organization Programming model - Program status word - register banks - Addressing modes - instruction set Programming examples.

ET2640 Microprocessors

EEE3410 Microcontroller Applications Department of Electrical Engineering Lecture 4 The 8051 Architecture

CHAPTER ASSEMBLY LANGUAGE PROGRAMMING

8051 Microcontrollers

Architecture & Instruction set of 8085 Microprocessor and 8051 Micro Controller

8051 Core Specification

ELEG3923 Microprocessor Ch.2 Assembly Language Programming

ELEG3924 Microprocessor

ET355 Microprocessors Friday 6:00 pm 10:20 pm

Chapter 9. Programming Framework

ET2640 Microprocessors

UNIT-III ASSEMBLY LANGUAGE PROGRAMMING. The CPU can access data in various ways, which are called addressing modes

Principle and Interface Techniques of Microcontroller

Microcontroller Intel [Instruction Set]

8051 Overview and Instruction Set

ENE 334 Microprocessors

8051 microcontrollers

CPEG300 Embedded System Design. Lecture 3 Memory

8-bit Microcontroller with 8K Bytes In-System Programmable Flash AT89S52

8051 Addressing Modes

Programming of 8085 microprocessor and 8051 micro controller Study material


8051 Microcontroller

MODULE-1. Short Answer Questions

C51 Family. Architectural Overview of the C51 Family. Summary

Module Contents of the Module Hours COs

ENE 334 Microprocessors

The 8051 Microcontroller and Embedded Systems

Understanding the basic building blocks of a microcontroller device in general. Knows the terminologies like embedded and external memory devices,

Question Bank Microprocessor and Microcontroller

8051 Microcontrollers

Introduction To MCS-51

Microprocessors 1. The 8051 Instruction Set. Microprocessors 1 1. Msc. Ivan A. Escobar Broitman

Chapter 09. Programming in Assembly

Module I. Microcontroller can be classified on the basis of their bits processed like 8bit MC, 16bit MC.

8051 Microcontroller Logical Operations. Prepared by : A. B. Modi Target Audience : 5 th Semester Students

TW8816 Built-in MCU. Application Notes

CS 320. Computer Architecture Core Architecture

Chapter Addressing Modes

EXPERIMENT NO.1. A Microcontroller is a complete computer system built on a single chip.

MICROPROCESSORS AND MICROCONTROLLERS MATERIAL. Features of 8051:

Assembly Language programming (1)

8051 Microcontroller Assembly Programming

UNIT MICROCONTROLLER AND ITS PROGRAMMING

TUTORIAL. Donal Heffernan University of Limerick May Tutorial D.Heffernan 2000,

EE6502- MICROPROCESSOR AND MICROCONTROLLER

UNIT MICROCONTROLLER

Memory Organization. Program Memory

8051 Microcontroller memory Organization and its Applications

SN8F5000 Family Instruction Set

Introducing The MCS 251 Microcontroller -- 8XC251SB

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: 8051 Architecture Module No: CS/ES/5 Quadrant 1 e-text

Introduction to uc & Embedded Systems

Microcomputer Architecture and Programming

Assembly Language programming (2)

UNIT V MICRO CONTROLLER PROGRAMMING & APPLICATIONS TWO MARKS. 3.Give any two differences between microprocessor and micro controller.

Embedded Controller Programming

1. INTRODUCTION TO MICROPROCESSOR AND MICROCOMPUTER ARCHITECTURE:


MODEL ANSWER SUBJECT- MICROCONTROLLER(12187) CLASS-EJ5E CLASS TEST-02 Q1.)Attempt any THREE of the following.

Microcontroller. Instruction set of 8051

Q. Classify the instruction set of 8051 and list out the instructions in each type.

Fig 1. Block diagram of a microcomputer

Laboratory: Introduction to Mechatronics. Instructor TA: Edgar Martinez Soberanes Lab 2. PIC and Programming

MICROPROCESSOR & MICROCONTROLLER

Digital Blocks Semiconductor IP

Lecture 1. Course Overview and The 8051 Architecture

UNIT IV MICROCONTROLLER

Instruction : A command to the microprocessor to perform a given task on specified data. Each instruction has two parts

ISSI. IS89C51 CMOS SINGLE CHIP 8-BIT MICROCONTROLLER with 4-Kbytes of FLASH ISSI IS89C51 NOVEMBER 1998 FEATURES GENERAL DESCRIPTION

8XC51RA RB RC Hardware Description

Rev. No. History Issue Date Remark

Digital Blocks Semiconductor IP

DR bit RISC Microcontroller. Instructions set details ver 3.10

UNIT 2 THE 8051 INSTRUCTION SET AND PROGRAMMING

Vidyalankar T.E. Sem. V [ETRX] Microprocessors and Microcontrollers I Prelim Question Paper Solution

ULTRA-HIGH-SPEED FLASH MICROCONTROLLER USER S GUIDE

Instruction set of 8085

Handshake Solutions. HT80C51 User Manual

SOLUTION MANUAL FOR THE 8051 MICROCONTROLLER 4TH EDITION BY MACKENZIE AND PHAN

Subject Code: Model Answer Page No: /25

EXPERIMENT NO. 1 THE MKT 8085 MICROPROCESSOR TRAINER

DS89C420 Ultra High-Speed Microcontroller User s Guide

SECURE MICROCONTROLLER USER S GUIDE... 1

80C51 family programmer s guide and instruction set. 80C51 Family. PROGRAMMER S GUIDE AND INSTRUCTION SET Memory Organization. Philips Semiconductors

INSTITUTE OF AERONAUTICAL ENGINEERING Dundigal, Hyderabad ELECTRONICS AND COMMUNICATION ENGINEERING QUESTION BANK

8051 MICROCONTROLLER

8051 Microcontroller. Ali Ziya Alkar 1

PART - B (Answer all five units, 5 X 10 = 50 Marks)

Digital Blocks Semiconductor IP

Embedded World Television, Radio, CD player, Washing Machine Microwave Oven Card readers, Palm devices

Three criteria in Choosing a Microcontroller

Transcription:

Page 1 ENE 334 Microprocessors Lecture 9: MCS-51: Moving Data : Dejwoot KHAWPARISUTH http://webstaff.kmutt.ac.th/~dejwoot.kha/

ENE 334 MCS-51 Moving Data Page 2 Moving Data: Objectives Use commands that place data in registers, internal memory, and external memory. List the data addressing modes. Describe how data may be pushed and popped using a stack. Use commands that get data from ROM addresses. Use commands that exchange data. Write simple data movement programs.

ENE 334 MCS-51 Moving Data Page 3 Moving Data: Memory The MOV opcodes involve data transfers within the 8051 memory. This memory is divided into the following four distinct physical parts: 1. Internal RAM 2. Internal special-function registers 3. External RAM 4. Internal and external ROM

ENE 334 MCS-51 Moving Data Page 4 Moving Data: Opcodes Finally, the following five types of opcodes are used to move data: 1. MOV 2. MOVX 3. MOVC 4. PUSH and POP 5. XCH

ENE 334 MCS-51 Moving Data Page 5 Moving Data: Addressing Mode The way the data sources or destination addresses are specified in the mnemonic that moves that data determines the addressing mode. Figure diagrams the four addressing modes: immediate, register, direct, and indirect.

Moving Data: Addressing Mode Page 6 ENE 334 MCS-51 Moving Data

ENE 334 MCS-51 Moving Data Page 7 Moving Data: Imme. & Reg. The following table shows all possible MOV opcodes using immediate and register addressing modes: and examples of MOV opcodes with immediate and register addressing modes:

Moving Data: Imme. & Reg. Page 8 ENE 334 MCS-51 Moving Data

Moving Data: Imme. & Reg. Page 9 ENE 334 MCS-51 Moving Data

ENE 334 MCS-51 Moving Data Page 10 Moving Data: Direct All 128 bytes of internal RAM and the SFRs may be addressed directly using the single-byte address assigned to each RAM location and each specialfunction register. Internal RAM uses addresses from 00h to 7Fh to address each byte. The SFR addresses exist from 80h to FFh at the following locations:

Moving Data: SFR addresses Page 11 ENE 334 MCS-51 Moving Data

ENE 334 MCS-51 Moving Data Page 12 Moving Data: The moves made possible using direct, immediate, and register addressing modes are as follows:

Moving Data: Page 13 ENE 334 MCS-51 Moving Data

ENE 334 MCS-51 Moving Data Page 14 Moving Data: The moves made possible using immediate, direct, register, and indirect addressing modes are as follows:

Moving Data: Page 15 ENE 334 MCS-51 Moving Data

Moving Data: External It is possible to expand RAM and ROM memory space by adding external memory chips to the 8051 microcontroller. The external memory can be as large as 64K for each of the RAM and ROM memory areas. Opcodes that access this external memory always use indirect addressing to specify the external memory. Figure shows that registers R0, R1, and the aptly named DPTR can be used to hold the address of the data byte in external RAM. R0 and R1 are limited to external RAM address ranges of 00h to 0FFh, while the DPTR register can address the maximum RAM space of 0000h to 0FFFFh. ENE 334 MCS-51 Moving Data Page 16

Moving Data: External Page 17 ENE 334 MCS-51 Moving Data

ENE 334 MCS-51 Moving Data Page 18 Moving Data: External An X is added to the MOV mnemonics to serve as a reminder that the data move is external to the 8051, as shown in the following table:

Moving Data: External Page 19 ENE 334 MCS-51 Moving Data

ENE 334 MCS-51 Moving Data Page 20 Moving Data: Code memory The following table shows examples of code ROM moves using register and indirect addressing modes:

Moving Data: Code memory Page 21 ENE 334 MCS-51 Moving Data

Moving Data: Push & Pop Page 22 ENE 334 MCS-51 Moving Data

ENE 334 MCS-51 Moving Data Page 23 Moving Data: Push & Pop The SP register is set to 07h when the 8051 is reset, which is the same direct address in internal RAM as register R7 in bank 0. The first PUSH opcode would write data to R0 of bank 1. The SP should be initialized by the programmer to point to an internal RAM address above the highest address likely to be used by the program.

ENE 334 MCS-51 Moving Data Page 24 Moving Data: Push & Pop The PUSH and POP opcodes behave as explained in the following table:

Moving Data: Push & Pop Ex: Page 25 ENE 334 MCS-51 Moving Data

ENE 334 MCS-51 Moving Data Page 26 Moving Data: Data Exchange MOV, PUSH, and POP instructions all involve copying the data found in the source address to the destination address; the original data in the source is not changed. Exchange instructions actually move data in two directions: from source to destination and from destination to source. All addressing modes except immediate may be used in the XCH (exchange) instructions:

Moving Data: Data Exchange Page 27 ENE 334 MCS-51 Moving Data

ENE 334 MCS-51 Moving Data Page 28 Moving Data: Data Exchange Exchanges between A and any port location copy the data on the port pins to A, whereas the data in A is copied to the port latch. Register A is used for so many instructions that the XCH opcode provides a very convenient way to save the contents of A without the necessity of using a PUSH opcode and then a POP opcode.

Moving Data: Data Exchange Page 29 ENE 334 MCS-51 Moving Data

Atmel: Instruction Set Page 30 ENE 334 MCS-51 Moving Data

Atmel: Instruction Set Page 31 ENE 334 MCS-51 Moving Data

ENE 334 MCS-51 Moving Data Page 32 Moving Data: Example 5.1 Copy the byte in TCON to register R2 using at least four different methods. Method 1: Use the direct address for TCON (88h) and register R2.

ENE 334 MCS-51 Moving Data Page 33 Moving Data: Example 5.1 Copy the byte in TCON to register R2 using at least four different methods. Method 2: Use the direct addresses for TCON and R2.

ENE 334 MCS-51 Moving Data Page 34 Moving Data: Example 5.1 Copy the byte in TCON to register R2 using at least four different methods. Method 3: Use R1 as a pointer to R2 and use the address of TCON.

ENE 334 MCS-51 Moving Data Page 35 Moving Data: Example 5.1 Copy the byte in TCON to register R2 using at least four different methods. Method 4: Push the contents of TCON into direct address 02h (R2).

ENE 334 MCS-51 Moving Data Page 36 Moving Data: Example 5.2 Set timer T0 to an initial setting of 1234h. Use the direct address with an immediate number to set TH0 and TL0.

ENE 334 MCS-51 Moving Data Page 37 Moving Data: Example 5.3 Put the number 34h in registers R5, R6, and R7 Method 1: Use an immediate number and register addressing.

ENE 334 MCS-51 Moving Data Page 38 Moving Data: Example 5.3 Put the number 34h in registers R5, R6, and R7 Method 2: Since the number is the same for each register, put the number in A and MOV A to each register.

ENE 334 MCS-51 Moving Data Page 39 Moving Data: Example 5.3 Put the number 34h in registers R5, R6, and R7 Method 3: Copy one direct address to another.

ENE 334 MCS-51 Moving Data Page 40 Moving Data: Example 5.4 Put the number 8Dh in RAM locations 30h to 34h Method 1: Use the immediate number to a direct address.

ENE 334 MCS-51 Moving Data Page 41 Moving Data: Example 5.4 Put the number 8Dh in RAM locations 30h to 34h Method 2: Using the immediate number in each instruction uses bytes; use a register to hold the number.

ENE 334 MCS-51 Moving Data Page 42 Moving Data: Example 5.4 Put the number 8Dh in RAM locations 30h to 34h Method 3: There must be a way to avoid naming each address; the PUSH opcode can increment to each address.

Moving Data: Example 5.4 Page 43 ENE 334 MCS-51 Moving Data

ENE 334 MCS-51 Moving Data Page 44 Moving Data: Summary There are four addressing modes: an immediate number, a register name, a direct internal RAM address, and an indirect address contained in a register. The opcode that move data between locations within the 8051 and between the 8051 and external memory have been discussed. The general form and results of these instructions are as follows:

Moving Data: Summary Page 45 ENE 334 MCS-51 Moving Data

Hw: Page 46 ENE 334 MCS-51 Moving Data