<?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: HC08 C Beginners Guide for CodeWarrior in Variables Declaration in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/HC08-C-Beginners-Guide-for-CodeWarrior-in-Variables-Declaration/m-p/133652#M3476</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Actually what i did was&lt;/DIV&gt;&lt;DIV&gt;count = @0x0081&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks a lot.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 26 Jun 2007 07:04:32 GMT</pubDate>
    <dc:creator>el_shaka</dc:creator>
    <dc:date>2007-06-26T07:04:32Z</dc:date>
    <item>
      <title>HC08 C Beginners Guide for CodeWarrior in Variables Declaration</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/HC08-C-Beginners-Guide-for-CodeWarrior-in-Variables-Declaration/m-p/133648#M3472</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi everybody!!&lt;/SPAN&gt;&lt;SPAN&gt;&lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif"&gt;&lt;IMG alt=":smileyhappy:" class="emoticon emoticon-smileyhappy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" title="Smiley Happy" /&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anybody knows about a document where it explains the way of how do special Things using C and codewarrior. Ive been using MC908AP8 for quite a while using only assembler.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now im having some problems because i do not know how to use C with Assembler, specifically with variable declarations and how to refer to an specific memory location as a variable.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Assume that i have a C code and I invoce a function in ASM. This function stores a result in, to say, $81, now i need that in my&amp;nbsp; C code, but i have no idea how to do it. Ive tried:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;count = 0x81; (failed)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#define count unsigned int 0x81; (failed)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and some other ways that ive found in the Hepl and in the forum.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;An example of my code is right here&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;void main (void)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; asm_code(); &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; // (It couts something and stores the final count in $81, it wont be over FF )&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; count = ????????????; ( I want to say that count = $81)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;SPAN&gt;Thanks a lot, an explanation, a link to some tutorial, a link to any manual, anything, please.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 12 May 2007 02:45:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/HC08-C-Beginners-Guide-for-CodeWarrior-in-Variables-Declaration/m-p/133648#M3472</guid>
      <dc:creator>el_shaka</dc:creator>
      <dc:date>2007-05-12T02:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: HC08 C Beginners Guide for CodeWarrior in Variables Declaration</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/HC08-C-Beginners-Guide-for-CodeWarrior-in-Variables-Declaration/m-p/133649#M3473</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Hello,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Try the following approach -&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Within a .c or .h file, use the following global variable definition -&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;extern char count @0x0081&lt;/FONT&gt;;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Then near the top of the .asm file in which you will be using the variable, include the line -&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&amp;nbsp; &lt;FONT face="Courier New"&gt;XREF&amp;nbsp; count&lt;/FONT&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Then simply refer to the variable name as required.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Regards,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Mac&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 12 May 2007 09:29:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/HC08-C-Beginners-Guide-for-CodeWarrior-in-Variables-Declaration/m-p/133649#M3473</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2007-05-12T09:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: HC08 C Beginners Guide for CodeWarrior in Variables Declaration</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/HC08-C-Beginners-Guide-for-CodeWarrior-in-Variables-Declaration/m-p/133650#M3474</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;try this out&lt;/DIV&gt;&lt;DIV&gt;count = *(int *)0x81;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 May 2007 09:16:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/HC08-C-Beginners-Guide-for-CodeWarrior-in-Variables-Declaration/m-p/133650#M3474</guid>
      <dc:creator>xiefei</dc:creator>
      <dc:date>2007-05-17T09:16:15Z</dc:date>
    </item>
    <item>
      <title>Re: HC08 C Beginners Guide for CodeWarrior in Variables Declaration</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/HC08-C-Beginners-Guide-for-CodeWarrior-in-Variables-Declaration/m-p/133651#M3475</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hello,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I hope that the next code give you an example and you can resolve tha task:&lt;BR /&gt;&lt;BR /&gt;byte aux[3];&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // This is the declaration in C&lt;BR /&gt;&lt;BR /&gt;asm{&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;&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;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LDHX #@aux&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;&lt;BR /&gt;&amp;nbsp; adquiere:&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; lda Some_Var &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sta ,X&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;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; incx&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpx #@aux+3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bne adquiere&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&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;&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;&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; I load the direction of aux in HX, but if I´not wrong if you put @aux you 've got the value of aux[0], @aux+1 value of aux[1] and so on.&lt;BR /&gt;&amp;nbsp; Try this:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mov @aux,@count or something else.&lt;BR /&gt;&lt;BR /&gt;Best regards&lt;BR /&gt;Pablo.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Jun 2007 20:46:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/HC08-C-Beginners-Guide-for-CodeWarrior-in-Variables-Declaration/m-p/133651#M3475</guid>
      <dc:creator>B_Conf</dc:creator>
      <dc:date>2007-06-07T20:46:05Z</dc:date>
    </item>
    <item>
      <title>Re: HC08 C Beginners Guide for CodeWarrior in Variables Declaration</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/HC08-C-Beginners-Guide-for-CodeWarrior-in-Variables-Declaration/m-p/133652#M3476</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Actually what i did was&lt;/DIV&gt;&lt;DIV&gt;count = @0x0081&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks a lot.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jun 2007 07:04:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/HC08-C-Beginners-Guide-for-CodeWarrior-in-Variables-Declaration/m-p/133652#M3476</guid>
      <dc:creator>el_shaka</dc:creator>
      <dc:date>2007-06-26T07:04:32Z</dc:date>
    </item>
  </channel>
</rss>

