User`s manual

RX62N Group, RX621 Group 5. Usage Examples
/* Wait for 1 character to be received on channel 1 */
R_SCI_Receive(
1,
PDL_NO_DATA,
&result,
1,
PDL_NO_FUNC,
PDL_NO_FUNC
);
/* Check that channel 0 has completed */
do
{
R_SCI_GetStatus(
0,
&result,
PDL_NO_PTR,
PDL_NO_PTR,
PDL_NO_PTR
);
} while ((result & 0x10) != 0);
/* Shut down channel 0 */
R_SCI_Destroy(
0
);
}
/* SCI channel 0 receive data handler */
void SCI0RxFunc(void)
{
char * str_ptr = (char *)rx_string;
while (*str_ptr-- != 0)
{
/* Process the string contents */
}
}
/* SCI channel 0 error handler */
void SCI0ErrFunc(void)
{
uint8_t error_flags = 0;
/* Read the status */
R_SCI_GetStatus(
0,
&error_flags,
PDL_NO_PTR,
PDL_NO_PTR,
PDL_NO_PTR
);
/* Overrun error? */
if ((error_flags & 0x20) != 0)
{
System_failed();
}
}
Figure 5-19: Example of SCI Reception code
R20UT0084EE0112 Rev.1.12 Page 5-36
July. 16, 2014