STM32F1 TIM1 & TIM8

Started by tha, November 21, 2020, 08:18:38 AM

Previous topic - Next topic

tha



Bit 15 Reserved, must be kept at reset value.

Bit 14 OIS4: Output Idle state 4 (OC4 output)
     อ้างอิงถึง OIS1 bit

Bit 13 OIS3N: Output Idle state 3 (OC3N output)
     refer to OIS1N bit

Bit 12 OIS3: Output Idle state 3 (OC3 output)
     refer to OIS1 bit

Bit 11 OIS2N: Output Idle state 2 (OC2N output)
     refer to OIS1N bit

Bit 10 OIS2: Output Idle state 2 (OC2 output)
     refer to OIS1 bit

Bit 9 OIS1N: Output Idle state 1 (OC1N output)
     0: OC1N=0 หลังจาก a dead-time เมื่อ MOE=0
     1: OC1N=1 หลังจาก a dead-time เมื่อ MOE=0
Note: บิตนี้ไม่สามารถถูกแก้ไขตราบเท่าที่ LOCK level 1, 2 หรือ 3 ถูกโปรแกรมแล้ว (LOCK bits ใน TIMx_BDTR register).

Bit 8 OIS1: Output Idle state 1 (OC1 output)
     0: OC1=0 (หลังจาก a dead-time ถ้า OC1N ถูกใช้งาน) เมื่อ MOE=0
     1: OC1=1 (หลังจาก a dead-time ถ้า OC1N ถูกใช้งาน) เมื่อ MOE=0
Note: บิตนี้ไม่สามารถถูกแก้ไขตราบเท่าที่ LOCK level 1, 2 หรือ 3 ถูกโปรแกรมแล้ว (LOCK bits ใน TIMx_BDTR register).

Bit 7 TI1S: TI1 selection
     0: The TIMx_CH1 pin ถูกต่อถึง TI1 input
     1: The TIMx_CH1, CH2 and CH3 pins ถูกต่อถึง the TI1 input (XOR combination)
ดู Section 14.3.18: Interfacing with Hall sensors ด้วย

Bits 6:4 MMS[2:0]: Master mode selection
บิตเหล่านี้ยอมให้เลือก the information ถูกส่งใน master mode ไปยัง slave timers สำหรับ synchronization (TRGO). The combination เป็นดังต่อไปนี้ :
     000: Reset - the UG bit จาก the TIMx_EGR register ถูกใช้เป็น trigger output (TRGO). ถ้า the reset ถูกสร้างโดย the
             trigger input (slave mode controller กำหนดค่าใน reset mode) จากนั้น the signal บน TRGO จะถูก delayed เปรียบ
             เทียบกับ the actual reset.
     001: Enable - the Counter enable signal, CNT_EN, ถูกใช้เป็น trigger output (TRGO). มันมีประโยชน์ในการเริ่ม timers
             หลายตัวในเวลาเดียวกันหรือเพื่อควบคุม a window ที่ซึ่ง a slave timer ถูก enabled. The Counter Enable signal ถูก
             สร้างโดย a logic OR ระหว่าง CEN control bit และ the trigger input เมื่อกำหนดค่าใน gated mode. เมื่อ the Counter
             Enable signal ถูกควบคุมโดย the trigger input, มี a delay บน TRGO, ยกเว้นถ้าf the master/slave mode ถูกเลือก
             (ดู the MSM bit description ใน TIMx_SMCR register).
     010: Update - The update event ถูกเลือกเป็น trigger output (TRGO). ตัวอย่างเช่น a master timer สามารถจากนั้นถูกใช้
             เป็น a prescaler สำหรับ a slave timer.
     011: Compare Pulse - The trigger output ส่ง a positive pulse เมื่อ the CC1IF flag ถูกเซ็ต (แม้ว่ามันเป็น high อยู่แล้ว),
             ทันทีที่ a capture หรือ a compare match เกิดขึ้น. (TRGO)
     100: Compare - OC1REF signal ถูกใช้เป็น trigger output (TRGO)
     101: Compare - OC2REF signal is used as trigger output (TRGO)
     110: Compare - OC3REF signal is used as trigger output (TRGO)
     111: Compare - OC4REF signal is used as trigger output (TRGO)
