<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to build and use interrupt vector tables. in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-build-and-use-interrupt-vector-tables/m-p/173017#M5443</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I was wondering if anybody could help me with building a vector table and also writing an interrupt service routine. I want to avoid using processor expert as much as possible. From what I've seen you can just build the table and then write the subroutines&amp;nbsp;corresponding to the vectors.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However there are some things I'm not sure on. Such as how to reset the system, how to write the subroutine itself, and how to build the vector table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If anybody could assist me on this it would be appreciated. &amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 18 Apr 2009 00:15:18 GMT</pubDate>
    <dc:creator>Albinoswordfish</dc:creator>
    <dc:date>2009-04-18T00:15:18Z</dc:date>
    <item>
      <title>How to build and use interrupt vector tables.</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-build-and-use-interrupt-vector-tables/m-p/173017#M5443</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I was wondering if anybody could help me with building a vector table and also writing an interrupt service routine. I want to avoid using processor expert as much as possible. From what I've seen you can just build the table and then write the subroutines&amp;nbsp;corresponding to the vectors.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However there are some things I'm not sure on. Such as how to reset the system, how to write the subroutine itself, and how to build the vector table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If anybody could assist me on this it would be appreciated. &amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Apr 2009 00:15:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-build-and-use-interrupt-vector-tables/m-p/173017#M5443</guid>
      <dc:creator>Albinoswordfish</dc:creator>
      <dc:date>2009-04-18T00:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to build and use interrupt vector tables.</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-build-and-use-interrupt-vector-tables/m-p/173018#M5444</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I assume you are building code for HC12 MCU.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In order to get working interrupts you need to:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;1 - Tell the compiler the function is an interrupt function. This is done specifying #pragma TRAP_PROC prior to the function implementation or using the interrupt keyword.&lt;BR /&gt;&lt;BR /&gt;Example&lt;BR /&gt;#pragma TRAP_PROC&lt;BR /&gt;void MY_Int(void){&lt;BR /&gt;}&lt;BR /&gt;or&lt;BR /&gt;__interrupt void MY_Int(void){&lt;BR /&gt;}&lt;BR /&gt;&amp;nbsp;&amp;nbsp;2 - If you are not building for small memory model, you also need to make sure the function is allocated in NON_BANKED memory.&lt;BR /&gt;&lt;BR /&gt;In this purpose enclose the function implementation between&lt;BR /&gt;#pragma CODE_SEG __SHORT_SEG NON_BANKED&lt;BR /&gt;and&lt;BR /&gt;#pragma CODE_SEG DEFAULT&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;3 - Initialize the vector table entry with the address of the function. This is done in the .prm file using command VECTOR ADDRESS.&lt;BR /&gt;&lt;BR /&gt;Example:&lt;BR /&gt;VECTOR ADDRESS 0xFFF0 MY_Int&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;4 - Initialize the peripheral appropriately and add code to enable the interrupt for the device.&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;5 - Make sure to enable the interrupts in your main function (you can use macro EnabelInterrupts from hidef.h in that purpose)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CrasyCat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2009 21:54:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-build-and-use-interrupt-vector-tables/m-p/173018#M5444</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2009-04-20T21:54:58Z</dc:date>
    </item>
  </channel>
</rss>

