EE319K Exams - UNIVERSITY OF TEXAS AT AUSTIN ELECTRICAL AND...

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

View Full Document Right Arrow Icon
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
Background image of page 3

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

View Full DocumentRight Arrow Icon
Background image of page 4
Background image of page 5

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

View Full DocumentRight Arrow Icon
Background image of page 6
Background image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: UNIVERSITY OF TEXAS AT AUSTIN ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT EE319K, Embedded Systems, Fall 2011 Final Exarh December 9,2011 Directions There are 6 problems worth a total of 100 points. The number of points for each question is indicated. Make sure that you Show all work since partial credit will be given. This exam is closed book, closed notes, and no calculators are allowed. You may not communicate in any way with anyone other than exam proctors during the exam time. Don’t forget to put your name down on the first page. You have 3 hours to finish the exam Name: :5 \J l Points possible Score s Problem 1 20 ' Problem 2 l 14 2. Problem 3 16 5 Problem 4 147 l Problem 5 16 l Problem 6 2( k l‘ Total 10) 1 . (20 points) Answer the following; (a) 6 points) W’rite assembly code that rotates the three registers: D goes into X, X goes into Y, and Y goes into D Note: If D, X and Y have 12, 5 and 3 before, then after the rotates they must have 3., 12. and 5 respectively. You are not allowed to use any variables but you niay use the sleek fps ioé €23 is; Wig (b) 6 points) Given two 9812 boards communicating using SCI with a baud-rate set to 55 Kbps (bits per sec). With no parity bit and one. start and one stop bit being used, how much time will it take to transmit the string ” Cruel World” (quotes not transmitted) if the Characters are transmitted as ASCII values? 6 55M”? gate??? Esra: big, Wsmleece Ls iixéfiasvg :; gm ’ ’t: : gm eeimm fie s’g riser, ,, Eta 13%; fies % gms M mség seas .1; §§ ((1) (8 points) Give the val ies of NZVC bits after execution of each of the following 2-instruetion sequences. Instruction sequence fN Z V C l 22, fi-1H (lll‘f‘lfill g a C} Q add-a #64 ld‘ia #200 ,_ . ‘ , ’7”, . € 3 2 £3 suba #64 [\I) 2. (14 points) There are two parts to this question. First, complete the C subroutine below that takes a string of digits that are null terminated and returns the decimal number it represents. unsigned short Str2Dec(unsigned char digits [6]) { aseifimaci gmt gig >23} {:31}; . \ ' 2 w W C: LginiéaCd/EGQ’EE‘J rag; E ’fé‘e/E 2; ES%’§“€E i‘fi’} W fies/s Notes: 0 Each eleniont of the digits array is an ascii character 70’” ’9‘ except the last element which is ASCII value 0. o The digits array is null-terminated. For example, the values may be digits[0]2’47, dig— itsm2’2’, digits[2]:75’, digitsIB]:O, meaning that your task in the C subroutine is to convert the number to decimal 425 and return it. o The ASCII value for digit ’0’ is 0X30. For the second part, you are required to write assembly code that calls the above C subroutine from assembly. Include appropriate Xdef7 Xref or Absentry statements Ere? £3?! :35 i, digs rmb 6 ; Storage for a null-terminated digits array ; Assume digs is initialized here and null terminated ; Setup call to StrQDec by passing it the appropriate information Dies jsr Str2Dec 3. (16 points) Write assembly or C code to do the following: Using periodic interrupts implemented using Output Compare Channel 0 read an 8—bit sample from ADC Channel 4 (PAD4) and write to SCHO “nth a busdeanisynehronizatnni Xiniinay assurne aH,reqiured devnxzregnmers fin OC/TCNT7ADCzmdSCIamcmdmedamimlmNMhmmmnemwptOC/TCNTMneahwflydmw for ycuii [lssurne that the Ell3loek is 8 hillz alul ycui are to saintfle at 1 l<llz. Pfiote that ()(3 2 ii'itei'i'upt is interrupt number 10 in l\’letrowerks C. // [3 pts] 0C~lnit : Initialize TCNT timer and Output compare Channel 2 Ejéégi ease {a i i We granting “recall; 2:}ng ggfgmaibia its}? 5; i empie W»; ices, fi3e§24:§xaé ;#i%a&$?§§5 emgafiez;§ Ties : lease :8 $932, a»? were a; use fig 1:. made; a 22:2»: em) “3%: TQNT+QWQ‘ a; 2% r ; g$m gig; / g; itifig Enigma” / [5 ptsl OC_ISR : You will call ADC‘IN and scLOUT from here // and schedule next interrupt based on the sampling rate. imf‘s :igéo dfi‘gtigg iawvmpe 5Q we: aeizseig> lg urisifpeeL €213“? fingig} gmw a: meme}; éajpgw Tgnai E: {Exiiém ,; éik Emmmwpt‘» ”?C§; 2. Tesla Erma /; [west éfiwris 3% l // [4 pts] ADCJN: Read from ADC Channel 4 and return 8~bit sample gimifi’flgiji 3342*»? ,éqi’Qwim Q} % efii‘me‘tfi : éxgés} 5:! tee? gisiré‘igifié seesaw Eases» senile Cgrseis’rss‘e 3i exgg} 1:3 {3"} {E figs“??? E‘Qfim Cgtseéasjfig ;/ [4 pts] SCI-OUT: Write the input 8*bit sample to SCIO gage gillwfifi Cvfisi‘égmeok totem simpler) § @Qfiéfifii gxgsfi‘g‘x) ;:§> 7? 733g 3? $Q§l§5§ii :: SS‘W%LQWXL (14 points) A tank implements its stealth system using a Moore FSM. The tank can operate in one of three modes, Visible7 Stealth or Repair. There are three possible events (inputs) that can occur: Fire, getHit and Ready. Here are the rules of its operation: 6:: i 2“ 0 Initially the tank is in a Visible mode. 0 The tank must be Visible to fire a shell and it changes to Stealth mode once it Fires a shell. 0 \Vhen it gets hit, no matter what its current mode is, it goes to the Repair mode. 0 Firing in any mode other than Visible is invalid and so puts the tank in Repair mode. 0 Once the tank becomes ready, no matter What its prior mode was7 it enters the Visible mode. Three indicator LED outputs colored Red ( Repair) Green (Visible) and Blue (Stealth) show which mode the tank is currently in. These LEDs are connected to Port T bits 2. l and 0 respectively. a g E (6 points) Give the 3‘state FSM diagram (b) (8 points)Complete the declarations section of the FSM (No FSM engine): org; $0800 CurSt rmb 2 org $4000 Data Structures for States iiisiibie reviews ; sea {as seas/a f iegtfia‘fi’; reggae; geealtia {eves/gee: ,2 ifii «£515? Kebaée ; Ee§>aé~zrj Rea/{sighs {Zefaw as sag/yea i} 323‘)“ gas W011“ teases» ; kz’ésibte Cr! 5. (10 points) Implement in assembly or C language a LIFO (Last In First Out) structure with the f(’)llowing specifications: o The LIF O has a capacity 014 elements (bytes) which are allocated in RAM a One 8—bit variable (Last) is allocated in RAEVI to store the position of the last item stored in the LIFO If you choose to write in assembly then the following assembly code defines the LIFO in RAM. You can NOT make changes or additions to these variables (specifically, no put and get indexes or pointers are allowed; you dont need them) org $2000 Lifo ri’nb 4 ; place for 4 numbers £399 Last rmb 1 ; position of the last placed item C Equivalent: char unsigned WLifo [4]; signed char Last; $5§g ((6% Mi get; 3 LIFO-Init initializes Last to —1. (a) (8 points) Write an assembly/C subroutine (LIFO-Put) that puts one 8—bit element into the LIFO The input parameter is call—by—value (in Reg E for assembly), and the return paran’ietcr is also call—by-value (in Reg B for assembly). The return value has the following semantic: 0 meai‘iing success, and 1 means the data was not stored because there were already four Q elements in the LIFO. gage? 5% am 7 E a CL®$%’ 4:35:2{Wi37}'§ (b) (8 points) W’rite an assembly/C subroutine (LIFO_Get)that gets one 8—bit element from the LIFO. The input parameter is call—by~reference (address in Reg D for assembly)T and the return parameter is also call-by-value (in Reg B for assembly). The return value has the following semantic: 0 meaning success, and 1 means the LIFO is empty. it (gages: «2) 5 Maggi %€’i§m 3,, Li A; a {sage}; test w - Wm {$3} (ii (20 points) Answer the following <a> (d) (e) (6 points) In G7 a char is 8~bits, a short is 16—bits, and a long is 32-bits. Assuming each is signed, give the range of each type of number. [You may express them unreducedl “15%? 3”? {if}??? “*2 2+1? «r2,» wi reei my? fines/t w; era a»: 5.. i 322:3 5 we? W; g2; gwglgé‘wg a} (6 points) You identified a potential race condition in your code which has a main subroutine and a interrupt service routine(ISR) that share a global variable counter. The main incre— ments it and the ISR decrements it. How will you fix it? Specifically7 show what code will you add and where? igi caring? Eva 2 W mafia ér: main bemecsé item 3‘3:ng ; wefléfifiw; 513m air; (4 points) What are the various Synchronization mechanisms used in device driver program— ming? Which one is used in programming the LCD? (2 points) In a RDRF Interrupt handler7 to acknowledge the interrupt we have to explicitly set the RDRF flag to 0 [True@ (2 points) In writing arithmetic expressions in C for the 9812, it is preferable to perform divisions before multiplications [True E ...
View Full Document

This note was uploaded on 02/20/2012 for the course EE 319K taught by Professor Bard during the Fall '08 term at University of Texas.

Page1 / 7

EE319K Exams - UNIVERSITY OF TEXAS AT AUSTIN ELECTRICAL AND...

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

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