Main Uart Code - Renesas RX72M Starter Kit User Manual

Renesas 32-bit mcu rx family / rx700 series
Table of Contents

Advertisement

Renesas Starter Kit+ for RX72M
5.5.2

Main UART code

Open the file 'SC_Tutorial.c'. Add the following declaration to near the top of the file:
#include
"r_smc_entry.h"
#include
"r_okaya_lcd.h"
#include
"r_cg_userdefine.h"
#include
"Config_S12AD0.h"
#include
"r_rsk_switch.h"
#include
"r_rsk_debug.h"
#include
"Config_SCI6.h"
/* Variable for flagging user requested ADC conversion */
volatile
uint8_t g_adc_trigger
/* Prototype declaration for cb_switch_press */
static void
cb_switch_press (void);
/* Prototype declaration for get_adc */
static
uint16_t get_adc(void);
/* Prototype declaration for lcd_display_adc */
static void
lcd_display_adc
/* Prototype declaration for uart_display_adc */
static void uart_display_adc(const
/* Variable to store the A/D conversion count for user display */
static uint8_t gs_adc_count
Add the following highlighted code in the main function:
void
main(void)
{
/* Initialize the switch module */
R_SWITCH_Init();
/* Set the call back function when SW1 or SW2 is pressed */
R_SWITCH_SetPressCallback(cb_switch_press);
/* Initialize the debug LCD */
R_LCD_Init();
/* Displays the application name on the debug LCD */
R_LCD_Display(0, (uint8_t
R_LCD_Display(1, (uint8_t
R_LCD_Display(2, (uint8_t
/* Start the A/D converter */
R_Config_S12AD0_Start();
/* Set up SCI6 receive buffer and callback function */
R_Config_SCI6_Serial_Receive((uint8_t *)&g_rx_char, 1);
/* Enable SCI6 operations */
R_Config_SCI6_Start();
while
(1U)
{
uint16_t adc_result;
/* Wait for user requested A/D conversion flag to be set (SW1 or SW2) */
if
(TRUE
==
g_adc_trigger)
{
/* Call the function to perform an A/D conversion */
adc_result
/* Display the result on the LCD */
lcd_display_adc(adc_result);
/* Increment the gs_adc_count */
if
(16
==
{
gs_adc_count
}
/* Send the result to the UART */
uart_display_adc(gs_adc_count, adc_result);
R20UT4389EG0100 Rev. 1.00
Jul.31.19
=
FALSE;
(const
uint16_t adc_result);
uint8_t gs_adc_count,
=
0;
*)" RSK+RX72M
*)" Tutorial
*)" Press Any Switch
=
get_adc();
(++gs_adc_count))
=
0;
const
uint16_t adc_result);
");
");
");
5. User Code Integration
Page 59 of 69

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the RX72M Renesas Starter Kit and is the answer not in the manual?

Questions and answers

Table of Contents