Exact match. Not showing close matches.
PICList
Thread
'[SX] PSXM/GD book: NOP and Registers/Program windo'
2006\01\02@004331
by
Petern/a
|
|
[PSXM/GD = Programming the SX Microcontroller, by Gunther Daubach]
Regarding Pg. 21(bot)-22(top) on adding NOP instructions to slow down the looping:
I notice in the Program section of the Registers debug window that the debugger "steps" differently from what I would have expected. It steps from clrb to the first nop, then directly to the jmp.
Loop
clrb rc.7
nop
nop
nop
setb rc.7
jmp Loop
The setb instruction does get executed; it's just that the debugger steps into the first nop, stepping "over" all the other nops and beyond the setb instruction to the subsequent jmp. The intended effect of the 3 nops --to delay the looping at that precise point-- also works, so the nops are getting executed (i.e., taking up one cycle each doing nothing) and the setb is causing the LED to change state so it too is obviously being executed.
I'm curious about why the debugger is designed to step in this way, rather than stepping into each nop and into the setb instructions? (E.g., are the 3 nops and the setb somehow bundled into a single 4-cycle-long version of setb that gets executed at the point the first nop is reached?)
PAR
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=103075
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)
2006\01\02@021528 by g_daubachn/a
|
|
PAR,
this behavior of the debugger is caused by the internal structure of the SX chips which causes that the debugger can't handle NOP instructions correctly. So, it is not possible to set a breakpoint on a NOP instruction, and single-stepping along NOP instructions also causes strange behavior. Actually, single-stepping is like continuously setting a breakpoint on the next instruction, and this is why the debugger seems to run out of sync when you try to step the NOPs. You are right, although the display is mis-leading, the SX executes all the instructions in correct order, and does not skip any of them.
Instead of the NOP, you might consider using any other single-cycle instruction but keep in mind that all other instructions modify some register contents, or the flags. For example, if you use and w, #$ff instead, this will preserve the contents of w but might change the Z flag, depending on the current contents of w. In the little loop sample code, this does not matter but it might in other contexts.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=103075#m103080
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)
2006\01\02@064340 by lordsteven/a
|
|
The SX Key IDE recommends "PAGE $" as a NOP. I like to use that if I'm not doing any complicated program execution requiring that the program bank bits in the STATUS register be different than the high-order bits of PC.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=103075#m103099
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)
More... (looser matching)
- Last day of these posts
- In 2006
, 2007 only
- Today
- New search...