<?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>8-bit MicrocontrollersのトピックRe: Set Program Counter</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Set-Program-Counter/m-p/192988#M14922</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hey, even better! I couldn't find the proper syntax for dc.w in the "C" asm command. Didn't think to try DCW.&lt;BR /&gt;$9E means a two byte opcode. There are single byte opcodes that work:&lt;BR /&gt;&lt;BR /&gt;__asm DCB $8D;&lt;BR /&gt;__asm DCB $AC;&lt;BR /&gt;&lt;BR /&gt;But I thought maybe they would get used later, as you would want to use single byte opcodes first.&lt;BR /&gt;But I just made that up, I suppose any current illegal opcode could get used at any time.&lt;BR /&gt;Is there any statement that a certain opcode will never get used?&lt;BR /&gt;&lt;BR /&gt;See page 234 in HCS08RMv1/D&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Feb 2008 13:37:07 GMT</pubDate>
    <dc:creator>JimDon</dc:creator>
    <dc:date>2008-02-22T13:37:07Z</dc:date>
    <item>
      <title>Set Program Counter</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Set-Program-Counter/m-p/192981#M14915</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, I want call a function, which set the Program Counter and resets the system. Is there somebody who has any experiences? I want to program it in C. Best Regards MEV&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Feb 2008 21:34:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Set-Program-Counter/m-p/192981#M14915</guid>
      <dc:creator>Mev</dc:creator>
      <dc:date>2008-02-21T21:34:57Z</dc:date>
    </item>
    <item>
      <title>Re: Set Program Counter</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Set-Program-Counter/m-p/192982#M14916</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi,&lt;/DIV&gt;&lt;DIV&gt;You could either jump to place where there is no memory or you could wait for a watchdog (COP) reset.&lt;/DIV&gt;&lt;DIV&gt;Another would be to execute an illegal instruction, that would reset the PC.&lt;/DIV&gt;&lt;DIV&gt;You could ofcourse load the reset vector and jump to it, but an all those cases, I don't think that you would get a true&amp;nbsp;system reset.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Ake&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Feb 2008 23:42:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Set-Program-Counter/m-p/192982#M14916</guid>
      <dc:creator>Ake</dc:creator>
      <dc:date>2008-02-21T23:42:24Z</dc:date>
    </item>
    <item>
      <title>Re: Set Program Counter</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Set-Program-Counter/m-p/192983#M14917</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;I do not want that the Watchdog initiate the reset. I want to solve the problem by a vector and set the program counter. How can I realize that? Could you give me an example? Thanks.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2008 00:05:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Set-Program-Counter/m-p/192983#M14917</guid>
      <dc:creator>Mev</dc:creator>
      <dc:date>2008-02-22T00:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: Set Program Counter</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Set-Program-Counter/m-p/192984#M14918</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;You originally stated that you required to "reset the system".&amp;nbsp; This will not occur if you simply jump to the location defined by the reset vector.&amp;nbsp; For the hardware to also undergo reset, you will need to use one of the three methods outlined by Ake - illegal op code, illegal address, or COP timeout.&amp;nbsp; The illegal op code can be implemented using inline assembler.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Mac&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2008 01:22:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Set-Program-Counter/m-p/192984#M14918</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2008-02-22T01:22:50Z</dc:date>
    </item>
    <item>
      <title>Re: Set Program Counter</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Set-Program-Counter/m-p/192985#M14919</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;Hi Mev,&lt;BR /&gt;&lt;BR /&gt;The following code is part of my new book about the HCS08. It is a simple software reset based on the illegal opcode feature available in the HCS08 CPU.&lt;BR /&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;void reset(void){  unsigned int temp;  temp = 0x9E00;  #asm    LDHX  @temp // load the address of temp into H:X    JMP   ,X // jump to the address pointed to by H:X  #endasm}&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;To reset your system, simply call reset().&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;Message Edited by fabio on &lt;SPAN class="date_text"&gt;2008-02-21&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;09:54 PM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:46:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Set-Program-Counter/m-p/192985#M14919</guid>
      <dc:creator>fabio</dc:creator>
      <dc:date>2020-10-29T09:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: Set Program Counter</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Set-Program-Counter/m-p/192986#M14920</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Cute, but lets not use the stack at all, and save some Flash.&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;const static int _illopcode = 0x9e00;#define RESET()  asm  JMP _illopcode; &lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:46:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Set-Program-Counter/m-p/192986#M14920</guid>
      <dc:creator>JimDon</dc:creator>
      <dc:date>2020-10-29T09:46:29Z</dc:date>
    </item>
    <item>
      <title>Re: Set Program Counter</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Set-Program-Counter/m-p/192987#M14921</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;why not &lt;SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;#define ILLEGAL_OPCODE 0x9E00&lt;BR /&gt;#define RESET()&amp;nbsp; __asm DCW ILLEGAL_OPCODE&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE&gt;(does it actually need 2 bytes, or does a single DCB 0x9E also work?)

Daniel

