Lab Manual MC &MP

15
Experiment No.2 “Introduction to the software’s used in microcontroller & microprocessor lab.” Objectives : The objective of this experiment is to get introduction of software’s used in microcontroller lab to implement it to different systems. In this experiment you will do the following. 1. Emu8086 2. Proteus Emu8086 : emu8086 is the emulator of 8086 (Intel and AMD compatible) microprocessor with integrated 8086 assembler and tutorials for beginners. The emulator runs programs like the real microprocessor in step-by-step mode. It shows registers, memory, stack, variables and flags. All memory values can be investigated and edited by a double click. The instructions can be executed in a regular forward direction and also in reverse direction.

description

nojk'knikj b mn lkjmpo;4m bkjnpoimj#

Transcript of Lab Manual MC &MP

Page 1: Lab Manual MC &MP

Experiment No.2

“Introduction to the software’s used in microcontroller & microprocessor lab.”

Objectives :

The objective of this experiment is to get introduction of software’s used in microcontroller lab to implement it to different systems. In this experiment you will do the following.

1. Emu80862. Proteus

Emu8086 :

emu8086 is the emulator of 8086 (Intel and AMD compatible) microprocessor with integrated 8086 assembler and tutorials for beginners. The emulator runs programs like the real microprocessor in step-by-step mode. It shows registers, memory, stack, variables and flags. All memory values can be investigated and edited by a double click. The instructions can be executed in a regular forward direction and also in reverse direction.

emu8086 can create a tiny operating system and write its binary code to a bootable floppy disk. This software package includes several virtual external devices: robot, stepper motor, led display, and traffic lights intersection. Virtually anyone with any programming experience can design animated virtual devices in assembly language or in any other programming language. All devices are open for modifications and cloning (source code is available). All communications between the microprocessor

Page 2: Lab Manual MC &MP

and devices is coming through this file: c:\emu8086.io, to emulate in/out instructions it's just required to change corresponding bytes in this binary file

Proteus

PROTEUS VSM allows professional engineers to run interactive simulations of real designs, and to reap the rewards of this approach to circuit simulation. And then, a range of simulator models for popular micro-controllers and a set of animated models for related peripheral devices such as LED and LCD displays, keypads, an RS232 terminal and more. It is possible to simulate complete micro-controller systems and thus to develop the software for them without access to a physical prototype. In a worldwhere time to market is becoming more and more important this is a real advantage. Structurally, Proteus 6 Professional separated into two main components, which are ISIS 6 Professional and ARES 6 Professional. ISIS 6 Professional mainly involved on circuit designing and simulation

DATE:

SIGNATURE:

Page 3: Lab Manual MC &MP

Experiment No.3:“Introduction to the instruction set in emu8086.”

Objective :

The objective is to get the introduction to the instructions AAA, CMP, ADC, CLC, ADD, SUB.

1. AAA

It works according to the following Algorithm:

if low nibble of AL > 9 or AF = 1 then:

AL = AL + 6AH = AH + 1AF = 1CF = 1elseAF = 0CF = 0in both cases:clear the high nibble of AL.

2. CMP Compare. Algorithm:operand1 - operand2 result is not stored anywhere, flags are set (OF, SF, ZF, AF, PF, CF) according to result.

Page 4: Lab Manual MC &MP

3. ADC operand1 = operand1 + operand2 + CF

4. CLC

Clear Carry flag. Algorithm: CF = 0

5. ADD

Add.Algorithm:operand1 = operand1 + operand2

6. SUB

Subtract. Algorithm:operand1 = operand1 - operand2

DATE

SIGNATURE

Page 5: Lab Manual MC &MP

Experiment No.4:“Introduction to the instruction set in emu8086.”

Objective :

The objective is to get the introduction to the instructions AAD, DEC, AND, RET, JUMP, MUL,DIV

1. AAD :Algorithm: AL = (AH * 10) + ALAH = 0

2. DEC:Decrement. Algorithm:operand = operand – 1

Page 6: Lab Manual MC &MP

