<?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=%24REDUCEIVR</id>
		<title>$REDUCEIVR - 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=%24REDUCEIVR"/>
		<link rel="alternate" type="text/html" href="http://wiki.mcselec.com/bavr/index.php?title=$REDUCEIVR&amp;action=history"/>
		<updated>2026-04-26T07:55:11Z</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=$REDUCEIVR&amp;diff=4972&amp;oldid=prev</id>
		<title>Admin: Created page with &quot;= &lt;span class=&quot;f_Header&quot;&gt;Action&lt;/span&gt; =  This directive will inform the compiler to reduce the IVR (interrupt vector table) to the smallest possible size.  &lt;span style=&quot;font-...&quot;</title>
		<link rel="alternate" type="text/html" href="http://wiki.mcselec.com/bavr/index.php?title=$REDUCEIVR&amp;diff=4972&amp;oldid=prev"/>
				<updated>2014-12-12T21:59:54Z</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; =  This directive will inform the compiler to reduce the IVR (interrupt vector table) to the smallest possible size.  &amp;lt;span style=&amp;quot;font-...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= &amp;lt;span class=&amp;quot;f_Header&amp;quot;&amp;gt;Action&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
This directive will inform the compiler to reduce the IVR (interrupt vector table) to the smallest possible size.&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 style=&amp;quot;font-weight: bold; color: rgb(0, 0, 128);&amp;quot;&amp;gt;$REDUCEIVR&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;Remarks&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
The flash memory of the processor always starts with the IVR (interrupt vector table). The user code is placed after this table.&lt;br /&gt;
&lt;br /&gt;
So what is this IVR&amp;amp;nbsp;?&lt;br /&gt;
&lt;br /&gt;
This table contains an address for each interrupt. When an interrupt occurs, the processor will jump to a specific and fixed address in code memory.&lt;br /&gt;
&lt;br /&gt;
The address depends on the interrupt itself, and on the processor. For example the MEGA88 has 25 interrupt sources. You can find them in the dat file&amp;amp;nbsp;:&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
INTname1=INT0,$001,EIMSK.INT0,EIFR.INTF0&lt;br /&gt;
&lt;br /&gt;
INTname2=INT1,$002,EIMSK.INT1,EIFR.INTF1&lt;br /&gt;
&lt;br /&gt;
INTname3=PCINT0,$003,PCICR.PCIE0,PCIFR.PCIF0&lt;br /&gt;
&lt;br /&gt;
INTname4=PCINT1,$004,PCICR.PCIE1,PCIFR.PCIF1&lt;br /&gt;
&lt;br /&gt;
INTname5=PCINT2,$005,PCICR.PCIE2,PCIFR.PCIF2&lt;br /&gt;
&lt;br /&gt;
INTname6=WDT@WATCHDOG,$006,WDTCSR.WDIE,WDTCSR.WDIF&lt;br /&gt;
&lt;br /&gt;
INTname7=OC2A@COMPARE2A,$007,TIMSK2.OCIE2A,TIFR2.OCF2A&lt;br /&gt;
&lt;br /&gt;
INTname8=OC2B@COMPARE2B,$008,TIMSK2.OCIE2B,TIFR2.OCF2B&lt;br /&gt;
&lt;br /&gt;
INTname9=OVF2@TIMER2,$009,TIMSK2.TOIE2,TIFR2.TOV2&lt;br /&gt;
&lt;br /&gt;
INTname10=ICP1@CAPTURE1,$00A,TIMSK1.TICIE1,TIFR1.ICF1&lt;br /&gt;
&lt;br /&gt;
INTname11=OC1A@COMPARE1A,$00B,TIMSK1.OCIE1A,TIFR1.OCF1A&lt;br /&gt;
&lt;br /&gt;
INTname12=OC1B@COMPARE1B,$00C,TIMSK1.OCIE1B,TIFR1.OCF1B&lt;br /&gt;
&lt;br /&gt;
INTname13=OVF1@TIMER1,$00D,TIMSK1.TOIE1,TIFR1.TOV1&lt;br /&gt;
&lt;br /&gt;
INTname14=OC0A@COMPARE0A,$00E,TIMSK0.OCIE0A,TIFR0.OCF0A&lt;br /&gt;
&lt;br /&gt;
INTname15=OC0B@COMPARE0B,$00F,TIMSK0.OCIE0B,TIFR0.OCF0B&lt;br /&gt;
&lt;br /&gt;
INTname16=OVF0@TIMER0,$010,TIMSK0.TOIE0,TIFR0.TOV0&lt;br /&gt;
&lt;br /&gt;
INTname17=SPI,$011,SPCR.SPIE,SPSR.SPIF&lt;br /&gt;
&lt;br /&gt;
INTname18=URXC@SERIAL,$012,UCSR0B.RXCIE0,UCSR0A.RXC0&lt;br /&gt;
&lt;br /&gt;
INTname19=UDRE,$013,UCSR0B.UDRIE0,UCSR0A.UDRE0&lt;br /&gt;
&lt;br /&gt;
INTname20=UTXC,$014,UCSR0B.TXCIE0,UCSR0A.TXC0&lt;br /&gt;
&lt;br /&gt;
INTname21=ADCC@ADC,$015,ADCSRA.ADIE,ADCSRA.ADIF&lt;br /&gt;
&lt;br /&gt;
INTname22=ERDY,$016,EECR.EERIE&lt;br /&gt;
&lt;br /&gt;
INTname23=ACI,$017,ACSR.ACIE,ACSR.ACI&lt;br /&gt;
&lt;br /&gt;
INTname24=TWI,$018,TWCR.TWIE,TWCR.TWINT&lt;br /&gt;
&lt;br /&gt;
INTname25=SPM,$019,SPMCSR.SPMIE&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
You can see that INT0 comes first. And that the address is $001 which is &amp;amp;H0001. So when INT0 occurs, the processor will jump to address 1.&lt;br /&gt;
&lt;br /&gt;
When you did not define an ISR (ON INT0) , the compiler will insert a RETI instruction. So nothing bad will happen to your code.&lt;br /&gt;
&lt;br /&gt;
When you did define an ISR , the compiler will insert a JUMP to your interrupt routine. When your interrupt ends, the RETI will let the processor continue where it was when the interrupt occurred.&lt;br /&gt;
&lt;br /&gt;
In the example when we only use the ISR with the lowest address all other addresses in the table would get a RETI instruction. And the user code could start at &amp;amp;H1A (one address after $19).&lt;br /&gt;
&lt;br /&gt;
Now that is not so bad but there are also processors with bigger tables and with tables that require 2 words for a JUMP. You waste a lot of space this way.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
So what does $REDUCEIVR do? It will determine which interrupt you have used has the highest address. And it will use the address after that as the user code start.&lt;br /&gt;
&lt;br /&gt;
This means that if we use only INT0 and we use $REDUCEIVR, the user code will start at address &amp;amp;H2 ($2). So you will save a lot of code space this way.&lt;br /&gt;
&lt;br /&gt;
Ok so why isn't this enabled by default? There is a catch&amp;amp;nbsp;: when your code has an interrupt enabled and there is no matching ON &amp;amp;lt;INT&amp;amp;gt; the processor will jump into the user code and this will create a crash almost for sure.&lt;br /&gt;
&lt;br /&gt;
So our advise&amp;amp;nbsp;: use this when you understand what this option does, and use it when your application is finished. In any case, retest the complete application when the option is enabled.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&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;See also&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt;[[$LOADER]]&amp;amp;nbsp;,&amp;amp;nbsp;&amp;lt;/span&amp;gt;[[CONFIG INTVECTORSELECTION|CONFIG INTVECTORSELECTION]]&amp;amp;nbsp;,&amp;amp;nbsp;[[$BOOTVECTOR]]&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;span style=&amp;quot;font-family: 'Courier New'; font-weight: bold; color: rgb(0, 0, 128);&amp;quot;&amp;gt;$REDUCEIVR&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Languages}}&lt;br /&gt;
&lt;br /&gt;
[[Category:BASCOM Language Reference]]&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>