Well the little guy is sick and I got about 4 hours sleep last night.
Havent tried this yet but I came up with this alternative and included Darrels changes.
Code:
START:
ADCIN 6, CSET 'READ VALUE OF CURRENT SET POT
ADCIN 4, CSEN 'READ VALUE OF CURRENT SENCE
IF CSEN > CSET Then LET DUTY = DUTY - 1
IF CSEN < CSET THEN LET DUTY = DUTY + 1
GOSUB NewDuty '
PAUSE 1
GOTO Start
NewDuty:
TMR2IF = 0
while !TMR2IF : wend ; let current cycle complete
CCP1CON = 0
CCPR1L = Duty >>2
CCP1CON.5 = Duty.1
CCP1CON.4 = Duty.0
CCPCON.7 = 0
CCPCON.6 = 0
CCPCON.3 = 1
CCPCON.2 = 1
CCPCON.1 = 0
CCPCON.0 = 0
RETURN
Bookmarks