1. The HCS12 has several interrupt sources, almost all of which can be controlle
ID: 2081523 • Letter: 1
Question
1. The HCS12 has several interrupt sources, almost all of which can be controlled via the I flag in the condition-code register.
a. Is the I flag active-high or active-low? That is, which state of the I flag indicates that interrupts are enabled?
b. Which instruction makes the interrupt flag active (enables interrupts)?
2. Watch the Podcast about digital interfacing, and answer the following short questions.
a. An HCS12 uses 5 Volts and is driving an LED. When the LED is on, it has a forward voltage of 1.8 Volts and draws 18 mA. What size current-limit resistor is needed?
b. What part turns on and off inside a relay in order to operate the switch?
c. Name an example of a chip or device that has enough drive strength to operate a relay that requires 100 mA of coil current.
d. Name an example of a device that protects circuits from too much current.
Explanation / Answer
In the Interrupt service method, the microcontroller uses the condition-code register as the I(interrupt) flag. When an interrupt occurs the sensors generates/triggers an interrupt request. The microcontroller put on hold the current instruction and services the interrupt request by running the Interrupt Service Routine (ISR). Interrupts can have priorities and it is of two types: 1. Maskable and 2. Non-maskable. Maskable intrrupts can be ignored by the microcontroller.
a) Active-high or active-low shows the status of the flag register. Active-high means the flag is set to '1' and Active -low means the flag is reset to '0'. So, the state of Active-low i.e I Flag = '0' indicates that the interrupts are enabled. That means the microcontroller is ready to take on interrupts. Active-high i.e I Flag = '1' indicates the interrupts are disabled which blocks the occurance of any further interrupts while the microcontroller is processing the current interrupt.
b) The instructions that enable and disable the I Flags are:
SEI - Set the I Flag = it disables the interrupt CLI - Clear the I Flag = it enables the interrupt. The RTI instruction pulls the Condition-code register out off the stack, that reset or clear the I Flag.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.