Main Switch And Adc 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
Open the Config_CMT2_user.c file and insert the following code in the user code area inside the function
r_Config_CMT2_cmi2_interrupt:
/* Start user code for r_Config_CMT2_cmi2_interrupt. Do not edit comment generated here */
/* Stop this timer - we start it again in the de-bounce routines */
R_Config_CMT2_Stop();
/* Call the de-bounce call back routine */
R_SWITCH_DebounceIsrCallback();
/* End user code. Do not edit comment generated here */
5.4.3

Main Switch and ADC Code

In this part of the tutorial we add the code to act on the switch presses to activate A/D conversions and display
the result on the LCD. In this code, we also perform software triggered A/D conversion from the user switches
SW1 and SW2, by reconfiguring the ADC trigger source on-the-fly once an SW1 or SW2 press is detected.
In the e2 studio Project Tree, expand the 'src\smc_gen\general' folder and open the file 'r_cg_userdefine.h'.
Insert the following code the user code area, resulting in the code shown below:
/* Start user code for function. Do not edit comment generated here */
extern volatile
uint8_t g_adc_trigger;
/* End user code. Do not edit comment generated here */
In the e2 studio Project Tree, expand the 'src' folder and Open the file 'SC_Tutorial.c' and add the highlighted
code, resulting in the code shown below:
#include
"r_smc_entry.h"
#include
"r_okaya_lcd.h"
#include
"r_cg_userdefine.h"
#include
"Config_S12AD0.h"
#include
"r_rssk_switch.h"
/* Variable for flagging user requested ADC conversion */
volatile
uint8_t
g_adc_trigger = FALSE;
/* 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
R20UT4449EG0100 Rev. 1.00
Aug.30.19
(const
uint16_t
adc_result);
5. User Code Integration
Page 49 of 64

Advertisement

Table of Contents
loading

This manual is also suitable for:

Rx200 seriesRssk

Table of Contents