Available RAM in the PIC16F676

Tips, Tricks and methods for programming, learn ways of making your programming life easier, and share your knowledge with others.

Moderators: Benj, Mods

Post Reply
User avatar
AbhijitR
Posts: 298
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 279 times
Been thanked: 78 times
Contact:

Available RAM in the PIC16F676

Post by AbhijitR »

Dear Friends
Hello

I am Abhi from India and a new user of FLOWCODE V6, my doubt is regarding the memory usage information which is provided after every successful compilation of any program.

My doubt is, why without any variable declared or anything written/added in the flow code/chart still occupy or use more than 50% of the RAM, is it possible to view the information, if included, while compiling?

Below is the result of the compilation:

RAM available:64 bytes, used:35 bytes (54.7%), free:29 bytes (45.3%),
Heap size:29 bytes, Heap max single alloc:28 bytes
ROM available:1024 words, used:74 words (7.3%), free:950 words (92.7%)


NOTE: what is the meaning of "Heap size"

Dear friends thanks for your time well in advance.

Regards
Abhi

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Available RAM in the PIC16F676

Post by Benj »

Hello,

The Heap size refers to the software stack used and created by the Sourceboost compiler. We can't really do anything about this at the moment. If you need more RAM then my advice would be to use one of the newer chips e.g. 16F18xx or 16F19xx, they are far more capable and usually come with a lower cost price.

User avatar
AbhijitR
Posts: 298
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 279 times
Been thanked: 78 times
Contact:

Re: Available RAM in the PIC16F676

Post by AbhijitR »

Hello Ben

Thanks for your quick reply, I appreciate that. Can I ask you one more doubt? I know you won’t mind, does a program written in ‘C’ language consume less memory rather than FLOWCODE 6, let me be very honest, I do not want to compare but to understand and clear my doubt I want to know this information.

Flowcode is far superior to program a PIC, I am fascinated to see the way it is designed (almost like a PLC programming software by Schneider or Omron)

Is there any way to know how to reduce the RAM usage, or maybe it is possible to chose the ‘include’ files, just to make sure I am not including those functions/features I really do not need in my flowcode.

Thank you, hear you soon.

Regards
Abhi

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Available RAM in the PIC16F676

Post by Benj »

Hello,

Flowcode 6 uses C in the background so using the same C compiler (BoostC) would likely use exactly the same amount of memory. i.e. the heap to allow the BoostC routines to function.

Using a different C compiler will probably give you better results. However the XC8 compiler is probably the best alternative and is known to generate massive unoptimised code using the "free" version.

We are working towards a new compiler for PIC as BoostC is known to have a few problems.

You may be able to squeeze more usefulness out of the available RAM by using efficient macros in your program and using local variables rather than global variables.

User avatar
AbhijitR
Posts: 298
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 279 times
Been thanked: 78 times
Contact:

Re: Available RAM in the PIC16F676

Post by AbhijitR »

Hi! Ben

Thanks for the update, but to be honest with you, I do not know how to program using ‘C’ language, I tried to learn it but I found FLOWCODE 6 very easy and a very sophisticated software to program PIC, as good as programming PLC, I am also a PLC programmer in my professional life.

I will surely follow your instructions and try to optimize the available memory, thanks for your kind words.

I will keep you posted.

Regards
Abhi

Post Reply