Home
Code Generator Tutorial Manual
Contents
1. End of function R CMT MsDelay voke oke oke RK okok ok ok ok ok ok ok okok ok dk okok okok ok okok ok ok ok ok ok ok okok ok ok okok okokok ok okok okok okok KKK KOK KK KK KK KK RK KK KKK R20UT2983EG0100 Rev 1 00 TEN ESAS Page 33 of 53 Jun 20 2014 RSK RX64M 5 User Code Integration 5 2 Additional include paths Before the project can be built the compiler needs some additional include paths added Select the CG Tutorial project in the Project Explorer pane Use the e button in the toolbar to open the project settings Navigate to C C Build gt Settings gt Compiler Source and click the button as shown in below in Figure 5 2 e Properties for CG Tutorial Build Variables Change Toolchain Vers C C General E Source file 3 Object 33 Li Dependency Scan E List Device 4 Optimize Environment 5 Advanced Logging E Miscellaneous Settings e User Tool Chain Editor 4 CPU 5 Advanced PIC PID type filter text Settings 2 EAT Resource Builders Compiler Include file directories aa 2 83 Source 4 C C Build 4 dB Source TCINSTALL include Project References Preinclude files E x Run Debug Settings Task Repository 4 8 Assembler E Source 4 Object 58 Advanced List 3 Miscellaneous 3 User 4 S Linker
2. f Function Name R ICU IRQSetRisingEdge Description This function sets clear the rising edge trigger for the specified ICU IRO Arguments x Ulnes t irg no uint8 t set r edge 1 if setting rising edge triggered 0 if i clearing x Return Value None FER KI kk ko IK ak kk ok ok kk I ak ok oke oka ok ke kk ok ok oka ok ok oke oka I ok ke oke aka ok II ok oke oka ok ke oke ak ok ke oka ok ak oke oka ok ok oke dk ok okok dk ok okok ok okok ok ARAS void R ICU IROSetRisingEdge const uint8 t irg no const uint8 t set r edge if 1 set_r_edge ICU IROCR irq_no BYTE 08 ICU IRO EDGE RISING else ICU IRQCR irq no BYTE amp uint8 t 08 ICU IRQ EDGE RISING KKK KK KKK A RR KK A ARK A ARK I A ARK A ARK ARK IR AR KK I kkk k End of function R_ICU_IROSetRisingEdge FA KKK KKK ARK ARK KA RR RR RR RR RR RR ARRAY Open the r cg icu user c file and insert the following code in the user code area for include near the top of the file Defines switch callback functions required by interrupt handlers include r_rsk_switch h In the same file insert the following code in the user c
3. the call back function when SW1 or SW2 is pressed R SWITCH SetPressCallback cb switch press ialise the debug LCD pit y Displays the application name on the debug LCD R LCD Display 0 uint8 t R LCD Display 1 uint8 t Tutorial R LCD Display 2 uint8 t RSK RX64M Press Any Switch the A D converter R S12ADO Start up SCI7 receive buffer and callback function Serial Receive uint8 t sg rx char 1 Enable SCI7 operations R SCI7 Start 1U uintl6 t adc result Wait for user requested A D conversion flag to be set SWl or SW2 if els TRUE g_adc_trigger Call the function to perform an A D conversion adc_result get_adc Display the result on the LCD lcd display adc adc result Increment the adc count and display using the LEDs if 16 kado count adc_count 0 Send the result to the UART uart display adc adc count adc result Reset the flag g adc trigger FALSE SW3 is directly wired into the ADTRGOn pin so will cause the interrupt to fire e if TRUE g adc complete Get the result of the A D conversion R S12ADO Get ValueResult ADCHANNELO amp adc result Display the result on the LCD lcd display adc adc result Increment the adc count and display using the LEDs if 16 kade count adc count
4. A variable to retrieve the adc result uint16 t adc result Stop the A D converter being triggered from the pin ADTRGOn R S12ADO Stop Start a conversion R S12ADO SWTriggerStart Wait for the A D conversion to complete while FALSE g adc complete Wait Stop conversion R_S12AD0_SWTriggerStop fe Clear ADC flag g_adc_complete FALSE R_S12AD0_Get_ValueResult ADCHANNELO amp adc result Set AD conversion start trigger source back to ADTRGOn pin R S12ADO Start return adc result BR KKK IKK I ZD kk I kk k I ke k kk I I Ck ke k kk I I ke k kk k k ke ke kk ke k k k k k k I k k k k k k k End of function get adc CK Ck Ck Ck ok ok kk Ck ok kk okok ok Ck ok kk okok kk Ck kk Ck e kk ok ke kk okokok ok ke kk Ck ke kk ke kk Ck ke kk Ck ko kk ke kk ko ke kk ke koe ke kk koe ke ke ek BR ARK KIRK Ck kk Ck kk Ck A kk Ck ko okok Ck kk kkk kkk AAA Function Name lcd display adc Description Converts adc result to a string and displays la it on the LCD panel Argument uintl6 t adc result x Return value none static void lcd display adc co
5. File Edit Source Refactor Navigate Search Project Run Window Help 5 Debug 52 U RH LN PIV 7D var 4 E CG Tutorial HardwareDebug Renesas GDB Hardware Debugging 4 2 CG Tutorial x 4 of Thread 1 1 No thread info available Suspended Signal SIGTRAP Trace breakpoint trap Beams PowerON Reset PCO at r_cg_resetprg c 1 Oxffc00000 pl gdb pl GDB server B r cg userdef Le reg main c Le r_cg_intprg c Ln r cg icu h Ln rcg sci h Le rcg sci userc rec 71 ffcovooo void P 72 73 tifdef RXV2 74 ffcooQo0e set extb sectop EXCEPTVECT 75 tendif 76 ffca0017 set intb sectop C VECT 77 78 tifdef ROZ Initialize FPSW 79 tdefine ROUND 04xe2000001 Let FPSW RMbits 01 round to zero 80 telse 81 tdefine ROUND axaaaaaaaa Let FPSW RMbits 00 round to nearest 82 tendif m El Console 53 4 Tasks Renesas Coverage Memory Usage Performance Analysis Profile um Real time Chart a CG Tutorial HardwareDebug Renesas GDB Hardware Debugging gdb monitor set_io_access_width RW 1 c1234 c1236 c1238 c123c c124c c124d c1260 c1270 c1280 c1282 c1284 c12 monitor set io access _width RW 1 c1404 c1405 c140c c1600 c16041 c1606 c1a00 cla0a clade cla0f cla2c cla monitor set io access width RW 1 clc84 clc86 c1c94 clc96 clca4 clca6 clcb2 clcb4 clcbo d0002 d0006 dO0 manitarn cat in arroco width DU 1 7fa5010 7fs01A4A FEMIR 7FaMOA FFAA 7EaMdAa m Figure 6 2 Debugger start up
6. 0 Send the result to the UART uart display adc adc count adc result Reset the flag g adc complete FALSE End user code Do not edit comment generated here R20UT2983EG0100 Rev 1 00 2TENESAS Jun 20 2014 Page 45 of 53 RSK RX64M 5 User Code Integration Then add the following function definition in the user code area at the end of the file AAA K k k k kk ke kk ko kk Ck k kk Ck RRA ke kk Ck RRA RRA ke kk Ck ke kk ke ke kk RR kk k kk k ke kk ke k k k k k ok ok okok ok k kk k k kk k k k k Function Name led display count Description Converts count to binary and displays on 4 LEDSO 3 Argument rnt8 t count Return value none Ck Ck Ck kk ko kk ke kk ko ko kk ke kk I kk ke ke kk ke kk Ck ke kk ke ke kk ke kk ke ke kk ke ke kk ke kk ke ke kk ke kk ko ke oke ok ke ke RAR RARA ok ok okok static void led display count const uint8 t count Set LEDs according to lower nibble of count parameter LEDO count amp 0x01 LED ON LED OFF LED1 count amp 0x02 LED ON LED OFF LED2 count amp 0x04 LED ON LED OFF LED3 count amp 0x08 LED ON LED OFF BRK KKK okok okok okok okok okok okok okok okok okok okok okok okok okok okok okok okok okok okok okok okok okok okok okok I Se ke okok okok okok okok okok okok ke ke e ke ke ke e e okok x End of function led display count vk ok kk ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok RARA RA
7. O 2014 Renesas Electronics Corporation All rights reserved O 2014 Renesas Solutions Corp All rights reserved R20UT2983EG0100 Rev 1 00 2tEN ESAS Page 49 of 53 Jun 20 2014 REVISION HISTORY RSK RX64M Code Generator Tutorial Manual Date Description Page Summary Jun 20 2014 First Edition issued Renesas Starter Kit Manual Code Generator Tutorial Manual Publication Date Rev 1 00 Jun 20 2014 Published by Renesas Electronics Corporation LENESAS 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 Shanghai Co Ltd Unit 301 Tower A Central Towers 555 LanGao Rd Putuo Distric
8. These tutorials are designed to show you how to use the RSK and are not intended as a comprehensive introduction to the e studio debugger compiler toolchains or the E1 emulator Please refer to the relevant user manuals for more in depth information R20UT2983EG0100 Rev 1 00 AS Page 8 of 53 Jun 20 2014 RENES RSK RX64M 3 Project Creation with e studio 3 Project Creation with e studio 3 1 Introduction In this section the user will be guided through the steps required to create a new C project for the RX64M MCU ready to generate peripheral driver code using Code Generator This project generation step is necessary to create the MCU specific source project and debug files 3 2 Creating the Project Start e studio and select a suitable location for the project workspace e Start e studio and select a suitable e Workspace Launcher location for the project workspace Select a workspace e2 studio stores your projects in a folder called a workspace Choose a workspace folder to use for this session Workspace Browse E Use this as the default and do not ask again e Inthe Welcome page click Go to the es file Edit Source Refactor Miavmate Search Proyect Bun Window Help workbench IQ Welcome D a Welcome Q EF JUNE Go to the workbench RENESAS Smert Menus Discovery Startup OIX m E e Create a new C project by right Project Explorer 52 clicking
9. Actual value 20 Interrupt setting 4 Enable compare match interrupt CMI1 Priority Level 10 Figure 4 7 CMT1 tab Navigate to the CMT2 sub tab and configure CMT2 as shown in Figure 4 8 This timer is configured to generate a High priority interrupt after 200ms This timer is used as our long switch de bounce timer later in this tutorial Peripheral Functions 2 Code Preview EJ Properties Co Generate Code D 7 O CMTO CMT1 CMT2 CMT3 E Compare match timer operation setting m gt Unused Used Count clock setting D PCLK 8 PCLK 32 D PCLK 128 PCLK 512 Interval value setting Interval value 200 ms w Actual value 200 004267 Interrupt setting Enable compare match interrupt CMI2 Priority Level 10 1 Figure 4 8 CMT2 tab 4 3 4 12 bit A D Converter Navigate to the 12 bit A D Converter tab in Code Generator Refer to the screenshot shown in Figure 4 9 and configure the S12ADO as shown We will be using the S12AD0 in 12 bit one shot mode on the ANOOO input which is connected to the RV1 potentiometer output on the RSK The conversion start trigger will be via the pin connected to SW3 R20UT2983EG0100 Rev 1 00 TEN ESAS Page 21 of 53 Jun 20 2014 RSK RX64M Ej Peripheral Functions 52 Code Preview Properties 4 Code Generation Using the e studio plug in Fx Generate Code Q 7 S12ADO 124D1 laj Set
10. m Figure 5 2 Adding additional search paths In the Add directory path dialog click the Workspace button and in the Folder selection dialog browse to the CG Tutorial src folder and click OK e studio formats the path as show in Figure 5 3 below E le Add directory path Directory workspace loc ProjName src Figure 5 3 Adding workspace search path Repeat the above steps to add the src cg src workspace search path Select Build Project from the Project menu or use the button e studio will build the project with no errors The project may now be run using the debugger as described in 6 The program will display RSK RX64M Tutorial Press Any Switch on 3 lines in the LCD display R20UT2983EG0100 Rev 1 00 Jun 20 2014 RENESAS Page 34 of 53 RSK RX64M 5 User Code Integration 5 3 Switch Code Integration API functions for user switch control are provided with the RSK Locate the files rskrx64mdef h r_rsk_switch h and r_rsk_switch c on the RSK DVD These files can be found in the Tutorial project for B studio Copy these files into the C Workspace CG_Tutorial src directory Import these three files into the project in the same way as the lcd files The switch code uses interrupt code in the files r cg icu h r cg icu c and r cg icu user c and timer code in the files r cg cmt h r cg cmt c and r cg cmt user c as described in 4 3 2 an
11. Declare a temporary variable char a Declare temporary character string static char uart_buffer ADC xH Value Convert ADC result into a character string and store in the local Casting to ensure use of correct data type a char adc count amp 0x000F uart_buffer 4 char a lt Ox0A a 0x30 a 0x37 a char adc result amp OxOF00 gt gt 8 uart_buffer 14 char a lt Ox0A a 0x30 a 0x37 a char adc result amp 0Ox00F0 gt gt 4 uart buffer 15 char a lt 0x0A a 0x30 a 0x37 a char adc result amp 0x000F uart buffer 16 char a lt Ox0A a 0x30 a 0x37 Send the string to the UART R DEBUG Print uart buffer BR KKK okok ok ok okok ok ok oke ok ok ok oka ok ok oke e ok ok oke oka ok oke oka ok ok oke ka ok ok oke oka ok oke oka ok ok oke oka ok ok oka oka ok oke oka ok ok oke oka ok ok oke oa ok oke ke ok ok oke ok ok okok ok ok okok okok okok x End of function uart display adc FER ok ok oke dk IK ok oke ok ok ok oke dk ok ok oke oka ok oke oka ok ok oke oka ok oke oke oa ok oke ok ok ok oke I oa ok oke da ok ok oke IR ok oke dk ok ok oke I ok oke ok ok okok ok ok ok Select Build Project from the Build menu e studio will build the project with no errors The project may now be run using the debugger as described in 6 Connect the RSK G1CUSBO port to a USB port on a PC If t
12. area at the end of the file Start user code for function Do not edit comment generated here End user code Do not edit comment generated here Now open the r cg sci user c file and insert the following code in the user area for global Start user code for global Do not edit comment generated here End user code Do not edit comment generated here Insert the following code in the transmitend call back function for SCI6 static void r sci6 callback transmitend void Start user code Do not edit comment generated here End user code Do not edit comment generated here Now insert the following function in the user code area at the end of the file BORK KKK KKK RK KKK KK RK KKK KKK KK KKK KKK KK KKK KK KK Function Name R_SCI6_SPIMasterTransmit Description This function sends SPI6 data to slave device Arguments f qx Dup transfer buffer pointer tx num buffer size Return Value status x MD OK or MD ARGERROR okok ok okok ok ok okok ok ok kok okok okok okok ok ok ok okok Ck kk kk kk Ck e kk Ck ke kk ke kk Ck ke RAR kk ke ko kk ke kk ke ke kk ke kk ko ke kk ko ke ko ke ke kk ke ke ke AAA Y MD STATUS R SCI6 SPIMasterTransmit uint8 t const tx buf const uintl16 t tx num MD_STATUS status MD_OK clear the flag before initiating a new transmission sci6 txdone FALSE Send the data using the API status R_SCI6_SPI_Master_Send tx_buf tx
13. describes how to the e studio IDE code generator plug in to create a working project for the RSK platform 1 2 Features This RSK provides an evaluation of the following features Project Creation with e studio e Code Generation using the code generator plug in e User circuitry such as switches LEDs and a potentiometer The RSK board contains all the circuitry required for microcontroller operation R20UT2983EG0100 Rev 1 00 AS Page 7 of 53 Jun 20 2014 RENES RSK RX64M 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 e studio IDE to create a working project for the RSK platform The tutorials help explain the following e Project generation using the e studio e Detailed use of the code generator plug in for e studio e Integration with custom code e Building the project e studio The project generator will create a tutorial project with two selectable build configurations e HardwareDebug is a project built with the debugger support included Optimisation is set to zero e Release is a project with optimised compile options producing code suitable for release in a product Some of the illustrative screenshots in this document will show text in the form RXxxx These are general screenshots and are applicable across the whole RX family In this case simply substitute RXxxx for RX64M
14. for an end product How to Use This Manual 1 Purpose and Target Readers This manual is designed to provide the user with an understanding of how to use Application Leading Tool Code Generator for RX together with the e studio IDE to create a working project for the RSK platform It is intended for users designing sample code on the RSK platform using the many different incorporated peripheral devices The manual comprises of step by step instructions to generate code and import it into e studio but does not intend to be a complete guide to software development on the RSK platform Further details regarding operating the RX64M microcontroller may be found in the Hardware Manual and within the provided sample code Particular attention should be paid to the precautionary notes when using the manual These notes occur within the body of the text at the end of each section and in the Usage Notes section The revision history summarizes the locations of revisions and additions It does not list all revisions Refer to the text of the manual for details The following documents apply to the RX64M 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 Description Document Title Document No User s Manual Describes the technical details of the RSK RSK RX
15. in the Project Explorer pave and selecting New gt C Project as shown Alternatively use the menu EE F Project item File gt New gt C Project 23 Import s C Project RA Export c3 C Project 2 Refresh FS F 3 Other Ctrl N R20UT2983EG0100 Rev 1 00 2TENESAS Page 9 of 53 Jun 20 2014 RSK RX64M Enter the project name CG_Tutorial In Project type choose Sample Project ln Toolchains choose Renesas RXC Toolchain Click Next In the Target Specific Settings dialog select the options as shown in the screenshot opposite The R5F564MLCxFC MCU is found under RX600 gt RX64M gt RX64M 176 pin Click Next R20UT2983EG0100 Rev 1 00 Jun 20 2014 C Project 3 Project Creation with e studio C Project Create C project of selected type Project name CG Tutorial Use default location Location CAWorkspaceNCG Tutorial Browse Create Directory for Project Toolchains KPIT GNUARM RZ EABI Toolchain KPIT GNURL78 ELF Toolchain KPIT GNURX ELF Toolchain KPIT GNUSH ELF Toolchain Renesas RXC Toolchain Renesas SHC Toolchain Project type Executable Renesas Sample Project Static Library Renesas Sample Project Debug Only Project Executable LAR 1800 Standalone Executable Green Hills 800 Standalone Static Library Green Hills 4800 ThreadX Executable
16. remaining application code is added to the project Source files found on the RSK DVD are copied into the workspace and the user is directed to add code in the user areas of the code generator files Code must be inserted in to the user code area in many files in this project in the areas delimited by comments as follows Start user code for _xxxxx_ Do not edit comment generated here End user code Do not edit comment generated here Where _xxxx_ depends on the particular area of code i e function for insertion of user functions and prototypes global for insertion of user global variable declarations or include for insertion of pre processor include directives User code inserted inside these comment delimiters is protected from being overwritten by Code Generator if the user needs to subsequently change any of the Code Generator generated code 5 1 LCD Code Integration API functions for the Okaya LCD display are provided with the RSK Locate the files ascii h r okaya lcd h ascii c and r okaya lcd c on the RSK DVD These files can be found in the Tutorial project for e studio Copy these files into the C Workspace CG_Tutorial src directory The files will be automatically added to the project as shown in Figure 5 1 Project Explorer 22 Su 4 S CG Tutorial HardwareDebug i Binaries RI Includes 4 Fa src cg src Le ascii c n ascii h n iodefine h e r okaya Icd c n r okaya Icd h af C
17. setting RXD7 SMISO7 5SCL7 P92 TXD7 5MO5I7 58SDA7 P30 4 m Figure 4 12 SCI7 General Setting tab Select the SCI7 Setting sub tab and configure SCI7 as illustrated in Figure 4 13 Make sure the Start bit edge detection is set as Falling edge on RXD7 pin and the Bit rate is set to 19200 bps All other settings remain at their defaults R20UT2983EG0100 Rev 1 00 a lt EN ESAS Page 25 of 53 Jun 20 2014 RSK RX64M 4 Code Generation Using the e studio plug in P Peripheral Functions 25 A Code Preview Properties General setting i SCIO sen SCI2 SCI3 SCI4 SCI5 SCI6 SCIZ sci12 5 Generate Code 1 Y g Start bit edge detection setting Low level on RXD7 pin 9 Falling edge on RXD7 pin Data length setting 9 bits 9 8 bits 7 bits Parity setting None Even Odd Stop bit length setting 1 bit 2 bits Transfer direction setting 9 LSB first MSB first Transfer rate setting Transfer clock Internal clock P31 Y Bit rate 19200 Actual value 19230 769 Error 0 16 F Enable modulation duty correction 255 SCK7 pin function SCK7 is not used EE m Noise filter setting F Enable noise filter Noise filter clock Clock signal divided by 1 60000000 Hz Hardware flow control setting 9 None CTS RTS CTS7 RTS pin P93 Data
18. 64M User s R20UT2593EG hardware Manual Tutorial Provides a guide to setting up RSK environment RSK RX64M R20UT2594EG running sample code and debugging programs Tutorial Manual Quick Start Guide Provides simple instructions to setup the RSK and RSK RX64M Quick R20UT2595EG run the first sample Start Guide Code Generator Provides a guide to code generation in the e studio RSK RX64M Code R20UT2983EG Tutorial IDE Generator Tutorial Manual Schematics Full detail circuit schematics of the RSK RSK RX64M R20UT2589EG Schematics Hardware Manual Provides technical details of the RX64M RX64M Group R01UH0377EJ microcontroller Hardware Manual 2 List of Abbreviations and Acronyms Abbreviation Full Form Analog to Digital Converter Application Programming Interface Compare Match Timer COMmunications port referring to PC serial port Central Processing Unit Digital Versatile Disc On chip Debugger Graphical User Interface IDE Integrated Development Environment IRQ Interrupt Request line LCD Liquid Crystal Display LED Light Emitting Diode MCU Micro controller Unit MSB Most Significant Bit PC Personal Computer Pmod Digilent Pmod Compatible connector PmodTM is registered to Digilent Inc Digilent Pmod Interface Specification Link valid at 26Jun2013 PLL Phase locked Loop RSK Renesas Starter Kit Plus SCI Serial Communications Interface SPI Serial P
19. C 7 D m 0 D o 24 NESAS RX64M Group Renesas Starter Kit Code Generator Tutorial Manual For e studio RENESAS MCU RX Family RX600 Series 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 Renesas Electronics www renesas com Rev 1 00 Jun 2014 Notice 1 Descriptions of circuits software and other related information in this document are provided only to illustrate 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 herei
20. Dedicated sample and hold circuit setting Input sampling time 8 lus The input value is invalid ANODO Self diagnosis conversion time setting Input sampling time 3 667 7 us Actual value 3 667 ANODI conversion time setting Input sampling time 3 667 us Actual value 3 567 ANOO2 conversion time setting Input sampling time 1587 lus Actual value 3 567 AN003 conversion time setting Input sampling time 3667 us Actual value 3 667 ANDO4 conversion time setting ll Input sampling time 3 667 ps Actual value 3 567 ANOO5 conversion time setting Input sampling time 1587 ps Actual value 3 567 ANOOE conversion time setting Input sampling time 367 hs Actual value 3 567 ANOO7 conversion time setting Input sampling time 3667 lus Actual value 3 567 Conversion time setting Total conversion time Group A 4 083 us Total conversion time Group B us Note Continuous sampling is disabled Interrupt setting Y Enable AD conversion end interrupt 124D10 Priority Level 15 highest m Y Enable AD conversion end interrupt for group B 512GBADIO Figure 4 9 A D Converter tab R20UT2983EG01 00 Rev 1 00 Jun 20 2014 TENESAS Page 22 of 53 RSK RX64M 4 Code Generation Using the e studio plug in 4 3 5 Serial Communications Interface Navigate to the Serial Communications Interface tab in Code Generator select the SCI6 sub tab and apply th
21. Green Hills Makefile project 4 m V Show project types and toolchains only if they are supported on the platform ler c Pro Em e2 studio Project Generation gt Select Target Specific Settings Toolchain Version v2 01 00 Debug Hardware El Data endian Little endian data Select Target RSFSGAMLOFC Select Configurations 4 Hardware Debug Debug using Simulator Debug using simulator j j Project without any debug information Debug using hardware lt Build configurations will be created in the project only for the selected debug mode options however by default the project will be built for the active configuration i e first configuration selected from group Based on the device selection you made RX600 the debug hardware E1 and debug target R5F564MLCxFC debug configuration will be automatically created for you Cancel Page 10 of 53 RSK RX64M 3 Project Creation with e studio e n the Code Generator Settings dialog ensure the Use Peripheral code Generator is checked e Click Next e In Select Additional CPU Options leave everything at default values e Click Next e2 studio Project Generation Code Generator Settings The e2 studio peripheral code generator automatically generates programs device drivers for MCU per
22. Hz Oscillator wait time 11000 us Actual value 11090 909 ps Oscillation stop detection function Disabled PLL circuit setting Y Operation PLL clock source Main clock oscillator Input frequency division ratio x1 Frequency multiplication factor x 100 Frequency 240 MHz Sub clock oscillator and ATC RTCSCLK setting peration Sub clock oscillator drive capacity Drive capacity for low CL EN 7 Frequency 32 768 kHz Oscillator wait time 2252 73 ms Actual value 2296 182 ms High speed clock oscillator HOCO setting Operation Frequency 16 MHz Low speed clock oscillator LOCO setting Y Operation Frequency 240 kHz m IWD T dedicated low speed clock oscillator IWDTLOCO setting Operation Frequency 1 20 kHz RTC clock setting Operation Clock source Sub clock oscillator v System clock setting Clock source PLL circuit System clock ICLK x1 2 120 MHz Peripheral module clock PCLKA x1 2 120 MHz Peripheral module clock PCLKB x1 4 60 MHz Peripheral module clock for ADC PCLKC x1 4 60 MHz Peripheral module clock for ADC PCLKD x 1 4 60 MHz External bus clock BCLK x1 4 60 MHz Flash IF clock FCLK x1 4 60 MHz USB clock UCLK x1 5 48 MHz BCLK pin output setting Dperation BCLK forced output Clock output source HEIN SDCLK pin output setting Operation L3 4 m
23. IRQIsFallingEdge KK oke KK KK ok ok ok ok ok okok okok okok okok ok okok ok ok ok ok ok ok okok ok ok ok ok okok okok okok okok okok KK KKK KK KK KK okok KKK KKK BRK KKK KK KK KK RK KKK KK RRA RRA ck ck ck ck ck ck ckckckckckckckckckck ck ck ck ck ck ck ck ck ck ck ck oko Function Name R ICU IRQSetFallingEdge Description This function sets clears the falling edge trigger for the specified ICU IRQ Arguments GgINt8 t irg no uint8 t set f edge 1 if setting falling edge triggered 0 if clearing x Return Value None okok okok ok ok ok okok ok ok okok okok ok ok ke kk Ck kk Ck ke kk KC kk Ck kk Ck Ck kk Ck ke kk Ck kk Ck ke kk Ck ko kk ke kk kk kk ko ko kk ke kk ke ke kc ke koe ke ke ke ke ek A void R ICU IROSetFallingEdge const uint8 t irg no const uint8 t set f edge if 1 set_f_edge ICU IRQCR irq no BYTE 04 ICU IRO EDGE FALLING else ICU IRQCR irg_no BYTE amp uint8 t _04_ICU_IRQ_EDGE_FALLING KKK KK KKK KA AK KK A RARA A ARK A ARK A RRA RARA RRA ARK AK KI k A End of Function R_ICU_IROSetFallingEdge R20UT2983EG0100 Rev 1 00 2tEN ESAS Page 35 of 53 Jun 20 2014 RSK RX64M 5 User Code Integration
24. R Tutorial Figure 5 1 Adding files to the project In the e studio Project Tree expand the src cg_src folder and open the file r_cg_userdefine h by double clicking on it Insert the following defines in between the user code delimiter comments as shown below Start user code for function Do not edit comment generated here define TRUE 1 define FALSE 0 End user code Do not edit comment generated here In the same folder open the file r_cg_main c by double clicking on it Insert include r okaya lcd h in between the user code delimiter comments as shown below Start user code for include Do not edit comment generated here include r okaya lcd h End user code Do not edit comment generated here Scroll down to the main function and insert the highlighted code as shown below into the beginning of the user code area of the main function void main void R20UT2983EG0100 Rev 1 00 a lt EN ESAS Page 31 of 53 Jun 20 2014 RSK RX64M 5 User Code Integration R MAIN UserInit Start user code Do not edit comment generated here while 1U End user code Do not edit comment generated here 5 1 1 SPI Code The Okaya LCD display is driven by the SPI Master that was configured using Code Generator in 4 3 5 In the e studio Project Tree open the file r_cg_sci h by double clicking on it Insert the following code in the user code
25. RA RARA RARA RARA RARA RARA RARA RARA ke ke ke ke okok okok okok ke ke ke ke e ee e e RAS Select Build Project from the Build menu or press F7 e studio will build the project with no errors The project may now be run using the debugger as described in 6 The code will perform the same but now the LEDs will display the adc count in binary form R20UT2983EG0100 Rev 1 00 a lt EN ESAS Page 46 of 53 Jun 20 2014 RSK RX64M 6 Debugging the Project 6 Debugging the Project In the Project Explorer pane ensure that the CG Tutorial project is selected To debug the project click the 35 button The dialog shown in Figure 6 1will be displayed r le Confirm Perspective Switch This kind of launch is configured to open the Debug perspective when it suspends This Debug perspective is designed to support application debugging It incorporates views for displaying the debug stack variables and breakpoint management Do you want to open this perspective now Remember my decision Figure 6 1 Perspective Switch Dialog Click OK to confirm that the debug window perspective will be used The debugger will start up and the code will stop at the Code Generator function PowerOn_Reset_PC as shown in Figure 6 2 R20UT2983EG0100 Rev 1 00 a lt EN ESAS Page 47 of 53 Jun 20 2014 RSK RX64M 6 Debugging the Project el Debug CG_Tutorial src cg src t cg resetprg e2studio 1 601
26. TEN ESAS Page 14 of 53 Jun 20 2014 RSK RX64M 4 Code Generation Using the e studio plug in r le Open Perspective fy C C default Code Generator B CVS Repository Exploring 5 Debug 2 Git Planning CS Resource Es SVN Repository Exploring EP Team Synchronizing Figure 4 1 Open Perspective Dialog In the Project Explorer pane expand the Code Generator and Peripheral Functions node The Code Generator initial view is displayed as illustrated in Figure 4 2 R20UT2983EG0100 Rev 1 00 a lt EN ESAS Page 15 of 53 Jun 20 2014 RSK RX64M 4 Code Generation Using the e studio plug in 3 e Code Generator e2 studio S File Edit Navigate Search Project Run Window Help aii a E i Pere E Quick Access Im E C C E Project Explorer 22 3 Peripheral Functions Code Preview Properties fel Generate Code 9 7 g esle Clock setting Block diagram 4 aj Code Generator 3 Main clock oscillator and RTCMCLK setting Z Pin View 4 Operation Ee Peripheral Functi 4 hn ae eee E Main clock oscillator forced oscillation only for ATC software standby and deep software standby mode J Clock Generator le Voltage Detection Cir Main clock oscillation source Resonator w Clock Frequency Acci ACUTE 24 MHz w Low Power Consump Ww Interrupt Controller U Oscillator wait time 11000 us A
27. ce code for the RX64M When using Code Generator the user is able to configure various MCU features and operating parameters using intuitive GUI controls thereby bypassing the need in most cases to refer to sections of the Hardware Manual Once the user has configured the project the Generate Code function is used to generate three code modules for each specific MCU feature selected These code modules are name r_cg_xxx h r_cg_xxx c and r_cg_xxx_user c where xxx is a three letter acronym for the relevant MCU feature for example adc Within these code modules the user is then free to add custom code to meet their specific requirement Custom code should be added whenever possible in between the following comment delimiters Start user code for adding Do not edit comment generated here End user code Do not edit comment generated here Code Generator will locate these comment delimiters and preserve any custom code inside the delimiters on subsequent code generation operations This is useful if after adding custom code the user needs to re visit Code Generator to change any MCU operating parameters By following the steps detailed in this Tutorial the user will generate a e studio project called CG Tutorial The fully completed Tutorial project is contained on the DVD and may be imported into e studio by following the steps in the Quick Start Guide This Tutorial is intended as a lea
28. code area inside the r sci7 callback transmitend function static void r sci 7 callback transmitend void Start user code Do not edit comment generated here R20UT2983EG0100 Rev 1 00 RENESAS Page 41 of 53 Jun 20 2014 RSK RX64M 5 User Code Integration End user code Do not edit comment generated here In the same file insert the following code in the user code area inside the r sci7 callback receiveend function static void r sci7 callback receiveend void Start user code Do not edit comment generated here End user code Do not edit comment generated here At the end of the file in the user code area for adding add the following function definition BRK KKK KK KK KKK KKK KK KKK KK AA Function Name R_SCI7_AsyncTransmit Description This function sends SCI7 data and waits for the transmit end flag Arguments Ex DUE transfer buffer pointer tx num buffer size Return Value status MD_OK or MD_ARGERROR okok okok ok dk ok a kk Ck kk Ck ke kk ke kk Ck ke kk Ck ke kk ke kk Ck ke kk ke ke kk ke kk Ck ke kk ke kk kc ke kk ko ke ee ee ee ke ke ke x A MD STATUS R SCI7 AsyncTransmit uint8 t const tx buf const uintl16 t tx num MD_STATUS status MD_OK clear the flag before initiating a new transmission sci7 txdone FALSE Send the data using the API status R SCI7 Serial Send tx buf tx num Wait for the transm
29. cts 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 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 milita
30. ctual value 11090 909 ps E M Buses Oscillation stop detection function Disabled X m DMA Controller w Data Transfer Control PLL circuit setting Ww Event Link Controller E Operation w IO Ports a Multi Function Timer PLL clock source Main clock oscillator amp Port Output Enable 3 nput frequency division ratio x1 Ww General PWM Timer wi 16 Bit Timer Pulse Un Frequency multiplication factor x 10 0 w Programmable Pulse Frequency 240 MHz 8 Bit Timer w Compare Match Time Sub clock oscillator and RTC RTCSCLK setting amp Compare Match Time E Operation w Realtime Clock Sub clock oscillator drive capacity Drive capacity for low CL amp Watchdog Timer amp Independent Watchd Gi le 52 Problems E r me Serial Communicatiot ne x Gi Eso Y Serial Communicatiol Code Generator Console w 12C Bus Interface d w Serial Peripheral Interi wm CRC Calculator 12 Bit A D Converter m 4 D Figure 4 2 Initial View Code Generator provides GUI features for configuration of MCU sub systems Once the user has configured all required MCU sub systems and peripherals the user can click the Generate Code button resulting in a fully configured e studio project that builds and runs without error Navigation to the MCU peripheral configuration screens may be performed by double clicking the required function in the Code Generator Peripheral Function on the left It is also possible to see a preview of th
31. d 84 3 3 It is necessary to provide additional user code in these files to implement the switch press release detection and de bouncing required by the API functions in r rsk switch c 5 3 1 Interrupt Code In the e studio Project Tree expand the src cg_src folder and open the file r cg icu h by double clicking on it Insert the following code in the user code area at the end of the file Start user code for function Do not edit comment generated here End user code Do not edit comment generated here Now open the r cg icu c file and insert the following code in the user code area at the end of the file 8K KK RR KK RK KK KK KK KK KKK KK A Function Name R ICU IRQIsFallingEdge Description This function returns l if the specified ICU_IRO is set to falling edge triggered otherwise 0 Arguments uint8 t irg no x Return Value 1 if falling edge triggered 0 if not vk ka ok okok ok ok okok ok ok okok okok ok ok ok okok ok ko kk ke kk ok okokok okok okok Ck kk ok ke kk Ck ko kk ke kk ok Ck kk ke kk kc ke kk ko ke kk ke kk ko ko kc ke kk ke ke ke kkk A uint8 t R ICU IROIsFallingEdge const uint8 t irg no uint8_t falling_edge_trig 0x0 if ICU IRQCR irq no BYTE 04 ICU IRO EDGE FALLING falling edge trig 1 return falling edge trig BKK kok KKK KK KK ok okok kk kk kk kk kk ok Sk ke KR KK Ck kk ck Sk okok KK KK KKK KK KK KK okok k ck ck KK End of function R ICU
32. ded 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 itin 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 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 produ
33. dit comment generated here Open the file r cg cmt user c and insert the following code in the user area for global at the beginning of the file Start user code for global Do not edit comment generated here End user code Do not edit comment generated here Scroll down to the r cmt cmiO interrupt function and insert the following line in the user code area static void r cmt cmi0 interrupt void Start user code Do not edit comment generated here End user code Do not edit comment generated here Then insert the following function in the user code area at the end of the file radiado o oco ao o oa o o ao ao III ouotono took kokao K I ICI II kk Function Name R_CMT_MsDelay Description Uses CMTO to wait for a specified number of milliseconds Arguments uintl16 t millisecs number of milliseconds to wait Return Value None FER ok okok ok ok okok ok ok okok ok okok ok Ck kk ok RR ok okok okokok Ck kk ok ke kk RI Ck ke kk okok okok okok okok ke IR RA IK A IR IK I ke ek void R CMT MsDelay const uintl6 t millisec uint16_t ms count 0 do R CMTO Start while FALSE one ms delay complete Wait R CMTO Stop one ms delay complete FALSE ms_count while ms_count lt millisec
34. e code that will be generated for the current peripheral function settings by double clicking the required function in the Code Generator Code Preview on the left R20UT2983EG0100 Rev 1 00 TEN ESAS Page 16 of 53 Jun 20 2014 RSK RX64M 4 Code Generation Using the e studio plug in 4 3 Code Generation In the following sub sections the reader is guided through the steps to configure the MCU for a simple project containing interrupts for switch inputs timers ADC and a UART 4 3 1 Clock Generator Figure 4 3 shows a screenshot of Code Generator with the Clock Generator function open Click on the Clock setting sub tab Configure the system clocks as shown in the figure In this tutorial we are using the on board 24 MHz crystal resonator for our main clock oscillation source and the PLL circuit is in operation The PLL output is used as the main system clock and the divisors should be set as shown in Figure 4 3 R20UT2983EG0100 Rev 1 00 a lt EN ESAS Page 17 of 53 Jun 20 2014 RSK RX64M 4 Code Generation Using the e studio plug in Sl Peripheral Functions 22 Code Preview E Properties Te Generate Code 3 Y A Block diagram e Main clock oscillator and RTCMCLK setting Y Operation Main clock oscillator forced oscillation only for RTC software standby and deep software standby mode Main clock oscillation source Resonator Frequency 24 M
35. e settings shown in Figure 4 10 In the RSK RX64M SCI6 is used as an SPI master for the Okaya Pmod LCD on the PMOD1 connector as shown in the schematic no EX Peripheral Functions 33 Code Preview EJ Properties sci2 scia sci4 scis Sib sciz sena Setting SCIO sci General settina Function setting O Unused O Asynchronous mode Transmission Asynchronous mode Multi processor Transmission Clock synchronous mode Transmission O Smart card interface mode Transmission Simple IIC bus Simple SPI bus Master transmit only Pin settina RXD5 SMISOG SSCL6 P01 TXD6 SMOSIB SSDAS POO Figure 4 10 SCI6 General Setting tab Select the SCI6 Setting sub tab and configure the SPI Master as illustrated in Figure 4 11 Make sure the Transfer direction setting is set to MSB first and the Bit rate is set to 1500000 All other settings remain at their defaults R20UT2983EG0100 Rev 1 00 a lt EN ESAS Page 23 of 53 Jun 20 2014 RSK RX64M 4 Code Generation Using the e studio plug in v EX Peripheral Functions 3 Code Preview Properties fe Generate Code 3 7 O scio scn sci2 scia scia scis scie seiz scii la General setting Setting Transfer direction setting LSB first 9 MSB first Data inversion setting m 9 Normal Inverted Transfer rate s
36. eneration None x Fast interrupt vector register None x ROM None RAM None Z Address H Address Register e In the Standard Header Files dialog lej cprojec Eo select C99 for Library Configuration da di Untick new EC and leave all Ter a F others at defaults e Click Next Library configuration C C99 Z Select Header Files runtime Runtime routines Checked and disabled by default ctype h Character classification routines math h Mathematical trigonometric operations double precision mathf h Mathematical trigonometric operations single precision Jstdarg h Variable argument functions Y stdio h Input Output V stdlib h General purpose library features V string h String handling operations l Jios EC Input Output Streams P j Memory allocation and deallocation routines complex EC Complex number operations string EC String manipulation operations complex h C99 Performs complex number calculation fenv h C99 Sets floating point environment inttypes h C99 Converts integer type format wcharh C99 Performs wide character wctype h C99 Performs wide character conversion o om EJ R20UT2983EG0100 Rev 1 00 TENESAS Page 12 of 53 Jun 20 2014 RSK RX64M e n the nex
37. eripheral Interface UART Universal Asynchronous Receiver Transmitter Table of Contents 7 1 1 A TH mur e re pr O ONTO E 7 1 2 FEOS 6 mksa kal Suka ea OE rer ener ranla ak kea TO KO oleino kae rece eer D DIE 7 A 8 3 Project Creation with e SIU O ska sk E p UE E LEE 9 3 1 e UU 0 eT a ran RR SI e ron rer pr o OP o EPOPEO LEE 9 3 2 Greating the Project i NE KL LAN bie etai ee A DR uie De adder 9 4 Code Generation Using the e studio plug in s s ssesseseesseesiesiesiesresrerresrenrnrsrrrrerrsrrsreereen 14 4 1 OO UC Mii pene NEETA EAN ee LA ede eee ada ene edn 14 42 Gode Generator TOUN on eri ab ddl ee Dp ide Mati deve Metta dac 14 4 3 Gode Generation d di t Ep d e Pep He Ug a a NAN IA 17 44 Building the Prolect sn deter LS e e Dun dee Ph LA 30 5 User Code Integratiom ue ai 31 boli e E DKE eTo NALE o LKE LiT p EE eee Ai AO A AREA tel AMPOLO 31 b 2 Additional moude patis mud es ebd ao l i ale ee ie ne idus 34 53 SWwitch Codelntegration s sg pe el LN dd 35 5 4 Debuqg Code lntegfation s m sn aka AN Ial dica 41 5 5 UART Code Integration sa eto n i ec dais 41 5 6 CED Cod Integration 2 debt e Er era kapan Seeders 44 6 Debugging the Project pp 47 7 Additional Information pe 49 LENESAS RSK RX64M R20UT2983EG0100 Rev 1 00 RENESAS STARTER KIT Jun 20 2014 1 Overview 1 1 Purpose This RSK is an evaluation tool for Renesas microcontrollers This manual
38. etting Transfer clock Internal clock P02 Bit rate 1500000 X bps Actual value 1500000 Error 0 E Enable modulation duty correction 255 SCKB pin function selection Clock output Clock setting Clock delay Clock is not delayed E Enable clock polarity inversion Data handling setting Transmit data handling Data handled in interrupt service routine Interrupt setting TB priority Level 15 highest TEIG ERIB priority Group BLO Level 15 highest Callback function setting Y Transmission end n Figure 4 11 SCI6 SPI Master Setting Staying in the Serial Communications Interface tab in Code Generator select the SCI7 sub tab and apply the settings shown in Figure 4 12 In the RSK RX64M SCI7 is connected via a Renesas RL78 G1C to provide a USB virtual COM port as shown in the schematic R20UT2983EG0100 Rev 1 00 RTENESAS Page 24 of 53 Jun 20 2014 RSK RX64M 4 Code Generation Using the e studio plug in E Peripheral Functions 23 Code Preview Properties scio sen sciz scia scia scis sce sez senz General setting Setting Function setting Unused 9 Asynchronous mode Transmission reception O Asynchronous mode Multi processor Transmission Clock synchronous mode Transmission O Smart card interface mode Transmission Simple IIC bus O Simple SPI bus Slave transmit receive Pin
39. f accurate delays CMT1 and CMT2 will be used as timers in de bouncing of switch interrupts In the CMTO sub tab configure CMTO as shown in Figure 4 6 This timer is configured to generate a High priority interrupt every 1ms We will use this interrupt later in the tutorial to provide an API for generating high accuracy delays required in our application EX Peripheral Functions 22 Jf Code Preview EJ Properties Co Generate Code 1 7 A EMTO cara cura cura Compare match timer operation setting D Unused O Used m Count clock setting PCLK 8 PCLK 32 D PCLK 128 PCLK 512 Interval value setting Interval value 1 ms v Actual value 1 Interrupt setting 4 Enable compare match interrupt CMIO Priority Level 10 4 n Figure 4 6 CMTO tab Navigate to the CMT1 sub tab and configure CMT1 as shown in Figure 4 7 This timer is configured to generate a High priority interrupt after 20ms This timer is used as our short switch de bounce timer later in this tutorial R20UT2983EG0100 Rev 1 00 TEN ESAS Page 20 of 53 Jun 20 2014 RSK RX64M 4 Code Generation Using the e studio plug in El Peripheral Functions 23 A Code Preview EJ Properties Fo Generate Code D 7 E CMTO Compare match timer operation setting m CO Unused Used Count clock setting PCLK 8 PCLK 32 PCLK 128 gt PCLK 512 Interval value setting Interval value 20 ms w
40. g LCD R LCD Display 0 uint8 t RSK RX64M R LCD Display 1 uint8 t Tutorial R LCD Display 2 uint8 t Press Any Switch Start the A D converter R S12ADO Start while 1U Wait for user requested A D conversion flag to be set if TRUE g_adc_trigger uintl6 t adc result Call the function to perform an A D conversion adc result get adc Display the result on the LCD lcd display adc adc result Reset the flag g_adc_trigger FALSE x SW3 is directly wired into the ADTRGOn pin so will cause the interrupt to fire else if TRUE g adc complete Get the result of the A D conversion R_S12AD0_Get_ValueResult ADCHANNELO amp adc result Display the result on the LCD lcd display adc adc result Increment the adc count Reset the flag g_adc_complete FALSE End user code Do not edit comment generated here R20UT2983EG0100 Rev 1 00 TEN ESAS Page 43 of 53 Jun 20 2014 RSK RX64M 5 User Code Integration Then add the following function definition in the user code area at the end of the file AA Function Name uart_display_adc Description Converts adc result to a string and sends it to the UARTI Argument ouint8 t ado count uint16 t adc result Return value none A A static void uart display adc const uint8_t adc count const uintl6 t adc result
41. ggered 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 e studio Project Tree 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 define TRUE 1 define FALSE 0 End user code Do not edit comment generated here Open the file r_cg_main c and insert include r_rsk_switch h in the user code area for include resulting in the code shown below Start user code for include Do not edit comment generated here include r okaya lcd h End user code Do not edit comment generated here Next add the switch module initialisation function call highlighted in the user code area inside the main function resulting in the code shown below void main void R MAIN UserInit Start user code Do not edit comment generated here Initialise the debug LCD R LCD Init Displays the application name on the debug LCD R LCD Display 0 uint8 t RSK RX64M R LCD Display 1 uint8 t Tutorial R LCD Display 2 uint8 t Press Any Switch while 1U End user code Do not edit comment generated here In the same file insert the declarations in the user code area for global resulting in the code shown below Start user code for g
42. handling setting Transmit data handling Receive data handling Data handled in interrupt service routine Data handled in interrupt service routine Interrupt setting TI priority RXI7 priority Enable error interrupt ERI TEI7 ERI priority Group BLO Level 15 highest Level 15 highest Level 15 highest Callback function setting Transmission end Reception end Reception error 4 Figure 4 13 SCI7 Asynchronous Setting R20UT2983EGO100 Rev 1 00 Jun 20 2014 RENESAS Page 26 of 53 RSK RX64M 4 3 6 1 0 Ports 4 Code Generation Using the e studio plug in Referring to the RSK schematic LEDO is connected to P03 LED1 is connected to P05 LED2 is connected to P26 and LED3 is connected to P27 Navigate to the I O Ports tab in Code Generator and configure these four I O lines as shown in Figure 4 14 and Figure 4 15 below Ensure that the Output 1 tick box is checked This ensures that the code is generated to set LEDs initially off Ea Peripheral Functions 22 A Code Preview EJ Properties 5 Generate Code 9 DO Pott Pom Port2 Porta Pors PortS Por Port Pons Pong Porta PonB Pott Pon Pone PonF Pona Pom 9 Unused P01 9 Unused PO2 9 Unused P03 C Unused PoS 5 Unused PO Unused 9 In Y 5 Dut tr CMOS output CMOS output CMOS output CMOS output CMOS o
43. he files r rsk debug h and r rsk debug c on the RSK DVD These files can be found in the RSKRX64M Tutorial project for e studio Copy these files into the CAWorkspacel CG Tutoriallsrc directory Import these two files into the project in the same way as the LCD files In the r rsk debug h file ensure the following macro definition is included Macro for definition of serial debug transmit function user edits this define SerialDbgWrite R SCI7 AsyncTransmit This macro is referenced in the r rsk debug c file and allows easy re direction of debug output if a different debug interface is used 5 5 UART Code Integration 5 5 1 SCI Code In the e studio Project Tree expand the src cg src folder and open the file r cg sci h by double clicking on it Insert the following code in the user code area at the end of the file Start user code for function Do not edit comment generated here MD STATUS R SCI6 SPIMasterTransmit uint8 t const tx buf const uintl16 t tx num End user code Do not edit comment generated here Open the file r cg sci user c Insert the following code in the user area for global near the beginning of the file Start user code for global Do not edit comment generated here Flag used locally to detect transmission complete static volatile uint8 t sci6 txdone End user code Do not edit comment generated here In the same file insert the following code in the user
44. hest IRQ3 setting IRQ3 Pin P33 Digital filter No filter 0 MHz Valid edge Low level Priority Level 15 highest IRG4 setting IRQ4 Pin PB1 Digital filter No filter 0 MHz Valid edge Low level Priority Level 15 highest i IRQ5 setting Y IROS Pin P15 Digital filter No filter l MHz Valid edge Falling Priority Level 15 highest Figure 4 4 Interrupt Functions tab Navigate to the Group Interrupts sub tab and ensure that the Group BLO interrupt is selected as shown in Figure 4 5 The Group BLO interrupt is used for SCI Transmit End Interrupts TEl and Reception Error Interrupts ERI as described in 4 3 5 R20UT2983EG0100 Rev 1 00 Jun 20 2014 RENESAS Page 19 of 53 RSK RX64M 4 Code Generation Using the e studio plug in Lu Peripheral Functions 3 XI Code Preview Properties General Group Interrupts Interrupt B A selection Group BED setting Group BEO Priority Level 15 highest Group BLO setting Y Group BLO Priority Level 15 highest Group BL1 setting Group BL1 Priority Level 15 highest Group ALO setting Group ALO Priority Level 15 highest Group ALT setting Group AL1 Priority Level 15 highest Figure 4 5 Group Interrupt Functions tab 4 3 3 Compare Match Timer Navigate to the Compare Match Timer node in Code Generator CMTO will be used as an interval timer for generation o
45. his 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 8 LPT as RSK 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 SCI7 see 4 3 5 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 via SCI7 Return to this point in the Tutorial to add the LED user code 5 6 LED Code Integration Open the file r cg main c Add the following declaration to the user code area for include near the top of the file include rskrx64mdef h Add the following declaration to the user code area for global near the top of the file Prototype declaration for led display count static void led display count const uint8 t count Add the following highlighted code to the user code area in the main function void main void R MAIN UserInit Start user code Do not edit comment generated here R20UT2983EG0100 Rev 1 00 TEN ESAS Page 44 of 53 Jun 20 2014 RSK RX64M 5 User Code Integration Init Set FE Init R LCD I Sart Set while R SCI7 ialise the switch module R SWITCH Init
46. ipheral functions clocks timers serial interfaces A D converters DMA controllers etc based on settings entered via a graphical user interface GUI Functions are provided as application programming interfaces APIs and are not limited to initialization of peripheral functions Automatic generation of peripheral Application under development function Software qe Microcontroller BERRGRRERERREE 2 Gon e C Project Sra e2 studio Project Generation Select Additional CPU Options p Select Additional CPU Options Round Nearest z Precision of Double Single precision Sign of Char Unsigned Sign of bit Field Unsigned Allocate from Lower Bit Lower bit Width of Divergence of Function 24 Bit Specify Global Options Denormalized number allowed as a result Replace from int with short Enum size is made the smallest l Pack structures unions and classes Use try throw and catch of C Use dynamic cast and typeid of C O ge C Net Ensh Cancel R20UT2983EG01 00 Rev 1 00 Jun 20 2014 2 NE SAS Page 11 of 53 RSK RX64M 3 Project Creation with e studio e n the Global Options Settings leave ss c project Sea everything at default values 2 studio Project Generation e Click Next Global Options Settings T Patch code g
47. it end flag while FALSE sci7 txdone Wait return status BK KK kkk kkk kk kok kkk kkk kok kok kok koko kok kok kok kkk kok KCKCKCkCKCKCkCKCKCKkCk KCKCKCk CK Ck k K Ck kck k ck ck k ck ckck ck ck kk x End of function R SCI7 AsyncTransmit voke oke oke oke oa oa ok KK ok ok ok ok ok ok okok okok oke ok okok okok ok ok ok ok ok ok okok ok ok okok kk ck KK KKK KKK KKK KK KK KK k ck KKK KKK 5 5 2 Main UART code Open the file r cg main c Add the following declaration to the user code area for include near the top of the file finclude r rsk debug h Add the following declaration to the user code area for global near the top of the file Prototype declaration for uart display adc static void uart display adc const uint8 t adc count const uintl6 t adc result Variable to store the A D conversion count for user display static uint8_t adc_count 0 Add the following highlighted code to the user code area in the main function R20UT2983EG0100 Rev 1 00 TEN ESAS Page 42 of 53 Jun 20 2014 RSK RX64M 5 User Code Integration void main void R MAIN UserInit Start user code Do not edit comment generated here Initialise the switch module R SWITCH Init Set the call back function when SW1 or SW2 is pressed R SWITCH SetPressCallback cb switch press Initialise the debug LCD R LCD Init Displays the application name on the debu
48. kokokokokokok ok KK static void cb switch press void Check if switch 1 or 2 was pressed if g_switch_flag amp SWITCHPRESS_1 SWITCHPRESS_2 set the flag indicating a user requested A D conversion is required g_adc_trigger TRUE Clear flag g_switch_flag 0x0 R20UT2983EG0100 Rev 1 00 RTENESAS Page 38 of 53 Jun 20 2014 RSK RX64M 5 User Code Integration x End of function cb switch press FER ok okok ok ok okok ok okok ok ok okok ok ok okok okok AIA RAR kk ke kk ko ke RAR RAR RAR RAR ok okok okok okok RRA RRA ke ke ke ke ke ke e BORK RK okok okok okok okok okok okok okok okok okok okok RARA RARA RARA RARA RARA RARA RARA RARA ke ke ke ke kk ke ke ke ke ke ke e e e e e e Function Name get adc Description Reads the ADC result converts it to a string and displays it on the LCD panel Argument none Return value uintl6 t adc value Kk kk ke oke ok Sk ke kk ke ke ok ok kc ke ok ke ok ke ok ok ok ok ok ok ok ok ok ok ok okok okok okok okok okok okok okok okok okok okok okok okok okok ke ke ke kc ke ke ke kc ke ke ke ke e ee ee e x Y static uintl16 t get adc void
49. kspace CG Tutorial M0409001 The following files were generated M0409000 srchcg srcir cg main c was generated M0409000 srchcg srcir cg dbsct c was generated M0409000 srchcg srcir cg intprg c was generated M0409000 srcicg srcir cg resetprg c was generated M0409000 srchcg srcir cg sbrk c was generated M0409000 srcicg srcir cg vecttbl c was generated M0409000 srchcg srcir cg sbrk h was generated M0409000 srchcg srcir cg stacksct h was generated M0409000 srchcg srcir cg vect h was generated M0409000 srchcg srcir cg hardware setup c was generated M0409000 srchcg srcir cg macrodriver h was generated Me4AQoQQO srcicg srcir cg userdefine h was generated M0409000 srchcg srcir cg cgc c was generated M0409000 srchcg srcir cg cge user c was generated M0409000 srcicg srcir cg cgc h was generated M0409000 srchcg srcir cg icu c was generated M0409000 srcicg srcir cg icu user c was generated M0409000 srchcg srcir cg icu h was generated M0409000 srchcg srcir cg port c was generated M0409000 srchcg srcir cg port user c was generated M0409000 srchcg srcir cg port h was generated M0409000 srchcg srcir cg cmt c was generated M0409000 srchcg srcir cg cmt user c was generated MO40900Q srcicg srcir cg cmt h was generated MO409000 srchcg srcir cg sci c was generated M0409000 srchcg srcir cg sci user c was generated M0409000 srchcg srcir cg sci h was generated M0409000 srchcg srcir cg sl2ad c was generated M0409000
50. lobal Do not edit comment generated here End user code Do not edit comment generated here Next add the highlighted code below in the user code area inside the main function R20UT2983EG0100 Rev 1 00 TEN ESAS Page 37 of 53 Jun 20 2014 RSK RX64M 5 User Code Integration and the code inside the while loop resulting in the code shown below void main void R MAIN UserInit Start user code Do not edit comment generated here Initialise the switch module R SWITCH Init Initialise the debug LCD R LCD Init Displays the application name on the debug LCD R LCD Display 0 uint8 t RSK RX64M R LCD Display 1 uint8 t Tutorial R LCD Display 2 uint8 t Press Any Switch while 1U End user code Do not edit comment generated here Then add the definition for the switch call back get adc and lcd display adc functions in the user code area for adding at the end of the file as shown below BRK RR KK RK KKK KK RK ko kckck ck ck kk kckckckckckckckckckck ck ck ck ck ck ck ck ckckckckckckckckckck ck ck ck ck ck ck KKK KK KKK KK kok kkk Function Name cb switch press Description Switch press callback function Sets g adc trigger flag Argument none Return value none ok ok ok ok kk kk kk kk kk kk ok ok ok ok ok ok ok ok ok okok okok ok ok ok Sk ok okok ok okok ok ok k okok okok okok okok okok he ko okok ok okok ok okokokoko
51. n 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 products 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 anticrime systems and safety equipment etc Renesas Electronics products are neither inten
52. nst uintl6 t adc result Declare a temporary variable uint8_t a Declare temporary character string char lcd_buffer 11 ADC XXXH Convert ADC result into a character string and store in the local Casting to ensure use of correct data type a uint8 t adc result OxOF00 gt gt 8 led buffer 6 char a lt Ox0A a 0x30 a 0x37 a uint8 t adc result amp 0x00F0 gt gt 4 lcd buffer 7 char a lt 0x0A a 0x30 a 0x37 a uint8 t adc result 0x000F lcd_buffer 8 char a Ox0A a 0x30 a 0x37 Display the contents of the local string lcd buffer R LCD Display 3 uint8 t lcd buffer R20UT2983EG0100 Rev 1 00 Jun 20 2014 SENES Page 39 of 53 RSK RX64M 5 User Code Integration BKK KK KKK KKK KK KKK KKK okok okokokokokokokokokokokokokokokokokokokokokokokokokokokokokokokokokokokokok End of function lcd display ade vek ok okok ok ok okok ok ok okok ok okok ok ok okok ok ok okok ok okok okok kok okok okok ok okok okok kok ok AK ok okok okok okok ok okok okok kokokok koko okok kok IK OK kok Open the file r cg s12ad h by double clicking on it Insert the following code in the in the user code area for function resulting in the code shown below Start user code for function Do not edit comment generated here End user code Do not edit comment generated here Open the file
53. num Wait for the transmit end flag while FALSE sci6 txdone Wait return status R20UT2983EG0100 Rev 1 00 a lt EN ESAS Page 32 of 53 Jun 20 2014 RSK RX64M 5 User Code Integration x End of function R SCI6 SPIMasterTransmit This function uses the transmit end callback function to perform flow control on the SPI transmission to the LCD and is used as the main API call in the LCD code module 5 1 2 CMT Code The LCD code needs to insert delays to meet the timing requirements of the display module This is achieved using the dedicated timer which was configured using Code Generator in 4 3 3 Open the file r cg cmt h and insert the following code in the user area for function at the end of the file Start user code for function Do not edit comment generated here End user code Do not e
54. ode area inside the function r icu irg2 interrupt Switch 2 callback handler R SWITCH IsrCallback2 In the same file insert the following code in the user code area inside the function r icu irq5 interrupt Switch 1 callback handler R SWITCH IsrCallbackl 5 3 2 De bounce Timer Code Open the r cg cmt user c file and insert the following code in the user code area for include near the top of the file x Defines switch callback functions required by interrupt handlers include r rsk switch h In the same file insert the following code in the user code area inside the function r cmt cmi1 interrupt Stop this timer we start it again in the de bounce routines R CMT1 Stop Call the de bounce call back routine R SWITCH DebounceIsrCallback In the same file insert the following code in the user code area inside the function r cmt cmi2 interrupt Stop this timer we start it again in the de bounce routines R CMT2 Stop Call the de bounce call back routine R SWITCH DebounceIsrCallback R20UT2983EG0100 Rev 1 00 TEN ESAS Page 36 of 53 Jun 20 2014 RSK RX64M 5 User Code Integration 5 3 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 4 3 4 we configured the ADC to be triggered from the ADTRGO pin In this code we also perform software tri
55. r 7 Figure 4 3 Clock setting tab Proceed to the next section on the Interrupt Controller Unit R20UT2983EGO100 Rev 1 00 TEN ESAS Page 18 of 53 Jun 20 2014 RSK RX64M 4 Code Generation Using the e studio plug in 4 3 2 Interrupt Controller Unit Referring to the RSK schematic SW1 is connected to IRQ5 P15 and SW2 is connected to IRQ2 P12 SW3 is connected to directly to the ADCTRGOn and will be configured later in 4 3 4 Navigate to the Interrupt Controller Unit node in Code Generator and in the General tab configure these two interrupts as falling edge triggered as shown in Figure 4 4 below EX Peripheral Functions 22 Code Preview Properties fo Generate Code D Y O il Group Interrupts Interrupt B7A selection 3 Fast interrupt setting Fast interrupt Interrupt source BSC BUSERR vect 16 Software interrupt setting Software interrupt Priority Level 15 highest l Software interrupt 2 Priority Level 15 highest NMI setting NMI pin interrupt Valid edge Falling Digital filter No filter 0 MHz IRQO setting IRQO Pin P30 Digital filter No filter 0 MHz Valid edge Low level Priority Level 15 highest IRGT setting IRQ1 Pin P31 Digital filter No filter 0 MHz Valid edge Low level Priority Level 15 highest IRQ2 setting Y IRQ2 Pin P12 Digital filter No filter v 0 MHz Valid edge Falling Priority Level 15 hig
56. r cg s12ad c by double clicking on it Insert the following code in the in the user code area for global resulting in the code shown below Start user code for adding Do not edit comment generated here End user code Do not edit comment generated here Open the file r cg s12ad user c and insert the following code in the in the user code area for global resulting in the code shown below x Start user code for global Do not edit comment generated here End user code Do not edit comment generated here Insert the following code in the in the user code area of the r_s12ad0_interrupt function resulting in the code shown below static void r_sl2ad0_interrupt void Start user code Do not edit comment generated here End user code Do not edit comment generated here R20UT2983EG0100 Rev 1 00 TEN ESAS Page 40 of 53 Jun 20 2014 RSK RX64M 5 User Code Integration Cu idi Select Build Project from the Project menu or use the button e studio will build the project with no errors The project may now be run using the debugger as described in 6 When any switch is pressed the program will perform an A D conversion of the voltage level on the ADPOT line and display the result on the LCD panel Return to this point in the Tutorial to add the UART user code 5 4 Debug Code Integration API functions for trace debugging via the RSK serial port are provided with the RSK Locate t
57. rning exercise for users who wish to use the Code Generator to generate their own custom projecis for e studio The CG Tutorial project uses interrupts for switch inputs the ADC module the Compare Match Timer CMT the Serial Communications Interface SCI and uses these modules to perform A D conversion and display the results via the Virtual COM port to a terminal program and also on the LCD display on the RSK Following a tour of the key user interface features of Code Generator in 4 2 the reader is guided through each of the peripheral function configuration dialogs in 4 3 In 5 the reader is familiarised with the structure of the template code as well as how to add their own code to the user code areas provided by the code generator The Code Generator installer is contained on the DVD This installer must be run before proceeding to the next section 4 2 Code Generator Tour In this section a brief tour of Code Generator is presented For further details of the Code Generator paradigm and reference refer to the Application Leading Tool Common Operations manual r20ut2663ej0100 Code Generator pdf Application Leading Tool is the stand alone version of Code Generator and this manual is applicable to the Code Generator From the e studio menus select Window gt Open Perspective gt Other In the Open Perspective dialog shown in Figure 4 1 select Code Generator and click OK R20UT2983EG0100 Rev 1 00
58. rotection requirements of the Electromagnetic Compatibility Directive and could lead to prosecution The product generates uses and can radiate radio frequency energy and may cause harmful interference to radio communications However there is no guarantee that interference will not occur in a particular installation If this equipment causes harmful interference to radio or television reception which can be determined by turning the equipment off or on you are encouraged to try to correct the interference by one or more of the following measures e ensure attached cables do not lie across the equipment e reorient the receiving antenna e increase the distance between the equipment and the receiver e connect the equipment into an outlet on a circuit different from that which the receiver is connected e power down the equipment when not in use e consult the dealer or an experienced radio TV technician for help NOTE It is recommended that wherever possible shielded interface cables are used The product is potentially susceptible to certain EMC phenomena To mitigate against them it is recommended that the following measures be undertaken e The user is advised that mobile phones should not be used within 10m of the product when in use e The user is advised to take ESD precautions when handling the equipment The Renesas Starter Kit does not represent an ideal reference design for an end product and does not fulfil the regulatory standards
59. ry 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 Itis 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 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 2012 4 Disclaimer By using this Renesas Starter Kit RSK the user accept
60. s 22 Jf Code Preview E Properties fe Generate Code Q Y A Port0 Pott Port2 Porta Port4 Port5 Port amp Port Port8 Port8 Port PortB Port PortD PortE PortF PortG Por P40 9 Unused in d On Pulup CMOS output Output 1 P4 9 Unused ln Out _ Pull up CMOS output Output 1 P42 I e 9 Unused O ln Out Pull up CMOS output C Output 1 P43 9 Unused O ln Out Pull up CMOS output E Output 1 P44 9 Unused O In Out Pul up CMOS output l Output 1 _P45 Unused O In 9 Dut Pull up CMOS output Dutput 1 P46 Unused O In Qut Pull up CMOS output Dutput 1 P47 Unused In 9 Out Pull up CMOS output E Output 1 4 Figure 4 16 I O ports Port4 R20UT2983EG0100 Rev 1 00 TEN ESAS Page 28 of 53 Jun 20 2014 RSK RX64M 4 Code Generation Using the e studio plug in Peripheral function configuration is now complete Save the project using the File gt Save menu item then click Generate Code The Console pane should report The operation of generating file was successful as shown Figure 4 17 below El Console 52 Bi Problems Ex amp B mu Code Generator Console 1104903008 Information of valid input value range 0 0001333333 8 738 M0409002 The generating source folder is C Wor
61. s the following terms The RSK is not guaranteed to be error free and the entire risk as to the results and performance of the RSK is assumed by the User The RSK is provided by Renesas on an as is basis without warranty of any kind whether express or implied including but not limited to the implied warranties of satisfactory quality fitness for a particular purpose title and non infringement of intellectual property rights with regard to the 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 costs whether the foregoing losses are direct or indirect nor shall Renesas or its affiliates be liable for any other direct or indirect special incidental or consequential damages arising out of or in relation to the use of this RSK even if Renesas or its affiliates have been advised of the possibility of such damages Precautions The following precautions should be observed when operating any RSK product This Renesas Starter Kit is only intended for use in a laboratory environment under ambient temperature and humidity conditions A safe separation distance should be used between this and any sensitive equipment lts use outside the laboratory classroom study area or similar such area invalidates conformity with the p
62. screen For more information on the e studio debugger refer to the Tutorial manual To run the code click the I button The debugger will stop again at the beginning of the main function Press IP again to run the code R20UT2983EG0100 Rev 1 00 RTENESAS Page 48 of 53 Jun 20 2014 RSK RX64M 7 Additional Information 7 Additional Information Technical Support For details on how to use e studio refer to the help file by opening e studio then selecting Help gt Help Contents from the Window menu bar e 9 Welcome 7 Help Contents 5 Search Dynamic Help For information about the RX 64M group microcontroller refer to the RX 64M Group Hardware Manual For information about the RX assembly language refer to the RX Series Software Manual Technical Contact Details Please refer to the contact details listed in section 9 of the Quick Start Guide General information on Renesas microcontrollers can be found on the Renesas website at http www renesas com Trademarks All brand or product names used in this manual are trademarks or registered trademarks of their respective companies or organisations Copyright This document may be wholly or partially subject to change without notice All rights reserved Duplication of this document either in whole or part is prohibited without the written permission of Renesas Electronics Europe Limited O 2014 Renesas Electronics Europe Limited All rights reserved
63. srchcg srcir cg sl2ad user c was generated M0409000 srchcg srcir cg sl2ad h was generated M0409003 The operation of generating file was successful n Figure 4 17 Code generator console R20UT2983EG0100 Rev 1 00 TEN ESAS Page 29 of 53 Jun 20 2014 RSK RX64M 4 Code Generation Using the e studio plug in 4 4 Building the Project The project is template created by Code Generator can now be built In the Project Explorer pane expand the src folder The three files created by the New Project Wizard in 83 2 have been excluded from the build automatically as part of the code generation procedure as shown in Figure 4 18 This is because the main function now resides in r_cg_main c in the cg_src folder and the type definitions and setting of sections has been handled by the Code Generator PS Project Explorer 33 E B 4 7 CG Tutorial HardwareDebug 3 Binaries RI Includes 4 9 src m cg src R iodefine h af CG Tutorial c af dbsct c M typedefine h Figure 4 18 Files excluded from the build by Code Generator Switch back to the C C perspective using the He C C button on the top right of the e studio workspace Use Build Project from the Project menu or the 4 button to build the tutorial The project will build with no errors R20UT2983EG0100 Rev 1 00 a lt EN ESAS Page 30 of 53 Jun 20 2014 RSK RX64M 5 User Code Integration 5 User Code Integration In this section the
64. t Shanghai China Tel 86 21 2226 0888 Fax 86 21 2226 0999 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 406 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 12F 234 Teheran ro Gangnam Gu Seoul 135 080 Korea Tel 82 2 558 3737 Fax 82 2 558 5141 O 2014 Renesas Electronics Corporation All rights reserved Colophon 2 0 RX64M Group LENESAS Renesas Electronics Corporation R20UT2983EG0100
65. t dialog untick all check boxes except I O Register Definition Files as shown opposite Click Finish e A summary dialog will appear click OK to complete the project generation R20UT2983EGO100 Rev 1 00 Jun 20 2014 3 Project Creation with e studio r le C Project e2 studio Project Generation Set various Stack Areas and to add additional Supporting Files Stack Heap Configuration Use User Stack User s Stack Size H 100 Interrupt Stack Size H 300 E Use Heap Memory Heap Size H 400 WO Register Definition Files Generate Hardware Setup Function None Z Project Summary PROJECT GENERATOR PROJECT NAME CG_Tutorial PROJECT DIRECTORY CAWorkspace CG_Tutorial CPU SERIES CPU TYPE TOOLCHAIN NAME Renesas RXC Toolchain TOOLCHAIN VERSION v2 01 00 GENERATION FILES CA Workspace CG_Tutorial src CG_Tutorial c Main Program CAWorkspace CG_Tutorialsrc dbsct c Setting of B and R sections C WWorkspace CG_Tutorial src typedefine h Aliases of Integer Type CAWorkspace CG_Tutorial src iodefine h 4 Click OK to generate the project or Cancel to abort 24 NE S AS Page 13 of 53 RSK RX64M 4 Code Generation Using the e studio plug in 4 Code Generation Using the e studio plug in 4 1 Introduction Code Generator is an e studio plug in GUI tool for generating template C sour
66. ting 1 Setting 2 5124D0 operation setting Unused Operation mode setting Used 9 Single scan mode Double trigger mode setting 7 Group scan mode Continuous scan mode Disable Enable Self diagnosis setting Mode Voltage used Disconnection detection assist setting Unused Use VREFHOXO Charge setting Period Group scan priority setting Unused 1 ADCLK Group A priority Group B action Group A without priority Not restarted or continued due to Group A priority M A D converted value count setting 9 Addition mode Analog input channel setting O Average mode Convert Group A ANOOO v ANOO1 la ANOO2 l AND03 E ANDO4 A ANDO5 La ANDOS la ANDO la Conversion start trigger setting Convert Group B Add Average AD value Dedicated sample and hold Conversion start trigger Group A Conversion start trigger Group B ADTRGO pin selection Data registers setting Compare match with or input capture to MTUO TGRA PO AD converted value addition count 1 time conversion Priority Data placement Right alignment Automatic clearing Disable automatic clearing Data accuracy 12 bit accuracy v
67. utput CMOS output a Y Output 1 Y Output 1 4 m R20UT2983EG0100 Rev 1 00 Jun 20 2014 RTENESAS Figure 4 14 I O ports Porto Page 27 of 53 RSK RX64M 4 Code Generation Using the e studio plug in Ed Peripheral Functions 52 Code Preview Properties fe Generate Code 3 Y O Port Porti Port2 Port3 Pon Por5 Pons Port Pons Pora Pora PortB Porc PorD Pone PonF Pona Por P20 Unused O In Out Pull up CMOS output Output 1 High drive outpu P21 Unused O In Out Pull up CMOS output Output 1 High drive outpu P22 9 Unused ln Out Pull up CMOS output Output 1 High drive outpu P23 9 Unused O In Out Pull up CMOS output Output C High drive outpu P24 E 9 Unused In Out Pull up CMOS output Output 1 High drive outpu P25 9 Unused O In Out Pull up CMOS output Output 1 High drive outpu P26 Unused O In Out Pull up CMOS output Output 1 7 High drive outpu P27 Unused O ln Out Pull up CMOS output Dutput 1 4 High drive output Figure 4 15 I O ports Port2 P45 is used as one of the LCD control lines together with P46 and P47 Configure these lines as shown in Figure 4 16 Sl Peripheral Function
Download Pdf Manuals
Related Search
Related Contents
Procedimiento de Tramitación de Acciones de Personal Samsung GT-S3330 manual de utilizador Advanced Telemetrics 1000S Manual full manual Polaroid PhotoMax Fun 320 Digital Camera VlZtO VW37L HDTV10A User Manual Dear VlZlO Customer Manual - LW2020/LW2030 LIVE Connect Series Video Baby Copyright © All rights reserved.
Failed to retrieve file