Hardware Reference
In-Depth Information
E6.9 Suppose that the OSCCLK clock frequency is 5 MHz. Compute the COP watchdog timer
timeout period for all the possible combinations of the CR2, CR1, and CR0 bits in the COPCTL
register.
E6.10 Assume that the interrupt vector for the timer overfl ow is $3000. Write the assembler
directives to initialize its vector table entry on a demo board with the D-Bug12 monitor.
E6.11 Write an instruction sequence to clear the X and I bits in the CCR. Write an instruction
sequence to set the S, X, and I bits in the CCR.
E6.12 Why does the HCS12 need to be reset when the power supply is too low?
E6.13 Write an instruction sequence to prevent the COP timer from timing out and resetting
the microcomputer.
E6.14 Suppose you want to generate a 25-MHz E-clock; propose a set of values for the SYNR
and REFDV registers to achieve this goal using a 5-MHz crystal oscillator and the PLL
circuit.
E6.15 Suppose you want to generate a 24-MHz E-clock; propose a set of values for the SYNR
and REFDV registers to achieve this goal using a 3-MHz crystal oscillator and the PLL
circuit.
E6.16 Suppose you want to generate a 20-MHz E-clock; propose a set of values for the SYNR
and REFDV registers to achieve this goal using a 4-MHz crystal oscillator and the PLL
circuit.
E6.17 Suppose you want to generate a 24-MHz E-clock; propose a set of values for the SYNR
and REFDV registers to achieve this goal using a 6-MHz crystal oscillator and the PLL
circuit.
E6.18 Set up the interrupt vectors for the enhanced capture timer Ch1, enhanced capture timer
Ch0, RTI, and IRQ to work with the CodeWarrior IDE by modifying the vectors.c fi le given in
Example 6.5.
E6.19 Write a program to drive the LED circuit in Figure 4.16 and display one LED at a time
from the one driven by pin 7 toward the one driven by pin 0 and then reverse. Repeat this
operation forever. Each LED is lighted for about 400 ms assuming that the HCS12 uses an
8-MHz crystal oscillator to generate a system clock. Use the RTI to trigger the change of the
LED light patterns. It may take several RTIs to trigger one change of the LED pattern for this
problem.
E6.20 Write a program to generate a periodic square waveform that is about 500 Hz (roughly)
using the PT0 pin and the RTI.
6.14 Lab Exercises and Assignments
L6.1 IRQ input interrupt experiment. Use the 555 timer (or take the signal from a function
generator) to generate a digital waveform with frequency equal to approximately 1 Hz. The
circuit connection of the 555 timer is illustrated in Figure L6.1. Connect the 555 timer output
(pin 3) to the IRQ pin. The IRQ interrupt service routine would output the message “Interrupt k.”
Enter the program (both assembly and C) to a fi le, assemble or compile, and download the S-
record fi le onto the demo board for execution.
L6.2 Simple interrupts. Connect the IRQ pin of the demo board to a debounced switch that can
generate a negative-going pulse. Write a main program and an IRQ interrupt service routine.
The main program initializes the variable irq_cnt to 10, stays in a loop, and keeps checking the
value of irq_cnt. When irq_cnt is decremented to 0, the main program jumps back to monitor.
The IRQ service routine simply decrements irq_cnt by 1 and returns.
 
Search WWH ::




Custom Search