View Single Post
Old 04-17-2009, 07:49 AM   #956 (permalink)
RedRod
EcoModding Lurker
 
Join Date: Feb 2009
Location: Portugal
Posts: 4
Thanks: 0
Thanked 1 Time in 1 Post
Hi all,

I'm following this tread for a long time but recently I'm having much work to be able to contribute.

Now is the time because as a programmer I can help in the programming area and code optimisation.

My 2 cents: as for the speed control your PI is too aggressive and CPU consuming you can make a simple
if(current > MAX_CURRENT || current > desired_current) PWM--;
because the program runs very fast and decrements PWM very fast.

Ex: current = 510A and MAX_CURRENT = 500A
in just 10 cycles the current is corrected and at 16MHZ it while take less then 1ms to do it even a 500A correction while be made in a few ms

as for optimisations you can put the optimisation level to 1 in the AVR studio as a level 1 optimisation makes the code allot smaller and makes no program change.

excuse for any miss spell as I'm not from a English spiking country.

RedRod
  Reply With Quote