English
Language : 

45111 Datasheet, PDF (92/184 Pages) List of Unclassifed Manufacturers – 14-DAY MONEY BACK GUARANTEE
10 SX Special Features and Coding Tips
To configure the I/O pins to Schmitt-Trigger input:
1) Set the MODE register to $0C (the value for Schmitt-Trigger register configuration).
2) Use the port configuration instruction to set the individual Schmitt-Trigger state of each I/O pin
within each port. A high bit (1) sets the corresponding pin to normal and a low bit (0) sets it to
Schmitt-Trigger.
3) Set I/O pin directions as necessary.
The following code snippet demonstrates this:
; Schmitt-Trigger Configuration
;
MODE $0C
; Set Mode to Schmitt Trigger configuration
MOV !rb,#%11110000 ; Port B bits 4-7 to normal, bits 0-3 to S.T.
MOV !rc,#%00001111 ; Port C bits 4-7 to S.T., bits 0-3 normal
MODE $0F
; Set Mode to allow Direction configuration
MOV !rb,#%10110011 ; Port B bits 2,3,6 to output, all others input
MOV !rc,#%11011110 ; Port C bits 0,5 to output, all others input
10.2.5 Edge Detection
Every I/O pin in port B can be set to detect logic level transitions (rising edge or falling edge). This can
be configured by writing to the Edge Selection register (WKED_B) and detected by monitoring the
Pending register (WKPEN_B). The I/O pins are set to detect falling edge transitions by default. By
configuring edge detection on input pins, the SX chip can set the pin’s associated bit in the Pending
register when the desired edge arrives. 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 flag
indicating this will remain set until the program has time to attend to it. This feature can be used by the
SX program for signals that need attention, but not necessarily immediately.
To configure the I/O pins for edge detection:
1) Set the MODE register to $0A (the value for Edge Detect register configuration).
2) Use the port configuration instruction to set the individual edge to detect on each I/O pin. A high
bit (1) sets the corresponding pin to falling-edge detection and a low bit (0) sets it to rising-edge
detection.
3) Set I/O pin directions as necessary.
Page 92 • SX-Key/Blitz Development System Manual 2.0 • Parallax, Inc.