&lt;/PRE&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;Message Edited by CompilerGuru on &lt;SPAN class="date_text"&gt;2008-02-22&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;06:19 AM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:46:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Set-Program-Counter/m-p/192987#M14921</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2020-10-29T09:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: Set Program Counter</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Set-Program-Counter/m-p/192988#M14922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hey, even better! I couldn't find the proper syntax for dc.w in the "C" asm command. Didn't think to try DCW.&lt;BR /&gt;$9E means a two byte opcode. There are single byte opcodes that work:&lt;BR /&gt;&lt;BR /&gt;__asm DCB $8D;&lt;BR /&gt;__asm DCB $AC;&lt;BR /&gt;&lt;BR /&gt;But I thought maybe they would get used later, as you would want to use single byte opcodes first.&lt;BR /&gt;But I just made that up, I suppose any current illegal opcode could get used at any time.&lt;BR /&gt;Is there any statement that a certain opcode will never get used?&lt;BR /&gt;&lt;BR /&gt;See page 234 in HCS08RMv1/D&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2008 13:37:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Set-Program-Counter/m-p/192988#M14922</guid>
      <dc:creator>JimDon</dc:creator>
      <dc:date>2008-02-22T13:37:07Z</dc:date>
    </item>
    <item>
      <title>Re: Set Program Counter</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Set-Program-Counter/m-p/192989#M14923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;Hi Jim and Compilerguru,&lt;BR /&gt;&lt;BR /&gt;Your alternatives are cool!&lt;BR /&gt;&lt;BR /&gt;Compilerguru: no, you can't use only 0x9E as a single byte opcode because this is a escape code for the second opcode page (0x9E means that a second opcode byte follows). In case the second byte is a valid opcode (there are some of them defined on page 2), the instruction is valid and no ILAD reset will occur.&lt;BR /&gt;&lt;BR /&gt;Jim: no, you can't use 0x8D and 0xAC because they are already used in the HCS08 CPU v4 (Flexis devices). These opcodes are used for the RTC and CALL instructions.&lt;BR /&gt;&lt;BR /&gt;Other alternatives for ILAD reset:&lt;BR /&gt;&lt;BR /&gt;1- Attempt to execute the STOP instruction when it is disabled (if your application is not using low power stop modes);&lt;BR /&gt;2 - Attempt to execute the BGND instruction when background debug is not active. This is very interesting. I always wondered why Freescale designed this is instruction to be illegal when debug mode is not active. If it was treated just as a NOP, it would be harmless when out of debug mode and act as a breakpoint when in debug mode.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;Message Edited by fabio on &lt;SPAN class="date_text"&gt;2008-02-22&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;12:04 PM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2008 20:03:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Set-Program-Counter/m-p/192989#M14923</guid>
      <dc:creator>fabio</dc:creator>
      <dc:date>2008-02-22T20:03:10Z</dc:date>
    </item>
    <item>
      <title>Re: Set Program Counter</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Set-Program-Counter/m-p/192990#M14924</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Well, I am quite disappointed that the document I mentioned does not reflect the Flexis instructions.&lt;BR /&gt;&lt;BR /&gt;This is supposed to the reference manual for Flexis as well.&lt;BR /&gt;&lt;BR /&gt;I am also very upset with the CFRM that is supposed to be for Flexis and is so old it does not even mention V1.&lt;BR /&gt;&lt;BR /&gt;However, my gut feel for single byte opcodes was correct. I did start off designing CPUs when you did that with 7400 chips, and using an unused opcode was actually a big no no,. Of course the programmers did any way.&lt;BR /&gt;&lt;BR /&gt;Is it possible that we could get Freescale to actually designate an opcode as RESET? Then we could be sure. It cold be a two byter, as you don't do this very often.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2008 22:01:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Set-Program-Counter/m-p/192990#M14924</guid>
      <dc:creator>JimDon</dc:creator>
      <dc:date>2008-02-22T22:01:38Z</dc:date>
    </item>
    <item>
      <title>Re: Set Program Counter</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Set-Program-Counter/m-p/192991#M14925</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Jim,&lt;BR /&gt;&lt;BR /&gt;I agree with you in all aspects: the Coldfire family reference manual and the HCS08 reference manual need some urgent review to include the newest features added to both families.&lt;BR /&gt;&lt;BR /&gt;The HCS08 reference manual is very old and references only the GB and GT devices.&lt;BR /&gt;&lt;BR /&gt;For the CFv1, there is a white paper (V1CFWP.pdf) that describes the CFv1 core and sheds some light on the V1 core operation. This white paper also compares the CF ISA_C against the CF ISA_A and the S08 ISA.&lt;BR /&gt;&lt;BR /&gt;It would be nice if Freescale could merge these documents into a single Coldfire reference documentation.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2008 23:53:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Set-Program-Counter/m-p/192991#M14925</guid>
      <dc:creator>fabio</dc:creator>
      <dc:date>2008-02-22T23:53:31Z</dc:date>
    </item>
    <item>
      <title>Re: Set Program Counter</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Set-Program-Counter/m-p/192992#M14926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Well HCS08RMV1 has a date 05/2007 and Flexis QE was cast in stone by then, so there is no excuse.&lt;BR /&gt;Whats more this document should be more family oriented, and not use specific processors&amp;nbsp;&lt;BR /&gt;Or a new one for Flexis.&lt;BR /&gt;&lt;BR /&gt;V1CFWP is 30% marketing hype, and leaves out things and it is a really pain to sort out the other document. You can't cover a processor like the V1 in 72 pages.&lt;BR /&gt;&lt;BR /&gt;It such a shame - they went to all this trouble, and then just couldn't manage to get a tech writer on the case.&lt;BR /&gt;Same with example code - weak. That's why we answer the same questions over and over.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Feb 2008 00:22:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Set-Program-Counter/m-p/192992#M14926</guid>
      <dc:creator>JimDon</dc:creator>
      <dc:date>2008-02-23T00:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: Set Program Counter</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Set-Program-Counter/m-p/192993#M14927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;For HC08, I used illegal Opcode to reset MCU and it works, and you can know the cause of reset, because they have a register that indicates this.&lt;BR /&gt;I guess that for HS08 this also works.&lt;BR /&gt;I suggest this procedure if you want reset MCU.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2008 03:50:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Set-Program-Counter/m-p/192993#M14927</guid>
      <dc:creator>erooll</dc:creator>
      <dc:date>2008-02-27T03:50:21Z</dc:date>
    </item>
  </channel>
</rss>

