
Chapter 6
IOW 0xD
; set port 2 as output
IOW 0xE
; set port 3 as output
CLR 0x04
; clear RAM select register
MOV A, @0xFF
; p2.0~p2.7 set to high
MOV 0x0C, A
SLEP
; enter sleep mode
;--scan keyboard----------------------------------------------
INIT:
SCAN:
JBC 0x0B, 0
; detect p1.0?=1: Y->tr1_debounce
JMP TR1_DEBOUNCE
; N->scan p1.1
JBC 0x0B, 1
; detect p1.1?=1: Y->tr2_debounce
JMP TR2_DEBOUNCE
; N->scan p1.2
JBC 0x0B, 2
; detect p1.2?=1: Y->tr3_debounce
JMP TR3_DEBOUNCE
; N->scan p1.3
JBC 0x0B, 3
; detect p1.3?=1: Y->tr4_debounce
JMP TR4_DEBOUNCE
; N->scan
JMP
SCAN
TR1_DEBOUNCE:
CALL DELAY20
; debounce time 20 ms
JBS 0x0B, 0
; detect p1.0?=1: Y->p3.0=1
JMP SCAN
; N->scan
TR1:
MOV A, @0b00000001
MOV 0x0D, A
SLEP
; enter sleep mode
JMP INIT
; wake up and go to INIT
TR2_DEBOUNCE:
CALL DELAY20
; debounce time 20 ms
JBS 0x0B, 1
; detect p1.1?=1: Y->p3.1=1
JMP SCAN
; N->scan
TR2:
MOV A, @0b00000010
MOV 0x0D, A
SLEP
; enter sleep mode
JMP INIT
; wake up and go to INIT
TR3_DEBOUNCE:
CALL DELAY20
; debounce time 20 ms
JBS 0x0B, 2
; detect p1.2?=1: Y->p3.2=1
JMP SCAN
; N->scan
EM60000 Series User’s Manual
Software Application
•
101
Содержание EM60000 series
Страница 8: ...Contents viii Contents EM60000 Series User s Manual ...
Страница 24: ...Chapter 2 16 Architecture EM60000 Series User s Manual ...
Страница 54: ...Chapter 4 46 Special Function Control EM60000Series User s Manual ...
Страница 80: ...Chapter 5 72 Instruction Set EM60000Series User s Manual ...