Dynamic/Static

General discussion on mikroBasic for dsPIC30/33 and PIC24.
Post Reply
Author
Message
kingGrey
Posts: 158
Joined: 08 Mar 2007 00:40
Location: portland, OR

Dynamic/Static

#1 Post by kingGrey » 09 Oct 2009 20:20

GO to Project > Edit Project

when here:
(1) what does Dynamic & Static really mean ?
(2) what the purpose of moving the slider in one direction
or the other?
Thank You for your help
An expert is a man who has made all the mistakes which can be made, in a narrow field.
http://www.stevenswater.com/catalog/stevensProductdl3000.aspx?SKU=%2793750%27

Skyline
Posts: 267
Joined: 10 Jan 2006 09:35

#2 Post by Skyline » 11 Oct 2009 09:14

Hi,

http://www.mikroe.com/forum/viewtopic.php?t=11316

The microchip 16bit CPUs have multiprogramming capabilities using the classical CPU stack architecture. Whenever an user subroutine is called or an interrupt subroutine is triggered, the CPU saves the current context registers to the stack (which uses RAM). With multiple level and multiple interrupt subroutine capability, the stack RAM requirement is dynamic and could be substantial, depending on your program. In addition, your local subroutine variables are created dynamically and stored in stack data space, and released upon subroutine exit. The CPU has a stack pointer to keep track of the dynamic stack requirement, and the maximum data memory that the stack pointer can use is set by the SPLIM register which is set by you using the slider in the Edit>Project menu.

So!
1. The mikroE default is to divide all available data RAM into two halves, one half of RAM for your global program variables, and the other half for dynamic subroutine variables and context registers.
2. If you have a rather large main program and do not have a lot of multiple level subroutines / interrupts with large local variables, you can possibly try 80% static / 20% dynamic allocation, giving yourself more RAM space for global variables.
3. If your global variables require say 25% of RAM, and ost of your processing is in interrupt and user subroutines with lots of local data, you may want to try 30% static / 70% dynamic allocation.

p.erasmus
Posts: 3391
Joined: 05 Mar 2009 10:28

#3 Post by p.erasmus » 11 Oct 2009 09:34

Skyline

Thank you for explaining about the slider ,I am aware of the static and dynamic situation in C30 where you set it in the compiler options but did not know you can do this in mikroBasic by ajusting the slider :D

Great ,I start to like the Basic compiler just hope we will get the pro verion soon !! :x
P.Erasmus
Saratov,Russia
--------------------------------------------------------------

kingGrey
Posts: 158
Joined: 08 Mar 2007 00:40
Location: portland, OR

#4 Post by kingGrey » 12 Oct 2009 17:52

thanks for the detailed explanation.
Thank You for your help
An expert is a man who has made all the mistakes which can be made, in a narrow field.
http://www.stevenswater.com/catalog/stevensProductdl3000.aspx?SKU=%2793750%27

Post Reply

Return to “mikroBasic for dsPIC30/33 and PIC24 General”