{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

ENB244-T2-S2-2007 - III-I — Examination Paper SEMESTER...

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 Document Right 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 Document Right 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: III-I... — Examination Paper SEMESTER: SECOND SEMESTER EXAMINATIONS 2007 UNIT: ENB244 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 ATMEGA‘IS INSTRUCTION SET AND REGISTER DATA 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 Kelvin Grove our 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 (i.e. input/output) applications. What are the main advantages and disadvantages of these embedded microprocessor type implementations, compared to pure hardware systems that could be implemented in PLD’s? ( 4 marks) (b) A ATMega16 microcontroller system has inputs on PinC (active high) and outputs on PortB (active high). Write an AVR assembly language routine to implement the Boolean function PBO : (PCO AND PCl) OR (PC2 AND PC3) where PEG 2 Output on bitO of PortB, at address $18 (DDRB is at address $17) PCn I Input bitn on PinC, at address $13 (DDRC is at address $14). Hence estimate the execution time of your processing routine if the ATMegal6 runs at SMHz (ie. cycle time 2 1/8 nSec), assuming that all instructions take 1 cycles. Compare this time with that of a hardware type solution in which each gate delay is 10 nSec (draw the hardware implementation) ( 6 marks) (c) Show how you would set up a microprocessor system ( 16-bit address bus, 8-bit data bus, R/~W, E) with the following devices. 4K byte RAM starting at address lOOOh 1 Input Tri-State Buffers (8-bits ) at address 2000b 1 Output D Type Latch (8—bits ) at address 3000h 32K byte ROM starting at address 8000b 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 negative going edge of their clock input. Your hardware circuit should include the interconnection of all the relevant address lines, the R/lW line, and the E line. ( 10 marks) ENB244T2.072 contf. . .. QUESTION 2 (a) With regard to the ATMegal6 microcontroller, briefly describe the main functions of the registers (r0 to r31), the Program Counter (PC), and the StackPointer (SP). ( 4 marks) (b) Write a macro in AVR assembly language that will reverse the order of the bits in register In (Where n is 2 to 15). Assume that the Temp (r16) can be used, if necessary. ; MACRO: ReverseBitOrder .******$$************** 3 ; Reverses the order of the hints in register n, where n = 2 to 15 ;P1‘6 I m : B7BfiBsB4B3BzBlB0 ;Post : rn I BOB 1B2B3B4BsB6B7 Show how you would use the macro to reverse the order of the bits in r5. ( 5 marks) (c) Describe the difference between signed and unsigned binary numbers, giving an example of each, with 8-bits and 16-bits. Draw a flow chart to Show how an 8-bit signed number in Temp (r16) could be converted to a 16—bit signed number in TempH2TempL (r17:r16).. ( 3 marks) (d) Write an assembly language subroutine GetMaxAndAverage to determine the max and average values in an array of 16, 8-bit unsigned binary numbers. ; SUBROUTINE: GetMaxAndAverage -*********$******$************** I ; Determines the max and average from an array 16 unsigned 8—bit numbers gPre: X (r272r26) points to the first element in the array (array is stored in RAM) ;Post: Max (r5) = max number ; Average (r6) = average value of all 16 elements. ( 8 marks) ENBZ44T2.072 cont/ . . .. QUESTION 3 (a) Describe with the aid of block diagrams how 8-bit data can be synchronously transferred in serial form between digital devices. ( 3 marks) (b) Describe, with the aid of block diagram and waveforms, how UARTS operate to transmit data asynchronously between digital systems. Determine the bit pattern & time require to asynchronously transmit the char ‘B’ at 9600 Baud, with 1 stop bit and no parity. (Note: ‘0’ I 30h, ‘A’ : 41h) ( 5 marks) (c) Write a subroutine TxChar in AVR assembly language that will transmit the 8-bit character in the Temp (r16) register to the TxDataReg of the UART after waiting (if necessary) for the TxEmpty flag to be set in the SerComsStatusReg. ( assume that the UART has already been initialised) ; SUBROUTINE: T xChar .******************$** ’ ; Transmits the 8-bit number in Temp (r16), waiting if necessary for the TX to be emptied. ; Pre: Temp (r16) = 8~bit number: ; Post: 8-bit number in Temp is Tx through the UART ( 3 marks) (d) Draw a flowchart, and write a subroutine TxUpT03Dec in HCll assembly language, to transmit the 8—bit binary number in the Temp(r16) Register as l to 3 decimal characters (‘0’, ‘1 ’,->’255’), assuming that the subroutine TxChar described in (0) already exists. ; SUBROUTINE: TxUpTo3Dec .**************$********** 5 ; Transmits the 8-bit number in Temp as a decimal number (0 ->255), suppressing any leading zeroes. ; Pre: Temp(r16) = 8-bit number: ; Post: Number is Tx through the UART, in Decimal ( 9marks) ENBZ44T2.072 cont/ . . .. QUESTION 4 (a) Briefly describe the OutputCompare and InputCapture features of the 16-bit Timer in the ATMegal 6 system. (4 marks ) (b) Describe how the ClearTimerOnCompare (CTC) feature of Timerl can be used to produce a continuous stream of real-time interrupts at a frequency of lOOHZ. ( 4 marks) (0) An ATMegal6 microcontroller system is to be used control the temperature of a tank of fluid from 2000 to 100°C. The temperature transducer produces an output of approx 40mVolts/OC (0Volts = 000, 4Volts 210000 and is feed into Channel 0 ofthe ADC whose resolution is 2bits/O C. The microcontroller has an output on portB (bit 0) that turns the tank heater ON and OFF.to control the temperature When the system is initially turned ON it assumes that the setpoint temperature is to be 800C, with hi and low points at 820C} and 7800, and operates accordingly. When the temperature falls below the low point the heater is turned ON, and when it rises above the high point the heater is turned OFF. The processor sends the actual temperature and setpoint to the computer (PC) along the serial line via the UART every second. If the temperature gets out of range a LED on P131 is to toggle every 1 second. If the operator wants to change the setpoint temperature he can transmit a new setpoint to the system via the UART. The high and low points are always iZOC from the setpoint. Design the software for the ATMega16 system, using flowcharts, and implement the more important sections of the code in assembly language. Assume a suitable serial communications module already exists with suitable subroutines such as InitSerComms, TxChar, Tx3Dec, LookChar, RxChar, Rx3Dec etc. ( 12 marks) END OF PAPER ENB244T2.072 ...
View Full Document

{[ snackBarMessage ]}