Chapter 12
Serial Interface 2
Operation
XII - 24
12-3-2
Setup Example
nTransmission / Reception Setup Example
Here is the setup example at transmission/reception with serial interface 2. Table 12-3-10 shows the
conditions.
Table 12-3-10
Conditions for Synchronous Serial Interface at transmission / reception)
Setup Procedure
Description
(1)
Select prescaler operation.
PSCMD (x'3F6F')
bp0
: PSCEN
= 1
(2)
Select the clock source.
SC2CKS (x'3FA7')
bp2-0
: SC2PSC2-0= 100
bp3
= 0
(3)
Control the pin type.
SC2ODC (x'3F46')
bp1-0
: SC2ODC1-0= 11
P0PLUD (x'3F40')
bp5, 3
: P0PLUD5, 3= 1, 1
(4)
Control the pin direction.
P0DIR (X'3F30')
bp5-3
: P0DIR5-3 = 101
(5)
Select the transfer bit count.
SC2MD0 (x'3FA0')
bp2-0
: SC2LNG2-0= 111
(1)
Set the PSCEN flag of the PSCMD register to
"1" to select prescaler operation.
(2)
Set the SC2PSC2-0 flag of the SC2CKS
register to "100" to select fs/2 at clock source.
Set bp3 of the SC2CKS register always to "0".
(3)
Set the SC2ODC1-0 flag of the SC2ODC
register to "11" to select N-ch open drain for
the SBO2/SBT2 pin type. Set the P0PLUD5, 3
flag of the P0PLUD register to "1, 1" to add pull-
up/pull-down resistor.
(4)
Set the P0DIR5-3 flag of the port 0 pin control
direction register (P0DIR) to "101" to set P05,
P03 to output mode, to set P04 to input mode.
(5)
Set the SC2LNG2-0 flag of the serial 2 mode
register (SC2MD0) to "111" to set the transfer
bit count to 8 bits.
An example setup procedure, with a description of each step is shown below.
Item
set to
Item
set to
SBI2 / SBO2 pins
independent
(with 3 channels)
clock
Internal
clock
Transfer bit count
8 bits
clock source
fs/2
Start condition
enable
SBT2 / SBO2 pin type
N-ch open-
drain
First bit to be transfered
MSB
SBT2 pin pull-up resistance
added
Input edge
at falling
SBO2 pin pull-up resistance
added
Output edge
at rising
Serial 2 interrupt
generate