Marc Trachy

HC908QT2 Monitor mode run

Discussion created by Marc Trachy on Oct 4, 2008
Latest reply on Oct 7, 2008 by bigmac
    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).  The problem I have now is that I cannot seem to run a user program.  I can upload an S19 file, like the one attached.   I don't actually write to the reset vector (so that it stays blank, making it easier to get into monitor mode).  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).  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.  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. 

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.

It doesn't seem to run the program, and the chip is back to responding to my serial inputs.  I am rather confused by this.

I know I could use a premade program to do the programming, but since I'm doing this for fun, I would rather not.