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

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

8051 Microcontroller

MICROCONTROLLER AND PLC LAB-436 SEMESTER-5

8051 Microcontrollers

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

Architecture & Instruction set of 8085 Microprocessor and 8051 Micro Controller

Three criteria in Choosing a Microcontroller

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

Module Contents of the Module Hours COs

CS 320. Computer Architecture Core Architecture

ENE 334 Microprocessors

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

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

MODULE-1. Short Answer Questions

8051 Microcontroller

8051 microcontrollers

8051 Overview and Instruction Set

SN8F5000 Family Instruction Set


Microcontroller Intel [Instruction Set]

ET355 Microprocessors Thursday 6:00 pm 10:20 pm

Microcontrollers. Fig. 1 gives a comparison of a microprocessor system and a microcontroller system.

2. List the five interrupt pins available in INTR, TRAP, RST 7.5, RST 6.5, RST 5.5.

UNIT 2 THE 8051 INSTRUCTION SET AND PROGRAMMING

Lecture 9. INC and DEC. INC/DEC Examples ADD. Arithmetic Operations Overflow Multiply and Divide


Microcontroller. Instruction set of 8051

MICROPROCESSORS AND MICROCONTROLLERS MATERIAL. Features of 8051:

1. INTRODUCTION TO MICROPROCESSOR AND MICROCOMPUTER ARCHITECTURE:

ENE 334 Microprocessors

TUTORIAL Assembly Language programming (2)

Chapter 1. Microprocessor architecture ECE Dr. Mohamed Mahmoud.

Engr. A. N. Aniedu Electronic and Computer Engineering Nnamdi Azikiwe University, Awka

8051 Microcontroller

Question Bank Microprocessor and Microcontroller

UNIT THE 8051 INSTRUCTION SET AND PROGRAMMING

ELEG3924 Microprocessor

EE6502- MICROPROCESSOR AND MICROCONTROLLER

b. List different system buses of 8085 microprocessor and give function of each bus. (8) Answer:

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

Principle and Interface Techniques of Microcontroller

1-Operand instruction types 1 INC/ DEC/ NOT/NEG R/M. 2 PUSH/ POP R16/M16/SR/F 2 x ( ) = 74 opcodes 3 MUL/ IMUL/ DIV/ DIV R/M

BHARATHIDASAN ENGINEERING COLLEGE. III Year / V Semester / EEE MICROPROCESSORS AND MICROCONTROLLERS (R-2013)

ET2640 Microprocessors

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

LAB FILE of EE1531: MICROCONTROLLER & EMBEDDED SYSTEMS LAB

EXPERIMENT NO. 1 THE MKT 8085 MICROPROCESSOR TRAINER

8051 Microcontrollers

MICROPROCESSOR LABORATORY MANUAL

3. (a) Explain the steps involved in the Interfacing of an I/O device (b) Explain various methods of interfacing of I/O devices.

1. Pin diagram of 8051 and ports

QUESTION BANK CS2252 MICROPROCESSOR AND MICROCONTROLLERS

WINTER 14 EXAMINATION Subject Code: Model Answer Page No: 1/ 26

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

Programming of 8085 microprocessor and 8051 micro controller Study material

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

Contents. Join the Technical Community Today!

Introducing The MCS 251 Microcontroller -- 8XC251SB

9/25/ Software & Hardware Architecture

ELEG3923 Microprocessor Ch.3 Jump, Loop, and Call

Control Unit: The control unit provides the necessary timing and control Microprocessor resembles a CPU exactly.

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

Signed number Arithmetic. Negative number is represented as

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

Moodle WILLINGDON COLLEGE SANGLI (B. SC.-II) Digital Electronics

Arithmetic Instructions

ELEG3924 Microprocessor

ELEG3923 Microprocessor Ch.2 Assembly Language Programming

Practical Course File For

ENE 334 Microprocessors

MICROPROCESSOR MICROPROCESSOR. From the above description, we can draw the following block diagram to represent a microprocessor based system: Output

MICROPROCESSOR & MICROCONTROLLER

ELEG3923 Microprocessor Ch.6 Arithmetic and Logics


LIST OF PROGRAMS. Prg. Name of the Program. 1 Study of Pin Diagram of Study of Architecture of Study of 8085 Kit.

Chapter 7 Central Processor Unit (S08CPUV2)

Digital Blocks Semiconductor IP

CHAPTER 5 : Introduction to Intel 8085 Microprocessor Hardware BENG 2223 MICROPROCESSOR TECHNOLOGY

Microprocessor Architecture

Introduction To MCS-51

8051 MICROCONTROLLER

CHAPTER 3 JUMP, LOOP, AND CALL INSTRUCTIONS

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

INSTITUTE OF ENGINEERING AND MANAGEMENT, KOLKATA Microprocessor

