Program loop
Next program address=00h
1
2
3 4
N
1
2 3 4
Time slot
Loop Resolution Period = LRP
VCLK2
Loop Res.
clock
Instructions
High Res.
clock
...
...
N2HET Functional Description
794
SPNU503C – March 2018
Copyright © 2018, Texas Instruments Incorporated
High-End Timer (N2HET) Module
20.2.1.2 Program Loop Time
The program loop time is the sum of all cycles used for instruction execution. This time may vary from one
loop to another if the N2HET program includes conditionally executed instructions.
The timer program restarts on every resolution loop. The start address is fixed at N2HET RAM address
00h. The longest path through a program must fit within one loop resolution period to guarantee complete
accuracy.
The last instruction of a program must branch back to the fixed start address (next program address =
00h). When an N2HET program branches back to address 00h before the end of a loop resolution period,
the N2HET detects this and pauses instruction execution until the beginning of the next loop resolution
period.
The timing diagram in
illustrates the program flow execution.
Figure 20-3. Program Flow Timings
20.2.1.3 Instruction Execution Sequence
The execution of a N2HET program begins with the first occurrence of the loop resolution clock, after the
N2HET is turned on. At the first and subsequent occurrences of the loop resolution, the instruction at
location address 00h is prefetched. The program execution begins at the occurrence of the loop resolution
clock and continues executing the instructions until the program branches to 00h location. The instruction
is prefetched at location 00h and execution flag is reset. The N2HET pauses instruction execution until the
occurrence of the loop resolution clock and resumes normal execution.
N2HET programs must be written so that they complete execution and return to address 00h before the
occurrence of the next loop resolution clock. If the N2HET program exceeds this execution time limit, then
a program overflow condition occurs as described in
.
20.2.1.4 Program Overflow Condition
If the number of time slots used in a program loop exceeds the number available time slots in one loop
resolution, the timer sets the program overflow interrupt flag located in the HETEXC2 register. To maintain
synchronization of the I/Os, this condition should never be allowed to occur in a normal operation. The
HETEXC2.PRGMOVRFLFLAG flag provides a mechanism for checking that the condition does not occur
during the debug and validation phases.
As
illustrates, when a program overflow occurs, the currently executing N2HET program
sequence is interrupted and restarted at N2HETaddress 0 for the beginning of the next loop resolution
clock period. Also, HETEXC2.PRGMOVRFLFLAG is set.
If the instruction that caused the overflow (instruction at address 0xC in
) has any pin actions
selected, these pin actions will not be performed. However other actions of the instruction including
register and RAM updates will still be performed.