Hello ...
I wrote this code for my Atmega 328P to make a PI control (changing the duty cycle of PWM according to the values of load current and voltage)
my code is sensible !! but I don't know why it's not work !!
PLZ help me PLZ
I didn't have any result !
in the main code when you change the OCR2A value for a constant one .. I have a result
for example if I put OCR2B=128*0.5; ... I have a duty cycle of 50% .. but I don't want that!!
PLZ I appreciate any help !
that's my code:
In the main function,before calling the while(1) loop you have initialized OCR2B as zero and inside the while(1) function also,you have initialized OCR2B zero.What is the reason behind initializing OCR2B twice?
But if you have initialized it already once,why you need to initialize it again?Use it as is from the previous initialization.Keep it initialized once,remove the declaration in the while loop and report on what happens.