150V 45A MPPT - roll your own


Author Message
flyingfishfinger
Senior Member

Joined: 12/09/2020
Location: United States
Posts: 113
Posted: 01:58am 18 Nov 2023      

Also, I believe you have an error in the red part. The if statement has an extra "(", just adding this bit of code will cause compilation to fail.

  poida said  [...]

The fix is in Red


if (nvd.pwm_freq != 20 && nvd.pwm_freq != 40)
  {
  // set default at 20 kHz
  timer1_period = 833;
  baud_waits = 1;
  ints_second = 19200;
  freq_scale = 1;
  }
else
  {
  timer1_period = nvd.timer1_period;
  baud_waits = nvd.baud_waits;
  ints_second = nvd.ints_second;

  if ((nvd.pwm_freq == 20)
     freq_scale = 1;
  else
     freq_scale = 2;

  }



Edited 2023-11-18 12:00 by flyingfishfinger