Shop OBEX P1 Docs P2 Docs Learn Events
dealing with duty ctr and signed spin numbers — Parallax Forums

dealing with duty ctr and signed spin numbers

Erik FriesenErik Friesen Posts: 1,071
edited 2008-06-17 23:23 in Propeller 1
I have been scratching my head trying to figure out how to make duty cycle work as a charge controller.· As soon as my method hits + $8000 0000 it goes full on and my >· and < don't seem to do what I need.·
Pri charge(blo,bhi,maxamps)
    ma:=long[noparse][[/noparse]bhi]-long[noparse][[/noparse]blo]  
    MAdesired <#=long[noparse][[/noparse]maxamps] 'limit to amps allowed
    if ma<MAdesired and pwm>-$ffff
       pwm+=100000
    elseif ma>MAdesired
       pwm-=100000
    if MAdesired ==0
      pwm:=0       
    frqa:=pwm

Here is the complete object
Sign In or Register to comment.