Alan B. Pearce wrote: > I get the impression, Peter, that you are setting out to do exactly > what I did using Olins development environment. I noticed some things you might want to look into: > .bank#v(gbank) udata I've got a nicer way of handling this since you grabbed the snapshot this code was based on. See the new DEFRAM macro. > if gbank != 0 > .bank0 udata > endif DEFRAM gets around this messiness. > clrf status ; select direct and indirect bank 0 > dbankis 0 > ibankis 0 > ... > dbank intr_led_reg > bcf intr_led_pin ; show serial activity LED I assume you are using DBANK only since this is intended to be temporary debug code. Otherwise DBANKIF would be better since it probably wouldn't emit any instructions. The bank is already known to be 0, and the port register is probably in bank 0. > if save_fsr ; FSR needs to be saved ? > movf fsr, w ; save FSR > movwf fsr_save > endif This is a problem since the LED code stomped on the bank. This code assumes the bank is 0 since it was meant to be right after the CLRF STATUS. In general it is best to put app code after the standard interrupt entry is complete. > if ncodepages > 1 ; multiple code pages may be in use ? > movf pclath, w ; save PCLATH > movwf pclath_save > clrf pclath > endif Same bank dependency on PCLATH_SAVE here. > dbank pir1 ; check for UART receive interrupt Why DBANK and not DBANKIF? I don't see any reason the assembler lost track of the bank. Anyway, I think it's better to state that separately with an UNBANK, then have code that requires a particular bank use DBANKIF. That allows code snippets to be moved around without problems and redundant bank setting cycles. > nop ; nop for ICD to stop on Yeah, I wish the ICD didn't have that problem either. However, I've been surrounding these NOPs with IF DEBUG. I can set one symbol in the main include file to include or remove the ICD2 debug NOPs. ***************************************************************** Embed Inc, embedded system specialists in Littleton Massachusetts (978) 742-9014, http://www.embedinc.com -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist