Posted: 04:37pm 26 Jan 2021 |
|
|
|
Good evening everyone,
thanks podia for the test, I immediately deleted those lines. there was a test, sometimes a trivial line changes everything I am continuously in test :D
I did some tests NPWM at 400 and PPWM 399 as per eq. of the manual for timer1 mode14:
ICR1 = (F_CPU / ( timer1Prescaler * DesideredFreq )) - 1;
the wave is good but it is more stable in the eye with prev values.
perhaps the RC filter should be reviewed or probably micro at the limit. also the memory is obviously almost full, just a test.
i am waiting for two power supply to power the test bench I plan to do. maybe a friend offers a 4channel oscilloscope
so
in the new line:
ICR1 = PPWM - (pcount_delta / 256);
now it is clear to me that from the ICR1 which regulates frequency, subtract a part of the out of phase that was calculated in INT0, so as to follow the wave for the sync minimizing the phase difference.
but where does 256 come from?
and also:
new_delta = 8 * (phase_error / 2 + 8 * (phase_error - old_phase_error));
in the comment I read PID but obviously the logic behind it is foreign to me
thanks for the clarifications and good evening, A. Edited 2021-01-27 02:39 by iannez |