Note: The clock ของ the slave timer และ ADC ต้องถูก enabled ก่อนที่จะรับ events จาก the master timer, และต้อง
          ไม่ถูกเปลี่ยนกลางอากาศขณะที่ triggers ถูกได้รับจาก the master timer.

Bit 3 CCDS: Capture/compare DMA selection
     0: CCx DMA request ส่งเมื่อ CCx event เกิดขึ้น
     1: CCx DMA requests ส่งเมื่อ update event เกิดขึ้น

Bit 2 CCUS: Capture/compare control update selection
     0: เมื่อ capture/compare control bits ถูกโหลดไว้ก่อนมันถูกอัปเดตโดยการเซ็ต the COMG bit เท่านั้น
     1: เมื่อ capture/compare control bits ถูกโหลดไว้ก่อน (CCPC=1), มันถูกอัปเดตโดยการเซ็ต the COMG bit หรือเมื่อ an
         rising edge เ้นกิดขึนบน TRGI
Note: บิตนี้ทำงานเพียงบน channels ที่มี a complementary output.

Bit 1 Reserved, must be kept at reset value.

Bit 0 CCPC: Capture/compare preloaded control
     0: CCxE, CCxNE and OCxM bits ไม่ถูก preloaded
     1: CCxE, CCxNE and OCxM bits ถูก preloaded, หลังจากเขียนแล้ว, มันจะอัปเดตเพียงเมื่อ a commutation event (COM)
         เกิดขึ้น (COMG bit เซ็ตหรือ rising edge ถูกตรวจพบบน TRGI, ขึ้นอยู่กับ the CCUS bit).
Note: บิตนี้ทำงานเพียงบน channels ที่มี a complementary output.

tha



Bit 15 ETP: External trigger polarity
บิตนี้เลือกว่า ETR หรือ ETR(inverted) ถูกใช้สำหรับ trigger operations
     0: ETR เป็น non-inverted, active ที่ high level หรือ rising edge
     1: ETR เป็น inverted, active ที่ low level หรือ falling edge

Bit 14 ECE: External clock enable
บิตนี้เปิดการใช้งาน External clock mode 2.
     0: External clock mode 2 ถูกปิดการใช้งาน
     1: External clock mode 2 ถูกเปิดการใช้งาน . The counter ถูก clocked โดย active edge ใดๆบน the ETRF signal.

1: การเซ็ต the ECE bit มีผลเดียวกันกับการเลือก external clock mode 1 ด้วย TRGI ถูกต่อกับ ETRF (SMS=111 และ TS=111).
2: เป็นไปได้ที่จะใช้ external clock mode 2 พร้อมด้วย the following slave modes: reset mode, gated mode และ trigger
    mode. อย่างไรก็ตาม, TRGI ต้องไม่ถูกต่อถึง ETRF ในกรณีนี้ (TS bits ต้องไม่เป็น 111).
3: ถ้า external clock mode 1 และ external clock mode 2 ถูกเปิดการใช้งานในเวลาเดียวกัน, the external clock input คือ
    ETRF.

Bits 13:12 ETPS: External trigger prescaler
External trigger signal ETRP frequency ต้องไม่เกิน 1/4 ของ CK_INT frequency. A prescaler สามารถถูกเปิดการใช้งานเพื่อลด ETRP frequency. มันมีประโยชน์เมื่อมีการป้อนเข้า fast external clocks.
     00: Prescaler OFF
     01: ETRP frequency ถูกหารโดย 2
     10: ETRP frequency divided by 4
     11: ETRP frequency divided by 8