C51 Family. Architectural Overview of the C51 Family. Summary

Digital Blocks Semiconductor IP

Dodatak. Skup instrukcija

UNIT MICROCONTROLLER AND ITS PROGRAMMING

Mnem. Meaning Format Operation Flags affected ADD Addition ADD D,S (D) (S)+(D) (CF) Carry ADC Add with ADC D,C (D) (S)+(D)+(CF) O,S,Z,A,P,C

Subject Code: Model Answer Page No: /25

CHAPTER 6 ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS

Micro Processor & Micro Controllers

1. Attempt any three of the following: 15

Q.1. A) Attempt any THREE of the following:

Lecture 8: Addition, Multiplication & Division

8088/8086 Programming Integer Instructions and Computations

DR bit RISC Microcontroller. Instructions set details ver 3.10

UNIT IV MICROCONTROLLER

1 MALP ( ) Unit-1. (1) Draw and explain the internal architecture of 8085.

Arithmetic and Logic Instructions And Programs

Transcription:

EXPERIMENT NO.1 AIM: Study of 8051 Microcontroller TOOLS: 8051 kit THEORY: Salient Features of 8051 A Microcontroller is a complete computer system built on a single chip. It contains all components like Processor (CPU), RAM, ROM, Serial port, Parallel port, Interrupt logic, Timer etc on chip. A Microcontroller saves cost, saves power consumption and makes the circuit compact. 8051 is an 8-bit Microcontroller On-Chip ROM = 4 KB (Program Memory). On-Chip RAM = 128 Bytes (Data Memory). Four 8 bit bi-directional I/O ports. Serial Port. Two 16 bit Up-Counters (Timers). It supports interrupts with two-level priority. Power saving modes. It is used in appliances such as Washing Machines, Microwaves, Mobile Phones, MP3 Players etc. Pin Diagram of 8051 Port 0(p0.0 to p0.7): It is 8-bit bi-directional I/O port. It is bit/ byte addressable. During external memory access, it functions as multiplexed data and low-order address bus AD0-AD7. Port 1 (p1.0 to p1.7): It is 8-bit bi-directional I/O port. It is bit/ byte addressable. When logic '1' is written into port latch then it works as input mode. It functions as simply I/O port and it does not have any alternative function. Port 2 (p2.0 to p2.7): It is 8-bit bi-directional I/O port. It is bit/ byte addressable. During external memory access it functions as higher order address bus (A8-A15).

Port 3(p3.0 to port 3.7): It is 8-bit I/O port. In an alternating function each pins can be used as a special function I/O pin. P3.0-RxD: It is an Input signal. Through this I/P signal microcontroller receives serial data of serial communication circuit. P3.1-TxD: It is O/P signal of serial port. Through this signal data is transmitted. P3.2- (INT0): It is external hardware interrupt I/P signal. Through this user, programmer or peripheral interrupts to microcontroller. P3.3-(INT1): It is external hardware interrupt I/P signal. Through this user, programmer or peripheral interrupts to microcontroller. P3.4- T0: It is I/P signal to internal timer-0 circuit. External clock pulses can connects to timer-0 through this I/P signal. P3.5-T1: It is I/P signal to internal timer-1 circuit. External clock pulses can connects to timer-1 through this I/P signal. P3.6-[WR(bar)]: It is active low write O/P control signal. During External RAM (Data memory) access it is generated by microcontroller. when [WR(bar)]=0, then performs write operation. P3.7-[RD(bar)]: It is active low read O/P control signal. During External RAM (Data memory) access it is generated by microcontroller. when [RD(bar)]=0, then performs read operation from external RAM. XTAL1 and XTAL2: These are two I/P line for on-chip oscillator and clock generator circuit. A resonant network as quartz crystal is connected between these two pin. 8051 microcontroller also drives from external clock, then XTAL2 is used to drive 8051 from external clock and XTAL1 should be grounded. [EA(bar)]/VPP: It is and active low I/P to 8051 microcontroller. when (EA)= 0, then 8051 microcontroller access from external program memory (ROM) only. When (EA) = 1, then it access internal and external program memories (ROMS).

[PSEN(bar)]: It is active low O/P signal. It is used to enable external program memory (ROM). When [PSEN(bar)]= 0, then external program memory becomes enabled and microcontroller read content of external memory location. Therefore it is connected to (OE) of external ROM. It is activated twice every external ROM memory cycle. ALE: Address latch enable: It is active high O/P signal. When it goes high, external address latch becomes enabling and lower address of external memory (RAM or ROM) latched into it. Thus it separates A0-A7 address from AD0-AD7. It provides properly timed signal to latch lower byte address. The ALE is activated twice in every machine cycle. If external RAM & ROM is not accessed, then ALE is activated at constant rate of 1/6 oscillator frequency, which can be used as a clock pulses for driving external devices. RESET: It is active high I/P signal. It should be maintained high for at least two machine cycle while oscillator is running then 8051 microcontroller resets. Figure: Pin diagram of 8051

