
ECE 383 - Microcomputers
Fall 2009 โ Quiz 4 Solutions
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 frequency range of PWM signals generated by the Drag12plus board (24M Hz main clock)?
Frequencymin = 24x106/27+9+16=32 โ 24/4000 = 0.006Hz Frequencymax = 12MHz
2. What are the frequency and duty cycle of the following PWM signals?
(1) MOVB #$45, PWMPRCLK
MOVB #100, PWMSCLA
MOVB #75, PWMSCLB
MOVB #100, PWMPER7
MOVB #50, PWMDTY7
Scaling = 16 x (2x75) x 100
Frequency = 100 Hz D = 50 %
(2) MOVB #$75, PWMPRCLK
MOVB #50, PWMSCLA
MOVB #75, PWMSCLB
MOVB #100, PWMPER5
MOVB #50, PWMDTY5
Scaling = 32 x (2x50) x 100
Frequency = 75 Hz D = 50 %
3. Finish the following code to generate a waveform with 0.05Hz and 10% high duty cycle
BSET PWMCTL, #%01000000
BSET PWME, #%00110000
BSET PWMPOL, #%00110000
BSET PWMCLK, #%00110000
MOVB #$06 , PWMPRCLK
MOVB #250 , PWMSCLA
MOVW #15000, PWMPER4 Scaling: 64 x (2x250) x 15000
MOVW #1500 , PWMDTY4
4. Finish the following code that can provide an interrupt service when pushbutton2 is pressed
ORG $2000
MOVW #$3000, $3E4C
BRA *
CLI
ORG $3000
SEI
BRCLR PIFH, #%00000100, ISR_DONE
INCA
ISR_DONE: BSET PIFH, #%00001111
CLI
RTI