Bits 11:8 ETF[3:0]: External trigger filter
bit-field นี้จะกำหนด the frequency ที่ใช้เพื่อสุ่ม ETRP signal และความยาวของ digital filter ที่ใช้กับ ETRP. The digital filter ถูกทำจาก an event counter ที่ซึ่ง N consecutive events ถูกต้องการเพื่อทำให้ถูกต้อง a transition บน the output:
     0000: No filter, การสุ่มถูกทำที่ fDTS
     0001: fSAMPLING=fCK_INT, N=2
     0010: fSAMPLING=fCK_INT, N=4
     0011: fSAMPLING=fCK_INT, N=8²
     0100: fSAMPLING=fDTS/2, N=6
     0101: fSAMPLING=fDTS/2, N=8
     0110: fSAMPLING=fDTS/4, N=6²
     0111: fSAMPLING=fDTS/4, N=8
     1000: fSAMPLING=fDTS/8, N=6
     1001: fSAMPLING=fDTS/8, N=8
     1010: fSAMPLING=fDTS/16, N=5
     1011: fSAMPLING=fDTS/16, N=6
     1100: fSAMPLING=fDTS/16, N=8
     1101: fSAMPLING=fDTS/32, N=5
     1110: fSAMPLING=fDTS/32, N=6
     1111: fSAMPLING=fDTS/32, N=8

Bit 7 MSM: Master/Slave mode
     0: No action
     1: The effect ของ an event บน the trigger input (TRGI) ถูก delayed เพื่อยอมให้ a perfect synchronization ระหว่าง
         the current timer และ slaves ของมัน (ผ่านทาง TRGO). มันมีประโยชน์ถ้าเราต้องการ synchronize หลายๆ timers บน a
         single external event.

Bits 6:4 TS: Trigger selection
bit-field นี้เลือก the trigger input ถูกใช้เพื่อประสานพร้อมกัน the counter.
     000: Internal Trigger 0 (ITR0).
     001: Internal Trigger 1 (ITR1).
     010: Internal Trigger 2 (ITR2).
     011: Internal Trigger 3 (ITR3).
     100: TI1 Edge Detector (TI1F_ED)
     101: Filtered Timer Input 1 (TI1FP1)
     110: Filtered Timer Input 2 (TI2FP2)
     111: External Trigger input (ETRF)
ดู Table 86: TIMx Internal trigger connection สำหรับรายละเอียดที่มากขึ้นบน ITRx ความหมายสำหรับแต่ละ Timer.
Note: บิตเหล่านี้ต้องถูกเปลี่ยนได้เพียงเมื่อมันไม่ถูกใช้ (ตัวอย่างเข่นเมื่อ SMS=000) เพื่อหลีกเลี่ยง wrong edge detections ที่
            the transition

Bit 3 Reserved, must be kept at reset value.

