SX Users Manual Rev. 3.1
© 2000 Scenix Semiconductor, Inc. All rights reserved.
Chapter 3 Instruction Set
Return from Interrupt
restore W, STATUS, FSR, and program counter from shadow registers
STATUS register restored, which affects all bits
0000 0000 1110
This instruction causes a return from an interrupt service routine. It restores the 12-
bit program counter value that was saved when the interrupt occurred. This causes
the program to return to the point in the program where the interrupt occurred. The
instruction also restores the contents of W, STATUS, and FSR registers that were
saved when the interrupt occurred.
2 in compatible mode (SX18/20/28AC and SX18/20/28AC75 only), or 3 in tur-
;interrupt routine at address 000h
;set up MODE register to access WKPND_B
;exchange W and WKPND_B contents
;mask out unused bits of WKPND_B
;move pending bits to register 1Ah
;test pending bits perform service
;return from interrupt
This is an example of an interrupt service routine that services interrupts triggered
on the RB0, RB1, RB2, and RB3 pins. When an interrupt occurs, the device saves
the 12-bit contents of the program counter and the contents of the W, STATUS, and
FSR registers into a set of shadow registers. The program then jumps to the interrupt
service routine, which starts at address 000h. The interrupt service routine
determines the cause of the interrupt, clears the applicable interrupt pending bit,
performs the required task, and ends with the reti instruction.
The reti instruction restores the contents of the program counter and the W,
STATUS, and FSR registers. This causes the device to continue program execution
at the point where the program was interrupted.