Home

RL78 Family CubeSuite+ Startup Guide

image

Contents

1. result_buffer 0U Initialize fesult buffer DIQ Disablefi R_ADC_Set_OperationOn Enablg comparator operation stabilization wait time ab for count 0U count lt 3U count API function refer to r_adc c NOP R_ADC _Start Start AD converter lt List omitted gt End user code Do not edit comment generated Remark Do not change character strings in these comments RO1AN1232EJ0100 Rev 1 00 Page 19 of 22 Aug 24 2012 7tENESAS RL78 Family CubeSuite Startup Guide er_adc c lt List omitted gt void R_ADC_Create void Binary constant e ADCEN 1U supply AD clock The value to be set to the register the lt List omitted gt ADMO register is the logical sum of the Set ANIO pin as analog input underlined bytes PM2 l 0x01U ADMO _28_AD_CONVERSION_CLOCK_5 _008AD_TIME_MODE_NORMAL_11 _00_AD_OPERMODE_SELECT ADM1 _00_AD_TRIGGER_SOFTWARE _00_AD_CONVMODE_CONSELECT lt List omitted gt Function Name R_ADC_Start Description This function starts the AD converter Arguments none Return Value none ak oe she ee ake afe ake ahe afe ake ahe ee ahe ofe 2 ake afe 2 ee oe ake ee 2 afe 2 oe 2 oe ale ee ale afe 2 2 2 he oe ale fe 2 afe 2 ale afe 2 eo ale afe he ale afe 2 fe oe ake 2 afe ake 2 ae ee oe 2k 7 void R_ADC_Start void ADIF 0U clear INTAD interrupt flag ADMK 0U enable INTAD interrupt ADCS 1U en
2. Security ID Permit flash programming Use wide voltage mode Erase flash ROM when starting P24 RL78 E1 Serial Debug Too a File l Build tool generated files SX startup LL Code Generator EJ r_main c r_systeminit c J rcac c E r_coc_user c J r_port c EY r_port_user c ha r_co_macrodriver h h4 r_cg_userdefine h hd r_cg_cgc h h r_cg_port h Ge r k d Power target from the emulator MAX 200m Select whether or not to supply power from the emulator Connect Settings Debug Tool Settings Download Fle Settings Hook Transaction Settings Output e_ege o gt r_port cl gt DefaultBuild sample_project 1mf gt DefaultBuild SAMPLE PROGRAM hex Build ended Error 0 Warning 0 lt gt All Messages Build Tool Fa FY s FE FT Fa les Fa Fn Ii i Fe i DISCONNECT Figure 4 3 Operation Environment Setting E1 Property Panel a Communication method Specifies the communication method by which the E1 emulator establishes a serial communication with the RL78 G13 in the target system Select 1 line type TOOLO b Power target from the emulator MAX 200 mA Specifies whether to supply power to the target system from the E1 emulator To supply power to it select Yes No is selected by default To choose not to supply power from the emulator select No and supply power externally c Supply Voltage This property is displayed only
3. ae m FF LB sample project Project Lisck setina On chip debug setting Confiming reset sogge Safety functions a RSFLOOLE Microcontroller E l Code Generator Design Tc w Clock Geperator Operation mode High speed main mode 2 7 V lt VDD lt 5 5 V High speed main mode 2 4 V lt VDD lt 5 5 V Low speed main mode 1 8 V lt VDD lt 5 5 V Low voltage main mode 1 6 V lt VDD lt 5 5 V EVDD setting O 27 M lt EVDD lt 5 51 O 24 lt EVDD lt 550 OC 18Mi lt EvDD lt 5514 O 1 8M lt EVDD lt 550M O High speed system clock MX Frequency 32 MHz bh speed system clock setting Operation 1 oscillation 04 Extemal clock input fEX Maa 2428 8 2 18 fM gt Internal low speed oscillation clock fIL setting Frequency Output W0403029 Please select pin assignment setting EOF lt Figure 5 1 Example of Configuration on the Code Generation Panel Remark If on the code generation panel settings are wrongly configured or necessary settings are not configured or if pins to be configured have already been used for other functions a J icon is displayed indicating that the relevant information is incorrect When the mouse cursor is moved onto the Q icon information on this warning hints about solution is shown as a pop
4. Precautions in the Handling of MPU MCU Products and in the body of the manual differ from each other the description in the body of the manual takes precedence 1 Handling of Unused Pins Handle unused pins in accord with the directions given under Handling of Unused Pins in the manual The input pins of CMOS products are generally in the high impedance state In operation with unused pin in the open circuit state extra electromagnetic noise is induced in the vicinity of LSI an associated shoot through current flows internally and malfunctions occur due to the false recognition of the pin state as an input signal become possible Unused pins should be handled as described under Handling of Unused Pins in the manual 2 Processing at Power on e The state of the product is undefined at the moment when power is supplied The states of internal circuits in the LSI are indeterminate and the states of register settings and pins are undefined at the moment when power is supplied In a finished product where the reset signal is applied to the external reset pin the states of pins are not guaranteed from the moment when power is supplied until the reset process is completed In a similar way the states of pins in a product that is reset by an on chip power on reset function are not guaranteed from the moment when power is supplied until the power reaches the level at which resetting has been specified 3 Prohibition of Access to Reserved Ad
5. any form in whole or in part without prior written consent of Renesas Electronics 12 Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this document or Renesas Electronics products or if you have any other inquiries Note 1 Renesas Electronics as used in this document means Renesas Electronics Corporation and also includes its majority owned subsidiaries Note 2 Renesas Electronics product s means any product developed or manufactured by or for Renesas Electronics 2CENESAS SALES OFFICES Renesas Electronics Corporation http www renesas com Refer to http www renesas com for the latest and detailed information Renesas Electronics America Inc 2880 Scott Boulevard Santa Clara CA 95050 2554 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 Tel 1 905 898 5441 Fax 1 905 898 3220 Renesas Electronics Europe Limited Dukes Meadow Millboard Road Bourne End Buckinghamshire SL8 5FH U K Tel 44 1628 651 700 Fax 44 1628 651 804 Renesas Electronics Europe GmbH Arcadiastrasse 10 40472 D sseldorf Germany Tel 49 211 65030 Fax 49 211 6503 1327 Renesas Electronics China Co Ltd 7th Floor Quantum Plaza No 27 ZhiChunLu Haidian District Beijing 100083 P R China Tel 86 10 8235 1155 Fax 86 10 8235 7679 Renesas Electronics Sha
6. in compliance with all applicable laws and regulations that regulate the inclusion or use of controlled substances including without limitation the EU RoHS Directive Renesas Electronics assumes no liability for damages or losses occurring as a result of your noncompliance with applicable laws and regulations 9 Renesas Electronics products and technology may not be used for or incorporated into any products or systems whose manufacture use or sale is prohibited under any applicable domestic or foreign laws or regulations You should not use Renesas Electronics products or technology described in this document for any purpose relating to military applications or use by the military including but not limited to the development of weapons of mass destruction When exporting the Renesas Electronics products or technology described in this document you should comply with the applicable export control laws and regulations and follow the procedures required by such laws and regulations 10 It is the responsibility of the buyer or distributor of Renesas Electronics products who distributes disposes of or otherwise places the product with a third party to notify such third party in advance of the contents and conditions set forth in this document Renesas Electronics assumes no responsibility for any losses incurred by you or third parties as a result of unauthorized use of Renesas Electronics products 11 This document may not be reproduced or duplicated in
7. or registers it must be written as a binary constant in the source code for code generation Table 5 2 List of Binary Constant Types Binary number with no additional code int unsigned int long int unsigned long int With an additional code u or U unsigned int unsigned ong int With an additional code I or L long int unsigned long i nt With additional codes u or y and i or u unsigned long int e Register Setting In the generated code registers are assigned the logical sum of variables automatically defined in r_cg_peripheral function name h R01AN1232EJ0100 Rev 1 00 Aug 24 2012 2tENESAS Page 21 of 22 RL78 Family CubeSuite Startup Guide Website and Support Renesas Electronics Website e http www renesas com index jsp Inquiries e http www renesas com contact RO1AN1232EJ0100 Rev 1 00 Page 22 of 22 Aug 24 2012 7tENESAS Revision Record RL78 Family CubeSuite Startup Guide Description Rev Date Page Summary 1 00 Aug 24 2012 First edition issued All trademarks and registered trademarks are the property of their respective owners General Precautions in the Handling of MPU MCU Products The following usage notes are applicable to all MPU MCU products from Renesas For detailed usage notes on the products covered by this manual refer to the relevant sections of the manual If the descriptions under General
8. Bo 0 a mie Pret 1 0 3 a A A Columns sample project Project 34 History DD MM YYYY Version Description a Curent X k 28 RSFLOOLE Microcontroller 35 28 07 2011 1 00 First Release T 7 FEE 3 3 Code Generator Design Tef 36 FOIE E E ISIS E E AE AE E E E E E E E E E E E E E E E E E E E E E E E E E E E E E AE E E E a Hw led pattern static unsime Clock Generator SEO IORI IIE III E A B E E E B BE AE E AIS SOO S OA AAAS ASA AIA ron 39 Includes lt System Includes gt OgProject Includesth Interrupt 40 FEO IORI ISIE D B E E BE E E IORI IIT IIIT III IIIT IOI IOS IAA Serial 41 include r_cg_macrodriver h A D Converter 42 include r_cg_cgc h Timer 43 include r_cg port h Watchdog Timer 44 Start user code for include Do not edit comment generated here amp Real time Clock 45 End user code Do not edit comment generated here Interval Timer include r_cg_userdefine h Clock Output Buzzer Oi OOOO GIGI IOI IO TOR OO III RIO IIE IGRI Rie RDM Controller 49 Function Name main w Voltage Detector 50 Description This function implements main function Ax CATBKOR Build Too 51 Arguments none RL78 E1 Serial Debug Toc 52 Return Value none a B rie 53 FESS IOI ISI AE E E E AE IOI IERIE RIGID III II E E IIR I AOR IIA ce Ell Build t
9. Previe 3 4 CA78KOR Property A sample project Project E Hex File RSFLOOLE Microcontroller Output hex file E Code Generator Design Too Cupu folder for hex file ex file name rs Clock Generator Hex file format mae Split hex file ett eh E Hex File Filling Serial Fill free memory space w A D Converter Filling value Timer Filling start address Watchdog Timer Filing size byte w Real time Clock aaa bleed CRC Operation Clock Output Buzzer Output Others DMA Controller Voltage Detector A CA78KOR Build Tool amp RL78 Simulator Debug Tool G Fie e Ell Build tool generated files S Startup l code Generator J r_main c r_systeminit c r_cac c Y r_cgc_user c r_port c Y r_port_user c ha r_cg_macrodriver h ha r_cg_userdefine h k r_cg_cgc h Raj r_cg_port h fq r kdr Output hex file Select this option to generate a hex file This option corresponds to the o option Build ended Error 0 Warning 0 Ended Success 1 Projects Failed 0 Projects Friday July 06 2012 4 10 27 PM i lt Fi Fe Fa FY FS FE F Fa Fa Fa n i DISCONNECT Figure 3 4 Build Execution Screen Remark The program in a HEX file hex can be written to the flash memory of the microcontroller by using a Renesas E1 emulator and flash programming software Renesas Flash Programmer RFP For details on flash programming refer to Renesas Flash Pro
10. R01AN1232EJ0100 Rev 1 00 Page 3 of 22 Aug 24 2012 RENESAS RL78 Family CubeSuite Startup Guide 2 2 Development Tools to be Used To check operation of the sample code the following development tools are used 2 2 1 CubeSuite Integrated Development Environment CubeSuite is an integrated development environment used on Windows In combination with development tools such as editors compilers and debuggers it allows efficient development The following are provided as main tools a Device dependent Information Files Files that contain device specific information b CA78KOR C Compiler A highly versatile and portable C compiler developed to describe in the C language a program embedded in the RL78 family In order to use CA78KOR on Windows CubeSuite is required c Debug Tools RL78 E1 Serial Performs on chip debugging using an El emulator RL78 IECUBE Performs debugging using a full spec emulator IECUBE CubeSuite RL78 Simulator Instruction simulator for the RL78 family Capable of simulating operation of source code and interval timer functions of channels 0 to 3 of TAU on the host PC d Design Tools Pin Arrangement Function of configuring shared pin settings on a pin arrangement diagram through GUI Capable of inserting a pin arrangement dialog into a design document and outputting pin arrangement in Excel format Code Generation Function capable of automatically generating according to GUI settings a dev
11. RENESAS APPLICATION NOTE RL78 Family R01AN1232EJ0100 Rev 1 00 CubeSuite Startup Guide Aug 24 2012 Introduction The purpose of this document is to help the user understand how to use the RL78 family sample code in CubeSuite and also understand basic operations of development tools for the RL78 family The user can further deepen his or her understanding of these by referring to this document during actual operation of the development tools This document provides an explanation by using the RL78 G13 sample codes Target Device RL78 G13 R01AN1232EJ0100 Rev 1 00 Page 1 of 22 Aug 24 2012 7tENESAS RL78 Family CubeSuite Startup Guide Contents Le EE e e ave isieiss seit nist E baies assent paseo eG alate E ET 3 2 Development Environments sec sccsscsvstescssseiscesuesaatseahasdoseresshcapabesaesousoaesbabesdebspscebessabnsanneascsaesbabeascsevecsbeapubeaanseue 3 2 1 Relationship between the Development Procedure and Development Tools ee eeeeceeseeeseeeseeeseteeeteeeeee 3 2 2 Development Tools t be USCC isevscic ssccyecesecsesevsneosuevehes shanbacsvatesecstbanesuscadessutebecnsuscsaevessnvsnstsi oabeabessicebecapubessevens 4 2 2 1 CubeSuite Integrated Development Environment eee ceeeceeeceeeeeeeeeseceseceaececeaecnaeensecaeeaeeeneees 4 222 Typical CPU Bvaliation Boards ccs iicciscatesscsiscessisascczecscugetadetencsecoussajaceesecsseevsedsdeysetbenetoga soeveuedbingocsaseosnosd 4 3 Generating Obje
12. _ peripheral function name h Defines macros for the values assigned to registers Project r_main c main function r_systeminit c Calls the initialization function of each peripheral function Calls R_CGC_Get_ResetSource r_cg_macrodriver h Defines the macros used in all source files r_cg_userdefine h Empty files For user definition r_lk dr Link directive Note For details on API function refer to CubeSuite V1 02 00 Integrated Development Environment User s Manual RL78 Design R20UT0976 5 2 2 Rules on Source Code This section shows the source code in RL78 G13 A D Converter Software Trigger and Sequential Conversion Modes RO1ANO0452 as an example to describe naming rules e main c lt List omitted gt EREE EEEEEEEEEEEEEEEEEEEEEEEEE EE EEEE EEEE EEEE E E E E ICC Exported global variables and functions to be accessed by other files aaaea oook Start user code for global Do not edit comment generated here You can define global uintl6_t result_buffer AD converte t buffer variables between these End user code Do not edit comment generated here Function Name main Description This function implements main function Arguments none Return Value none PEE EE EEEE EAC EE E E EA HA 2 2 E E E EE 2 2 EEE a a 2 a oe a a ae void main void You can write a user program Start user code Do not edit comment generated here De IMSS WANE uint8_t count Loop counter
13. able AD conversion POS b RS Mcce icon cb ccc EEE EEEE EEEE EEEE EEE EEEE ick ak ck End of function R_ADC_Start FEISS SGC ISS GIS GIGS IC ICICI CIC Remark Do not change character strings in these comments a Defining Global Variables Global variables must be defined after Start user code for global Do not edit comment generated here Note that the lines before End user code Do not edit comment generated here are not changed by code generation Note If a global variable is defined in lines other than these it is overwritten by CubeSuite during code generation b Writing a User Program A user program must be written after Start user code Do not edit comment generated here Note that the lines before End user code Do not edit comment generated here are not changed by code generation Note If a user program is written in lines other than these it is overwritten by CubeSuite during code generation c API Functions API functions must be called by the user program Its calling them configures registers for each peripheral function and performs other operations according to the generated code For details on API functions refer to CubeSuite V1 02 00 Integrated Development Environment User s Manual RL78 Design R20UT0976 RO1AN1232EJ0100 Rev 1 00 Page 20 of 22 Aug 24 2012 RENESAS RL78 Family d Binary Constants CubeSuite Startup Guide To directly write data to bits
14. ate the operation of semiconductor products and application examples You are fully responsible for the incorporation of these circuits software and information in the design of your equipment Renesas Electronics assumes no responsibility for any losses incurred by you or third parties arising from the use of these circuits software or information 2 Renesas Electronics has used reasonable care in preparing the information included in this document but Renesas Electronics does not warrant that such information is error free Renesas Electronics assumes no liability whatsoever for any damages incurred by you resulting from errors in or omissions from the information included herein 3 Renesas Electronics does not assume any liability for infringement of patents copyrights or other intellectual property rights of third parties by or arising from the use of Renesas Electronics products or technical information described in this document No license express implied or otherwise is granted hereby under any patents copyrights or other intellectual property rights of Renesas Electronics or others 4 You should not alter modify copy or otherwise misappropriate any Renesas Electronics product whether in whole or in part Renesas Electronics assumes no responsibility for any losses incurred by you or third parties arising from such alteration modification copy or otherwise misappropriation of Renesas Electronics product 5 Renesas Electronics product
15. ated from a LMF file and does not include debug information RO1AN1232EJ0100 Rev 1 00 Page 5 of 22 Aug 24 2012 7tENESAS RL78 Family CubeSuite Startup Guide 3 1 Creating a New Project and Reading the Sample Code 3 1 1 Preparing the Sample Code Decompress the downloaded file and save it into a desired location folder 3 1 2 Starting CubeSuite and Preparing for Creating a New Project Start 5 When you start CubeSuite and click at Stat S on the toolbar the start panel is opened After the start panel is opened click the Go button below the Create New Project shown in figure 3 1 to create a new project CubeSuite Start Ele File Edit View Project Build Debug Tool Window Help Rar BAJ x 8 Oo a SB z GLA PojectTee ax E Start gt x 29 3 Learn About CubeSuite O We recommend reading the tutorial to find out what can be done in CubeSuite GO The tutorial contains the information on how to effectively use CubeSuite oject B ANgew project can be created ew project can also be created by reusing the file configuration registered to an existing project Open Existing Project B Open Existing CubeSuite High performance Embedded Workshop PM Project The project created with the old IDE can be converted to the CubeSuite project Support version a High performance Embedded Workshop Mao V 4 07 00 or later SH RX RBC M16C H8 project I In following case the build opt
16. cceseacnccu aE a E E E aE E a ai 12 4 2 Procedure for Configuring On chip Debug Settings cc eeeeesecseeeceseceeeecseeseceaeeeesaecaeesecneesessaseneaeeneeas 13 4 2 1 Selecting Changing a Debug Tool 0 0 cee ceeecsseescssecseesecseesecnseeecsaeceeesecaeesecsaeeecsaecaessecaeeaeenesaeenaeeneeaeeas 13 4 2 2 Setting up the On chip Debug Environment eee ceeeccseeesceseeeceseeeeesecaeeseeneeeecsaecasssecaeeaeenaeeeseeeeeeeaeens 14 4 2 3 Connecting the Debug Tool to CubeSuitet oo cee cesecesecnseceecaeecaeeeeeseeeeeeeeeeeesecaeesaessaeeaeenseeens 15 4 2 4 Disconnecting the Debug Tool from CubeSuitet 0 cece sccssesceesecseeeeceeeeecsaeeeeeecaeeeeeaecaeeeeeneseeeaeeetees 16 5 Appendix Code Generations srasni ae EEE ENE aE EE EE REE EEEE EEE aai 17 5 1 Howto Perform Code Generation ssrdsn iens ke aietara aiae a eie aea E Abend 17 5 1 1 Configuration on the Code Generation Panel esssseeeeseseieeteeeesrsrsrerterererstsretiererustsrstereretesrsrnreerersenses 17 52 Checking the Source Code sic sicci ses svete ies sncbsdouessusaaseasseovecsudesacwpatesuedeces subcbans ateussde sacvecbunbaussubonnebsnseteenasesatet 17 D153 gt Outputting the S rece COME iirinn aeniea u EE E EEN EEEE EET AARE EEEE 18 5 2 Rules on Source Code Output through Code Generation ssseseessssesstseresrsrtesssersrsstrressesreetrsrenreseereerrerentes 19 5 2 1 Structure of Source Code ccccsccsssssssocsesesoesscnetsososenonsssevensncnorsossn
17. ct To select or change the debug tool use the context menu shown by right clicking the RL78 debug tool name Debug Tool node in the project tree panel Refer to figure 4 2 sample_project CubeSuite Project Tree File Edit View Project Build Debug Tool Window Help l RL78 Simulator Property E Internal ROM RAM 9 RSF100LE Microcontroller Size of intemal ROMIKBytes Se th code Generator Desion Too Size of intemal RAM Bytes 4096 16 Clock Generator Et lek Main clock frequency MHz 4 00 Pot Sub clock frequency kHz 32 768 Interrupt Select Timer Trace clock frequency CPU clock frequency Serial Unit of Timer Trace clock frequency MHz AJD Converter wie Timer Watchdog Timer Real time Clock Interval Timer Clock Output Buzzer Output DMA Controller No gt Rive recuBe RL78 E1 Serial RL78 E20 Serial RL78 EZ Emulator Z 78KOR Simulator Property 5 startup S code Generator r_main c r_systeminit c regec r_cgc_user c r_port c E r_port_user c h r_cg_macrodriver h h4 r_cg_userdefine h hd r_cg_cgc h hd r_cg_port h 4 r kedr Size of internal ROM KBytes Specifies the size of the internal ROM Connect Settings Debug Tool Settings Output ax gt r_ege e a gt r_port c gt DefaultBuild sample_project 1mf
18. ct Module Piles i ccsccscscscsiescssesdshs scuseensseseceswensensepeesscbscesosssuseutesunsessesnasiees ides sabuseevesenseosessuseoers 5 3 1 Creating a New Project and Reading the Sample Code s ssesssseeseeseesesesrsrserrrersterereeretersrnrererernsenrresnernrseee 6 3 41 71 Preparing the Sample C odessseiniiecririeiei e e i Ee E E EEN 6 3 1 2 Starting CubeSuite and Preparing for Creating a New Project eeseesesseeresesrsrsreriererrrerrerernserrererrereerees 6 3 1 3 Specifying a Proje t isinisccetgscenres enee aeee ee e o aa re Ea a e aea EES Es EE aE 7 32 SOMME Option ByfeSscsenss onae aeee e a a R eas e E Eaa Ea ee Ea aa EE EEEE E ra ESA 8 3 2 1 Setting the On chip Debug Option Byte sseessssesssseesssreesestrrrsrrteerrstesrsrestesretssentretententrsreetnsrereesenreeresreet 8 3 2 2 Setting the User Opuon Bytes siccsiseisvoaschetived oinor orstedo POCEN EE SEENE Ea EATE O AAEE OEEO ERa PE SEEE EEEE 9 3 3 Generating Object Module Files Build s ssseseeseseeseeseseererssrsrsrrrrerersrsrsreretssrtsrttetnenistteretntrsrsresenrerrersenets 10 3 3 Specifying a HEX Pile esc cs 5 coded ec has eset ize akeuecbetuecous e iee A EEE TE Aaea E aea ea Ea AE a E 10 332 Perormmine a BUda eaa ae e a a o EA aea eE aee aE eE tea Ris 11 4 On chip Debugging with E1 Emulator sessseseeseeeseeeseseeesssreerssteresrrrsertresrsreeteseersentrstesteetesreeterertreeerreeresre 12 4 1 Preparation for Debug cic sacescds sii catesaes shacecchustea
19. dresses e Access to reserved addresses is prohibited The reserved addresses are provided for the possible future expansion of functions Do not access these addresses the correct operation of LSI is not guaranteed if they are accessed 4 Clock Signals e After applying a reset only release the reset line after the operating clock signal has become stable When switching the clock signal during program execution wait until the target clock signal has stabilized When the clock signal is generated with an external resonator or from an external oscillator during a reset ensure that the reset line is only released after full stabilization of the clock signal Moreover when switching to a clock signal produced with an external resonator or by an external oscillator while program execution is in progress wait until the target clock signal is stable 5 Differences between Products e Before changing from one product to another i e to one with a different part number confirm that the change will not lead to problems The characteristics of MPU MCU in the same group but having different part numbers may differ because of the differences in internal memory capacity and layout pattern When changing to products of different part numbers implement a system evaluation test for each of the products Notice 1 Descriptions of circuits software and other related information in this document are provided only to illustr
20. e for the project at a time Remark For details on build methods refer to CubeSuite V1 01 00 Integrated Development Environment User s Manual RL78 78KOR Build R20UT0730 This section describes Build as an example to show the procedure for creating a HEX file 3 3 1 Specifying a HEX File After opening the project follow the procedure below to specify the HEX file name 1 Double click CA78KOR build tool shown with a red line in figure 3 3 in Project Tree shown on the left to display the CA78KOR Property screen 2 After the CA78KOR Property screen is displayed select the Object Convert Options tab on the bottom of the screen 3 Enter your desired file name with the file extension hex in the HEX file name property of the HEX File category By default the same name as the project file is shown sample_project CubeSuite Property DER File Edt View Project Buld Debug Tool Window Help sot M W N 2 SAN ES 0 52 cz cs EFES Project Tree BX Property Code Generator 4 Code Generator Preview x O38 A CA78KOR Property Be sample project Proiect E Hex File 94 RSF100LE Microcontroller baat hex Nie Sn es Eoad oss Teall Output folder for hex fle BuildModeName 7 Hex file name SAMPLE_PROGRAM hex E Clock Generator Intel expanded hex format kie Port Interrupt Serial as ery A D Converter pu 1E C
21. e to describe the procedure for setting the option bytes in the CA78KOR build tool property of CubeSuite 3 2 1 Setting the On chip Debug Option Byte Set the on chip debug option byte to enable the on chip debug function of the microcontroller 1 After the CA78KOR Property screen is displayed select the Link Options tab on the bottom of the screen 2 Open the Device category and select Yes go in the Use on chip debug property The Option byte values for OCD Debug monitor area start address and Debug monitor area size byte properties are displayed Option byte values for OCD Property Specifies the control value of the on chip debug option byte as a hexadecimal number without 0x For RL78 G13 specify whether to disable on chip debug operation 0x04 or enable on chip debug operation 0x84 0x85 Debug monitor area start address Property Specifies the start address of the debug monitor area as a hexadecimal number without 0x Default the internal ROM end address 1024 1 Debug monitor area size byte Property Specifies the size of the debug monitor area as a decimal number The range of specifiable values is 0 to 1024 Default 512 RO1AN1232EJ0100 Rev 1 00 Page 8 of 22 Aug 24 2012 7tENESAS RL78 Family CubeSuite Startup Guide 3 2 2 Setting the User Option Byte Set the user option byte to configure the watchdog timer WDT and the low voltage detector LVD and to specify the syste
22. ed project folder to a new project folder 4 Click the Create button to create a project Note If the product type to be used does not exist in the selection list install the device dependency information file Create Project Microcontroller Using microcontroller A Search microcontroller Update R5F101JE 52pin Product Name R5F100 i Internal ROM size KByte g E 01 We ren Internal RAM size Bytes 4096 cH 8h RL78 G13 ROM 96KB tH h RL78 G13 ROM 128KB WA AL78 G13 ROM 192KB Hj AL78 G13 ROM 256KB Hh RL78 G13 ROM 384KB Lon fi n annae Kind of project Project name sample_project Place amp Program Files R enesas Electronics v Make the project folder C Program Files Renesas Electronics sample_project sample_project m V Pass the file composition of an existing project to the new project Project to be passed C Documents and Settings toolai D esktof f V Copy composition files in the diverted project folder to a n Figure 3 2 Create Project Dialog R01AN1232EJ0100 Rev 1 00 Page 7 of 22 Aug 24 2012 RENESAS RL78 Family CubeSuite Startup Guide 3 2 Setting Option Bytes The option bytes consist of a user option byte and an on chip debug option byte When the power is turned on or at reset the microcontroller automatically refers to the settings of the option bytes and starts operation This section shows settings of RL78 G13 as an exampl
23. euoncnsosesossseesenssenononenossenssonenensesosonss 19 5 2 2 JRUIES OD Source COGS sacssscssecesschahsssnasyasysscbsdovseesvbbsepisesseepuccnasnedpuseevsuseuncoaisstassvueysacbadp aessaevencbeibapestoeaendly 19 RG VISION RECOIL yeisccuscseschssesicosescsaeseabebanceuscdecedabeuscenusssacvousabseseusesaesbasesaensdesaaevenbsbinseiien spestnsnsacoedesaaseaiebaacevseduesnasnaaess 23 General Precautions in the Handling of MPU MCU Products 000 0 seeceeseecseeeeesecseeseceeeeecsaeeeceaecaeesesaeeeesaeeessnesaees 24 RO1AN1232EJ0100 Rev 1 00 Page 2 of 22 Aug 24 2012 7tENESAS RL78 Family CubeSuite Startup Guide 1 Preface Audience e This document is intended for customers who for the first time use the sample code and development tools for the RL78 family Note that basic knowledge of how to operate Windows is required for the use of the development tools 2 Development Environment This section describes a development procedure and development tools under the use of the RL78 family 2 1 Relationship between the Development Procedure and Development Tools The figure below shows the relationship between a product development procedure and development tools Product planning design Integrated development environment CubeSuite S Debug tools e RL78 E1 Serial e RL78 IECUBE e RL78 simulator System evaluation Productization Figure 2 1 Development Procedure and Development Tools
24. grammer flash memory programming software User s Manual R20UT0599 RO1AN1232EJ0100 Rev 1 00 Aug 24 2012 RENESAS Page 11 of 22 RL78 Family CubeSuite Startup Guide 4 On chip Debugging with E1 Emulator The use of debug functions provided by CubeSuite allows efficient debugging of programs developed for the RL78 family This section provides an example of configuring settings for on chip debugging with a Renesas E1 emulator For details on the debug functions provided by CubeSuite refer to CubeSuite V1 02 00 Integrated Development Environment User s Manual RL78 Debug R20UT0978 4 1 Preparation for Debug Connect the host machine the E1 emulator and the target board if necessary as shown in figure 4 1 For details on how to connect them refer to E1 E20 Emulator Additional Document for User s Manual Notes on Connecting RL78 R20UT1994 g D eS D o f Dedicated probe gt f z USB cable EDN g Host machine H E1 CubeSuite Target system Note Only serial communication is supported as the method of communication with the target system JTAG communication cannot be used Figure 4 1 Example of Connecting the Host Machine and Debug Tools E1 RO1AN1232EJ0100 Rev 1 00 Page 12 of 22 Aug 24 2012 7tENESAS RL78 Family CubeSuite Startup Guide 4 2 Procedure for Configuring On chip Debug Settings 4 2 1 Selecting Changing a Debug Tool Select the debug tool to be used in the proje
25. gt DefaultBuild SAMPLE_PROGRAM hex Build ended frror 0 Warning 0 A Ended Success 1 Projects Failed 0 Projects Friday July 06 2012 4 10 27 PM 3 y EOF Jim anmessages mamata 5 Fe Fe F3 vad Fs FE F Fa F3 w n te Uses serial connected E1 as the debug tool DISCONNECT Figure 4 2 Selecting Changing a Debug Tool E1 RO1AN1232EJ0100 Rev 1 00 Page 13 of 22 Aug 24 2012 RENESAS RL78 Family CubeSuite Startup Guide 4 2 2 Setting up the On chip Debug Environment Use the property panel shown in figure 4 3 to set up the operation environment for the E1 emulator This section shows a process for configuring the settings in Connection with Target Board For configuring other settings refer to CubeSuite V1 02 00 Integrated Development Environment User s Manual RL78 Debug R20UT0978 E Connection with T arget Board Communication method 1 line type TOOLO Power target from the emulator M amp x 200m4 Yes Supply voltage 5 04 sample_project CubeSuite Project Tree Uf sample proieB Project 9M RSFLOOLE Microcontroller d Code Generator ign Tool E Clock Generator Port Interrupt Serial A D Converter Timer Watchdog Timer Realtime Clock Interval Timer Clock Output Buzzer Output wi DMA Controller Voltage Detector A CA78KOR Build Tool Ma Using intemal clock Using intemal clock
26. ice driver program that controls peripheral microcontroller functions e g timer serial I F A D 2 2 2 Typical CPU Evaluation Boards CPU board e g QB R5FIOOLE TB RL78 G13 with 64 pins and 64 kbyte ROM Renesas Starter Kit e g Renesas Starter Kit for RL78 G13 RL78G13 Stick starter kit RL78G13 STICK RO1AN1232EJ0100 Rev 1 00 Page 4 of 22 Aug 24 2012 7tENESAS RL78 Family CubeSuite Startup Guide 3 Generating Object Module Files Build the sample code using CubeSuite in order to generate object module files HEX and LMF files from the sample code This section describes a process from creating a project of the sample code to performing a build For details on how to create a CubeSuite project refer to CubeSuite V1 02 00 Integrated Development Environment User s Manual Start R20UT0975 Note In the sample code for the RL78 family it is impossible to change the device product name specified first in the project Therefore to change the device product name in the project create a new project Remarks 1 To use the downloaded original project of the sample code double click the file lt the name of the downloaded file gt lt file extension gt mtpj to open the CubeSuite project In this case follow the procedure described in section 3 2 Setting Option Bytes 2 A load module file LMF is an object file that includes debug information such as symbols 3 A hex file is a hex format object file gener
27. if Yes is selected in the Power target from the emulator MAX 200 mA property It specifies the voltage supplied to the target system Example 5 0 V A voltage of 5 0 V is supplied to the target system Note The properties in this category cannot be changed while the E1 emulator is connected RO1AN1232EJ0100 Rev 1 00 Page 14 of 22 Aug 24 2012 RENESAS RL78 Family CubeSuite Startup Guide 4 2 3 Connecting the Debug Tool to CubeSuite Click the button on the debug toolbar to download the LMF file after connecting the debug tool CubeSuite Property Z Property i Code Genera ram to the debug tool SY RL78 E1 Serial Property Bytes 9 RSF100LE Microcontroller E Byte SJ Code Generator Design Tool E Clock Generator karemani w Port Fiat Main clock frequency MHz Interrupt Sub clock frequency kHz Serial Monitor clock System w A D Converter B Connection with Target Board Timer Communication method 1 line type TOOLO Watchdog Timer Power target from the emulator M4 gt 200m4 Yes od et hnal e 5 0 v Connecting to AL78 E1 Serial Emulator firmware is automatically updated if necessary Do not disconnect USB cable and power supply until connection is completed Cancel sample_project RL78 E1 Serial CubeSuite Output File Edit View Project Build Debug Tool Window Help
28. ions also can be converted From the HEW RX compiler package V 1 00R00 or later project to the CubeSuite RX project Open Sample Project m Many sample projects that can be built immediately are provided After selecting the desired project from the list below press the GO button and specify the destination folder to copy the selected sample project 78K0 7 KOR RL78 Rx _ veso 78K0_KC2 L_Tutorial_Basic_Operation aG 78KO_KF2_Tutotial_ Analysis All Messages fa en F S DISCONNECT Figure 3 1 CubeSuite Start Panel R01AN1232EJ0100 Rev 1 00 Page 6 of 22 Aug 24 2012 RENESAS RL78 Family CubeSuite Startup Guide 3 1 3 Specifying a Project After the Create Project dialog shown in figure 3 2 is displayed configure the following settings 1 Select the name of the device product to be used in the project 2 Specify the project name and the location at which the project file is to be created If you do not want to create a folder with the project name at the specified location uncheck Make the project folder 3 Check Pass the file composition of an existing project to the new project and in Project to be passed specify the name of the project file of the sample code to be reused By specifying it here the source file to be reused is automatically read To use the same file structure of the specified source project check Copy composition files in the divert
29. lICK TN Timer Hex file format No Yest u F FF Watchdog Timer W Realtime Clock Interval Timer A Clock Output Buzzer Output DMA Controller W Voltage Detector i ATKOR Build Tool RL78 Simulator Debug Tool j File S startup Code Generator r_main c J r_systeminit c J r_cgc c EY r_cgc_user c J r_port c Y r_port_user c A r_cg_macrodriver h h r_cg_userdefine h k r_cg_coc h ka r_cg_port h fe r_Ik dr a Output hex file Select this option to generate a hex file This option corresponds to the o option amon Options Compile Options Assemble Options Link Options S amp DISCONNECT Figure 3 3 Object Convert Options Screen RO1AN1232EJ0100 Rev 1 00 Page 10 of 22 Aug 24 2012 RENESAS RL78 Family CubeSuite Startup Guide 3 3 2 Performing a Build ir Click the button shown in a frame in figure 3 4 to perform a build After the build is performed a HEX file hex is generated from the source file and stored in the project file folder Upon completion of the build the message Build ended Error 0 Warning 0 is displayed on the output screen of the CubeSuite screen sample_project CubeSuite Property File Edit View Project Build Debug Tool Window Help E start i Project Tree ax IE Property 2 Code Generator Code Generator
30. m reserved area The setting of the user option byte can also be specified in the Device category of the Link Options tab Selecting Yes go in the Set user option byte property displays the User option byte value property User Option Byte Value Property Specifies the user option byte value as a hexadecimal number without 0x For RL78 G13 specify whether to stop the WDT OxEF or use the LVD reset mode 2 81 V 0x7F or set the operation clock to fm 32 MHz HS mode OxE8 Remark For details on how to set the option bytes refer to CubeSuite V1 01 00 Integrated Development Environment User s Manual RL78 78KOR Build R20UT0730 Note The option bytes can be set by programming in source code as well as by configuring the link options Note that if the option bytes are set simultaneously in both the ways the value set by configuring the link options becomes valid RO1AN1232EJ0100 Rev 1 00 Page 9 of 22 Aug 24 2012 7tENESAS RL78 Family CubeSuite Startup Guide 3 3 Generating Object Module Files Build Build the sample code using CubeSuite to generate object module files HEX and LMF files from the sample code There are the following types of build Type Description Build Of the build target files only the updated files are built Rebuild All build target files are built Rapid build A build is performed while build settings are changed Batch build A build is performed in all build modes availabl
31. ng DMA Controller High speed OCO flH voltage Detector Qe Ce A CA78KOR Build Tool High speed OCO clock setting S RL78 Simulator Debug Too Operation Frequency 32 v Mka B g File I ED build tool generated fie High speed system clock setting S startup Operation X1 oscillation X External clock input EX Frogamoy E Mha Stable time 2428 8 2 18 IMX us Subsystem clock fSUB setting Operation XT1 oscillation EXT External subclock input fEXS Frequency kHz XT1 oscillator oscillation mode setting Low power consumption Subsystem clock in STOP HALT mode setting Enables supply Intemal low speed oscillation clock fiL setting 15 Output ax W0403029 Please select pin assignment setting a EOF lt z FE Build amp Downl F9 Set Delel Figure 5 2 009 bmp Paint Example of Outpuiting Source Code RO1AN1232EJ0100 Rev 1 00 Aug 24 2012 2tENESAS Page 18 of 22 RL78 Family CubeSuite Startup Guide 5 2 Rules on Source Code Output through Code Generation 5 2 1 Structure of Source Code Listed below are the files output through code generation Table 5 1 List of the Files Output through Code Generation Output Unit File Name Description Each peripheral r_cg_peripheral function name c Initialization functions API functions function t_cg_peripheral function name_user c Interrupt functions callback functions r_cg
32. nghai Co Ltd Unit 204 205 AZIA Center No 1233 Lujiazui Ring Rd Pudong District Shanghai 200120 China Tel 86 21 5877 1818 Fax 86 21 6887 7858 7898 Renesas Electronics Hong Kong Limited Unit 1601 1613 16 F Tower 2 Grand Century Place 193 Prince Edward Road West Mongkok Kowloon Hong Kong Tel 852 2886 9318 Fax 852 2886 9022 9044 Renesas Electronics Taiwan Co Ltd 13F No 363 Fu Shing North Road Taipei Taiwan Tel 886 2 8175 9600 Fax 886 2 8175 9670 Renesas Electronics Singapore Pte Ltd 80 Bendemeer Road Unit 06 02 Hyflux Innovation Centre Singapore 339949 Tel 65 6213 0200 Fax 65 6213 0300 Renesas Electronics Malaysia Sdn Bhd Unit 906 Block B Menara Amcorp Amcorp Trade Centre No 18 Jin Persiaran Barat 46050 Petaling Jaya Selangor Darul Ehsan Malaysia Tel 60 3 7955 9390 Fax 60 3 7955 9510 Renesas Electronics Korea Co Ltd 11F Samik Lavied or Bldg 720 2 Yeoksam Dong Kangnam Ku Seoul 135 080 Korea Tel 82 2 558 3737 Fax 82 2 558 5141 2012 Renesas Electronics Corporation All rights reserved Colophon 2 2
33. nnected debug tool After the communication is terminated the status bar on the main window changes as shown in figure 4 5 DISCONNECT l The information of the debug tool disappears at this area DISCONNECT is displayed Figure 4 5 Status Bar Indicating Disconnection with the Debug Tool R01AN1232EJ0100 Rev 1 00 Page 16 of 22 Aug 24 2012 7tENESAS RL78 Family CubeSuite Startup Guide 5 Appendix Code Generation 5 1 How to Perform Code Generation Code generation with CubeSuite outputs source code device driver program according to settings that are configured through the CubeSuite panel and are necessary to control peripheral functions e g functions of clock generators and ports provided by the RL78 family This section describes the procedure for code generation For details on code generation refer to CubeSuite V 1 02 00 Integrated Development Environment User s Manual RL78 Design R20UT0976 5 1 1 Configuration on the Code Generation Panel Open the code generation panel for the peripheral functions to be used e g functions of clock generators and ports and configure necessary settings sample_project_ CubeSuite Code Generator File Edit View Project Build Debug Tool Window Help Q srt DO 2 8 9 Ra A 7 SGA Project Tree z Code Generator Code Generator Preview 2 O38 ectinPin S Generatecoee Le FU SPASM AO Me E j ia nea Aaa i 5
34. ool generated file 54 void main void S startup t S code Generator 56 Start user code Do not edit comment generated here TE k 57 LED1 3 pattern ty r_man c 58 static const uint t led pattern 4 r_systeminit c 59 7 r_cgc c 60 No use EY r_cgc_user c 61l P12 LED3 E r_port c 2 fo ED2 r_port_user c 63 TELL LD ED1 K r_cg_macrodriver H f 4 0b00000011 SH1 ON SW2 O i npt na 65 0b00000101 SW1 OFF SW2 Oll a cee h 66 0b00000110 SW1 ON SW2 0 SS t_eg_cac 67 0b00000111 SW1 OFF SW2 O Raj r_cg_port h r lt j gt rkr 5 Local Variables fi CPU Register while 10 es 71 73 0018e tew 74 End user code Do not edit comment generated here 75 00190 76 AOI III IO RAAR AAA RAER SOS IO EA 77 End of function main 78 TBE BE E E E E E E SE E E E E B AE E BE BE AE DE E E E BE E E E E E III IOI BE E AE DE AE E IR E E E E E E E E AE AE E A AE AOA SE E Start user code for adding Do not edit comment generated here End user code Do not edit comment generated here 9 Line 13 Column Read only BREAK Figure 4 4 Example of Downloading the Program to the Debug Tool R01AN1232EJ0100 Rev 1 00 Page 15 of 22 Aug 24 2012 RENESAS RL78 Family CubeSuite Startup Guide 4 2 4 Disconnecting the Debug Tool from CubeSuite x Click the button in the debug toolbar to terminate the communication with the currently co
35. s are classified according to the following two quality grades Standard and High Quality The recommended applications for each Renesas Electronics product depends on the product s quality grade as indicated below Standard Computers office equipment communications equipment test and measurement equipment audio and visual equipment home electronic appliances machine tools personal electronic equipment and industrial robots etc High Quality Transportation equipment automobiles trains ships etc traffic control systems anti disaster systems anti crime systems and safety equipment etc Renesas Electronics products are neither intended nor authorized for use in products or systems that may pose a direct threat to human life or bodily injury artificial life support devices or systems surgical implantations etc or may cause serious property damages nuclear reactor control systems military equipment etc You must check the quality grade of each Renesas Electronics product before using it in a particular application You may not use any Renesas 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 6 You should use the Renesas Electronics products described in this document within the range
36. specified by Renesas Electronics especially with respect to the maximum rating operating supply voltage range movement power voltage range heat radiation characteristics installation and other product characteristics Renesas Electronics shall have no liability for malfunctions or damages arising out of the use of Renesas Electronics products beyond such specified ranges 7 Although Renesas Electronics endeavors to improve the quality and reliability of its products semiconductor products have specific characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use conditions Further Renesas Electronics products are not subject to radiation resistance design Please be sure to implement safety measures to guard them against the possibility of physical injury and injury or damage caused by fire in the event of the failure of a Renesas Electronics product such as safety design for hardware and software including but not limited to redundancy fire control and malfunction prevention appropriate treatment for aging degradation or any other appropriate measures Because the evaluation of microcomputer software alone is very difficult please evaluate the safety of the final products or systems manufactured by you 8 Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental compatibility of each Renesas Electronics product Please use Renesas Electronics products
37. up message 5 1 2 Checking the Source Code Selecting Code Generation Preview allows you to on the opened code generation preview panel check the source code to be generated according to settings configured on the code generation panel R01AN1232EJ0100 Rev 1 00 Page 17 of 22 Aug 24 2012 RENESAS RL78 Family 5 1 3 Outputting the Source Code Click the Generate Code button on the code generation panel to output the source code CubeSuite Startup Guide sample_project_ CubeSuite de Generator File Edit View Project Build Debug Tool Window Help ax E Property ay om at jenerator Preview vx 20 a Bl eetiect in pin ff Generate Code we FU E F S sample project Project _ i a a Pin assignment sel bug setting Confirming reset source Safety functions E RSFLOOLE Microcontroller a i Generat Ba el nicl iy P Code Generator Design Tia nena neato 5 Clock Generator High speed main mode 2 7 V lt VI w Port High speed main mode 2 4 v lt VDD S a seta O Low speed main mode 1 8 V VDD lt 5 rial amp AID Converter Low voltage main mode 1 6 V lt VDD lt 5 5 Timer EVDD setting a Worstedog Tier 40M lt EVDD lt 55M 55M Real time Clock Interval Timer 1 8 lt EVDD lt 55 Clock Output Buzzer _ Main system clock fMAIN setti

Download Pdf Manuals

image

Related Search

Related Contents

fiche de sécurité    Fish 4430 / 4431  6002TA User Manual B  Service Manual - Fuji Electric  PIANO DI SICUREZZA E DI COORDINAMENTO  SDNMS取り扱い説明書 - Twise Labo, Inc.  NuTone 10N User's Manual  

Copyright © All rights reserved.
Failed to retrieve file