EE 324Introduction to Embedded Microcontrollersfall 2001

EE 324Introduction to Embedded Microcontrollersfall 2001

EE 324Introduction to Embedded MicrocontrollersFall 2001

Final Exam

Name: ______

Instructor: K. CHOI M. BREGAR

Section Number: ______

Instructions

  • This exam is an open book, closed notes exam. Only the course textbook (Microcomputer Engineering, Gene Miller) may be used. No other books or notes are permitted. Calculators are allowed.
  • Please read all questions carefully.
  • Show all your work. Incorrect answers without the work will not receive any partial credit.
  • Use common conventions when interpreting and expressing numbers. (i.e. Opcodes and register values are written in hex.)
  • All code must be written to meet the Motorola AS11 compiler syntax.
  • State any assumptions necessary.
  • Place appropriate comments, so the instructor can determine the intent and logic flow.

Problem 1 (Opcodes & Operands)(25 pts)______

Problem 2 (Subroutine Development)(25 pts)______

Problem 3 (Hardware Concepts)(20 pts)______

Problem 4 (Interrupt Prog Dev)(30 pts)______

Problem 5 (Required to Pass Course)(P/F)______

Total(100 pts)______

Problem 3: (Show all work in order to get credit !!!)

Part A: Given a two input “AND” gate with a pull down resistor switch combination and the following parameters:

Vih = 1.74 VDC

Vil = 0.66 VDC

Vohoohoh

oh = 2.9 VDC

Vol = 0.6 VDC

Iih = 80 uA

Iil = -0.6 mA

Ioh = -0.2 mA

Iol = 8 mA

What would be the maximum 1% resistor for R in this application.

20K1.01K1.97K14.5KR = VIL/IIL = .66v/.6 ma = 1100 ohms

1010108912791950with tolerance answer = 1089 ohms

33021088297519K

33001100295642K

Part B: Given a simple FET output stage with the following characteristics:

Determine the power dissipated in the FET when it is the Vgs = 5.0 VDC.

I 2

1

~2.51820 VDS

Power in FET = Ids * Vds = 1 A * 2.5 V = 2.5 watts

There is some interpretation in the reading of the graph so 2.0 < power < 3.0

A B C D A

Problem #4: The above waveform is generated by a quadrature motor position encoder. The top signal is designated CHAN A and the lower signal is CHAN B. It provides 4 states designated by the letters A,B,C,D. When the motor is turning clockwise the signal proceeds from left to right (ABCDABCD...)and the opposite for counter clockwise (ADCBADC…). Utilizing the input capture interrupts (IC1 = CHAN A & IC2 = CHAN B), write interrupt service routine(s) which returns the current position or state (A,B,C,D) and the direction of rotation. Assume that the initial condition is always in state A. (Hint: consider using a look up table to keep track of state)

Part A: Please provide the necessary setup information. (Hint: Pseudo Vectors, Interrupt Particular Setups, Global Interrupt Controller)

ORG$0000

STATERMB$0001;A=1,B=2,C=4,D=8

DIRRMB$0001;CW = 1, CCW = 0

OLD_STRMB$0001

NEW_STRMB$0001

ORG$00E5

JMPIC2_ISR

ORG$00E8

JMPIC1_ISR

ORG$0100

LDAA#$CF

STAATCTL2;SET BOTH EDGES FOR IC

LDAA#$06

STAATFLG1

STAATMSK1;SET UP INTERRUPTS

CLI

Part B: some code please…

IC1_ISREQU*

LDAA#$04

STAATFLG1;CLEAR FLAG

LDAAOLD_ST

EORA#$01;COMPLEMENT STATE

STAAOLD_ST

LDAANEW_ST

LSLA

LSLA

ORAAOLD_ST;MASK IN OLD

ANDA#$0F;MASK OFF

STAANEW_ST

TAB

LDXTABLE

ABX

LDAA0,X

ANDA#$0F

STAADIR

LDAA0,X

ANDA#$F0

LSRA

LSRA

LSRA

LSRA

STAASTATE

RTI

IC2_ISR EQU*

;SAME AS ABOVE EXCEPT MASK WITH #$02 FOR COMPLEMENT

RTI

SET UP TABLE WITH ADDRESS = 0000,LAST STATE, NOW STATE

DATA = 00,STATE,000,DIR

Problem #5: As you will recall, from the beginning of the semester, you were told that you would be grading the members of your lab team as a way of determining a portion of their final grade. We want you to be objective in your assessment of your lab partner’s work and provide a numerical grade from 0 to 100 % for each of your lab partners. If you have provided no grade for this section, your individual grade, for lab participation, will be zero! If you had no lab partner, this portion will be provided by your EE 324 T/A lab instructor.

Lab Partner #1: Name ______, Grade______

Lab Partner #2: Name ______, Grade______