Program Example Of Expanded I/O Serial Interface - Fujitsu MB90480 Series Hardware Manual

F2mc-16lx 16-bit microcontroller
Table of Contents

Advertisement

CHAPTER 18 EXPANDED I/O SERIAL INTERFACE
18.6

Program Example of Expanded I/O Serial Interface

This section describes the program example of the expanded I/O serial interface.
Program example of expanded I/O serial interface
Example of setting procedure
Send data of 1 byte with sio1 (channel 0)
<Initial setting>
Control SIO
Set mode register
Select shift clock >>
Set interrupt enable >>
Set interrupt request >>
Display transfer state >>
Set SOT1, 2 pins >>
Set SCK1, 2 pins >>
Set control register
Set communication
prescaler >>
Set division ratio >>
Interrupt related
Set interrupt level
Set I flag
<Start>
Start SIO
Send any data
Start SIO operation
<Interrupt>
Transmission interrupt
processing
Initialize interrupt flag
<Interrupt vector>
Set vector table
Note:
Setting related to clock and setting of __set_il
(numeric value) are required in advance.
See the chapter of clock and interrupt.
404
Program example
void sio_sample(void)
{
sio_initial();
sio_start();
}
void sio_initial(void)
{
Register name. bit name
SMCS0
IO_SMCS0.word = 0x3003;/* Setting value = 0011_0000_0000_0011 */
.SMD2-0
.SIE
.SIR
.BUSY
.SOE
.SCOE
IO_SDCR0.byte = 0x83;
SDCR0
.MD
.DIV3-0
IO_ICR13.byte = 0x10;
ICR13
__EI();
(CCR)
}
void sio_start(void)
{
Register name. bit name
IO_SDR0 = 0xaa;
SDR0
IO_SMCS0.bit.STRT = 1; /* bit1 = 1
SMCS0 .STRT
}
__interrupt void sio_int(void)
Register name. bit
{
name
IO_SMCS0.bit.SIR = 0;
SMCS0 .SIR
}
#pragma intvect sio_int 37
Note:
For the description form of the register, see "SAMPLE I/O REGISTER FILES FOR
2
F
MC-16LX FAMILY MB90480 SERIES".
/* bit15-13 = 001 4 division */
/* bit12 = 1
Enable interrupt */
/* bit11 = 0
Clear interrupt request */
/* bit10 = 0
R/W wait state */
/* bit1 = 1
Enable SOE serial output */
/* bit0 = 1
Enable SCOE shift clock output */
/* Setting value =1000_0011 */
/* bit15 = 1
Enable communication prescaler */
/* bit11-8 = 11
4 division */
/* Set SIO transmission completion interrupt level
(arbitrary value) */
/* Enable interrupt */
/* Send any value of data */
Enable SIO operation */
/* bit0 = 0
Initialize SIR interrupt flag */

Advertisement

Table of Contents
loading

Table of Contents