45181 Parallax Inc, 45181 Datasheet - Page 93

SX TECH TOOL KIT NO POWER

45181

Manufacturer Part Number
45181
Description
SX TECH TOOL KIT NO POWER
Manufacturer
Parallax Inc
Series
SXr
Type
Microcontrollerr
Datasheet

Specifications of 45181

Contents
SX Book, SX Key, SX Tech Board, Samples, Resonators, Cable and Manual
Product
Microcontroller Basic Stamps
Operating Supply Voltage
5 V
For Use With/related Products
SX MCUs
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
The following code snippet demonstrates this:
Start
Main
The following are points to remember with edge detection:
10.2.6 Wakeup (Interrupt) on Edge Detection
Every I/O pin in port B can be set to cause an interrupt upon logic level transitions (rising edge or
falling edge). By configuring interrupts on input pins, the SX chip can respond to signal changes in a
quick and deterministic fashion. In addition, an interrupt of this sort will wake up the SX chip from a
SLEEP state. This can be configured by writing to the Edge Selection register (WKED_B) and the Wake-
Up Enable register (WKEN_B) and detected by monitoring the Pending register (WKPEN_B) in the
interrupt routine. The I/O pins have interrupts disabled and are set to detect falling edge transitions by
default.
As with edge selection, the Pending register bits will never be cleared by the SX alone; the running
program is responsible for doing so. This means if a desired edge is detected, the interrupt will occur
The edge detection feature is always enabled and the Pending register is always updated even if the
SX program does not configure or use it.
It is up to the SX program to clear the bits of the Pending register when detection of a future
transition is desired. The MOV !rb, #%00000000 instruction effectively clears all bits of the Pending
register at the same time that it stores the current edge detection status in W.
If the SX program is designed to handle only one edge detection event at a time (on two or more
pins), it will be necessary to get the status (as shown above), clear only the bit being attended to and
move the modified status back to the Pending register.
An edge detection event will not wake up the SX chip from a SLEEP mode unless the Wake-Up
Enable mode is also set. See below for more information.
; Edge Detection Configuration
;
MODE $0A
MOV
MODE $0F
MOV
MODE $09
MOV
JMP
!rb,#%11111111 ; Port B bits 0-7 to falling edge
!rb,#%11111111 ; Port B bits 0-7 to input
!rb,#%00000000 ; This line moves WKPND_B to W and
Main
; Set Mode to allow Edge configuration
; Set Mode to allow Direction configuration
; Set Mode for Pending register check
; writes all zeros to WKPND_B
; At this point, W should be checked for
; high bits, indicating a falling
; edge occurred
10 SX Special Features and Coding Tips
SX-Key/Blitz Development System Manual 2.0 Parallax, Inc. Page 93

Related parts for 45181