<?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: HC908QT2 Monitor mode run</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/HC908QT2-Monitor-mode-run/m-p/191365#M14715</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Does the monitor mode 'RUN' instruction reset the device?&amp;nbsp; I thought it was merely supposed to execute the PULH and RTI instructions, allowing a program written into RAM to be run.&amp;nbsp; Is it possible to write directly to the flash with the monitor mode 'WRITE' and 'IWRITE' instructions?&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 06 Oct 2008 22:45:01 GMT</pubDate>
    <dc:creator>Impudence</dc:creator>
    <dc:date>2008-10-06T22:45:01Z</dc:date>
    <item>
      <title>HC908QT2 Monitor mode run</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/HC908QT2-Monitor-mode-run/m-p/191363#M14713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; I have been able to enter monitor mode, write to ram, verify the ram write, and even blink an LED from monitor mode (by sending commands to write to PTA).&amp;nbsp; The problem I have now is that I cannot seem to run a user program.&amp;nbsp; I can upload an S19 file, like the one attached.&amp;nbsp;&amp;nbsp; I don't actually write to the reset vector (so that it stays blank, making it easier to get into monitor mode).&amp;nbsp; Instead, I use the monitor mode READSP command (call the returned data SP_plus_1), and write what would have gone into the reset vector into (SP_plus_1 + 4) and (SP_plus_1+5).&amp;nbsp; This should, as I understand it, put the address of the beginning of the program into the stack at the point where the return address should be stored.&amp;nbsp; I don't know if it increments the program counter before it puts it on the stack, or after it pops it from the stack, so I added a NOP instruction to the beginning of the program I want to run, just to be sure.&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;SPAN&gt;Once I've edited the stack in this way, I send the RUN monitor mode command....and nothing happens except that the stack pointer (which was 0x00FA) is now 0x00FF, indicating that it's executed the PULH and RTI instructions.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It doesn't seem to run the program, and the chip is back to responding to my serial inputs.&amp;nbsp; I am rather confused by this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I know I could use a premade program to do the programming, but since I'm doing this for fun, I would rather not.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 05 Oct 2008 05:00:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/HC908QT2-Monitor-mode-run/m-p/191363#M14713</guid>
      <dc:creator>Impudence</dc:creator>
      <dc:date>2008-10-05T05:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: HC908QT2 Monitor mode run</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/HC908QT2-Monitor-mode-run/m-p/191364#M14714</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;There seems to be some misunderstanding about the reset process, and the reset vector.&amp;nbsp; The stack pointer plays no part.&amp;nbsp; When the reset vector is fetched from location $FFFE, it is used to set the program counter (PC).&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;For the device you are using, the stack pointer should not be altered from its reset default position ($00FF) without a specific reason.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;From the contents of your S19 file, your program appears to commence at address $00B0 within RAM.&amp;nbsp; Additionally, if you were to use this file to program the flash memory, the reset vector would, in fact, point to the start of your program within RAM.&amp;nbsp; But this is not allowable for POR since the RAM contents are volatile.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Within your source assembly code, I might suggest that you ORG to the start of flash memory prior to the start of your code, so that non-volatile storage is used.&amp;nbsp;&amp;nbsp;A simple test program might have the following structure.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp; ORG&amp;nbsp; ROMStart&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;START:&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;; Initialisation code&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;MAIN:&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Main program loop&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; JMP&amp;nbsp;&amp;nbsp; MAIN&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;; Loop always&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp; ORG&amp;nbsp; $FFFE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Reset vector location&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;DC.W&amp;nbsp; START&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Start of program&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&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>Mon, 06 Oct 2008 10:42:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/HC908QT2-Monitor-mode-run/m-p/191364#M14714</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2008-10-06T10:42:47Z</dc:date>
    </item>
    <item>
      <title>Re: HC908QT2 Monitor mode run</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/HC908QT2-Monitor-mode-run/m-p/191365#M14715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Does the monitor mode 'RUN' instruction reset the device?&amp;nbsp; I thought it was merely supposed to execute the PULH and RTI instructions, allowing a program written into RAM to be run.&amp;nbsp; Is it possible to write directly to the flash with the monitor mode 'WRITE' and 'IWRITE' instructions?&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2008 22:45:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/HC908QT2-Monitor-mode-run/m-p/191365#M14715</guid>
      <dc:creator>Impudence</dc:creator>
      <dc:date>2008-10-06T22:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: HC908QT2 Monitor mode run</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/HC908QT2-Monitor-mode-run/m-p/191366#M14716</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;The operation of the RUN monitor command assumes that the current monitor operation was effectively caused by execution of a SWI&amp;nbsp;instruction, and so performs the usual ISR exit process.&amp;nbsp; If the return address on the stack should be the entry point to the program, the initialisation code would then run, but&amp;nbsp;MCU reset would not have taken place.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;A reset from any source will always attempt to load the contents of the reset vector to the program counter&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The WRITE and IWRITE commands do not alter the contents of flash memory.&amp;nbsp; Erase and programming procedures are required.&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>Tue, 07 Oct 2008 20:59:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/HC908QT2-Monitor-mode-run/m-p/191366#M14716</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2008-10-07T20:59:57Z</dc:date>
    </item>
  </channel>
</rss>

