User`s manual

RX62N Group, RX621 Group 5. Usage Examples
5.12.5. SCI Transmission in Asynchronous Multi-Processor mode
Figure 5-23 shows the setting of SCI channel 2 and the Multi-Processor mode transmission of data using
interrupts and polling.
/* PDL functions */
#include "r_pdl_sci.h"
#include "r_pdl_cgc.h"
/* PDL device-specific definitions */
#include "r_pdl_definitions.h"
void SCI1tx(void);
uint8_t* send_data0 = "\n\rWelcome to the Renesas RX62N.\n\r";
uint8_t* send_data = "testing ASYNC MP mode";
bool tx_end;
void main(void)
{
/* Configure the clocks */
R_CGC_Set(
12E6,
96E6,
48E6,
0,
PDL_CGC_BCLK_HIGH
);
/* Configure the pin selection of SCI */
R_SCI_Set(PDL_SCI_PIN_SCI2_A);
/* Configure the RS232 port, specify Async MP mode */
R_SCI_Create(
2,
PDL_SCI_8N1 | PDL_SCI_ASYNC_MP,
100E3,
15
);
/* -------------------------------------------- */
/* Async MP mode, data Transmission, by CPU ISR */
/* -------------------------------------------- */
/* Send Target Station ID (0x0A), by internal polling */
R_SCI_Send(
2,
0x0A00 | PDL_SCI_MP_ID_CYCLE,
PDL_NO_PTR,
0,
PDL_NO_FUNC
);
tx_end = false;
/* Send data to Target Station (ID = 0x0A), using interrupts */
R_SCI_Send(
2,
PDL_NO_DATA,
send_data0,
0,
SCI1tx
);
while(tx_end == false);
/* -------------------------------------------- */
/* Async MP mode, data Transmission, by polling */
/* -------------------------------------------- */
R20UT0084EE0112 Rev.1.12 Page 5-43
July. 16, 2014