Docsity

Quiz Solutions for ECE 383 - Microcomputers, Fall 2009, Quiz 3 - Prof. Qi Hao, Quizzes of Electrical and Electronics Engineering

Toggle sidebar
bg1
ECE 383 - Microcomputers
Fall 2009 โ€“ Quiz 3 Solution
Instructions:
1. Please write your name and student number in the upper right hand corner of the back of this sheet.
2. When you are finished answering the questions, fold the paper in half lengthwise with this side of the
page to the inside of the fold.
Problems:
1. What is the 7-segment LED patterns (Hexadecimal) of the following symbols
a. โ€œAโ€ $77
b. โ€œHโ€ $76
c. โ€œEโ€ $79
d. โ€œLโ€ $38
e. โ€œPโ€ $73
f. โ€œ!โ€ $86
2. Finish the following code for a 5s delay (assuming 24MHZ MCLK).
DELAY_5S: LDX #1000
DELAY_1: LDY #40000
DBNE Y, *
DBNE X, DELAY_1
3. Finish the following code that can display data on the discrete LED.
ORG $1000
DATA DC.B $F0
ORG $2000
MOVB #$FF , DDRB
MOVB #%00000010 , DDRJ
MOVB DATA , PORTB
BCLR PORTJ , #%00000010
JSR DELAY_5s
BSET PORTJ , #%00000010
4. Finish the following code that can test whether Key4 is pressed
MOVB #$0F, DDRA
BSET PORTA, #%00001111
BCLR PORTA, #%00000001
NOP
BRSET PORTA, #%11110000, *
LDAA PORTA
CMPA #$DE
BNE KEY4_NOT_PRESSED

Partial preview of the text

Download Quiz Solutions for ECE 383 - Microcomputers, Fall 2009, Quiz 3 - Prof. Qi Hao and more Quizzes Electrical and Electronics Engineering in PDF only on Docsity!

ECE 383 - Microcomputers

Fall 2009 โ€“ Quiz 3 Solution

Instructions:

  1. Please write your name and student number in the upper right hand corner of the back of this sheet.
  2. When you are finished answering the questions, fold the paper in half lengthwise with this side of the page to the inside of the fold.

Problems:

  1. What is the 7-segment LED patterns (Hexadecimal) of the following symbols a. โ€œAโ€ $ b. โ€œHโ€ $ c. โ€œEโ€ $ d. โ€œLโ€ $ e. โ€œPโ€ $ f. โ€œ!โ€ $
  2. Finish the following code for a 5s delay (assuming 24MHZ MCLK).

DELAY_5S: LDX # DELAY_1: LDY # DBNE Y, * DBNE X, DELAY_

  1. Finish the following code that can display data on the discrete LED.

ORG $ DATA DC.B $F

ORG $ MOVB #$FF , DDRB MOVB #%00000010 , DDRJ MOVB DATA , PORTB BCLR PORTJ , #% JSR DELAY_5s BSET PORTJ , #%

  1. Finish the following code that can test whether Key4 is pressed

MOVB #$0F , DDRA BSET PORTA, #% BCLR PORTA, #% NOP BRSET PORTA, #%11110000 , * LDAA PORTA CMPA #$DE BNE KEY4_NOT_PRESSED