Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem 1: HCS12 Timer Set Up. Assume an HCS12 microprocessor has a bus clock speed (fclk) of 16MHz. It is desired to generate a periodic
Problem 1: HCS12 Timer Set Up.
Assume an HCS12 microprocessor has a bus clock speed (fclk) of 16MHz. It is desired to generate a periodic output compare that repeats at an interval of 50Hz(see figure below). In terms of timing error, the accuracy of the output compare must be at least 99%. Answer the following questions. Show your work.
a. Determine the maximum value of TC that can support the 50Hz period with 99% accuracy. Show all work.
b. Provide the maximum prescale values to satisfy the above constraint.
c. Assume is 8 selected as the prescale value, determine whether this value meets the constraints determined in part a.
d. write a small section of code to set the prescale values.
Question 2. (20 points [8 + 4 + 4 + 4])
(a) Describe the 6 steps that result in the execution of the Interrupt Service Routine after IRQ is asserted. Draw Stack growth wherever necessary.
Step 1:
Step 2:
Step 3:
Step 4:
Step 5:
Step 6:
(b) What are the 3 conditions that needs to be fulfilled for IRQ to be asserted? Explain with the help of AND gate circuit.
(c) What is the difference between JSR and SWI?
(d) What is the purpose of I flag, when it is set and when it is cleared? Explain your answer with the help of examples?
3. Interrupt Sequence and Interrupt Handling (20 points)
a. Describe an advantage of using interrupts over polling. (3 points)
b. Assume an interrupt occurs on Port J, pin 7. Describe the sequence of steps that occurs on an HCS12 to initiate execution of the ISR once a valid IRQ on port J pin 7 is signaled (7 points)?
c. Assume an interrupt occurs on Port J, pin 7. Describe the sequence of steps that allows the HCS12 to return from the ISR to the main program with global interrupts enabled. (7 points)
d. Describe why global interrupts should not be enabled in an ISR. (3 points)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started