S1C88348/317/316/308 TECHNICAL SOFTWARE
EPSON
II-35
8 SERIAL INTERFACE 1 (CLOCK SYNCHRONOUS INTERFACE)
Notes
(1) External routines are called for switching to OSC3 and OSC1. (external call: osc1toosc3, osc3toosc1)
(2) Switching the operating mode when the supply voltage is lower than the VD1 setting may cause a
malfunction. Hence, the example routine checks the supply voltage when switching to the normal
mode (OSC3) and terminates as a supply voltage error remains unprocessed if the supply voltage is
lower than the VD1 setting. For this determination, vdd_ngf flag is used. (See "4 OSCILLATION
CIRCUIT".)
(3) When switching from OSC3 to OSC1 (VD1 = 2.2 V
→ 1.3 V), the program example does not perform
special checking of the supply voltage of SVD if the supply voltage is already more than the VD1
setting.
(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 IRQ2 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) When you have written "1" for the transmitting/receiving trigger and begin transmitting/receiving,
first read the data and be sure to write "1" only on the necessary bits.
Another transmitting/receiving status (receiving status during transmitting, and transmitting status
during receiving) has been allocated for reading to the same address as the transmitting/receiving
triggers. For example, when directly writing to the transmitting trigger, using the OR instruction
during a receiving operation (receiving status = "1"), the receiving status is read once and it is then
written as the receiving trigger. It is the same as the current receiving trigger.
(7) In this program example for serial interface 1 (clock synchronous system), the vector address setting
and program have been allocated from 003000H for the sake of convenience.
Flowchart
(1) Initialization for clock synchronous serial interface (master mode)
sio_init
Clock = OSC3/4
Clock synchronous master mode
Selects serial I/O
Enables IRQ2 interrupt
(BR setting)
P12 (SCLK)
← HIGH
P11 (SOUT)
← HIGH
P10, P13
← Input mode
P12, P14–P17
← Output mode
RXEN
← 0 (receiving disable)
TXEN
← 0 (transmitting disable)
Serial mode setting
Sets interrupt priority
level to IRQ2
Enables receive and
transmit interrupts
Clears I1 flag
ret