English
Language : 

45111 Datasheet, PDF (96/184 Pages) List of Unclassifed Manufacturers – 14-DAY MONEY BACK GUARANTEE
10 SX Special Features and Coding Tips
Main
; Comparator Configuration
;
MODE $08
; Set Mode to Comparator configuration
MOV !rb,#%00000000 ; Enable comparator and result output
MODE $0F
; Set Mode to allow Direction configuration
MOV !rb,#%11111110 ; Port B bits 1-7 to input, bit 0 to input
MODE $08
MOV !rb,#$00
JMP Main
; Here, bit 0 of W holds result of compare
The following are points to remember with Comparator mode:
• Port B I/O pins 1 and 2 are the comparator inputs and I/O pin 0 is, optionally, the comparator
result output.
• Port B I/O pin 0 may be used as a normal I/O pin by setting the OE bit of the Comparator register.
• The comparator is independent of the clock source and thus will operate even if the SX chip is
halted or in SLEEP mode. To avoid spurious current draw during SLEEP mode, disable the
comparator.
10.3 The SX48/52 Multi-Function Timers
In addition to the standard timers (RTCC and watchdog), the SX48/52 devices come with two Multi-
Function Timers T1 and T2. These timers are useful to replace a software solution for generating PWM
signals, counting events, and generating longer time delays.
Each timer comes with a free-running 16-bit counter. At reset, the counters are initialized with $0000,
and then, they start continuously counting upwards. The counters can either be clocked from the
system clock (through an 8-bit prescaler), or from an external transition at the external clock pin. This
input can be configured to sense positive, or negative transitions.
Each counter has associated 16-bit capture and comparison registers. As an option, various events can
be used to trigger an interrupt, or to generate an output signal.
Page 96 • SX-Key/Blitz Development System Manual 2.0 • Parallax, Inc.