<?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>S12 / MagniV MicrocontrollersのトピックCode Change ASM to C Code</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Code-Change-ASM-to-C-Code/m-p/519125#M12544</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below I want to change the ASM to C code.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Core is S12P.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Asm ANDCC # 0x7Fu;  // Logical AND with CCR&lt;/P&gt;&lt;P&gt;Asm JSR Send_Command;  Jump to Subroutine Send_Command Function&lt;/P&gt;&lt;P&gt;Asm SEI;  Set interrupt bit&lt;/P&gt;&lt;P&gt;Asm CLI  Clear Interrupt bit&lt;/P&gt;&lt;P&gt;Asm STOP  STOP&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank BR&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 13 Jun 2016 01:00:36 GMT</pubDate>
    <dc:creator>michaellee</dc:creator>
    <dc:date>2016-06-13T01:00:36Z</dc:date>
    <item>
      <title>Code Change ASM to C Code</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Code-Change-ASM-to-C-Code/m-p/519125#M12544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below I want to change the ASM to C code.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Core is S12P.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Asm ANDCC # 0x7Fu;  // Logical AND with CCR&lt;/P&gt;&lt;P&gt;Asm JSR Send_Command;  Jump to Subroutine Send_Command Function&lt;/P&gt;&lt;P&gt;Asm SEI;  Set interrupt bit&lt;/P&gt;&lt;P&gt;Asm CLI  Clear Interrupt bit&lt;/P&gt;&lt;P&gt;Asm STOP  STOP&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank BR&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jun 2016 01:00:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Code-Change-ASM-to-C-Code/m-p/519125#M12544</guid>
      <dc:creator>michaellee</dc:creator>
      <dc:date>2016-06-13T01:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: Cord Change ASM to C Cord</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Code-Change-ASM-to-C-Code/m-p/519126#M12545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Michael,&lt;/P&gt;&lt;P&gt;The asm CLI; and asm SEI; commands are defined in hidef.h file as EnableInterrupts; and DisableInterrupts; commands.&lt;/P&gt;&lt;P&gt;The same format might be used for other commands. For example:&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14658077163459586 jive_text_macro" data-renderedposition="112_8_1192_16" jivemacro_uid="_14658077163459586"&gt;&lt;P&gt;#define ClearSbit {__asm ANDCC # 0x7Fu;}&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;or&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_1465807722952871" data-renderedposition="154_8_1192_16" jivemacro_uid="_1465807722952871"&gt;&lt;P&gt;#define StopMode {__asm STOP;}&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code for flash command with wait loop in RAM might be defined as an array of opcodes. For example:&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14658077324596326 jive_text_macro" data-renderedposition="248_8_1192_64" jivemacro_uid="_14658077324596326"&gt;&lt;P&gt;static byte Send_Command[]=&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; 0x14, 0x10, 0x1C, 0x01, 0x06, 0x80, 0x1F, 0x01, 0x06, 0x80, 0xFB, 0x10, 0xEF, 0x3D&lt;/P&gt;&lt;P&gt;};&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;And the command for execution will be&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14658077482793566 jive_text_macro" data-renderedposition="338_8_1192_16" jivemacro_uid="_14658077482793566"&gt;&lt;P&gt;asm JSR Send_Command;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or you may directly write C code and let linker to place it into RAM. For example:&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14658077674553360 jive_text_macro" data-renderedposition="406_8_1192_144" jivemacro_uid="_14658077674553360"&gt;&lt;P&gt;#pragma CODE_SEG __NEAR_SEG MY_RAM&lt;/P&gt;&lt;P&gt;void Send_Command2(void)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;DisableInterrupts;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //start critical section&lt;/P&gt;&lt;P&gt;&amp;nbsp; FSTAT_CCIF = 1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //launch command&lt;/P&gt;&lt;P&gt;&amp;nbsp; while(FSTAT_CCIF == 0); //wait for done&lt;/P&gt;&lt;P&gt;EnableInterrupts;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //end critical section&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;#pragma CODE_SEG DEFAULT&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;And the command for execution will be&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="_jivemacro_uid_14658077790009201 jive_macro_code jive_text_macro" data-renderedposition="576_8_1192_16" jivemacro_uid="_14658077790009201"&gt;&lt;P&gt;Send_Command2();&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;Note: In CW5.1, the MY_RAM must be a user segment defined in prm file. Placing this code into DEFAULT_RAM doesn’t work. For example:&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14658077862106911 jive_text_macro" data-renderedposition="618_8_1192_160" jivemacro_uid="_14658077862106911"&gt;&lt;P&gt;SEGMENTS&lt;/P&gt;&lt;P&gt;//..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RAM_ROUTINE&amp;nbsp; = READ_WRITE&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x3FF0 TO 0x3FFF;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //space for flash routine&lt;/P&gt;&lt;P&gt;//..&lt;/P&gt;&lt;P&gt;END&lt;/P&gt;&lt;P&gt;PLACEMENT&lt;/P&gt;&lt;P&gt;//..&lt;/P&gt;&lt;P&gt;MY_RAM INTO&amp;nbsp; RAM_ROUTINE;&lt;/P&gt;&lt;P&gt;//..&lt;/P&gt;&lt;P&gt;END&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;Radek&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jun 2016 08:50:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Code-Change-ASM-to-C-Code/m-p/519126#M12545</guid>
      <dc:creator>RadekS</dc:creator>
      <dc:date>2016-06-13T08:50:30Z</dc:date>
    </item>
  </channel>
</rss>

