0% found this document useful (0 votes)
91 views10 pages

Introduction To Microprocessor Laboratory Report (EM205)

This laboratory report describes experiments conducted using a microprocessor. It contains code to control LED patterns using switches as inputs. The code contains functions to blink LEDs in different patterns when different switches are pressed. Registers and memory locations are used to control the LED output and track switch states and loop counts. Delays are added using a timer trap.

Uploaded by

Lee Yann Lynn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
91 views10 pages

Introduction To Microprocessor Laboratory Report (EM205)

This laboratory report describes experiments conducted using a microprocessor. It contains code to control LED patterns using switches as inputs. The code contains functions to blink LEDs in different patterns when different switches are pressed. Registers and memory locations are used to control the LED output and track switch states and loop counts. Delays are added using a timer trap.

Uploaded by

Lee Yann Lynn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

INTRODUCTION TO MICROPROCESSOR

LABORATORY REPORT
(EM205)

Name : Teoh Yee Cien


Student ID : 1001437330
Course : B.Eng. (Hons) Mechanical Engineering
QUESTION 1

ORG $1000
START:
LED EQU $2000
SW EQU $3000
CLR LED

MAIN
CLR D6
CLR D7
MOVE.B (SW),D2
CMP.B #1,D2
BEQ FUNC1
CMP.B #2,D2
BEQ FUNC2
CMP.B #3,D2
BEQ FUNC3
BRA START

FUNC1
MOVE.B #%11110000,D3
MOVE.B D3,LED
JSR DELAY

LOOP
ROL.B #4,D3
MOVE.B D3,LED
JSR DELAY
ADD.B #1,D7
CMP.B #9,D7
BLT LOOP
BRA MAIN

FUNC2
MOVE.B #%00000001,D3
MOVE.B D3,LED
JSR DELAY

LOOP1
LSL.B #1,D3
MOVE.B D3,LED
JSR DELAY
CMP.B #%10000000,D3
BNE LOOP1
BRA MAIN

FUNC3
MOVE.B #%11111111,D4
MOVE.B D4,LED
JSR DELAY
CLR LED
JSR DELAY
ADD.B #1,D6
CMP.B #10,D6
BLT FUNC3
BRA MAIN

DELAY
MOVE.B #50,D1
MOVE.B #23,D0
TRAP #15
RTS

EXIT
END START
QUESTION 2
ORG $1000
START:
SG7 EQU $6000
SG7B EQU $6002
SG7C EQU $6004
SW EQU $4000

SWITCH
MOVE.B (SW),D6
CMP.B #1,D6
BEQ FUNC1
CMP.B #2,D6
BEQ FUNC2
CMP.B #3,D6
BEQ FUNC3
BRA START

FUNC1
LEA DATA1,A0
MOVE.B (A0)+, $6000
MOVE.B (A0)+, $6002
MOVE.B (A0)+, $6004
MOVE.B (A0)+, $6006
MOVE.B (A0)+, $6008
MOVE.B (A0)+, $600A
MOVE.B (A0)+, $600C
MOVE.B #0, $600E
JSR DELAY
BRA START

FUNC2
LEA SG7,A0
LEA SG7B,A2
JSR CLEARSG7
LEA DATA,A2
CLR D4

F2LOOP1
LEA DATA, A1
CLR D3
ADD.B #1,D4
CMP.B #10,D4
BGT START
MOVE.B (A2)+, SG7
MOVE.B (A1)+, SG7B
JSR DELAY

F2LOOP
ADD.B #1, D3
CMP.B #9, D3
BGT F2LOOP1
MOVE.B (A1)+, SG7B
JSR DELAY
BRA F2LOOP
FUNC3
LEA SG7,A0
LEA SG7B,A2
LEA SG7C,A3
JSR CLEARSG7
LEA DATA,A3
CLR D5

F3LOOP2
LEA DATA,A2
CLR D4
ADD.B #1,D5
CMP.B #10,D5
BGT START
MOVE.B (A3)+, SG7
MOVE.B (A2),SG7B
MOVE.B (A1),SG7C

F3LOOP1
LEA DATA, A1
CLR D3
ADD.B #1,D4
CMP.B #10,D4
BGT F3LOOP2
MOVE.B (A2)+,SG7B
MOVE.B (A1)+,SG7C
JSR DELAY

F3LOOP
ADD.B #1, D3
CMP.B #9, D3
BGT F3LOOP1
MOVE.B (A1)+, SG7C
JSR DELAY
BRA F3LOOP

CLEARSG7
CLR D7
MOVE.W D7, (A0)+
CMPA.W #$600E, A0
BLE CLEARSG7
RTS

DELAY
MOVE.B #5,D1
MOVE.B #23,D0
TRAP #15
RTS

ORG $2000
DATA
DC.B 63,6,91,79,102,109,125,7,127,111

ORG $3000
DATA1
DC.B 109,56,8,49,119,109,118
END START

You might also like