Hi guys,
OK, encountered a weird result and was wondering if anyone could explain it. I am using a PIC12F683 and I wrote A LOT of lines of code. I actually filled the chip and had to make modifications to the code to consolidate space. Anyway, I found that when I wrote the code,
Code:
FOR fade = 0 to 255 STEP fadevalue
PWM left, fade, 1
PWM right, fade, 1
gosub buttoncheck ' check for a button press
NEXT fade
FOR fade = 255 to 0 STEP -fadevalue
PWM left, fade, 1
PWM right, fade, 1
gosub buttoncheck ' check for a button press
NEXT fade
the chip compiled just fine, leaving VERY LITTLE space left. But when the fade result was a little too long for me and I rewrote the code to,
Code:
FOR fade = 0 to 150 STEP fadevalue
PWM left, fade, 1
PWM right, fade, 1
gosub buttoncheck ' check for a button press
NEXT fade
FOR fade = 150 to 0 STEP -fadevalue
PWM left, fade, 1
PWM right, fade, 1
gosub buttoncheck ' check for a button press
NEXT fade
I got an error message saying I was out of space. By just changing the value from 255 to 150, I ran out of space? Not sure why this was happening, but I wound up going through my code again and consolidating some more to make it fit on the chip.
I just want to know what's going on and why it was doing that. Anybody know why?
Thanks,
Tony
Bookmarks