I haven't tested this, but I think this should work if your code is not going to
grow or use other PBP commands.
Try this.
Comment out RR1, RM1, and FLAGS in your PBPPIC12.RAM file and save it.
Code:
R0 VAR WORD BANK0 SYSTEM ' System Register
R1 VAR WORD BANK0 SYSTEM ' System Register
R2 VAR WORD BANK0 SYSTEM ' System Register
R3 VAR WORD BANK0 SYSTEM ' System Register
R4 VAR BYTE $0F SYSTEM ' System Register
;RR1 VAR BYTE BANK0 SYSTEM ' Pin 1 Register
;RM1 VAR BYTE BANK0 SYSTEM ' Pin 1 Mask
GOP VAR BYTE BANK0 SYSTEM ' Gen Op Parameter
;FLAGS VAR BYTE BANK0 SYSTEM ' Static flags
OPTION_REG VAR BYTE BANK0 SYSTEM ' OPTION_REG shadow register
SOFT_STACK VAR BYTE[4] SYSTEM ' Software return stack
SOFT_STACK_PTR VAR BYTE BANK0 SYSTEM ' Sotware stack pointer
PBP will allocate RAM space by default. Even if it's never used.
Now simplify this equation by breaking it down;
Change: IF time2 >= 2 AND b0 = 2 Then dim = dim + 1
to;
Code:
IF time2 >= 2 Then
IF b0 = 2 Then
dim = dim + 1 'if over 20 min then start dimming dim period 4 cycles = 10 mins
ENDIF
ENDIF
It's the same logic, but PBP doesn't create temp variables just to figure it out.
Try compiling your code for a 12F629 without making this change, and take a
peek at how temp variables get created in the .LST file.
Now make the change, and re-compile it for the 12F629. Temp variables are
gone. Works the same on pretty much any target I suspect. Just simplify your
equations by breaking them down into smaller parts. Especially for little parts
like the 10F.
Don't forget you have those line items commented out in your .RAM file. As
your program grows, you compile for another device, use more PBP commands
etc, one or more might be needed by a library function. You should get an
error if you have one commented out that's needed.
It should compile & work leaving you with a whopping whole byte of free
RAM...;o}
Bookmarks