Input capture timer 1 atmega 328p to calculate duty cycle

96 views Asked by At

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.

0

There are 0 answers