Renesas Solution Starter Kit for RX23W
R20UT4449EG0100 Rev. 1.00
Page 56 of 64
Aug.30.19
/* Reset the flag */
g_adc_trigger
=
FALSE;
}
else
{
/* do nothing */
}
}
}
Then, add the following function definition in the end of the file:
/******************************************************************************
* Function Name : uart_display_adc
* Description : Converts adc result to a string and sends it to the UART.
* Argument : uint8_t : gs_adc_count
* uint16_t: adc result
* Return value : none
******************************************************************************/
static
void
uart_display_adc (
const
uint8_t gs_adc_count,
const
uint16_t adc_result)
{
/* Declare a temporary variable */
char
a;
/* Declare temporary character string */
static
char
uart_buffer[]
=
"ADC xH Value: xxxH\r\n"
;
/* Convert ADC result into a character string, and store in the local.
Casting to ensure use of correct data type. */
a
=
(
char
)(gs_adc_count
&
0x000F);
uart_buffer[4]
=
(
char
)((a
<
0x0A)
?
(a
+
0x30) : (a
+
0x37));
a
=
(
char
)((adc_result
&
0x0F00)
>>
8);
uart_buffer[14]
=
(
char
)((a
<
0x0A)
?
(a
+
0x30) : (a
+
0x37));
a
=
(
char
)((adc_result
&
0x00F0)
>>
4);
uart_buffer[15]
=
(
char
)((a
<
0x0A)
?
(a
+
0x30) : (a
+
0x37));
a
=
(
char
)(adc_result
&
0x000F);
uart_buffer[16]
=
(
char
)((a
<
0x0A)
?
(a
+
0x30) : (a
+
0x37));
/* Send the string to the UART */
R_DEBUG_Print(uart_buffer);
}
/******************************************************************************
* End of function uart_display_adc
******************************************************************************/
Select ‘Build Project’ from the ‘Project’ menu. e
2
studio will build the project with no errors.
The project may now be run using the debugger as described in §6. Connect the RSSK
USBCN0
port to a
USB port on a PC. If this is the first time the RSSK has been connected to the PC then a device driver will be
installed automatically. Open Device Manager, the virtual COM port will be appeared under 'Port (COM &
LPT)' as 'RSSK USB Serial Port (COMx)', where x is a number.
Open a terminal program, such as HyperTerminal, on the PC with the same settings as for SCI8 (Baudrate:
19200, Data Length: 8, Parity Bit: None, Stop Bit: 1, Flow Control: None).
When any switch is pressed, or when ‘c’ is sent via the COM port, the program will perform an A/D conversion
of the voltage level on the ADPOT line and display the result on the LCD panel and send the result to the PC
terminal program via the SCI8.
Содержание RSSK
Страница 64: ...R20UT4449EG0100 RX23W Group ...