' picaxe mppt code
' Author: Andrew Sarkis
' Date:8/05/2008
' this is the code for the Constant Voltage tracking method. The sensed voltage is compared to
' a reference voltage to keep it at the maximum powr point. The predetermined value for
symbol duty = b4 ' variable to control duty cycle with. Stored in byte5.
symbol maxduty = b5
symbol minduty = b6
symbol cv = w4
symbol v1 = b1
maxduty = 200 ' the maximum duty cycle, preset for a period of (49+1)*4*250nS = 50uS 20khz
minduty = 5 ' minimum value for duty cycle
pwmout 2,49,duty ' initialises pwm signal
for b0 = 1 to 3
high 4 ' turn on/off led for 3 seconds. indicating that the pic is working
pause 500
low 4
next b1
duty = 25
readadc 1, b1
cv = 185 '75*b1/100
main:
if v1 > cv and duty < maxduty and duty > minduty then
duty = duty + 1
else if v1 < cv and duty < maxduty and duty > minduty then
duty = duty - 1
end if
goto main' picaxe mppt code
' Author: SOLARFREAKS
' Date:8/05/2008
' this is the code for the Constant Voltage tracking method. The sensed voltage is compared to
' a reference voltage to keep it at the maximum powr point. The predetermined reference value is
'
symbol duty = b4 ' variable to control duty cycle with. Stored in byte5.
symbol maxduty = b5
symbol minduty = b6
symbol cv = w4
symbol v1 = b1
maxduty = 200 ' the maximum duty cycle, preset for a period of (49+1)*4*250nS = 50uS 20khz
minduty = 5 ' minimum value for duty cycle
pwmout 2,49,duty ' initialises pwm signal
for b0 = 1 to 3
high 4 ' turn on/off led for 3 seconds. indicating that the pic is working
pause 500
low 4
next b1
duty = 25 ' Preset the duty cycle to some random value, not too high.
cv = 136 ' 136/255*3volts = 1.6volts on the reference pin.
main:
readadc 1, b1
if v1 > cv and duty < maxduty and duty > minduty then
duty = duty + 1
else if v1 < cv and duty < maxduty and duty > minduty then
duty = duty - 1
end if
pwmout 2,49,duty
goto mainemerson wrote:another question :
" 136/255*3volts = 1.6 " isnt it represent the voltage divider, with 136 and 255 the two resistors??
Users browsing this forum: No registered users and 0 guests