<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://wiki.mcselec.com/bavr/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.mcselec.com/bavr/index.php?action=history&amp;feed=atom&amp;title=%24FRAMESIZE%2Fde</id>
		<title>$FRAMESIZE/de - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.mcselec.com/bavr/index.php?action=history&amp;feed=atom&amp;title=%24FRAMESIZE%2Fde"/>
		<link rel="alternate" type="text/html" href="http://wiki.mcselec.com/bavr/index.php?title=$FRAMESIZE/de&amp;action=history"/>
		<updated>2026-04-05T18:32:53Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.18.6</generator>

	<entry>
		<id>http://wiki.mcselec.com/bavr/index.php?title=$FRAMESIZE/de&amp;diff=1936&amp;oldid=prev</id>
		<title>Admin: 1 revision</title>
		<link rel="alternate" type="text/html" href="http://wiki.mcselec.com/bavr/index.php?title=$FRAMESIZE/de&amp;diff=1936&amp;oldid=prev"/>
				<updated>2013-02-15T19:06:58Z</updated>
		
		<summary type="html">&lt;p&gt;1 revision&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='1' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='1' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 19:06, 15 February 2013&lt;/td&gt;
		&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://wiki.mcselec.com/bavr/index.php?title=$FRAMESIZE/de&amp;diff=1935&amp;oldid=prev</id>
		<title>Admin: Created page with &quot;= &lt;span class=&quot;f_Header&quot;&gt;Action&lt;/span&gt; =  Sets the available space for the frame.  &lt;span style=&quot;font-family: Arial;&quot;&gt;&amp;nbsp;&lt;/span&gt;  &lt;span style=&quot;font-family: Arial;&quot;&gt;&amp;nbsp;&lt;/s...&quot;</title>
		<link rel="alternate" type="text/html" href="http://wiki.mcselec.com/bavr/index.php?title=$FRAMESIZE/de&amp;diff=1935&amp;oldid=prev"/>
				<updated>2013-02-06T19:39:22Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;= &amp;lt;span class=&amp;quot;f_Header&amp;quot;&amp;gt;Action&amp;lt;/span&amp;gt; =  Sets the available space for the frame.  &amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt; &amp;lt;/span&amp;gt;  &amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt; &amp;lt;/s...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== (**COPIED FROM ENGLISH PAGE**) === &amp;lt;span class=&amp;quot;f_Header&amp;quot;&amp;gt;Action&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
