<?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>CodeWarrior for MCUのトピックRe: CodeWarrior V5.1 for 9S08QG8 beginner questions</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/CodeWarrior-V5-1-for-9S08QG8-beginner-questions/m-p/132446#M1271</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Do you have a #define _main in main.c prior to including the header file?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;CrasyCat&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 May 2007 18:12:56 GMT</pubDate>
    <dc:creator>CrasyCat</dc:creator>
    <dc:date>2007-05-02T18:12:56Z</dc:date>
    <item>
      <title>CodeWarrior V5.1 for 9S08QG8 beginner questions</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/CodeWarrior-V5-1-for-9S08QG8-beginner-questions/m-p/132441#M1266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I pressed the wrong key so the message got put on without any text.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've just started using CodeWarrior for C code developement. I am after some fairly fundamental info about where to declare variables and how to make them available to other modules. I have used a Keil C compiler for 8051s before now and there were tons of documentation and examples published that helped me get a head start. My simple trial code I have tried so far has declared variables in the 'home'&amp;nbsp; .c module and declared them as external in the 'away' .c module. There must be a more elegant way of doing this. I guess what I need is some kind of overall project template. I guess if I look long enough I'll find what I need but some pointers (sorry about the pun) would be handy.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've already had some very useful help from you guys regarding the processor. I expect there'll be quite a lot more in the coming weeks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Steve&lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2007 16:29:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/CodeWarrior-V5-1-for-9S08QG8-beginner-questions/m-p/132441#M1266</guid>
      <dc:creator>stevec</dc:creator>
      <dc:date>2007-05-02T16:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: CodeWarrior V5.1 for 9S08QG8 beginner questions</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/CodeWarrior-V5-1-for-9S08QG8-beginner-questions/m-p/132442#M1267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I would recommend to use usual ANSI C modular programming rules here.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I would define the variables in a C source file and declare them (with extern keyword) in a header file (.h).&lt;/DIV&gt;&lt;DIV&gt;They you just need to include the header file in each C source file, which wants to use the variable.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;CrasyCat&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2007 16:31:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/CodeWarrior-V5-1-for-9S08QG8-beginner-questions/m-p/132442#M1267</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2007-05-02T16:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: CodeWarrior V5.1 for 9S08QG8 beginner questions</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/CodeWarrior-V5-1-for-9S08QG8-beginner-questions/m-p/132443#M1268</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;But wouldn't I have to have a header file for the variables used in the 'home' module which didn't declare them as extern.&lt;BR /&gt;&lt;BR /&gt;I seem to recall using a header file with something like&lt;BR /&gt;&lt;BR /&gt;#ifdef _MAIN&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; //if header is included in module 'main'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;byte variable1;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; //variable used in main&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;void main_function1(void); //prototype for function in 'main'&lt;BR /&gt;&lt;BR /&gt;#else&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; //this header file included in module other than 'main' so define externals&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;extern byte variable1; // variable not defined in this module so external&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;extern void main_function1(void);&lt;BR /&gt;&lt;BR /&gt;#endif&lt;BR /&gt;&lt;BR /&gt;and used a header file like this which declared variables and functions for each module.&lt;BR /&gt;&lt;BR /&gt;Can&amp;nbsp; I do something similar with CodeWarrior?&lt;BR /&gt;&lt;BR /&gt;Steve&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2007 17:09:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/CodeWarrior-V5-1-for-9S08QG8-beginner-questions/m-p/132443#M1268</guid>
      <dc:creator>stevec</dc:creator>
      <dc:date>2007-05-02T17:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: CodeWarrior V5.1 for 9S08QG8 beginner questions</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/CodeWarrior-V5-1-for-9S08QG8-beginner-questions/m-p/132444#M1269</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Yes this is working in CodeWarrior too.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;CrasyCat&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2007 17:22:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/CodeWarrior-V5-1-for-9S08QG8-beginner-questions/m-p/132444#M1269</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2007-05-02T17:22:03Z</dc:date>
    </item>
    <item>
      <title>Re: CodeWarrior V5.1 for 9S08QG8 beginner questions</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/CodeWarrior-V5-1-for-9S08QG8-beginner-questions/m-p/132445#M1270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Ok...I've given that a try.&lt;BR /&gt;I have used Device Initialisation to set up PB7 as o/p and to interrupt on 1ms timer. Interrupt code just says if timer1_count &amp;gt; 5000 then toggle PB7 and reset count.&lt;BR /&gt;&lt;BR /&gt;I am initialising a variable&amp;nbsp; unsigned int timer1_count in source main.c and incrementing it in the timer interrupt routine in MCUinit.c. I have included the header file main.h in both main.c and MCUinit.c, which is:&lt;BR /&gt;&lt;BR /&gt;#ifdef _main&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;unsigned int timer1_count;&lt;BR /&gt;&lt;BR /&gt;#else&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;extern unsigned int timer1_count;&lt;BR /&gt;&lt;BR /&gt;#endif&lt;BR /&gt;&lt;BR /&gt;I get a warning L1823: External object timer1_count in......MCUinit.c.o&amp;nbsp;&amp;nbsp; created by default.&lt;BR /&gt;&lt;BR /&gt;Have I not used the correct name in the #ifdef line (have tried _main_,&amp;nbsp; __main also)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2007 17:53:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/CodeWarrior-V5-1-for-9S08QG8-beginner-questions/m-p/132445#M1270</guid>
      <dc:creator>stevec</dc:creator>
      <dc:date>2007-05-02T17:53:23Z</dc:date>
    </item>
    <item>
      <title>Re: CodeWarrior V5.1 for 9S08QG8 beginner questions</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/CodeWarrior-V5-1-for-9S08QG8-beginner-questions/m-p/132446#M1271</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Do you have a #define _main in main.c prior to including the header file?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;CrasyCat&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2007 18:12:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/CodeWarrior-V5-1-for-9S08QG8-beginner-questions/m-p/132446#M1271</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2007-05-02T18:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: CodeWarrior V5.1 for 9S08QG8 beginner questions</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/CodeWarrior-V5-1-for-9S08QG8-beginner-questions/m-p/132447#M1272</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Ooops...thats exactly it. Many thanks.&lt;BR /&gt;&lt;BR /&gt;Steve&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2007 18:23:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/CodeWarrior-V5-1-for-9S08QG8-beginner-questions/m-p/132447#M1272</guid>
      <dc:creator>stevec</dc:creator>
      <dc:date>2007-05-02T18:23:04Z</dc:date>
    </item>
  </channel>
</rss>

