User`s manual

RX62N Group, RX621 Group 5. Usage Examples
/* Set up a DMAC channel for IIC reception */
R_DMAC_Create(
2,
PDL_DMAC_NORMAL | PDL_DMAC_SIZE_8 |
PDL_DMAC_SOURCE_ADDRESS_FIXED |
PDL_DMAC_DESTINATION_ADDRESS_PLUS |
PDL_DMAC_IRQ_END,
PDL_DMAC_TRIGGER_IIC0_RX,
(uint8_t *)&RIIC0.ICDRR,
data_storage,
5-1,
PDL_NO_DATA,
PDL_NO_DATA,
PDL_NO_DATA,
PDL_NO_DATA,
iic_rx_dmac_end_handler,
7 );
/* Select I²C mode at 100kHz, 300ns rise time, 200ns fall time */
R_IIC_Create(
0,
PDL_IIC_MODE_IIC | PDL_IIC_INT_PCLK_DIV_8,
0,
0,
0,
0,
100E3,
(300 << 16) | 200
);
/* Write the data into the EEPROM */
write_eeprom_data();
/* Prepare the next data for the EEPROM */
R_DMAC_Control(
3,
PDL_DMAC_SUSPEND | PDL_DMAC_ENABLE | \
PDL_DMAC_UPDATE_SOURCE | PDL_DMAC_UPDATE_COUNT | PDL_DMAC_CLEAR_DTIF,
eeprom_data_array_2,
PDL_NO_PTR,
8,
PDL_NO_DATA,
PDL_NO_DATA,
PDL_NO_DATA,
PDL_NO_DATA
);
/* Write the data into the EEPROM */
write_eeprom_data();
/* Clear the data storage area */
for (i = 0; i < 20; i++) data_storage[i] = 0x00;
/* Reset the EEPROM sub-address to 0, using polling */
R_IIC_MasterSend(
0,
PDL_IIC_STOP_DISABLE,
EEPROM_ADDRESS,
eeprom_data_array_1,
1,
PDL_NO_FUNC,
0
);
/* Read data from the EEPROM on channel 1, using the DMAC */
read_eeprom_data();
R20UT0084EE0112 Rev.1.12 Page 5-52
July. 16, 2014