Main Uart Code - Renesas RX Series User Manual

Rx23w group. solution starter kit for rx23w smart configurator
Hide thumbs Also See for RX Series:
Table of Contents

Advertisement

Renesas Solution Starter Kit for RX23W
5.6.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_rssk_switch.h"
#include
"r_rssk_debug.h"
#include
"Config_SCI8.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 SCI8 receive buffer and callback function */
R_Config_SCI8_Serial_Receive((uint8_t *)&g_rx_char, 1);
/* Enable SCI8 operations */
R_Config_SCI8_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);
R20UT4449EG0100 Rev. 1.00
Aug.30.19
=
FALSE;
(const
uint16_t adc_result);
uint8_t gs_adc_count,
=
0;
*)" RSSKRX23W
*)" Tutorial
");
*)" Press Any Switch
=
get_adc();
(++gs_adc_count))
=
0;
const
uint16_t adc_result);
");
");
5. User Code Integration
Page 55 of 64

Advertisement

Table of Contents
loading

This manual is also suitable for:

Rx200 seriesRssk

Table of Contents