Renesas M16C/26A Bedienungsanleitung Seite 3

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 9
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 2
M16C/2
6
Using the M16C/26 Timers in Timer Mod
e
REU05B0046-0100Z June 2003
Page 3 of 8
3.0 Timer Mode Description
In Timer Mode, the counter register counts down using the selected clock source until the counter underflows
(0000 to FFFFh). At this point, the value in the reload register is copied into the counter and countdown continues.
At the same time, the timer interrupt request bit is set and an interrupt is generated if the timer interrupt priority
level is set above the current CPU priority level and the I flag is set. If at any time during countdown the count
start flag is cleared, counting is suspended until the start flag is set. Figure 3 illustrates this operation.
Figure 3 Operation Timing of Timer Mode
4.0 Configuring Timer Mode
The steps to configure a timer A for Timer Mode are shown below. The steps are similar when setting timer B.
1. Load the TAi register (which also loads the reload register) with the count source
2. Load the timer mode register, TAiMR
Select timer mode: bits TMOD0, TMOD1 = 0.
Select the clock source (f1, f/8, f/32, or fc/32): bits TCK0, TCK1
3. Load the timer ‘interrupt priority level’, TAiIC with a value of at least 1
4. Ensure interrupts are enabled (CPU I flag set)
5. Set the ‘start count’ flag bit, TAiS in the ‘count start flag’ register, TABSR
It is not necessary to perform these steps in the order listed, however, the count register should be loaded before
the ‘start count’ flag is set. Also, the priority level should not be modified when there is a possibility of an interrupt
occurring.
Seitenansicht 2
1 2 3 4 5 6 7 8 9

Kommentare zu diesen Handbüchern

Keine Kommentare