Bits 2:0 SMS: Slave mode selection
เมื่อ external signals ถูกเลือก the active edge ของ the trigger signal (TRGI) ถูกเชื่อมโยงถึง the polarity เลือกบน the external input (ดู Input Control register and Control Register
description.
     000: Slave mode ถูกปิดการใช้งาน - ถ้า CEN = '1 จากนั้น the prescaler ถูก clocked โดยตรงโดย the internal clock.
     001: Encoder mode 1 - Counter นับขึ้น/ลงบน TI2FP1 edge ขึ้นอยู่กับ TI1FP2 level.
     010: Encoder mode 2 - Counter นับขึ้น/ลงบน TI1FP2 edge ขึ้นอยู่กับ TI2FP1 level.
     011: Encoder mode 3 - Counter นับขึ้น/ลงบนทั้ง TI1FP1 และ TI2FP2 edges ขึ้นอยู่กับ the level ของ the other input.
     100: Reset Mode - Rising edge ของ the selected trigger input (TRGI) เริ่มต้นใหม่ the counter และสร้าง an update
             ของ the registers.
     101: Gated Mode - The counter clock ถูก enabled เมื่อ the trigger input (TRGI) เป็น high. The counter หยุด (แต่ไม่
             ถูก reset) ทันทีที่ the trigger กลายมาเป็น low. ทั้ง start และ stop ของ the counter ถูกควบคุม.
     110: Trigger Mode - The counter เริ่มที่ a rising edge ของ the trigger TRGI (แต่ไม่ถูก reset). มีเพียง the start ของ
             the counter เท่านั้นที่ถูกควบคุม.
     111: External Clock Mode 1 - Rising edges ของ the selected trigger (TRGI) ให้สัญญาณนาฬิกา the counter.

Note: The gated mode ต้องไม่ถูกใช้ถ้า TI1F_ED ถูกเลือกเป็น the trigger input (TS=100). อันที่จริง, TI1F_ED
             outputs 1 พัลส์สำหรับแต่ละ transition บน TI1F, ในขณะที่ the gated mode
             ตรวจเช็ค the level ของ the trigger signal.

             The clock ของ the slave timer ต้องถูก enabled ก่อนเพื่อรับ events จาก the master timer, และต้องไม่ถูกเปลี่ยนกลาง
             อากาศขณะที่ triggers ถูกได้รับจาก the master timer.


1. เมื่อ a timer ไม่ถูกแสดงใน the product, the corresponding trigger ITRx ก็ไม่มีให้ใช้งาน

tha



tha



Bit 15:13 Reserved, must be kept at reset value.

Bit 12 CC4OF: Capture/Compare 4 overcapture flag
อ้างอิงถึง CC1OF description

Bit 11 CC3OF: Capture/Compare 3 overcapture flag
refer to CC1OF description

Bit 10 CC2OF: Capture/compare 2 overcapture flag
refer to CC1OF description

Bit 9 CC1OF: Capture/Compare 1 overcapture flag
flag นี้ถูกเซ็ตโดย hardware เพียงเมื่อ the corresponding channel ถูกกำหนดค่าใน input capture mode. มันถูกเคลียร์โดย software โดยการเขียนมันเป็น '0'.
     0: ไม่มี overcapture ถูกตรวจจับแล้ว.
     1: The counter value ถูก captured แล้วใน TIMx_CCR1 register ขณะที่ CC1IF flag ถูกเซ็ตอยู่

Bit 8 Reserved, must be kept at reset value.

Bit 7 BIF: Break interrupt flag
flag นี้ถูกเซ็ตโดย hardware ทันทีที่ the break input ไปเป็น active. มันสามารถถูกเคลียร์โดย software ถ้า the break input ไม่ active.
     0: ไม่มี break event เกิดขึ้น.
     1: An active level ถูกตรวจพบบน the break input.

Bit 6 TIF: Trigger interrupt flag
flag นี้ถูกเซ็ตโดย hardware บน trigger event (active edge ถูกตรวจจับได้บน TRGI input เมื่อ the slave mode controller ถูก enabled ในทุก modes แต่ gated mode, ทั้งสอง edges ในกรณีที่ gated mode ถูกเลือก). มันถูกเคลียร์โดย software.
     0: ไม่มี trigger event เกิดขึ้น.
     1: Trigger interrupt ค้างอยู่.

Bit 5 COMIF: COM interrupt flag
flag นี้ถูกเซ็ตโดย hardware บน COM event (เมื่อ Capture/compare Control bits - CCxE, CCxNE, OCxM - ถูกอัปเดตแล้ว). มันถูกเคลียร์โดย software.
     0: ไม่มี COM event เกิดขึ้น.
     1: COM interrupt ค้างอยู่.

Bit 4 CC4IF: Capture/Compare 4 interrupt flag
อ้างอิงถึง CC1IF description

Bit 3 CC3IF: Capture/Compare 3 interrupt flag
refer to CC1IF description

Bit 2 CC2IF: Capture/Compare 2 interrupt flag
refer to CC1IF description

Bit 1 CC1IF: Capture/compare 1 interrupt flag
ถ้า channel CC1 ถูกกำหนดค่าเป็น output:
flag นี้ถูกเซ็ตโดย hardware เมื่อ the counter เท่ากับ the compare value, ด้วยบางข้อยกเว้นใน center-aligned mode (อ้างอิงถึง the CMS bits ใน the TIMx_CR1 register description). มันถูกเคลียร์โดย software.
     0: No match.
     1: The content ของ the counter TIMx_CNT เท่ากันกับ the content ของ the TIMx_CCR1 register.
ถ้า channel CC1 ถูกกำหนดค่าเป็น input:
บิตนี้ถูกเซ็ตโดย hardware บน a capture. มันถูกเคลียร์โดย software หรือโดยการอ่าน the TIMx_CCR1 register.
     0: ไม่มี input capture เกิดขึ้น.
     1: The counter value ถูก captured แล้วใน TIMx_CCR1 register (An edge ถูกตรวจจับได้แล้วบน IC1 ซึ่งเท่ากันกับ the
         selected polarity).

Bit 0 UIF: Update interrupt flag
– บิตนี้ถูกเซ็ตโดย hardware บน an update event. มันถูกเคลียร์โดย software.
     0: ไม่มี update เกิดขึ้น.
     1: Update interrupt ค้างอยู่. บิตนี้ถูกเซ็ตโดย hardware เมื่อ the registers ถูก updated:
– ที่ overflow หรือ underflow และถ้า the UDIS=0 ใน the TIMx_CR1 register.
– เมื่อ CNT ถูกเริ่มต้นใหม่โดย software โดยใช้ the UG bit ใน TIMx_EGR register, ถ้า URS=0 และ UDIS=0 ใน the
   TIMx_CR1 register.
– เมื่อ CNT ถูกเริ่มต้นใหม่โดย a trigger event อ้างอิงถึง Section 14.4.3: TIM1 and TIM8 slave mode control register (TIMx_SMCR), ถ้า URS=0 และ UDIS=0 ใน the TIMx_CR1 register.
   ใน the TIMx_CR1 register.

tha



Bits 15:8 Reserved, must be kept at reset value.

Bit 7 BG: Break generation
บิตนี้ถูกเซ็ตโดย software เพื่อสร้าง an event, มันถูกเคลียร์โดยอัตโนมัติโดย hardware.
     0: No action
     1: A break event ถูกสร้าง. MOE bit ถูกเคลียร์และ BIF flag ถูกเซ็ต. Related interrupt หรือ DMA transfer สามารถเกิดขึ้นถ้า
         เปิดการใช้งาน

Bit 6 TG: Trigger generation
บิตนี้ถูกเซ็ตโดย software เพื่อสร้าง an event, มันถูกเคลียร์โดยอัตโนมัติโดย hardware.
     0: No action
     1: The TIF flag ถูกเซ็ตใน TIMx_SR register. interrupt หรือ DMA transfer ที่เกี่ยวข้องสามารถเกิดขึ้นถ้าถูกเปิดการใช้งาน.

Bit 5 Reserved, must be kept at reset value.

Bit 4 CC4G: Capture/compare 4 generation
refer to CC1G description

Bit 3 CC3G: Capture/compare 3 generation
refer to CC1G description

Bit 2 CC2G: Capture/compare 2 generation
refer to CC1G description

Bit 1 CC1G: Capture/compare 1 generation
บิตนี้ถูกเซ็ตโดย software เพื่อสร้าง an event, มันถูกเคลียร์โดยอัตโนมัติโดย hardware.
     0: No action
     1: A capture/compare event ถูกสร้างบน channel 1:
ถ้า channel CC1 ถูกกำหนดค่าเป็น output:
CC1IF flag ถูก set, interrupt or DMA request ที่ตรงกันถูกส่งถ้าถูกเปิดการใช้งาน..
ถ้า channel CC1 ถูกกำหนดค่าเป็น input:
The current value ของ the counter ถูก captured ใน TIMx_CCR1 register. The CC1IF flag ถูก set, the corresponding interrupt or DMA request ถูกส่งถ้าถูกเปิดการใช้งาน. The CC1OF flag ถูกเซ็ตถ้า the CC1IF flag เป็น high อยู่แล้ว.

Bit 0 UG: Update generation
บิตนี้ถูกเซ็ตโดย software เพื่อสร้าง an event, มันถูกเคลียร์โดยอัตโนมัติโดย hardware.
     0: No action
     1: เริ่มต้นใหม่ the counter และสร้าง an update ของ the registers. บันทึกไว้ว่า the prescaler counter ถูกเคลียร์ด้วย
         (อย่างไรก็ตาม the prescaler ratio ไม่ได้รับผลกระทบ). The counter ถูกเคลียร์ถ้า the center-aligned mode ถูกเลือกหรือ
        ถ้า DIR=0 (upcounting), มิฉะนั้นจะเอา the auto-reload value (TIMx_ARR) ถ้า DIR=1 (downcounting).

tha

14.4.7 TIM1 and TIM8 capture/compare mode register 1 (TIMx_CCMR1)
Address offset: 0x18
Reset value: 0x0000



Output compare mode

Bit 15 OC2CE: Output compare 2 clear enable

Bits 14:12 OC2M[2:0]: Output compare 2 mode

Bit 11 OC2PE: Output compare 2 preload enable

Bit 10 OC2FE: Output compare 2 fast enable

Bits 9:8 CC2S[1:0]: Capture/Compare 2 selection
bit-field นี้กำหนด the direction ของ the channel (input/output) เช่นเดียวกับ the used input.
     00: CC2 channel ถูกกำหนดเป็น output
     01: CC2 channel ถูกกำหนดเป็น input, IC2 ถูกแม็ปบน TI2
     10: CC2 channel ถูกกำหนดเป็น input, IC2 ถูกแม็ปบน TI1
     11: CC2 channel ถูกกำหนดเป็น input, IC2 ถูกแม็ปบน TRC. โหมดนี้กำลังทำงานเพียงถ้า an internal trigger input ถูกเลือก
           ผ่านทาง the TS bit (TIMx_SMCR register)
Note: CC2S bits เขียนได้เพียงเมื่อ the channel ถูก OFF (CC2E = 0 ใน TIMx_CCER).

Bit 7 OC1CE: Output compare 1 clear enable
OC1CE: Output Compare 1 Clear Enable
     0: OC1Ref ไม่ถูกได้รับผลกระทบ the ETRF input
     1: OC1Ref ถูกเคลียร์ทันทีที่ a High level ถูกตรวจจับได้บน ETRF input

Bits 6:4 OC1M: Output compare 1 mode
บิตเหล่านี้กำหนด the behavior ของ the output reference signal OC1REF จากที่ OC1 และ OC1N สืบสายมา. OC1REF จะ active high ขณะที่ OC1 และ OC1N active level ขึ้นอยู่กับ CC1P และ CC1NP bits.
     000: Frozen - The comparison ระหว่าง the output compare register TIMx_CCR1 และ the counter TIMx_CNT ไม่มี
             ผลบน the outputs.(โหมดนี้ถูกใช้สร้าง a timing base).
     001: เซ็ต channel 1 เป็น active level เมื่อเท่ากัน. OC1REF signal ถูกบังคับเป็น high เมื่อ the counter TIMx_CNT เท่ากัน
             กับ the capture/compare register 1 (TIMx_CCR1).
     010: เซ็ต channel 1 เป็น inactive level เมื่อเท่ากัน. OC1REF signal ถูกบังคับเป็น low เมื่อ the counter TIMx_CNT เท่ากัน
             กับ the capture/compare register 1 (TIMx_CCR1).
     011: Toggle - OC1REF สลับเมื่อ TIMx_CNT=TIMx_CCR1.
     100: Force inactive level - OC1REF ถูกบังคับเป็น low.
     101: Force active level - OC1REF ถูกบังคับเป็น high.
     110: PWM mode 1 - ในการนับขึ้น, channel 1 จะ active ตราบเท่าที่ TIMx_CNT<TIMx_CCR1 เป็นอย่างอื่นจะ inactive. ใน
             การนับลง, channel 1 จะ inactive (OC1REF='0) ตราบเท่าที่ TIMx_CNT>TIMx_CCR1 เป็นอย่างอื่นจะ active
             (OC1REF=1).
     111: PWM mode 2 - ในการนับขึ้น, channel 1 จะ inactive ตราบเท่าที่ TIMx_CNT<TIMx_CCR1 เป็นอย่างอื่นจะ active. ใน
             การนับลง, channel 1 จะ active  ตราบเท่าที่ TIMx_CNT>TIMx_CCR1 เป็นอย่างอื่นจะ inactive.       
Note: ใน PWM mode 1 หรือ 2, the OCREF level เปลี่ยนเพียงเมื่อ the result ของ the comparison เปลี่ยนหรือเมื่อ the
           output compare mode สวิทช์จาก "frozen" mode ไปยัง "PWM" mode.

Bit 3 OC1PE: Output compare 1 preload enable
     0: Preload register บน TIMx_CCR1 ถูกปิดการใช้งาน. TIMx_CCR1 สามารถถูกเขียนได้ตลอดเวลา, ค่าใหม่จะถูกนำเข้าโดยทันที.
     1: Preload register บน TIMx_CCR1 ถูกเปิดการใช้งาน. Read/Write operations เข้าถึง the preload register.
         TIMx_CCR1 preload value ถูกโหลดใน the active register ที่แต่ละ update event.
Note: 1: บิตเหล่านี้ไม่สามารถถูกแก้ไขตราบเท่าที่ LOCK level 3 ถูกโปรแกรมแล้ว (LOCK bits ใน TIMx_BDTR register)
         และ CC1S=00 (the channel ถูกกำหนดใน output).
         2: The PWM mode สามารถถูกใช้โดยไม่ต้องตรวจสอบความถูกต้อง the preload register เพียงใน onepulse mode (OPM
         bit เซ็ตใน TIMx_CR1 register). เป็นอย่างอื่น the behavior ไม่ถูกรับประกัน.

Bit 2 OC1FE: Output compare 1 fast enable
บิตนี้ถูกใช้เร่งผลของ an event บน the trigger ใน input บน the CC output.
     0: CC1 ทำงานตามปกติโดยขึ้นอยู่กับ counter และ CCR1 values แม้เมื่อ the trigger จะ ON. The minimum delay ที่ทำให้
         CC1 output ทำงานเมื่อ an edge เกิดขึ้นบน the trigger input คือ 5 clock cycles.
     1: An active edge บน the trigger input ทำงานเหมือน a compare match บน CC1 output. จากนั้น, OC ถูกเซ็ตถึง the
         compare level เป็นอิสระจาก the result ของ the comparison. Delay เพื่อสุ่ม the trigger input และเพื่อทำให้ CC1
         output ทำงานถูกลดลงเป็น 3 clock cycles. OCFE ทำงานเพียงถ้า the channel ถูกกำหนดค่าใน PWM1 หรือ PWM2 mode.

Bits 1:0 CC1S: Capture/Compare 1 selection
bit-field นี้กำหนด the direction ของ the channel (input/output) เช่นเดียวกันกับ the used input.
     00: CC1 channel ถูกกำหนดค่าเป็น output.
     01: CC1 channel ถูกกำหนดค่าเป็น input, IC1 ถูกแม็ปบน TI1.
     10: CC1 channel is configured as input, IC1 is mapped on TI2.
     11: CC1 channel is configured as input, IC1 is mapped on TRC. โหมดนี้กำลังทำงานเพียงถ้า an internal trigger input
           ถูกเลือกผ่านทาง the TS bit (TIMx_SMCR register)
Note: CC1S bits เขียนได้เพียงเมื่อ the channel ถูก OFF (CC1E = 0 in TIMx_CCER).

tha

Input capture mode

Bits 15:12 IC2F: Input capture 2 filter

Bits 11:10 IC2PSC[1:0]: Input capture 2 prescaler

Bits 9:8 CC2S: Capture/compare 2 selection
bit-field นี้กำหนด the direction ของ the channel (input/output) เช่นเดียวกันกับ the used input.
     00: CC2 channel ถูกกำหนดค่าเป็น output.
     01: CC2 channel ถูกกำหนดค่าเป็น input, IC2 ถูกแม็ปบน TI2.
     10: CC2 channel is configured as input, IC2 is mapped on TI1.
     11: CC2 channel is configured as input, IC2 is mapped on TRC. โหมดนี้กำลังทำงานเพียงถ้า an internal trigger input
            ถูกเลือกผ่านทาง the TS bit (TIMx_SMCR register)
Note: CC2S bits เขียนได้เพียงเมื่อ the channel ถูก OFF (CC2E = 0 in TIMx_CCER).

Bits 7:4 IC1F: Input capture 1 filter
bit-field นี้จะกำหนด the frequency ที่ใช้เพื่อสุ่ม TI1 input และความยาวของ digital filter ที่ใช้กับ TI1. The digital filter ถูกทำจาก an event counter ที่ซึ่ง N consecutive events ถูกต้องการเพื่อทำให้ถูกต้อง a transition บน the output:
     0000: No filter, การสุ่มถูกทำที่ fDTS
     0001: fSAMPLING=fCK_INT, N=2
     0010: fSAMPLING=fCK_INT, N=4
     0011: fSAMPLING=fCK_INT, N=8
     0100: fSAMPLING=fDTS/2, N=6
     0101: fSAMPLING=fDTS/2, N=8
     0110: fSAMPLING=fDTS/4, N=6
     0111: fSAMPLING=fDTS/4, N=8
     1000: fSAMPLING=fDTS/8, N=6
     1001: fSAMPLING=fDTS/8, N=8
     1010: fSAMPLING=fDTS/16, N=5
     1011: fSAMPLING=fDTS/16, N=6
     1100: fSAMPLING=fDTS/16, N=8
     1101: fSAMPLING=fDTS/32, N=5
     1110: fSAMPLING=fDTS/32, N=6
     1111: fSAMPLING=fDTS/32, N=8

Bits 3:2 IC1PSC: Input capture 1 prescaler
bit-field นี้กำหนด the ratio ของ the prescaler ทำงานบน CC1 input (IC1).
The prescaler ถูก reset ทันทีที่ CC1E=0 (TIMx_CCER register).
     00: no prescaler, capture ถูกทำแต่ละเวลาที่ an edge ถูกตรวจจับได้บน the capture input
     01: capture ถูกทำหนึ่งครั้งทุกๆ 2 events
     10: capture is done once every 4 events
     11: capture is done once every 8 events

Bits 1:0 CC1S: Capture/Compare 1 selection
bit-field นี้กำหนด the direction ของ the channel (input/output) เช่นเดียวกันกับ the used input.
     00: CC1 channel ถูกกำหนดค่าเป็น output
     01: CC1 channel ถูกกำหนดค่าเป็น input, IC1 ถูกแม็ปบน TI1
     10: CC1 channel is configured as input, IC1 is mapped on TI2
     11: CC1 channel is configured as input, IC1 is mapped on TRC. โหมดนี้กำลังทำงานเพียงถ้า an internal trigger input
           ถูกเลือกผ่านทาง the TS bit (TIMx_SMCR register)
Note: CC1S bits เขียนได้เพียงเมื่อ the channel ถูก OFF (CC1E = 0 in TIMx_CCER).

tha

14.4.8 TIM1 and TIM8 capture/compare mode register 2 (TIMx_CCMR2)
                       Address offset: 0x1C