Docsity

Quiz 5 for ECE 383 - Microcomputers, Fall 2010 - Prof. Qi Hao, Quizzes of Electrical and Electronics Engineering

Toggle sidebar
bg1
ECE 383 - Microcomputers
Fall 2010 โ€“ Quiz 5
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 are the hexadecimal values of ADC with respect to the following sensor readings?
a. 8-bit ADC, sensor range [-20 80], sensor reading 50 $B3
b. 10-bit ADC, sensor range [-20 80], sensor reading 50 $2CC
2. Finish the following code to collect a sample (1) at channel 5 of 10-bit resolution with the 1-stage
successive approximation; (2) at channel 7 of 8-bit resolution with the 4-stage successive approximation.
BSET ATD0CTL2 , #%10000000
BSET ATD0CTL3 , #%00001000
BCLR ATD0CTL4 , #%10000000
MOVB # 5 , ATD0CTL5
BRCLR ATD0STAT0 , #$80 ,*
LDD ADR00H
STD SENSOR_READING
BSET ATD0CTL2 , #%10000000
BSET ATD0CTL3 , #%00100000
BSET ATD0CTL4 , #%10000000
MOVB #7 , ATD0CTL5
BRCLR ATD0STAT0 , #$80 ,*
LDAA ADR03H
STAA SENSOR_READING
3. Finish the following code that can provide an interrupt service every 32 ms
ORG $2000
MOVW #$3020 , $3E4A ; Initialize interrupt vector
BSET TSCR1 , # %10000000 ; Timer enable
BSET MCCTL , #%11000111 ; Interrupt enable, Restart the counter
; Modulus enable, scaling down by 16
MOVW #48000 , MCCNT ;
CLI
BRA *
RTS
ORG $3020
SEI
INCA
MOVW #48000 , MCCNT ;
BSET MCFLG , #%10000000 ; Clear the flag
CLI
RTI

Partial preview of the text

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

ECE 383 - Microcomputers

Fall 2010 โ€“ Quiz 5

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 are the hexadecimal values of ADC with respect to the following sensor readings?

a. 8-bit ADC, sensor range [-20 80], sensor reading 50 $B

b. 10-bit ADC, sensor range [-20 80], sensor reading 50 $2CC

  1. Finish the following code to collect a sample (1) at channel 5 of 10-bit resolution with the 1-stage successive approximation; (2) at channel 7 of 8-bit resolution with the 4-stage successive approximation.

BSET ATD0CTL2 , #% BSET ATD0CTL3 , #% BCLR ATD0CTL4 , #% MOVB # 5 , ATD0CTL BRCLR ATD0STAT0 , #$80 ,* LDD ADR00H STD SENSOR_READING

BSET ATD0CTL2 , #%

BSET ATD0CTL3 , #%

BSET ATD0CTL4 , #%

MOVB #7 , ATD0CTL

BRCLR ATD0STAT0 , #$80 ,*

LDAA ADR03H

STAA SENSOR_READING

  1. Finish the following code that can provide an interrupt service every 32 ms

ORG $

MOVW #$3020 , $3E4A ; Initialize interrupt vector BSET TSCR1 , # %10000000 ; Timer enable BSET MCCTL , #%11000111 ; Interrupt enable, Restart the counter ; Modulus enable, scaling down by 16 MOVW #48000 , MCCNT ; CLI BRA * RTS

ORG $

SEI

INCA

MOVW #48000 , MCCNT ;

BSET MCFLG , #%10000000 ; Clear the flag CLI RTI