- 打卡等级:初来乍到
- 打卡总天数:4
- 最近打卡:2025-05-01 06:58:22
金牌会员
- 积分
- 1333
|
发表于 2023-12-27 04:07:59
|
显示全部楼层
Timer3 can only be used with some limitations.
The best hardware HI-LEVEL measurement is a gated time, like T0,T1.
With GATE the count stops, when the pin is LOW.
Next best HW is a CAPTURE timer, where the pin edge gets the timer value at that instant.
You get two captures and take the difference.
Timer3 has no GATE and no capture, so you would need to use INT1 to SW start/stop/read/clear timer3. That Sw solution has more jitter, and needs a high priority interrupt.
STC8H does have TM3PS register, so T3.CLK = SysCLK/(TM3PS+1) which can nicely scale the 16 bits timer read value. |
|