전자부품 데이터시트 검색엔진
  Korean  ▼
ALLDATASHEET.CO.KR

X  

STM8S 데이터시트(PDF) 169 Page - STMicroelectronics

부품명 STM8S
상세설명  STM8S Series and STM8AF Series 8-bit microcontrollers
PDF  467 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
제조업체  STMICROELECTRONICS [STMicroelectronics]
홈페이지  http://www.st.com
Logo STMICROELECTRONICS - STMicroelectronics

STM8S 데이터시트(HTML) 169 Page - STMicroelectronics

Back Button STM8S Datasheet HTML 165Page - STMicroelectronics STM8S Datasheet HTML 166Page - STMicroelectronics STM8S Datasheet HTML 167Page - STMicroelectronics STM8S Datasheet HTML 168Page - STMicroelectronics STM8S Datasheet HTML 169Page - STMicroelectronics STM8S Datasheet HTML 170Page - STMicroelectronics STM8S Datasheet HTML 171Page - STMicroelectronics STM8S Datasheet HTML 172Page - STMicroelectronics STM8S Datasheet HTML 173Page - STMicroelectronics Next Button
Zoom Inzoom in Zoom Outzoom out
 169 / 467 page
background image
DocID14587 Rev 14
169/467
RM0016
16-bit advanced control timer (TIM1)
261
17.5.3
Input capture mode
In input capture mode, the capture/compare registers (TIM1_CCRi) are used to latch the
value of the counter after a transition detected on the corresponding ICi signal. When a
capture occurs, the corresponding CCiIF flag (TIM1_SR1 register) is set.
An interrupt can be sent if it is enabled, by setting the CCiIE bits in the TIM1_IER register. If
a capture occurs while the CCiIF flag is already high, the over-capture flag CCiOF
(TIM1_SR2 register) is set. CCiIF can be cleared by software by writing it to 0 or by reading
the captured data stored in the TIMx_CCRiL registers. CCiOF is cleared by writing it to 0.
Procedure
The following procedure shows how to capture the counter value in TIM1_CCR1, for
example, when TI1 input rises.
1.
Select the active input: For example, to link the TIM1_CCR1 register to the TI1 input,
write the CC1S bits to 01 in the TIM1_CCMR1 register. This configures the channel in
input mode and the TIM1_CCR1 register becomes read-only.
2.
Program the required input filter duration for the signal to be connected to the timer.
This is done for each TIi input using the ICiF bits in the TIM1_CCMRi registers. For
example, if the input signal is unstable for up to five tMASTER cycles when it toggles, the
filter duration must be performed for longer than five clock cycles. The filter bits allow a
duration of eight cycles to be selected by writing them to 0011 in the TIMx_CCMR1
register. With this filter setting, a transition on TI1 is valid only when eight consecutive
samples with the new level have been detected (sampled at fMASTER frequency).
3.
Select the edge of the active transition on the TI1 channel by writing the CC1P bit to 0
in the TIM1_CCER1 register (rising edge in this case).
4.
Program the input prescaler. In this example, the capture needs to be performed at
each valid transition, so the prescaler is disabled (write the IC1PS bits to 00 in the
TIM1_CCMR1 register).
5.
Enable capture from the counter into the capture register by setting the CC1E bit in the
TIM1_CCER1 register.
6.
If needed, enable the related interrupt request by setting the CC1IE bit in the TIM1_IER
register.
When an input capture occurs:
The TIM1_CCR1 register gets the value of the counter on the active transition
The input capture flag (CC1IF) is set. The overcapture flag (CC1OF) is also set if at
least two consecutive captures occur while the flag remains uncleared.
An interrupt is generated depending on the CC1IE bit
To handle the overcapture event (CC1OF flag), it is recommended to read the data before
the overcapture flag. This avoids missing an overcapture which could occur after reading
the flag and before reading the data.
Note:
IC interrupts can be generated by software by setting the corresponding CCiG bits in the
TIM1_EGR register.



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100  ...More


데이터시트 다운로드

Go To PDF Page


링크 URL



ALLDATASHEET 가 귀하에 도움이 되셨나요?  [ DONATE ] 

Alldatasheet는?   |   광고문의   |   운영자에게 연락하기   |   개인정보취급방침   |   링크 투 데이터시트    |   링크교환   |   제조사별 검색
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
Russian : Alldatasheetru.com  |   Korean : Alldatasheet.co.kr  |   Spanish : Alldatasheet.es  |   French : Alldatasheet.fr  |   Italian : Alldatasheetit.com
Portuguese : Alldatasheetpt.com  |   Polish : Alldatasheet.pl  |   Vietnamese : Alldatasheet.vn
Indian : Alldatasheet.in  |   Mexican : Alldatasheet.com.mx  |   British : Alldatasheet.co.uk  |   New Zealand : Alldatasheet.co.nz
Family Site : ic2ic.com  |   icmetro.com