CONCLUSION: Salient features and pin structure of 8051MC were studied in detail.

EXPERIMENT NO.2 AIM: a)to write a program to add and subtract two 8-bit hexadecimal numbers stored at location D000H and D001H also store the result at location D002H using DYNA-51. b) To write a program to Multiply and Divide two 8-bit hexadecimal numbers stored at location D000H and D001H, also store the result from location D002H using DYNA-51 TOOLS: DYNA-8051 kit, MCU 8051 IDE. THEORY: The program is written at memory location C000H. DPTR is initialized to D000H. The instructions used in the program are as follows: MOV:The MOV instruction moves data bytes between the two specified operands. The byte specified by the second operand is copied to the location specified by the first operand. The source data byte is not affected. E.g.: MOV A, B ADD:The ADD instruction adds a byte value to the accumulator and stores the results back in the accumulator. The destination operand is always in register A while the source operand can be a register, immediate data, or in memory. The instruction could change any of the AF, CF, or P bits of flag register. E.g.: ADD 0F0H this instruction will add the contents of 0F0H register to default register A and store the result in default register A. SUBB (subtract with borrow) :In subtraction, the 8051 use the 2 s complement method. There are two case for SUBB instruction; (1) with CY = 0, and (2) with CY = 1.The SUBB instruction subtracts the specified byte variable and the carry flag from the accumulator. The result is stored in the accumulator. This instruction sets the carry flag if a borrow is required for bit 7 of the result. If no borrow is required, the carry flag is cleared. E.g.: SUBB 0F0H this instruction will subtract the contents of 0F0H register from default register A and store the result in default register A. MUL:The MUL instruction multiplies the unsigned 8-bit integer in the accumulator and the unsigned 8-bit integer in the B register producing a 16-bit product. The low-order byte of the product is returned in the accumulator. The high-order byte of the product is returned in the B register. The OV flag is set if the product is greater than 255 (0FFh), otherwise it is cleared. The carry flag is always cleared.

DIV:The DIV instruction divides the unsigned 8-bit integer in the accumulator by the unsigned 8-bit integer in register B. After the division, the quotient is stored in the accumulator and the remainder is stored in the B register. The carry and OV flags are cleared. If the B register begins with a value of 00h the division operation is undefined, the values of the accumulator and B register are undefined after the division, and the OV flag will be set indicating a division-by-zero error. INC:The INC instruction increments the specified operand by 1. An original value of 0FFh or 0FFFFh overflows to 00h or 0000h. No flags are affected by this instruction. When this instruction is used to modify an output port, the value used as the port data is read from the output data latch, not the input pins of the port. E.g.: DPTR initialized at C100 After INC DPTR => C101 LJMP: LJMP is an unconditional long jump. It is 3-byte instruction in which first byte is opcode, and the second and third bytes represent the 16- bit address of the target location. The LJMP instruction transfers program execution to the specified 16-bit address. The PC is loaded with the high-order and low-order bytes of the address from the second and third bytes of this instruction respectively. No flags are affected by this instruction. The program execution will stop at this instruction ALGORITHM: Step1: Get first number in register A Step2: Get second number in register B Step3: Add/Subtract/Multiply/Divide the two numbers Step4: Store Result in Memory location Step5:Stop

FLOWCHART: Start Move First no. to A Move Second no. to B Add/Subtract content of A and B Store the result in A Stop Fig:Addition and Subtraction Start Move Multiplicand to A / Dividend to A Move multiplier to B/Divisor to B Multiply A and B / Divide A by B Store the lower byte in A and upper byte in B of the product /Quotient in A and Remainder in B to the destination Stop Fig: Multiplication and Division

RESULTS: Addition ADDRESS VALUE(eg) INPUT Before execution D000H D001H OUTPUT After execution D002H Subtraction ADDRESS VALUE INPUT Before execution D000H D001H OUTPUT After execution D002H Multiplication ADDRESS VALUE INPUT D000H OUTPUT D001H D002H D003H Division ADDRESS VALUE INPUT D000H OUTPUT D001H D002H D003H

CONCLUSION: Addition and Subtraction of two 8-bit hexadecimal nos. was done using ADD and SUBB instruction respectively and the result was stored in the register A and then shifted to memory location. Multiplication of two 8-bit hexadecimal numbers was done using MUL instruction and the lower byte of the result was stored in the register A and Higher byte in register B and further was shifted to memory location. Similarly Division of two 8-bit hexadecimal numbers was done using DIV instruction. The quotient was stored in a register A and remainder was stored in register B, further quotient and remainder was stored in Memory location.