找回密码
 立即注册
楼主: zhang***

INT3测量频率信号问题 | 已解决,用 CCP 模块测量

[复制链接]

该用户从未签到

551

主题

9436

回帖

1万

积分

管理员

积分
14021
发表于 2023-12-25 19:45:39 | 显示全部楼层
回复 支持 反对 送花

使用道具 举报

该用户从未签到

4

主题

86

回帖

664

积分

高级会员

积分
664
发表于 2023-12-27 04:07:59 | 显示全部楼层
gjf 发表于 2023-12-25 17:01
stc8h可以用Timer3+int1来测量高电平脉冲宽度吗?

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.
回复 支持 反对 送花

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|深圳国芯人工智能有限公司 ( 粤ICP备2022108929号-2 )

GMT+8, 2024-5-15 08:48 , Processed in 0.079958 second(s), 33 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表