Page 1 of 1

Programm size ?

Posted: Sun Apr 04, 2010 5:52 pm
by Albert38
Hello, I'm new to flowcode and to my opinion, somehow I do something wrong.

I made this first programm and run out of programm memory. What I see is that the Analog inputs I use in the macro 'Analog_input' are using 1037 program words and the calculation made in the same macro 236. In my opinion these aren't the most special functions and I don't see why they use so mutch program space.

Im I doing something wrong?

The programm doesn't make mutch yet it is only a tryout of some functions I need in my final program to heat controll my pool.

Thanks for your help...

Re: Programm size ?

Posted: Sun Apr 04, 2010 8:18 pm
by medelec35
You ran out of memory because of 7 lots of float variables, and two lots of string with 20 chars reserved. Floats variables take up If you can use bytes of int instead of float that will help, unless you require precision of float. You can reduce the string size from the default 20 if 20 are not needed.

To give you an idea, I believe 1 float = 32 bits since you have 7 lots of float then 7 * 32 = 224 bits of reserved memory.
With the string you have 40 * 8 bits = 320 bits so far without any other variable you require 544 bits of reserved RAM. See how easy it is to run out.. <talking form experience :P >

Re: Programm size ?

Posted: Sun Apr 04, 2010 9:33 pm
by Albert38
Thank you medelec35 for your reply. this is verry intresting, I can cut the string values to a smaller size in my example I only use 2 digits for the largest string.

But the biggest problem is that my ROM memorie is full with this programm I do not understand what is using so mutch bytes. And becourse I'm new to flowcode any tips on reducing the ROM size of the programm are verry welcome, I tried to use loops with changing varaibles as mutch as posible but that did not help.

P.S. I just noticed that making the String size smaller also less ROM is used.

Re: Programm size ?

Posted: Tue Apr 06, 2010 9:22 am
by Benj
Hello,

Floats and floating point functions consume a huge amount of memory on a 8-bit device. You may want to consider changing your functionality to use integer maths if at all possible. This should allow your ROM usage to come right down.