this is very frustrating ...but ....sometimes its not too bad ...ish
i,m thinking of using a pic to control a mill into a dump water element .....no batteries just the mill , circuit and load ....
pretend big fets and cap bank actually exist in circuit ..
the pic seems to give the option to set a variable power pwm point at a given voltage window .....say 48v to 56v in increments ...a gentle curve in a way...not really sure about that bit though
but the code i,m using is eating up the memory of the little chip very fast ....which is a pity as it could maybe do other tasks as well ......like monitoring the temp of the fets , kick in a fan maybe
crude code ..memory is almost gone...options running out now
Start:
SYMBOL Volt = W0
Main:
readadc10 4,Volt
if volt>500 and volt<=510 then load0
if volt>510 and volt<=520 then load
if volt>520 and volt<=530 then load1
if volt>530 and volt<=540 then load2
if volt>540 and volt<=550 then load3
if volt>550 and volt<=560 then load4
if volt>560 and volt<=570 then load5
if volt>570 and volt<=580 then load6
if volt>580 and volt<=590 then load7
if volt>590 then load8
if volt<500 then load9
goto Main
load0:
pwmout pwmdiv16, 2, 249, 100
goto main
load:
pwmout pwmdiv16, 2, 249, 200
goto main
load1:
pwmout pwmdiv16, 2, 249, 300
goto main
load2:
pwmout pwmdiv16, 2, 249, 400
goto Main
load3:
pwmout pwmdiv16, 2, 249, 500
goto Main
load4:
pwmout pwmdiv16, 2, 249, 600
goto Main
load5:
pwmout pwmdiv16, 2, 249, 700
goto main
load6:
pwmout pwmdiv16, 2, 249, 800
goto main
load7:
pwmout pwmdiv16, 2, 249, 900
goto Main
load8:
pwmout pwmdiv16, 2, 249, 1000
goto main
load9:
pwmout pwmdiv16, 2, 249, 000
goto main