<?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 Re: Call a subroutine from a separate file in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Call-a-subroutine-from-a-separate-file/m-p/176071#M5718</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 want to build the 2 .asm file separately and then link them together.&lt;/P&gt;&lt;P&gt;Am I right?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then you should&lt;/P&gt;&lt;P&gt;&amp;nbsp; 1- Create a file SR_Test.inc, where you have declaration for all symbols from SR_Test.asm&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; that are visible from outside of the file.&lt;/P&gt;&lt;P&gt;&amp;nbsp; 2- Include that .inc file in main.asm and remove include from SR_Test.asm&lt;/P&gt;&lt;P&gt;&amp;nbsp; 3. In SR_Test.asm, include directive.inc and make label SR_Test_Function visible from&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outside of the module (using directive XDEF)&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>Thu, 13 Jan 2011 23:11:00 GMT</pubDate>
    <dc:creator>CrasyCat</dc:creator>
    <dc:date>2011-01-13T23:11:00Z</dc:date>
    <item>
      <title>Call a subroutine  from a separate file</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Call-a-subroutine-from-a-separate-file/m-p/176070#M5717</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;It is my first time to write an application with a main program in a file and several subroutines in different files for a HCS08QE MCU. Attached is a program for testing. After compling it, I got the following message:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A13003: Value is truncated to one byte&lt;/P&gt;&lt;P&gt;SR_Test.asm line 3&lt;/P&gt;&lt;P&gt;A13003: Value is truncated to one byte&lt;/P&gt;&lt;P&gt;SR_Test.asm line 4&lt;/P&gt;&lt;P&gt;A1104: Undeclared user defined symbol:&amp;nbsp; PTCD&lt;/P&gt;&lt;P&gt;SR_Test.asm line 3&lt;/P&gt;&lt;P&gt;Compile failed&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The compiler regards the command&amp;nbsp; "BSET 7,PTCD" in the main program as a direct addressing instruction since the address of PTCD is 0x04. However, it is not the case for the same command in the subroutine.&lt;/P&gt;&lt;P&gt;I tried many times by adding XDEF, XREF, XREF.B to the .asm files, and the object code file to Project.prm, but I got other error messages.&lt;/P&gt;&lt;P&gt;Please give me advice because I have spend a long time to learn this which should be a straightforward issue.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Jan 2011 22:48:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Call-a-subroutine-from-a-separate-file/m-p/176070#M5717</guid>
      <dc:creator>sctang</dc:creator>
      <dc:date>2011-01-13T22:48:52Z</dc:date>
    </item>
    <item>
      <title>Re: Call a subroutine from a separate file</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Call-a-subroutine-from-a-separate-file/m-p/176071#M5718</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 want to build the 2 .asm file separately and then link them together.&lt;/P&gt;&lt;P&gt;Am I right?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then you should&lt;/P&gt;&lt;P&gt;&amp;nbsp; 1- Create a file SR_Test.inc, where you have declaration for all symbols from SR_Test.asm&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; that are visible from outside of the file.&lt;/P&gt;&lt;P&gt;&amp;nbsp; 2- Include that .inc file in main.asm and remove include from SR_Test.asm&lt;/P&gt;&lt;P&gt;&amp;nbsp; 3. In SR_Test.asm, include directive.inc and make label SR_Test_Function visible from&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outside of the module (using directive XDEF)&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>Thu, 13 Jan 2011 23:11:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Call-a-subroutine-from-a-separate-file/m-p/176071#M5718</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2011-01-13T23:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: Call a subroutine from a separate file</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Call-a-subroutine-from-a-separate-file/m-p/176072#M5719</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, CrasyCat,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It works. This is what I need.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sctang&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Jan 2011 19:37:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Call-a-subroutine-from-a-separate-file/m-p/176072#M5719</guid>
      <dc:creator>sctang</dc:creator>
      <dc:date>2011-01-14T19:37:51Z</dc:date>
    </item>
  </channel>
</rss>

