Raspberry Pi

nick12ab

Senior Member
I have done the GPS locator program in both compiled Mikrobasic and PICXAXE basic, the amount of free memory was about the same on a 18F25k22\28X2, 11K.

And to take a silly example, a simple program of var1 = var2 + var 3, has 32,724 bytes free on the compiler and 16,376 bytes free on the PICAXE.
In the first case, Rev-Ed have previously stated that the PICAXE firmware is programmed in assembler for maximum efficiency. Presumably your code does not use all of the libraries already built into PICAXE so this can only mean that MikroBasic libraries are less efficient and therefore if for some reason you needed all of the libraries, PICAXE would be better.

Of course, execution speed of the PICAXE is still slower, but it seems that having comparatively fast execution speed is an excuse to do things sloppily and go unnoticed. I avoid the Arduino's LCD library for this reason, and just use PICAXE-style code (but in C). And this is another advantage of PICAXE - the reduced execution speed encourages users to write efficient code.
 

Dippy

Moderator
I'm not sure you can conclude that about ME BASIC Nick.
When using a compiler the amount space used depends hugely on your programme structure and cutting out repetition.
For a start a (good) compiler doesn't plonk a load of unused subroutine sections onto the PIC, even though it may all visually appear in your Editor.

Other things (e.g.) un-needed TRISing and ADCxxxing (which tend to be used in general purpose subroutines) can be left out.
On the other hand if you've made procedures 'inline' out of habit and keep calling them then that can waste a lot of space.

Yes, of course, space usage is very much down to efficient writing, but with a compiler it is very much more down to the author with regards to space - including with compilers being able to write your own library routines/procedures sans bloat. Some compilers allow you to rejiggle and rename library routines too in order to reduce bloat.

Most of the stuff I write these days involves me writing my own procedures from scratch and it can save vast amounts (Flash and RAM) usage compared to the standard routines. There are other compilers that are superior to ME BASIC in this respect which allows the user to do this.
 

lbenson

Senior Member
>Most of the stuff I write these days involves me writing my own procedures from scratch and it can save vast amounts (Flash and RAM) usage compared to the standard routines.

Reminds me of my earliest job, in which I wrote crosstabs in Fortran instead of using the customary report generator--the programs were far smaller and quicker (and you could make the output look exactly the way you wanted). Of course, in that bygone era, the economics were completely reversed from what they are today--programmer time was cheap (I was paid $2.50 an hour) and computer run time was very expensive (and memory was very constrained).

I once created a bug which cost the equivalent of 20 hours of my time. My boss was kind and said nothing.
 
Top