Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem 1: Answer the questions below completely. What are the default frequenci

ID: 2293985 • Letter: P

Question

Problem 1: Answer the questions below completely. What are the default frequencies for ACLK, MCLK and SMCLK on the MSP430F5529 after power up? What is the purpose of these various clock signals (i.e. What are they used for)? a. b. How does the CPU know where to go on an interrupt? How does it find the correct ISR? Explain the operation of a Timer in "up mode" (ie. What happens to the timer count? When is an interrupt triggered?) c. d. True or False: The operation of peripherals like the Timers or ADC12 causes a big drairn on CPU speed. Why or why not? True or False: Interrupt Service Routines (ISRs) should be kept short because the CPU will stop executing them after 255 instructions. e.

Explanation / Answer

a) Default frequencies

ACLK <---- XT1CLK (this is the external xrystal connected which is typically 32.768 KHz)

SMCLK <---- DCOCLKDIV (1.048575 MHz)

MCLK <---- DCOCLKDIV (1.048575 MHz)

Applications

ACLK -----> It is the low frequency crystal connected externally. it is used for various peripheral which requires accurate and slow clock such as RTC etc

SMCLK -----> It is generally a high frequency clock which is used for external peripheral modules such as ADC, Timer(ACLK can also be used but a clock is generally slow)

MCLK -----> Used as a clock source for CPU

b) Interrupt is occured in MCU from various souces such as timer adc etc.

ISR is the interrupt handler is which is the piece of code stored in the memory of MCU.

When the interrupt occurs

i) It completes its current intruction execution and stores the program counter into the stack

ii) it goes to the address of the respective interrupt source

iii) Now the address of the ISR is fetched from the memory location of the respective interrupt vector.

iv) it goes to the address, executes the ISR and then comes back to the main program after fetching the program counter from Stack

c) Timer Up Mode:

In this mode, the timer repeatedly counts from zero to the value of TAxCCR0. then it rolls over from TAxCCR0 to zero hence the timer runs for (TAxCCRO+1) counts. This mode is mainly used when we want to vary the frequency (timer will count upto the value of TAxCCR0). When the timer count reaches to the top (i.e. TAxCCR0) it becomes zero and TAxCCR0 CCIFG interrupt is generated if Interrupts are enabled. If the ISR has been written for it then Interrupt service routine execution happens. (flag is also set in case you want to handle it manually)

d) False :

External peripherals on the microcontroller is present so that the cpu can be used to do important tasks. Using these external peripherals will only reduce the load on CPU as the CPU assigns certains tasks to it and keep doing what it want to do

e) False :

ISR is just another function which is executed on occurance of respective interrupts. we must only take care to disable the global interrupt while executing the ISR as it may result in unexpected behaviour. Nesting of interrupt may be done by expereinced programmers only