User`s manual
RX62N Group, RX621 Group 5. Usage Examples
5.6.2. SCI transmission trigger
DMAC Channel 3 will be used to transmit the string "Renesas RX62N".
Then the string "Hello, World" will be transmitted by polling.
/* PDL functions and definitions */
#include "r_pdl_dmac.h"
#include "r_pdl_cgc.h"
#include "r_pdl_intc.h"
#include "r_pdl_sci.h"
/* RPDL device-specific definitions */
#include "r_pdl_definitions.h"
/* Required for this example */
#include <string.h>
/* Callback function prototype */
void DMAC3_transfer_end_handler(void);
/* Data source and destination declarations */
const uint8_t source_string_1[]="Renesas RX62N";
const uint8_t source_string_2[]="Hello, World";
/* Global flags */
volatile uint8_t sci_dma_transfer_complete;
volatile uint8_t break_required;
void main(void)
{
/* Initialise the system clocks */
R_CGC_Set(
12.5E6,
100E6,
50E6,
PDL_NO_DATA,
PDL_CGC_BCLK_DISABLE
);
/* Set the CPU’s Interrupt Priority Level to 0 */
R_INTC_Write(
PDL_INTC_REG_IPL,
0
);
/* Configure the RS232 port */
R_SCI_Create(
2,
PDL_SCI_ASYNC | PDL_SCI_RX_DISCONNECTED | PDL_SCI_8N1,
115200,
0
);
/* Configure channel 3 */
R_DMAC_Create(
3,
PDL_DMAC_BLOCK | PDL_DMAC_SOURCE_ADDRESS_PLUS | \
PDL_DMAC_DESTINATION_ADDRESS_FIXED | PDL_DMAC_SIZE_8 | PDL_DMAC_IRQ_END,
PDL_DMAC_TRIGGER_SCI2_TX,
source_string_1,
(uint8_t *)&SCI1.TDR,
1,
(uint16_t)strlen((char *)source_string_1),
PDL_NO_DATA,
PDL_NO_DATA,
PDL_NO_DATA,
DMAC3_transfer_end_handler,
R20UT0084EE0112 Rev.1.12 Page 5-18
July. 16, 2014