Vous êtes sur la page 1sur 3

EXPERIMENT MP1: INTRODUCTION TO MICROPROCESSOR Related course: KEEE 3235 (Microprocessor and Microcontroller) OBJECTIVES: To perform simple addition,

double precision addition, adding five numbers and multiplication by shifting using microprocessor EQUIPMENT: Heathkit EE-3401 PRECAUTIONS: Familiarise yourself with the operation of the ET-3400 microprocessor trainer. A manual of the trainer is available in the laboratory. REFERENCE(S): Refer to the main references of KEEE 3235 (Microprocessor and Microcontroller) TEST: TEST 1: Simple addition TEST 2: Double precision addition TEST 3: Adding five numbers TEST 4: Multiplication by shifting INTRODUCTION: The purpose of this experiment is to introduce you to the fundamentals of microprocessor. Before performing the experiment, it is advisable to read Unit 1 through Unit 5 of the Heathkit EE3401 notes on microprocessors accompanying the ET-3400 microprocessor trainer available in the laboratory. Make sure that you have an idea of the basic arrangement of a microcomputer, the architecture of a microprocessor, the execution of a program and the basics for machine language and assembly language programming. TEST 1: Simple addition The following program adds two numbers stored in memory locations $0000 and $0001 and store the sum in location $0002. The program begins at location $0010. Enter the machine code program into the ET-3400 and verify the operation of the program. ADDRESS
0010 0012 0014 0016

M/C CODE INSTRUCTION


9600 9B01 9702 3E LDAA ADDA STAA WAI $00 $01 $02

COMMENTS
LOAD ADDEND INTO ACC.A ADD AUGEND TO ACC.A STORE SUM IN LOCATION $0002 STOP OR WAIT FOR INTERRUPT

TEST 2: Double precision addition This program illustrates how to add two 2-byte unsigned binary numbers to produce a sum of two bytes or three bytes tong. Adding in double precision basically involves saving the carry status from the lower byte and adding it to the highest byte in the least significant bit position.

Last updated on 19th January 2014

An instruction of the 6800 ADC permits an addition with carry to be performed with a single instruction. In the following program, the addend is originally stored at location $0000 and $0001 with the MSB at $0000 and the augend at location $0002 and $0003. The sum in three bytes is stored at the next three locations with the first byte as the MSB. ADDRESS
0000 0000 0001 0001 0001 0002 0001 0003 0001 0004 0001 0005 0001 0006 0001 0010 0010 7F 0004 0013 96 01 0015 98 03 0017 97 06 0019 96 00 001B 99 02 001D 97 05 001F 24 03 0021 7C 0004 0024 3E

M/C CODE INSTRUCTION


ADD1 ADD2 AUG1 AUG2 SUM1 SUM2 SUM3 ORG RMB RMB RMB RMB RMB RMB RMB ORG CLR LDA A ADD A STA A LDA A ADC A STAA BCC INC WAI 0 1 1 1 1 1 1 1 $0010 SUM1 ADD2 AUG2 SUM3 ADD1 AUG2 SUM2 DONE SUM1

COMMENTS
FIRST BYTE OF ADDEND SECOND BYTE OF ADDEND FIRST BYTE OF AUGEND SECOND BYTE OF AUGEND FIRST BYTE OF SUM SECOND BYTE OF SUM THIRD BYTE OF SUM CLEAR MSB OF SUM GET 2-BYTE OF ADDEND ADD 2BYTE OF AUGEND TO STORE RESULT IN SUM2 GET FIRST BYTE OF ADDEND ADD I-BYTE OF AUGEND TO I STORE RESULT IN SUM2 NO CARRY, DONE CARRY, SET MSB OF SUM

DONE

TEST 3: ADDING FIVE NUMBERS This is a program to add five numbers stored at locations $0000 through $0004 and store a single byte sum at location $0005, ignoring any overflow of the sum. It illustrates how the accumulator B is used as a counter and the indexed addressing mode used in fetching a list of numbers. The following is an assembly listing of the program. Key in the program and verify. ADDRESS
0000 0000 0001 A 0001 0001 A 0002 0001 A 0003 0001 A 0004 0001 A 0005 0001 A 0010 0010 4F 0011 C6 05 A 0013 CE 0000 A 0016 AB 00 A 0018 08 0019 5A 001A 26 FA 001C 97 05 A 00I E 3E

M/C CODE INSTRUCTION


FIRST SECOND THIRD FOURTH FIFTH ANSWER STRT ORG RMB RMB RMB RMB RMB RMB ORG CLRA LDAB LDX ADDA INX DECB BNE STAA WAI

COMMENTS
$0000 1 1 1 1 1 1 $0010 CLEAR TEMP STORAGE ACCA INITIALIZE COUNTER POINT X TO LOCATION $0000 ADD ONE LOCATION TO ACCA POINT X TO NEXT LOCATlON DONE ALL FIVE LOCATIONS? LOOP BRANCH IF NOT ANSWER STORE ANSWER $05 $0000 X

LOOP

Last updated on 19th January 2014

TEST 4: Multiplication by shifting In the following program a method identical with the pencil and paper method is used for multiplication. It involves examining each bit of the multiply: from the right and if the bit is one. The multiplication is added to the product and then shifted one bit to the left; if the bit is a zero, the multiplication is merely shifted one bit to the left; the following is an example of multiplying decimal 130 and 5. DECIMAL 130 X 5 650 BINARY 10000010 X 00000101 10000010 10000010 1010001010

Key in the program into the ET3400 and verify. ROUTINE: TO MULTIPLY TWO 8-BIT BYTES ADDRESS
0000 0000 0001 0002 0003 0004 0005 0010 7F 00 04 0013 7F 00 02 0016 7F 00 03 0019 96 01 001B 20 06 0010 78 00 00 0020 79 00 04 0023 44 0024 24 0D 0026 D6 03 0028 DB 00 002A D7 03 002C D6 02 002E D9 04 0030 D7 02 0032 4D 0033 26 E8 0035 3E 0036 00 10

M/C CODE INSTRUCTION


PLCND PLIER UPBYTE LOBYTE SHIFT MULT ORG RMB RMB RMB RMB RMB ORG CLR CLR CLR LDAA BRA ASL ROL LSR A BCC LDA B ADD B STA B LDA B ADC B STA B BNE WAI END MULT $0000 1 1 1 1 1 $0010 SHIFT UPBYTE LOBYTE PLIER LOOP 1 PLCND SHIFT NOADD LOBYTE PLCND LOBYTE UPBYTE SHIFT UPBYTE LOOP 2

COMMENTS
MULTIPLICAND MULTIPLIER UPPER BYTE OF RESULT LOWER BYTE OF RESULT SHIFT MULTIPLICAND CLR ANSWER & SHIFT AREA

LOOP 2 LOOP 1

SHIFT MULTIPICAND LEFT UP BYTE OF MULTICAND

NOADD

END OF EXPERIMENT

Last updated on 19th January 2014

Vous aimerez peut-être aussi