<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Watch and log free sram during runtime..]]></title><description><![CDATA[<p dir="auto">(I copied interrupt setup from another script, dont know if its 100% correct, but it works :P) i think ir runs the timer1 each 1ms.</p>
<pre><code> int min_mem=32000;
 int free_mem=0;
 ISR(TIMER1_COMPA_vect) {
 cli();
   extern int __heap_start, *__brkval;
   int m = (int) &amp;m - (__brkval == 0 ? (int) &amp;__heap_start : (int) __brkval);
   if (m &lt; min_mem) min_mem=m;
   free_mem=m;
 sei();
 } 
 
 int main(void) {
 	init();
 	cli();
 	TCCR1A = 0;
 	TCCR1B = 0;
 	TCNT1  = 0;
 	OCR1A = 1000;
 	TCCR1B |= (1 &lt;&lt; WGM12);
 	TCCR1B |= (1 &lt;&lt; CS11);
 	TIMSK1 |= (1 &lt;&lt; OCIE1A); 
 	sei();
 	
 	while (1) {
 		do_stuff();
 		delay(100);
 		Serial.print("mem: ");
 		Serial.print(free_mem,DEC);
 		Serial.print(" - lowest: ");
 		Serial.println(min_mem,DEC);
 	}
 }
</code></pre>
]]></description><link>https://forum.mysensors.org/topic/314/watch-and-log-free-sram-during-runtime</link><generator>RSS for Node</generator><lastBuildDate>Mon, 12 Oct 2026 05:41:44 GMT</lastBuildDate><atom:link href="https://forum.mysensors.org/topic/314.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 26 Aug 2014 13:42:28 GMT</pubDate><ttl>60</ttl></channel></rss>