English
Language : 

45111 Datasheet, PDF (94/184 Pages) List of Unclassifed Manufacturers – 14-DAY MONEY BACK GUARANTEE
10 SX Special Features and Coding Tips
and the flag indicating this will remain set until the program clears it. Additional transitions on that pin
will not cause interrupts until the associated bit in the Pending register is cleared.
To configure the I/O pins for wake-up (interrupt) edge detection:
1) Set I/O pin edge detection as desired. (See Edge Detection, above, for more information).
2) Set the MODE register to $0B (the value for Wake-Up Enable register configuration).
3) Use the port configuration instruction to enable the individual pins for wake-up interrupts. A high
bit (1) disables interrupts and a low bit (0) enables interrupts.
4) Set I/O pin directions as necessary.
5) Clear the Pending register to enable new interrupts.
The following code snippet demonstrates this:
RESET Start
Interrupt
ORG
MODE
MOV
RETI
$0
$09
!rb,%00000000
; Interrupt routine (must be at address $0)
; Set Mode for Pending register
; Clear Pending/get current status in W
; rest of interrupt routine goes here
Start
Main
; Wake-Up Edge Detection Configuration
;
MODE
MOV
MODE
MOV
MODE
MOV
MODE
MOV
$0A
; Set Mode to allow Edge configuration
!rb,#%11111111 ; Port B bits 0-7 to falling edge
$0B
; Set Mode to allow Wake-Up configuration
!rb#%11110000 ; Port B bits 4-7 to normal, 0-3 to Wake-Up
$0F
; Set Mode to allow Direction configuration
!rb,#%11111111 ; Port B bits 0-7 to input
$09
; Set Mode for Pending register
!rb,%00000000 ; Clear register to allow new interrupts
NOP
JMP Main
; rest of main routine goes here
Page 94 • SX-Key/Blitz Development System Manual 2.0 • Parallax, Inc.