;******************************  nmitrap.asm  *******************************
; $Source: /home/cvs/ESP/gen2/software/msp430/lib/nmitrap.asm,v $
;  Copyright (C) 2003 MBARI
;
;  MBARI Proprietary Information. All rights reserved.
; $Id: nmitrap.asm,v 1.1 2004/12/01 01:28:29 brent Exp $
;
; Quicky null RESET/NMI ISR for debugging purposes
;
;  To use simply include this .asm file in your project then, in the debugger...
;
;   [Be sure to write 0x5Axx into the upper byte of WDTCTL on any write,
;       you'll read back 0x69xx]
;
;    Set or Clear WDTNMIES in WDTCTL to select desired interrupt polarity
;        (1 = low-going, 0 = high-going)  (bit 6)
;    Set WDTNMI in WDTCTL (bit 5)
;    Put a breakpoint at NMI_TRAP
;      Single-step the debugger to set WDTCTL
;
;--> Reset is now disabled, drive it with the synchronous signal to be used
;    as an external debug breakpoint
;
;    Clear NMIIFG in IFG1
;      Single-step debugger for a to update IFG1
;    Finally, set NMIIE in IE1
;
;  The debugger should break on the next configured edge
;  of the Reset/NMI input.  It is possible to signal step
;  out of the NMI_TRAP to determine where in the code the
;  external event occurred.
;
;  Note that any subsequent configured edges on Reset/NMI will
;  cause the NMI_TRAP to be reentered until WDTNMI is cleared in WDTCTL
;
;*****************************************************************************

#include "msp430x16x.h"

	.global NMI_TRAP
NMI_TRAP:
	bic.b	#NMIIFG,&IFG1  ;CLEAR NMIIFG
	bis.b	#NMIIE,&IE1    ;SET NMIIE
	reti

	.iseg nmitrap_ivec,abs=0xffe0+NMI_VECTOR
	.data NMI_TRAP

