Hiya, Should I post the source code I created from the ICD download on my web page? I held off because seeing the code is one thing, but you do not see how the ICD box interfaces to it (there is a *lot* of communications including resets going on there). Before I post it, I want to change the registers (0x018E and 0x018F) to the Microchip specified names. > > Hi Bob, hi Myke, and others interested in ICD > > > > Another question: > > The ICD code do not allow nested routines? According to DS51242A, > > a RETURN will cause the clear of the INBUG bit and "warms" peripherals > > freezed by FREEZ bit. (I think that more flexible will be if Microchip > > creates a new specific instruction, like "RETURN_FROM_ICD" > > instead a general-purpose RETURN). > > Yes, that is how I read it. This "feature" makes it quite challenging to code for the ICD and when you take a look at the source for the ICD (on the targe PICmicro), it can be quite difficult to understand. When I played around with the ICD, trying to "clean up" the code on my own, I discovered this aspect of the debugger. Personally, I don't know how much importance I would place on a separate instruction since there is really only 256 instructions that you can play with and I want to see what I can come up with on my own, but I will probably use the Microchip code simply because I have invested quite a bit of time understanding it. > > Another more interesting thing: > > Is necesary to write a GOTO DEBUG_CODE in the configuration zone (at > > position > > 0x2004)? In certain situation, the PC points to 0x2004 (beyond the program > > memory) > > Yeah, I guess so. But something is fishy here because nothing is being done > with PCLATH! I don't understand this either. I suspect that if ICD mode is selected in the configuration registers this address becomes a new reset vector. > > But, I dont understand why, in another situation, if a HALT > > signal is asserted the PC points to 0x0001. (Section 2.7 to 2.7.2 ) > > Its because of the way the breakpoint is implemented. The breakpoint address > register is initialized to zero. If external HALT is asserted as we come out > of reset the device will automatically take a breakpoint, BUT the breakpoint > is always taken AFTER the instruction executes, hence the PC will be 0x0001. > That's why mChip tells you to put a NOP in location 0: so that you can > really start single stepping your programming from location 0x0001. > > > What do you have discovered about it? DS51242A is confusing, I think. > > It certainly is. I have spent about fifteen hours with an oscilloscope and burning different code into the chip to see how it works. It actually isn't that confusing - but it is limited. I feel like there should be ways of enhancing its capabilities (ie being able to access the PC stack), but I don't know. myke -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics