EE319K-FinalS10 - 1/11 EE 319K Spring 2010 Final Exam...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
1/11 EE 319K Spring 2010 Final Exam Ramesh Yerraballi TTh Full Name : Duration : 75 minutes This is a closed book exam; You may use your calculators; Write answers within the space provided after each of the questions. There are 7 questions on the test, read all of them first so you may properly allocate your time to answer them. Please provide comments for all code you write to help understand your answer and possibly award you partial credit. You may use the back of the sheets for extra space. 1. [4 points] In the FIFO implementation that uses a counter, what causes a race condition? How do you fix it? 2. [6 points] To convert from temperature expressed in Fahrenheit to Celsius, the following formula is used: C = (5/9)x(F-32) . Given the range of F is 0 to127, write C code that will do the conversion without the use of float/double declarations or casts. Specifically, write the appropriate declarations for F and C and the expression that realizes the given formula. unsigned char Faren; // can also define as short char Cels; // can also define as short Cels = (5*(Faren-32))/9; // multiply first divide last 3. [5 points] For a clock frequency of 8 Mhz, $______ should be written into the 9S12 SCIBD register to provide a bandwidth of 24 kbps. The protocol is 8 bits data. 1 start bit, 1 stop bit and no parity bit. Bandwidth(=24x10^3) =(Useful Bits=8/Total Bits=11) x Baud-Rate Therefore, Baud-Rate = 24 x 10^3 x (11/8) SCIBD = M-clock/(16 x Baud-Rate) = 8 x 10^6 / [(16 x 24 x 10^3) x 11/8] = 15.1515. . 15 = $000F
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2/11 4. [20 pts] In the following code, the stack is used for passing an input parameter, a return value, local variables, and, to save registers that the subroutine modifies. The subroutine makes use of two local variables, which are accessed using Register X as the stack frame pointer. Read the comments to understand the code and pay attention to instructions to figure out the sizes of input/output parameters and variables. org $0800 reslt rmb 2 org $4000 main lds #$4000 des ; Allocate space des ; for the return value movb #100,1,-sp ; Allocate and pass input parameter jsr sub ldd nnn ,sp ; get return value into reg D std reslt ; store result leas 3,sp ; De-allocate input and output space infty bra infty ;****************sub************* inp equ aaa ; binding for input parameter out equ bbb ; binding for return value sum equ ccc ; binding for local variable sum num equ ddd ; binding for local variable num sub pshx ; save register X tsx ; Setup Frame Pointer leas -2,sp ; Allocate space for sum leas -1,sp ; Allocate space for num ; . .... other stuff . .... ldaa inp,X ; get a copy of inp parameter ; . .... other stuff . .... -----> std out,X ; store RegD into out to return leas 3,sp ; De-allocate locals pulx ; restore RegX rts ; return org $FFFE fdb main
Background image of page 2
3/11 4.1. [10 pts] What are the values of aaa, bbb, ccc, ddd and nnn ? aaa 4 bbb 5 ccc -2 ddd -3 nnn 1 4.2. [10 pts] Describe the contents (e.g., oldX in two bytes, local variable num ) of the stack after line indicated by the arrow ----> is executed: Address Contents $3FF4 $3FF5 $3FF6 Num $3FF7 Sum(High Byte) $3FF8 Sum(Low Byte) $3FF9 Saved Old X (High Byte) $3FFA Saved Old X (Low Byte) $3FFB Return Address (High Byte) $3FFC Return Address (Low Byte) $3FFD Inp $3FFE Out (High Byte) $3FFF Out (Low Byte) $4000
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 11

EE319K-FinalS10 - 1/11 EE 319K Spring 2010 Final Exam...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online