Page 1
All information contained in these materials, including products and product specifications, represents information on the product at the time of publication and is subject to change by Renesas Electronics Corporation without notice. Please review the latest information published by Renesas Electronics Corporation through various means, including the Renesas Electronics Corporation website (http://www.renesas.com).
Page 2
Electronics product for any application for which it is not intended. Renesas Electronics shall not be in any way liable for any damages or losses incurred by you or third parties arising from the use of any Renesas Electronics product for which the product is not intended by Renesas Electronics.
Page 3
RSK. Renesas expressly disclaims all such warranties. Renesas or its affiliates shall in no event be liable for any loss of profit, loss of data, loss of contract, loss of business, damage to reputation or goodwill, any economic loss, any reprogramming or recall...
The following documents apply to the RX113 Group. Make sure to refer to the latest versions of these documents. The newest versions of the documents listed may be obtained from the Renesas Electronics Web site. Document Type...
Full Form Analog-to-Digital Converter Application Programming Interface COMmunications port referring to PC serial port Central Processing Unit Digital Versatile Disc Renesas On-chip Debugging Emulator Graphical User Interface Integrated Development Environment Interrupt Request line Liquid Crystal Display Light Emitting Diode Micro-controller Unit...
Mar 03, 2015 1. Overview Purpose This RSK is an evaluation tool for Renesas microcontrollers. This manual describes how to use the CS+ IDE Code Generator plug in to create a working project for the RSK platform. Features This RSK tutorial guides the user through creating a project to evaluate the following features: •...
RSKRX113 2. Introduction 2. Introduction This manual is designed to answer, in tutorial form, how to use the Code Generator plug in for the RX family together with the CS+ IDE to create a working project for the RSK platform. The tutorials help explain the following: •...
MCU-specific source, project and debug files. Creating the Project To use the program, start CS+: Windows 7 & Vista: Start Menu (Start Menu > All Programs > Renesas Electronics CS+ > CS+ for CC (RX, RH850) Windows 8: From Apps View , click ‘CS+ for CC (RX,RH850)’...
RSKRX113 4. Code Generation Using the CS+ plug in 4. Code Generation Using the CS+ plug in Introduction Code Generator is an CS+ plug in GUI tool for generating template ‘C’ source code for the RX113. When using Code Generator, the user is able to configure various MCU features and operating parameters using intuitive GUI controls, bypassing the need, in most cases, to refer to sections of the Hardware Manual.
RSKRX113 4. Code Generation Using the CS+ plug in Code Generator Tour This section presents a brief tour of Code Generator. For further details of the Code Generator paradigm and reference, refer to the Application Leading Tool Common Operations manual (r20ut2663ej0100). Application Leading Tool is the stand-alone version of Code Generator and this manual is applicable to the Code Generator.
RSKRX113 4. Code Generation Using the CS+ plug in Code Generation In the following sections, the reader is guided through the steps to configure the MCU for a simple tutorial project containing ADC with external switch trigger, Serial Communications Interface (SCI) and LCD Output. 4.4.1 Clock Generator Figure 4-2 shows a screenshot of Code Generator with the Clock Generator function open.
Page 13
RSKRX113 4. Code Generation Using the CS+ plug in Figure 4-2 Clock setting tab R20UT3254EG0101 Rev. 1.01 Page 13 of 38 Mar 03, 2015...
RSKRX113 4. Code Generation Using the CS+ plug in 4.4.2 I/O Ports This peripheral will be configured to assign output pins for user LEDs and input pins for user switches, with the exception of SW3 which is used as a trigger for the A/D Converter peripheral. Please refer to the RSK schematic for full details of the connectivity.
RSKRX113 4. Code Generation Using the CS+ plug in 4.4.3 Serial Communications Interface This peripheral is configured to use SCI1. This channel of the SCI is connected to the USB to serial converter and allows the application to send data to the terminal program running on the PC. Double click on the ’Serial Communications Interface’...
RSKRX113 4. Code Generation Using the CS+ plug in Figure 4-7 SCI1 Setting tab 4.4.4 12-bit A/D Converter This peripheral is configured to sample the analogue output value of the RV1 potentiometer. The A/D Converter is set to perform a sample when the user presses SW3, which is connected to the ADTRG0 pin of the microcontroller.
Page 17
RSKRX113 4. Code Generation Using the CS+ plug in Figure 4-9 A/D Converter Setting tab R20UT3254EG0101 Rev. 1.01 Page 17 of 38 Mar 03, 2015...
RSKRX113 4. Code Generation Using the CS+ plug in 4.4.5 Generating the code Peripheral function configuration is now complete. Click ‘Generate Code’ button located at the top right of the Peripheral Function tab. The Console pane should report ‘The operation of generating file was successful’, as shown Figure 4-10 below.
RSKRX113 5. Project Settings 5. Project Settings This section covers changes to the CS+ blank project to allow it to run on the RSK. • In the ‘Project Tree’ pane, click on ‘CC-RX (Build Tool)’. The build properties will appear in the main window.
Page 20
RSKRX113 5. Project Settings • These settings easily added by clicking the button pasting following text into the dialog: D_1=R_1 D_2=R_2 This instructs the linker to assign RAM rather than ROM addresses to initialised C variables. Build Mode Creation and Configuration - Debug •...
Page 21
RSKRX113 5. Project Settings • In the ‘Frequently Used Options (for Compile)’ group, select the ‘Optimization Level’ option and select ‘0’ from the pull-down. This has now created a ‘Debug’ build mode, with code optimisation. This Build Mode will be used throughout this tutorial to build and debug the project.
RSKRX113 5. Project Settings Adding Project Folders • Before new source files are added to the project, we will create two additional folders in the CS+ Project Tree. • In the Project Tree pane, right- click the CG_Tutorial project name and select ‘Add -> Add New Category’.
RSKRX113 6. User Code Integration 6. User Code Integration At this stage of a typical project development the user would expand on the generated code to create the application required. As a demonstration this tutorial will include code lines and files from the complete ‘Tutorial’...
RSKRX113 6. User Code Integration Including files in the CS+ Project • Right-click on ‘C Source Files’ in the Project Tree and select ‘Add -> Add File…’. • Browse to and select the following files copied in the section above and click ‘Add’: r_rsk_utility.c r_lcd_appv2.c •...
RSKRX113 6. User Code Integration 6.4.2 r_cg_s12ad.c Code Insertion Open this file by double clicking on the file name in the CS+ Project Tree window. Insert the following at the end of the file between the user code delimiter comments as shown below. /* Start user code for adding.
RSKRX113 6. User Code Integration 6.4.4 r_cg_s12ad_user.c Code Insertion Open this file by double clicking on the file name in the CS+ Project Tree window. Insert the following between the user code delimiter comments as shown below in the file section designated Global variables and functions: /* Start user code for global.
RSKRX113 6. User Code Integration Insert the following between the user code delimiter comments at the end of the file: /* Start user code for adding. Do not edit comment generated here */ /******************************************************************************* * Function Name: R_SCI1_AsyncTransmit * Description : This function sends SCI1 data and waits for the transmit end flag.
RSKRX113 6. User Code Integration 6.4.7 r_cg_main.c Code Insertion Insert the following between the user code delimiter comments as shown below in the file section designated Includes: /* Start user code for include. Do not edit comment generated here */ "r_cg_s12ad.h"...
Page 29
RSKRX113 6. User Code Integration while (1U) uint16_t adc_result; /* If the user has requested ADC sample via the serial port */ (TRUE g_adc_trigger) /* Call the function to perform an ADC conversion */ adc_result get_adc(); /* Display the result on the LCD */ lcd_display_adc(adc_result);...
Page 30
RSKRX113 6. User Code Integration Insert the following between the user code delimiter comments at the end of the file: /* Start user code for adding. Do not edit comment generated here */ /****************************************************************************** * Function Name : get_adc * Description : Creates a ADC12 Software trigger and returns the ADC result, once the ADC conversion is complete.
Page 31
RSKRX113 6. User Code Integration /****************************************************************************** * Function Name : uart_display_adc * Description : Converts ADC result to a string and sends it to the UART1. * Argument : uint8_t : adc_count uint16_t: ADC result * Return value : none ******************************************************************************/ static void uart_display_adc...
RSKRX113 7. Project Build and Debugger Configuration 7. Project Build and Debugger Configuration Select ‘Build Project’ from the ‘Build’ menu, or press F7. CS+ will build the project with no errors. Configure the E1 debugger and board as follows. • In the ‘Project Tree’...
RSKRX113 7. Project Build and Debugger Configuration Running the Tutorial Before launching the tutorial connect the RSK RL78G1C-USB port to a USB port on a PC. If this is the first time the RSK has been connected to the PC then a device driver will be installed automatically. Open Device Manager, the virtual COM port will now appear under 'Port (COM &...
Page 37
SALES OFFICES Refer to "http://www.renesas.com/" for the latest and detailed information. Renesas Electronics America Inc. 2801 Scott Boulevard Santa Clara, CA 95050-2549, U.S.A. Tel: +1-408-588-6000, Fax: +1-408-588-6130 Renesas Electronics Canada Limited 1101 Nicholson Road, Newmarket, Ontario L3Y 9C3, Canada...
Need help?
Do you have a question about the RX100 Series and is the answer not in the manual?
Questions and answers