STM32F1 RTC

Started by tha, December 05, 2020, 08:15:08 AM

Previous topic - Next topic

tha

18.4.3 RTC prescaler load register (RTC_PRLH / RTC_PRLL)
The Prescaler Load registers เก็บ the period counting value ของ the RTC prescaler. มันถูก write-protected โดย the RTOFF bit ใน the RTC_CR register, และ a write operation ถูกยอมได้ถ้า the RTOFF value เป็น '1'.



Bits 15:4 Reserved, forced by hardware to 0.

Bits 3:0 PRL[19:16]: RTC prescaler reload value high
บิตเหล่านี้ถูกใช้เพื่อกำหนด the counter clock frequency สอดคล้องกันกับสูตรต่อไปนี้ :




Bits 15:0 PRL[15:0]: RTC prescaler reload value low
บิตเหล่านี้ถูกใช้เพื่อกำหนด the counter clock frequency สอดคล้องกันกับสูตรต่อไปนี้ :


ข้อควรระวัง: The zero value ไม่แนะนำ. RTC interrupts และ flags ไม่สามารถถูกยืนยันอย่างถูกต้อง.

Note: ถ้า the input clock frequency (fRTCCLK) คือ 32.768 kHz, เขียน 7FFFh ใน register นี้จะได้รับ a signal
            period ของ 1 second


tha

18.4.4 RTC prescaler divider register (RTC_DIVH / RTC_DIVL)
ในระหว่างแต่ละ period ของ TR_CLK, the counter ภายใน the RTC prescaler ถูกโหลดซ้ำใหม่ด้วย the value ที่เก็บใน the RTC_PRL register. เพื่อให้ได้ an accurate time measurement มันเป็นไปได้ที่จะอ่าน the current value ของ the prescaler counter, ที่เก็บใน the RTC_DIV register, โดยปราศจากการหยุดมัน. register นี้ read-only และมันถูกโหลดซ้ำใหม่โดย hardware หลังจากการเปลี่ยนใดๆใน the RTC_PRL หรือ RTC_CNT registers.


tha

18.4.5 RTC counter register (RTC_CNTH / RTC_CNTL)
The RTC core มี one 32-bit programmable counter, เข้าถึงได้ผ่านทาง two 16-bit registers; the count rate ขึ้นอยู่กับ the TR_CLK time reference, ที่สร้างโดย the prescaler. RTC_CNT registers เก็บ the counting value ของ counter นี้. มันถูก write-protected โดย bit RTOFF ใน the RTC_CR register, และ a write operation ถูกยอมได้ถ้า the RTOFF value เป็น '1'. A write operation บน the upper (RTC_CNTH) หรือ lower (RTC_CNTL) registers โหลดโดยตรง the corresponding programmable counter และโหลดซ้ำใหม่ the RTC Prescaler. เมือ่อ่าน, the current value ใน the counter  (วันที่ของระบบ) จะถูกส่งกลับ.



Bits 15:0 RTC_CNT[31:16]: RTC counter high
การอ่าน the RTC_CNTH register, the current value ของ the high part ของ the RTC Counter register ถูกส่งกลับ. การเขียนถึง register นี้มันจำเป็นต้องเข้าสู่ configuration mode (ดู Section 18.3.4: Configuring RTC registers).



Bits 15:0 RTC_CNT[15:0]: RTC counter low
การอ่าน the RTC_CNTL register, the current value ของ the lower part ของ the RTC Counter register ถูกส่งกลับ. การเขียนถึง register นี้มันจำเป็นต้องเข้าสู่ configuration mode (ดู Section 18.3.4: Configuring RTC registers).


tha

18.4.6 RTC alarm register high (RTC_ALRH / RTC_ALRL)
เมื่อ the programmable counter ถึง the 32-bit value ที่เก็บใน the RTC_ALR register, an alarm ถูก triggered และ the RTC_alarmIT interrupt request ถูกสร้าง. register นี้ถูก write-protected โดย the RTOFF bit ใน the RTC_CR register, และถูกยอมได้ถ้า the RTOFF value เป็น '1'.



Bits 15:0 RTC_ALR[31:16]: RTC alarm high
The high part ของ the alarm time ถูกเขียนโดย software ใน register นี้. การเขียนถึง register นี้มันจำเป็นต้องเข้าสู่ configuration mode (ดู Section 18.3.4: Configuring RTC registers).



Bits 15:0 RTC_ALR[15:0]: RTC alarm low
The low part ของ the alarm time ถูกเขียนโดย software ใน register นี้. การเขียนถึง register นี้มันจำเป็นต้องเข้าสู่ configuration mode (ดู Section 18.3.4: Configuring RTC registers).

tha



ปล. จบไปอีกตอน เพราะอากาศมันเย็นสบายดี พรุ่งนี้ขึ้น TIM1&8 ใช่ไหม ว่าไงว่าตามกันนะ