Usage example (Slave, Reception)

Receive 4Bytes data by Slave.

[GUI setting example]

Serial

Used

SAU0

Unused

SAU1

Unused

IICA0

Used

Transfer mode

Slave

Slave0

Clock mode setting

fCLK/2

Local address setting

0xA0

Operation mode setting

Normal

Wakeup function setting

Off

Communication endinterrupt priority (INTIICA0)

Low

Slave transmission end (Callback function setting)

Unused

Slave reception end (Callback function setting)

Used

Slave error (Callback function setting)

Unused

[API setting example]

r_main.c

/* Start user code for global. Do not edit comment generated here */

volatile uint8_t g_iica0_rx_buf[4];

/* End user code. Do not edit comment generated here */

void main(void)

{

R_MAIN_UserInit();

/* Start user code. Do not edit comment generated here */

/* Receive data as slave mode */

R_IICA0_Slave_Receive((uint8_t *)g_iica0_rx_buf, 4U);

while (1U)

{

;

}

/* End user code. Do not edit comment generated here */

}

r_cg_serial_user.c

static void r_iica0_callback_slave_receiveend(void)

{

/* Start user code. Do not edit comment generated here */

/* Stop IICA0 module operation */

R_IICA0_Stop();

/* End user code. Do not edit comment generated here */

}