Rev. 1.71
82
April 11, 2017
Rev. 1.71
83
April 11, 2017
HT66F002/HT66F0025/HT66F003/HT66F004
Cost-Effective A/D Flash MCU with EEPROM
HT66F002/HT66F0025/HT66F003/HT66F004
Cost-Effective A/D Flash MCU with EEPROM
Capture Input Mode
To select this mode bits ST0M1 and ST0M0 in the STM0C1 register should be set to 01 respectively.
This mode enables external signals to capture and store the present value of the internal counter
and can therefore be used for applications such as pulse width measurements. The external signal is
supplied on the STP0I, whose active edge can be either a rising edge, a falling edge or both rising
and falling edges; the active edge transition type is selected using the ST0IO1 and ST0IO0 bits in
the STM0C1 register. The counter is started when the ST0ON bit changes from low to high which is
initiated using the application program.
When the required edge transition appears on the STP0I the present value in the counter will be
latched into the CCRA registers and a STM interrupt generated. Irrespective of what events occur on
the STP0I the counter will continue to free run until the ST0ON bit changes from high to low. When
a CCRP compare match occurs the counter will reset back to zero; in this way the CCRP value can be
used to control the maximum counter value. When a CCRP compare match occurs from Comparator
P, a STM interrupt will also be generated. Counting the number of overflow interrupt signals from
the CCRP can be a useful method in measuring long pulse widths. The ST0IO1 and ST0IO0 bits can
select the active trigger edge on the STP0I to be a rising edge, falling edge or both edge types. If the
ST
0IO1 and ST0IO0 bits are both set high, then no capture operation will take place irrespective of
what happens on the STP0I, however it must be noted that the counter will continue to run.
The ST0CCLR and ST0DPX bits are not used in this Mode.
Counter Value
YY
CCRP
ST0ON
ST0PAU
CCRP Int. Flag
STMP0F
CCRA Int. Flag
STMA0F
CCRA
Value
Time
Counter cleared
by CCRP
Pause
Resume
Counter
Reset
ST0M [1:0] = 01
STM capture pin
STP0I
XX
Counter
Stop
ST0IO [1:0]
Value
XX
YY
XX
YY
Active
edge
Active
edge
Active edge
00
–
Rising edge
01
–
Falling edge 10
–
Both edges
11
–
Disable Capture
Capture Input Mode
Note: 1. ST0M[1:0] = 01 and active edge set by the ST0IO[1:0] bits
2. A TM Capture input pin active edge transfers the counter value to CCRA
3. The S
T
0CCLR and S
T
0DPX bits are not used
4. No output function –
ST
0OC and
ST
0POL bits are not used
5. CCRP determines the counter value and the counter has a maximum count value when
CCRP is equal to zero.