45181 Parallax Inc, 45181 Datasheet - Page 101

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:
Interrupt
Start
Main
The above code will cause the interrupt routine to be executed once every 256 clock cycles (when RTCC
rolls over from 255 to 0). A different return-from-interrupt command called RETIW can be used, how-
ever, to customize the time interval (cycle interval) in which the interrupt executes. RETIW, like RETI,
causes a return from the interrupt routine. RETIW has the additional effect of adding the contents of W
to the RTCC register upon return. By moving a negative number into W just before executing an
RETIW, the RTCC will be backed-off by the designated number of cycles. This method also has the
benefit of compensating for the number of cycles spent in the interrupt routine.
For example, if the interrupt routine should be executed once every 50 cycles, use the following two
lines of code in place of the RETI command in the listing above:
Of course, for this to work properly the interrupt routine must take 46 cycles or less (see below for cycle
bandwidth calculation). Even if the interrupt routine contained multiple paths of execution, due to com-
pare-jump instructions, and each path consumed a different number of clock cycles, the interrupt would
still execute once every 50 cycles. Table 21 – Interrupt Timing, below, demonstrates the effects on the
RTCC if the interrupt routine contained two possible paths of execution (path 1 is 28 cycles and path 2 is
15 cycles):
DEVICE STACKX
RESET Start
ORG
RETI
; RTCC Rollover Interrupt Configuration
;
MOV
NOP
JMP
MOV
RETIW
$0
!OPTION, #%10011111
Main
W, #-50
10 SX Special Features and Coding Tips
; Interrupt routine (must be at address $0)
; rest of interrupt routine goes here
; Enable RTCC rollover interrupt
; RTCC inc on clock, no prescale
; rest of main routine goes here
SX-Key/Blitz Development System Manual 2.0 Parallax, Inc. Page 101

Related parts for 45181