3. AND :

Logical AND between all bits of two operands. Result is stored in operand1.These rules apply:1 AND 1 = 11 AND 0 = 00 AND 1 = 0 0 AND 0 = 0

4. RET:Return from near procedure. Algorithm:Pop from stack:IPif immediate operand is present: SP = SP + operand

5. JUMP:

Unconditional Jump. Transfers control to another part of the program.4-byte address may be entered in this form: 1234h: 5678h, first value is a segment second value is an offset.Algorithm:always jump

Page 7: Lab Manual MC &MP

6. MUL: Algorithm:

when operand is a byte:AX = AL * operand.when operand is a word:(DX AX) = AX * operand.

7. DIV :

Algorithm:when operand is a byte:AL = AX / operandAH = remainder (modulus)when operand is a word:AX = (DX AX) / operandDX = remainder (modulus)

DATE:

SIGNATURE:

Page 8: Lab Manual MC &MP

Experiment No.5:“Introduction to the instruction set in emu8086.”

Objective :

The objective is to get the introduction to the instructions JLE, LOOP, LOOPZ, NOT, PUSH, STC

1. JLE :

Short Jump if first operand is Less or Equal to second operand (as set by CMP instruction). Signed. Algorithm:if SF <> OF or ZF = 1 then jump

2. LOOP:

Decrease CX, jump to label if CX not zero. Algorithm: CX = CX - 1 if CX <> 0 thenjumpelseno jump, continue

Page 9: Lab Manual MC &MP

3. LOOPZ:Algorithm: CX = CX - 1if (CX <> 0) and (ZF = 1) thenjumpelseno jump, continue

4. NOT :Algorithm: if bit is 1 turn it to 0.if bit is 0 turn it to 1.

5. PUSH: Algorithm:SP = SP - 2SS:[SP] (top of the stack) = operand

6. STC :Set Carry flag. Algorithm: CF = 1

DATE:

SIGNATURE:

Page 10: Lab Manual MC &MP

EXPERIMENT N0.6

“ Introduction to microcontroller software µkeil (2 EDITION) ”

Introduction

Keil MicroVision is an integrated development environment used to createsoftware to be run on embedded systems (like a microcontroller). It allows for suchsoftware to be written either in assembly or C programming languages and for thatsoftware to be simulated on a computer before being loaded onto the microcontroller.

µVision2 is an IDE (Integrated Development Environment) that helps write,compile, and debug embedded programs. It encapsulates the following components:

A project manager. A make facility. A Tool configuration. An Editor. A powerful debugger.

STEPS FOLLOWED IN CREATING AN APPLICATION IN uVision2: To create a new project in uVision2:

7. Select Project - New Project.8. Select a directory and enter the name of the project file.3. Select Project –Select Device and select a device from Device Database.4. Create source files to add to the project5. Select Project - Targets, Groups, and Files. Add/Files, select Source Group1, and add the

source files to the project.6. Select Project - Options and set the tool options. Note that when the target device is

selected from the Device Database™ all-special options are set automatically. Default memory model settings are optimal for most applications.

7. Select Project - Rebuild all target files or Build target To create a new project, simply start Micro Vision and select “Project”=>”New Project” from the pull–down menus. In the file dialog that appears, choose a name and base directory for the project. It is recommended that a new directory be created for each project, as several files will be generated. Once the project has been named, the dialog shown in the figure below will appear, prompting the user to select a target device. In this lab, the chip being used is

Page 11: Lab Manual MC &MP

the “AT89S52,” which is listed under the heading “Atmel”.

Next, Micro Vision must be instructed to generate a HEX file upon programcompilation. A HEX file is a standard file format for storing executable code that is tobe loaded onto the microcontroller.In the “Project Workspace” pane at the left, right–click on “Target 1” and select“Options for ‘Target 1’ ”.Under the “Output” tab of the resulting options dialog,ensure that both the “Create Executable” and “Create HEX File” options are checked.Then click “OK”as shown in the two figures below.

DATE:

SIGNATURE: