输入捕获计时器1 ATMEGA 328P计算占空比周期

发布于 2025-01-27 23:56:49 字数 382 浏览 6 评论 0原文

我是MP编程的新手,并且正在使用CodeVision程序进行一个项目,该项目需要:

  • 在A0上连接电位计。
  1. 生成具有等效平均直流电压的PWM信号,比电位计的电压的测量值。 DAC的测量电压显示在LCD(16*2)的第1行。
  2. 选择合适的RC电路以获取纯直流电压。
  3. 将生成的PWM信号连接到ICP1并计算其占空比,并在屏幕上的第2行上显示。

因此,屏幕应该像:

Pot1 = 0.000 V
Duty Cycle = ..%

我制作了第一行,但我不知道如何将Timer1实现到此要求中。

同样,计时器1具有ICRH和ICRL,我很困惑应该使用哪些。

I am new to MP programming and I am working on a project with codevision program, which requires to:

  • Connect potentiometer at A0.
  1. Generate a PWM signal with an equivalent average DC voltage to the measured value of the voltage of the potentiometer.
    The measured voltage from the DAC is displayed on line 1 of lcd (16*2).
  2. Choose a suitable RC circuit to get a pure DC voltage.
  3. Connect the generated PWM signal to the ICP1 and calculate its duty cycle and display it on line 2 off the screen.

So the screen should be like:

Pot1 = 0.000 V
Duty Cycle = ..%

I made the first line but I don't know how to implement timer1 into this requirement.

Also timer 1 has ICRH and ICRL and I am confused which of them should be used.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文