ENB244-T2-S2-2008

ENB244-T2-S2-2008 - GUT Surname Given Name/s III-II...

Info iconThis preview shows pages 1–5. 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
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: GUT Surname Given Name/s III-II.- Examination Paper SEMESTER: SECOND SEMESTER EXAMINATIONS 2008 UNIT: ENBZ44 MICROPROCESSORS AND DIGITAL SYSTEMS - THEORY 2 DURATION OF EXAMINATION: PERUSAL: 10 MINUTES WORKING: 2 HOURS EXAMINATION MATERIAL SUPPLIED BY THE UNIVERSITY: EXAMINATION BOOKLETS EXAMINATION MATERIAL SUPPLIED BY THE STUDENT: WRITING IMPLEMENTS NO CALCULATORS AVR REGISTERS AND INSTRUCTION SET INSTRUCTIONS TO STUDENTS: Students are prohibited from having mobile phones or any other device capable of communicating information (either verbal or written) in their possession during the examination NOTES MAY BE MADE QNLX ON THE EXAMINATION PAPER DURING PERUSAL TIME THREE (3) QUESTIONS ONLY ARE TO BE ATTEMPTED ALL QUESTIONS ARE OF EQUAL VALUE Queensland University of Technology GUT GUT GUT Gardens Point Kelvin Grove Carseldine QUESTION 1 (a) Draw a block diagram of a microcontroller system (RAM, ROM, ALU, 10, etc), and explain how it operates when processing data in control type (ie. input/output) applications. What are the main advantages and disadvantages of these embedded microcontroller type implementations, compared to using pure hardware systems implemented in devices such as PLD’s? ........ ..( 4 marks) (b) An ATMega16 microcontroller system has inputs A,B,C on PinC (bits 0,1,2 respectively of PortC) and outputs X,Y,Z on PortB (bits 0,1,2 respectively). Write an AER assembly language routine to implement the Boolean functions X=A YZAB Z=B+C (Assume constants PortB, PinC etc. have already been defined) ........ ..( 6 marks) (0) Show how you would set up a microprocessor system (l6-bit address bus, 8-bit data bus, R/Wbar, E) with the following devices. 1K byte RAM starting at address 0000b 1 Input Tri-State Buffers (8-bits ) at address 2000b 1 Output D Type Latch (S-bits ) at address 3000h 16K byte ROM starting at address COOOh The above devices do not need to be fully decoded (ie. can exist at other unused addresses). The ROM and RAM chips are enabled with active low inputs on their ChipSelect (CSbar) and OutputEnable (OEbar) lines. The input device (tri—state buffers) is enabled with a logic 0 on its OutputEnable input line. Data is clocked into the D type latches on the positive going edge of their clock input. Your hardware circuit should include the interconnection of all the relevant address lines, the R/Wbar line, and the E line. ........ ..( 8 marks) ((1) Explain how the Output Device (Latch) operates to get appropriate data from the data bus to the outside world. ........ ..( 2 marks) ENB244T2.082 contdl...) QUESTION 2 (a) With regard to the ATMegal6 microcontroller, briefly describe the main function and use of the Program Counter (PC), the Stack Pointer (SP), and the Condition Code Register. ........ ..( 3 marks) (b) Describe the difference between signed and unsigned 8-bit binary numbers, giving an example of each, and explaining how they are processed differently in assembly language. ......... ..( 2 marks) (0) Explain the main difference between Macros and Subroutines. Write a macro in AVR assembly language that will determine the magnitude of a signed 8-bit binary number. .*******$$$*$*** ; MACRO: Mag * .*************** a ; Determines the magnitude of an 8-bit signed number (e.g. mag Temp, r5) ;Pre : @0 2 Destination Register, @1 I Source Register ;Post : @0 I Magnitude of @l ......... ..( 4 .marks) ((1) Show how you would use the above macro to turn on an output LED (active high) on PBS if the magnitude of the signed number that is input on PinC > 7-bit unsingned number in r4. (Assume that Part3, DDR3 , PinC, DDRC, etc. have already been defined) ......... ..( 4 marks) (3) Write an assembly language subroutine GetMinAndMax to determine the min and max values in an array of 24, 8-bit signed hourly temperature readings stored in RAM. ; SUBROUTINE: GetMinAndMax ;**************************** ; Determines the max and average from an array 16 signed 8-bit numbers ;Pre: X (r27:r26) points to the first element in the array (array is stored in RAM) ;Post: Min (r18) = min number Max (r19) 2 max number MaxElementNum (r20) = Position in array (0.23) of first Max 9 5 ........ ..( 7 marks) ENB244T2.082 ( .... .. contd/.. .) QUESTION 3 (a) Describe with the aid of a block diagram how 8-bit data can be synchronously transferred in serial form between SP1 digital devices on the same circuit board. What are the advantages and disadvantages of this serial type data transfer, compared with the usual parallel data transfer. ....... ..( 4 marks) (b) Describe how UARTS operate to transmit data asynchronously between digital systems. Determine the bit pattern and time require to asynchronously transmit the string “A1” at 9600 Baud, with 1 stop bit and no parity. (Note: ‘0’ 2 30h, ‘A’ 2 41h) Show how you would transmit the above “A1” string in AVR assembly language, assuming that the UART-has already been initialised, and that a subroutine T xChar , that outputs the char in Temp, already exists. ....... ..( 5 marks) (0) Explain why status flags such as TxEmpty and RxFull are an important feature of a UART. Write the subroutines T xChar and RxChar, in AVR assembly language, that will transmit/receive an 8-bit character (in the Temp (r16) register) to/from the TxDataReg of the UART, after. waiting (if necessary) for the appropriate flag (TxEmpty/RxFull) to be set in the SerComsStatusReg. ....... ..( 4 marks) ((1) Draw a flowchart, and hence write some code, for a subroutine RxCommand, to receive a command char into Temp (r16), and a command number (0.9) into TempH (r17), from the UART. (Assume the routine RxChar that receives a char into Temp already exists). ; SUBROUTINE: RxCommrmd .************************* 9 ; This routine examines the incoming serial data from the UART for the Start of Command ; Identifier ‘A’. It then collects the following 2 chars (Command ID + Command Number) ; and expects the next char to be the End of Command Identifier ‘#’. ; Post: 7 Temp(r16) 2 Command Char TempH (r17) = Command Number (0..9) Carry = 0 if 2 valid char Command between the W and ‘#’ is valid, else Carry = 1 . 9 ; Example 1 : Rx : “.."RS#..” ; returns Temp = ‘R’, TempH = 5, C = 0 ; Example 2: Rx : “.."R54..” ; returns Temp = ‘R’, TempH = 5, C = 1 ; Example 3: Rx : “.."R#..” ; returns Temp = ‘R’, TempH = 5, C = 1 ........ ..( 7marks) ENB244T2.082 ( .... .. contdl...) QUESTION 4 (3) Briefly describe the OutputCompare and InputCapture features of the 16-bit Timer in the ATMegal6 system. ........ ..( 4 marks ) (b) Show how the OutputCompareA feature of Timerl can be used to produce a continuous stream of real-time interrupts at a frequency of 501—12 (i.e 20msecs imterrupts) while still allowing the Timer to count through the full 16-bit range at lMHz. (Assume that the ATMega16 is running with an SMHz E clock) ........ ..( 4 marks) (0) Describe, with the aid of a flow chart, the basic features of a real-time microprocessor system, that could be implemented using the continuous stream of 20msec interrupts generated in (b). Explain any advantages of such systems that incorporate real time interrupt driven processes (ie. background processes such as ReadADC, etc.) into microprocessor system software, so that there are both foreground and background tasks. ....... ..( 4 marks ) (d) The Input Capture feature on Timer 1 is to be used to measure the period (up to 50,000 microsecs) between positive going pulses occurring on PD6 (1C1). During the Timer 1 input capture interrupt routine (InputCapureISR) the system is to determine the period (in units of microsecs), place it into the 16—bit PulsePeriod (r6:67), and set the PeriodAvailableFlag (i.e.bit 1) in the SystemStatusFlagReg (r8). Assuming that the SystemStatus and PulsePeriod etc. have already declared in the main program write an InitPulsePeriodMeasurement subroutine in which, ICl is enabled to interrupt on the positive edges of pulses on PD6. Also write the InputCaptureISR.. Assume that the Timer Registers etc. have been given appropriate names such as TimerCounterl, EdgeControlRegister etc, and that the ATMega16 is running at a cycle time (E clock) of 8MHz. ........ ..( 8 marks ) END OF PAPER ENB244T2.082 ...
View Full Document

This note was uploaded on 11/03/2011 for the course EN 40 taught by Professor Mcgregor during the Three '10 term at Queensland Tech.

Page1 / 5

ENB244-T2-S2-2008 - GUT Surname Given Name/s III-II...

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

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