Rev. 1.00
��
��ne ��� �01�
Rev. 1.00
�9
��ne ��� �01�
HT66FM5440
Brushless DC Motor A/D Flash MCU
HT66FM5440
Brushless DC Motor A/D Flash MCU
Capture Input Mode
To select this mode bits PTnM1 and PTnM0 in the PTMnC1 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 TPn_0 or TCKn pin which is selected using the PTnCAPTS bit in the
PTMnC1 register. The input pin 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 PTnIO1 and PTnIO0 bits in
the PTMnC1 register. The counter is started when the PTnON bit changes from low to high which is
initiated using the application program.
The PTnIO1 and PTnIO0 bits decide which active edge transition type to be latched and to generate
an interrupt. The PTnTCLR1 and PTnTCLR0 bits decide the condition that the counter reset back to
zero. The present counter value latched into CCRA or CCRB is decided by both PTnIO1~PTnIO0
and PTnTCLR1~PTnTCLR0 setting. The PTnIO1~PTnIO0 and PTnTCLR1~PTnTCLR0 bits are
setup independently on each other.
When the required edge transition appears on the TPn_0 or TCKn pin the present value in the
counter will be latched into the CCRA or CCRB registers and a PTMn interrupt generated.
Irrespective of what events occur on the TPn_0 or TCKn pin, the counter will continue to free run
until the PTnON 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 PTMn 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 PTnIO1 and PTnIO0 bits can select the active trigger edge
on the TPn_0 or TCKn pin to be a rising edge, falling edge or both edge types. If the PTnIO1 and
PTnIO0 bits are both set high, then no capture operation will take place irrespective of what happens
on the TPn_0 or TCKn pin, however it must be noted that the counter will continue to run.
If the capture pulse width is less than two timer clock cycles, it may be ignored by hardware. The
timer clock source must be equal to or less than 50MHz, otherwise the counter may fail to count.
As the TPn_0 or TCKn pin is pin shared with other functions, care must be taken if the PTMn is in
the Capture Input Mode. This is because if the pin is setup as an output, then any transitions on this
pin may cause an input capture operation to be executed. The PTnCCLR, PTnOC and PTnPOL bits
are not used in this Mode.