Sets the available space for the frame.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span class=&amp;quot;f_Header&amp;quot;&amp;gt;Syntax&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;f_Syntax&amp;quot;&amp;gt;$FRAMESIZE&amp;lt;/span&amp;gt;&amp;amp;nbsp;= var&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span class=&amp;quot;f_Header&amp;quot;&amp;gt;Remarks&amp;lt;/span&amp;gt; =&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding: 0px; margin: 0px 0px 0px 4px;&amp;quot;&amp;gt;&lt;br /&gt;
{| width=&amp;quot;604&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;1&amp;quot; border=&amp;quot;1&amp;quot; style=&amp;quot;border: 2px solid rgb(0, 0, 0); border-spacing: 0px; border-collapse: collapse;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; width=&amp;quot;10%&amp;quot; style=&amp;quot;width: 57px; border: 1px solid rgb(0, 0, 0);&amp;quot; | &lt;br /&gt;
Var&lt;br /&gt;
&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; width=&amp;quot;100%&amp;quot; style=&amp;quot;width: 538px; border: 1px solid rgb(0, 0, 0);&amp;quot; | &lt;br /&gt;
A numeric decimal value.&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While you can configure the Frame Size in Options, Compiler, Chip, it is good practice to put the value into your code. This way you do no need the cfg(configuration) file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The $FRAMESIZE directive overrides the value from the IDE Options.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is important that the $FRAMESIZE directive occurs in your main project file. It may not be included in an $include file as only the main file is parsed for $FRAMESIZE. $FRAMESIZE only accepts numeric values.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
[[File:Notice.jpg|left|Notice.jpg]]Functions like&amp;amp;nbsp;[[PRINT]],&amp;amp;nbsp;[[LCD]],&amp;amp;nbsp;[[INPUT]]&amp;amp;nbsp;and the FP num &amp;lt;&amp;gt;&amp;amp;nbsp;[[FORMAT]]&amp;amp;nbsp;&amp;amp;nbsp;String conversion routines require a buffer in SRAM. Because of that&amp;amp;nbsp;&amp;lt;span style=&amp;quot;font-weight: bold;&amp;quot;&amp;gt;the compiler always is using 24 bytes of frame space&amp;lt;/span&amp;gt;. This 24 Byte start at the beginning of the Frame which act as the conversion buffer within the frame (See also picture).&lt;br /&gt;
&lt;br /&gt;
Because the FRAME is growing bottom up and this 24 Byte start at the beginning of the FRAME this 24 Byte conversion buffer start at the lowest FRAME Address (See picture). Here you also see that a too small $framesize causes an overwriting of Software Stack and/or Hardware Stack which lead to malfunction. If you use Print numVar, then the numeric variable &amp;quot;numvar&amp;quot; is converted into a string representation of the binary number. The framespace buffer is also used for that.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
When there is not enough room inside the frame, the ERR variable will be set to 1.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span class=&amp;quot;f_Header&amp;quot;&amp;gt;See also&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
[[$SWSTACK]],&amp;amp;nbsp;[[$HWSTACK]],&amp;amp;nbsp;[[Memory usage|Memory usage]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Framesize.png|center|Framesize.png]] Picture: Memory of ATXMEGA128A1&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
A LOCAL variable is a temporary variable that is stored in frame.&lt;br /&gt;
&lt;br /&gt;
There can be only LOCAL variables of the type BYTE, INTEGER, WORD, LONG, SINGLE, DOUBLE or STRING.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
A LOCAL Integer will use 2 Bytes of Frame ,&lt;br /&gt;
&lt;br /&gt;
A LOCAL Long will use 4 Bytes.&lt;br /&gt;
&lt;br /&gt;
A LOCAL string * 20 will use 20 + 1 = 21 Byte (this additional 1 Byte is because every String is terminated with a 0-Byte)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
When the SUB or FUNCTION is terminated, the memory will be released back to the frame but the FRAME will not be cleared&amp;amp;nbsp;! Therefore a LOCAL variable is not initialized. So you can not assume the variable is 0. If you like it to be 0, you need to assign it&amp;amp;nbsp;!&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
BIT variables are not possible as LOCAL because they are always GLOBAL to the system.&lt;br /&gt;
&lt;br /&gt;
Arrays can NOT be used as LOCAL (but arrays can be passed by REFERENCE as parameter to SUB and FUNCTIONS which just need 2 Bytes Software Stack of the Address of Array start)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
See following example for frame calculation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span class=&amp;quot;f_Header&amp;quot;&amp;gt;Example&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
$regfile = &amp;quot;xm128a1def.dat&amp;quot;&lt;br /&gt;
$crystal = 32000000 '32MHz&lt;br /&gt;
$hwstack = 64&lt;br /&gt;
$swstack = 128&lt;br /&gt;
$framesize = 288&lt;br /&gt;
 &lt;br /&gt;
Config Osc = Enabled , 32mhzosc = Enabled '32MHz&lt;br /&gt;
 &lt;br /&gt;
'configure the systemclock&lt;br /&gt;
Config Sysclock = 32mhz , Prescalea = 1 , Prescalebc = 1_1 '32MHz&lt;br /&gt;
 &lt;br /&gt;
'Config Interrupts&lt;br /&gt;
Config Priority = Static , Vector = Application , Lo = Enabled 'Enable Lo Level Interrupts&lt;br /&gt;
Config Com1 = 57600 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
Declare Sub My_sub()&lt;br /&gt;
 &lt;br /&gt;
Call My_sub()&lt;br /&gt;
 &lt;br /&gt;
End 'end program&lt;br /&gt;
 &lt;br /&gt;
Sub My_sub()&lt;br /&gt;
Local A1 As Byte , A2 As Byte , A3 As Byte , A4 As Byte , A5 As Byte&lt;br /&gt;
Local S As String * 254&lt;br /&gt;
 &lt;br /&gt;
