
Originally Posted by
helmut
ledincrease:
high portc.4
l = l + 16
if (l >= 240 ) then
hpwm 1,255,1000
else
IF (L < 240) THEN
HPWM 1,L,1000
endif
endif
return
Let's just look at this subroutine .. what happens if L = 226 coming into this routine. L is changed to 240, HPWM is set to 255, and then you exit. What happens if you return to this subroutine again. L is increased from 240 to 0 (240+16 = 256 = 1 0000 0000, but as a byte = 0000 0000). HPWM is set to 0. 
See my reply in your earlier related thread for the answer (the answer: do not update L if L is equal to 240)
http://www.picbasic.co.uk/forum/showthread.php?t=6989
You also should check the decrease subroutine - I did not check it this time.
Paul Borgmeier
Salt Lake City, UT
USA
__________________
Bookmarks