II-18
EPSON
S1C88348/317/316/308 TECHNICAL SOFTWARE
5 INPUT PORTS (K PORTS)
Notes
(1) When the pull-up resistor option has been set to "with resistor", a delay in the waveform rise time will
occur depending on the time constant of the input gate capacitance when changing the input terminal
from LOW to HIGH. For this reason, set an appropriate wait time (for reference, approximately 500
sec) for the introduction of the input port. In particular, special attention should be paid to key
scanning for key matrix formation.
(2) Note that the K11 terminal cannot be used as an input port when the K11 terminal has been set for
input of the bus release request (BREQ) signal.
See Part I in this manual, "S1C88348/317/316/308 Technical Hardware", for details of the bus release
sequence.
(3) The K10 terminal doubles as the input terminal of the programmable timer/event counter with input
port functions sharing the input signal as it is. For this reason, when the K10 terminal has been set to
the input terminal of the programmable timer/event counter, pay attention to interrupt setting.
See "12 PROGRAMMABLE TIMER", for the control of the programmable timer/event counter.
(4) To reset the interrupt factor flag, write "1" into the corresponding flags alone, using the AND or LD
instruction. When the OR logic operation instruction has been used, "1" is written for the interrupt
factor flags that have been set to "1" within the same address and those flags are then clear.
(5) The interrupt flags (I1 and I0) have not been reset in the interrupt processing routine of this program
example, so an interrupt lower than IRQ3 level is disabled at the time of generation. When you wish
to accept the next interrupt after an interrupt has been generated, re-setting of the interrupt flags or
resetting the interrupt factor flag is necessary after due consideration for the nesting level.
(6) A noise reject circuit is not included in the input port (K port).
In particular, when input port data is read using an interrupt, the interrupt may generate one of the
another by key chattering. For this reason, some measure must be devised such as adding noise reject
processing in software or with an external.
(7) In this program example for input port (K port), the vector address setting and program have been
allocated from 003000H for the sake of convenience.
(8) The S1C88308 does not have K11 terminal.
Source List
Control of input port (K port )
external
scan_delay
public
input_normal,input_keyscan,input_keywait,input_keyintr
public
key_data
;
k1x_vector
equ
00000ah
;k1x interrupt vector address offset
keyinput
equ
003000h
;program start address offset
br_io
equ
0ffh
;base reg. address (set i/o area)
sik1
equ
00ff51h
;interrupt selection reg. for k1x
kcp1
equ
00ff53h
;interrupt comparison reg. for k1x
k0d
equ
00ff54h
;input port data from k0x
k1d
equ
00ff55h
;input port data from k1x
r0d
equ
00ff73h
;r0x output data
intr_pr1
equ
00ff21h
;interrupt priority reg. 0
intr_en1
equ
00ff23h
;interrupt enable reg. 0
intr_fac1
equ
00ff25h
;interrupt factor flag reg. 0
;
data
key_data:
dw
[1]
code