Quote Originally Posted by Acetronics View Post
IF you use PBPL ...

May be you should declare your DIV relevant vars as LONG ... no ???

IF you use DIV32

May be you've noticed it's ( ONLY ? ) a 31 x 15 bits operation ... Manual $ 4.17.8
Yes, I know that and have build hundred of lines to calculate what I need (but have not tested that yet),
in one place I need:
'------- ex. L = 349,989/2 = 349989/2 = 174,995 => 174995
'------- ' (L/2)^2 = (L/2) * (L/2) square it
That should give 30 623 250 (=01 d3 46 12h)
and this is not the only one.

So it would really be nicer to use the LONG variable instead of doing tricks and getting the program longer.
By tricking I mean something like this:
lsb = L0.0 : mL0 = L0 >> 1 ' remember lsb, then shift lower 8 bits right
mL0.7 = L1.0: mL1 = L1 >> 1 ' shift middle
mL1.7 = L2.0: mL2 = L2 >> 1 ' shift higher 8 bits right

Or saying it in other words if you can (on the upper level) do the same thing within 10 lines instead of 200 lines, why wouldn't you try to do so then?

This sentence always make me laugh !!!
So, you will live longer...

may we know about those calculations ???
I will send the formula later...

To re-arrange your program not to exceed the 32k limit ... probably some redundant or overkilling calculations ...
There still room for the program to grow. At the moment 28632 bytes used + 1k for the bootloader... so the limit is not close yet, but I think tricking would bring it fast closer

BTW ... I remember Skimask ( Wish you a happy new year ,Ski ! ) wrote an interesting paper about that on this Forum ...
What kind of story would that paper tell?

Still I think, if Microchip provides PBPL then it also should work... you could convert your existing program to using LONG if you have use to it. If you have then remove your DIV32 (possible R0 and R2) and use LONG variables instead. Isn't that neat?

Or do you not think so???