English
Language : 

45111 Datasheet, PDF (89/184 Pages) List of Unclassifed Manufacturers – 14-DAY MONEY BACK GUARANTEE
10 SX Special Features and Coding Tips
; Set output pins low
;
MOV ra, #%0000
; Port A bits 0-3 low
MOV rb, #%00000000 ; Port B bits 0-7 low
MOV rc, #%00000000 ; Port C bits 0-7 low
10.2.2 Pull-Up Resistors
Every I/O pin has optional internal pull-up resisters that can be configured by writing to the
appropriate pull-up register (PLP_A, PLP_B, PLP_C, PLP_D and PLP_E). By configuring pull-up
resisters on input pins, the SX chip can be connected directly to open/drain circuitry without the need
for external pull-up resisters. The internal pull-up resisters are disabled by default. Pull-up resisters can
be activated for all pins, regardless of pin direction but really matter only when the associated pin is set
to input mode.
To configure the I/O pins to have internal pull-up resisters:
1) Set the MODE register to $0E (the value for pull-up register configuration).
2) Use the port configuration instruction to set the individual pull-up state of each I/O pin within
each port. A high bit (1) disables the pull-up for the corresponding pin and a low bit (0) enables the
pull-up resister for a pin.
3) Set I/O pin directions as necessary.
The following code snippet demonstrates this:
; Pull-Up Resistor Configuration
;
MODE $0E
; Set Mode for Pull-Up Resistor configuration
MOV !ra,#%0000
; Port A bits 0-3 to pull-ups
MOV !rb,#%11110000 ; Port B bits 4-7 normal, bits 0-3 pull-ups
MOV !rc,#%00001111 ; Port C bits 4-7 pull-ups, bits 0-3 normal
MODE $0F
; Set Mode to allow Direction configuration
MOV !ra,#%1111
; Port A bits 0-3 to input
MOV !rb,#%00001111 ; Port B bits 4-7 to output, bits 0-3 input
MOV !rc,#%11110000 ; Port C bits 4-7 to input, bits 0-3 output
SX-Key/Blitz Development System Manual 2.0 • Parallax, Inc. • Page 89