For A1 = 1 To 254&lt;br /&gt;
 S = S + &amp;quot;1&amp;quot;&lt;br /&gt;
Next A1&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
A1 = 1&lt;br /&gt;
A2 = 2&lt;br /&gt;
A3 = 3&lt;br /&gt;
A4 = 4&lt;br /&gt;
A5 = 5&lt;br /&gt;
Print A1&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span class=&amp;quot;f_Header&amp;quot;&amp;gt;Now we calculate the FRAME:&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
The Print A1 will be placed in the first frame-Byte of the 24 Byte conversion buffer.&lt;br /&gt;
&lt;br /&gt;
5 LOCAL Byte (A1 … A5) &amp;amp;nbsp;= &amp;amp;nbsp;5 Byte of FRAME&lt;br /&gt;
&lt;br /&gt;
LOCAL String: 254 Byte + 1 Byte = 255 Byte&lt;br /&gt;
&lt;br /&gt;
Frame needed = 24Byte Frame conversion Buffer + 5 Byte + 255 Byte = 284 Byte&lt;br /&gt;
&lt;br /&gt;
This can be easy double checked with BASCOM-AVR Simulator (see following picture).&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
In following picture &amp;amp;nbsp;you see the start of FRAME which start with the 24Byte conversion buffer. The 31 in the first Frame Byte is from Print A1. After the 24 Byte conversion buffer follow the 5 Local Byte variables (A1 …. A5) and then the 255 Byte for the LOCAL String.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
As with Software Stack you need to calculate the Framesize needed by the SUB or FUNCTION with the most LOCAL Variables and parameter passed by REFERENCE etc..&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Take care when calling a SUB within a SUB. In this case you need to add the FRAME needed by both SUB&amp;amp;nbsp;!&lt;br /&gt;
&lt;br /&gt;
When both SUB need 284 Byte you need to use:&lt;br /&gt;
&lt;br /&gt;
24 Byte conversion Buffer + 2* 5 Byte (A1…A5) + 2*255 Byte (String) =&amp;amp;nbsp;&amp;lt;span style=&amp;quot;font-weight: bold;&amp;quot;&amp;gt;544 Byte&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(the conversion buffer is needed only once&amp;amp;nbsp;!)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
[[File:Frame calc.png|center|Frame calc.png]] &lt;br /&gt;
&lt;br /&gt;
Picture: &amp;amp;nbsp;Memory window of BASCOM-AVR Simulator (Frame calculation example)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
For further investigation of Stacks and Frame we use a SUB with 5 LOCAL Byte Variables and a PRINT function within the SUB. We start with hwstack, swstack and framesize defined and in second step we set swstack to 0. In addition we will lower the framesize to a not recommended value to force overwriting of other stack bytes.&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
$regfile = &amp;quot;xm128a1def.dat&amp;quot;&lt;br /&gt;
$crystal = 32000000 '32MHz&lt;br /&gt;
$hwstack = 64&lt;br /&gt;
$swstack = 128&lt;br /&gt;
$framesize = 256&lt;br /&gt;
 &lt;br /&gt;
Config Osc = Enabled , 32mhzosc = Enabled '32MHz&lt;br /&gt;
 &lt;br /&gt;
'configure the systemclock&lt;br /&gt;
Config Sysclock = 32mhz , Prescalea = 1 , Prescalebc = 1_1 '32MHz&lt;br /&gt;
 &lt;br /&gt;
'Config Interrupts&lt;br /&gt;
Config Priority = Static , Vector = Application , Lo = Enabled 'Enable Lo Level Interrupts&lt;br /&gt;
Config Com1 = 57600 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
Declare Sub My_sub()&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
Call My_sub()&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
End 'end program&lt;br /&gt;
 &lt;br /&gt;
Sub My_sub()&lt;br /&gt;
Local A1 As Byte , A2 As B&lt;br /&gt;
&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;{{Languages}}&lt;br /&gt;
&lt;br /&gt;
[[Category:BASCOM Language Reference/de]]&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>