Instruction Set
957
SPNU503C – March 2018
Copyright © 2018, Texas Instruments Incorporated
High-End Timer (N2HET) Module
Table 20-93. Step Width Encoding for SCNT
P5
P4
Step Width (K)
0
0
8
0
1
16
1
0
32
1
1
64
gapstart
Defines the gap start angle, which SCNT writes to register A. The gap
start value has no effect on the SCNT instruction, but if the ACNT
instruction is being used, register A must contain the correct gap start
value. For a typical toothed wheel gear:
GAPSTART
= (
stepwidth
× (
actual teeth on gear
- 1)) + 1.
data
Specifies the 25-bit integer value serving as a counter.
Default: 0.
This instruction is incremented by the step value K on each timer resolution up to the previous period
value P(n-1) measured by APCNT (stored in register T). The resulting period of SCNT is: P(n - 1)/K
Due to stepping, the final count of SCNT will not usually exactly match the target p(n-1). SCNT
compensates for this error by starting each cycle with the remainder of the previous cycle.
When SCNT reaches the target p(n-1), the zero flag is set as an increment condition for ACNT.SCNT also
specifies a gap start angle, defining the start of a range in ACNT where period measurements in APCNT
are temporarily stopped to mask singularities in the external signal.
SCNT uses register A to store the gap start value. Gap start has no effect for SCNT.
Execution
SWF1 = P5;
SWF0 = P4;
Z = 0;
If (register T != 0000000h)
{
If (DCF == 1 OR ACF == 1)
{
Data Field register = 0000000h;
Counter value = 0000000h;
}
If (DCF == 0 AND ACF == 0)
{
Data Field register = Data field re Step Width;
}
If ((Data Field register - register T) >= 0)
{
Data field register = Data Field register - register T;
Z = 1;
}
Register A = Gap start value;
}
Jump to Next Program Address;