Home

CubeSuite+ V1.03.00 Integrated Development Environment User`s

image

Contents

1. 3 5 2 Change file name The Code Generator is used to change the file name by selecting Rename from the context menu displayed by right clicking the file name in the Code Generator Preview panel Figure 3 9 Change File Name Code Generator Preview i amp TERK a a a a a a a a a a a a a a a a a a a Copyright C 2008 2012 Renesas Electroni RENESAS ELECTRONICS CONFIDENTIAL AND PROP This program must be used solely for the it was furnished by Renesas Electronics Ci program may be reproduced or disclosed to form without the prior written permissio Corporation Rename Property _ option asm System Port Interrupt Serial Operational Amplifier A D Converter Timer Watchdog Timer Real time Clock Clock Output Ll E a a a a a E a Lo a Lo a This device driver was created by CodeGen 6 Bit Single Chip Microcontrollers Filename CG main c Abstract This file implements main funct API1lib CodeGenerator for 78KO Kx2 L V1 Device uPD SFO5868 46 Compiler CC78K0 Creation date 7 11 2012 EE re ee o ee ee ee ee o o E A Remark To restore the default file name defined by Code Generator select Default from the context menu R20UT2138EJ0100 Rev 1 00 ztENESAS Page 30 of 280 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 3 FUNCTIONS Code Generator 3 5 3 Change API function name The Code Generator is used to change the name of the API function by s
2. R20UT2138EJ0100 Rev 1 00 ztENESAS Page 70 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE 2 Information setting area The content displayed in this area differs depending on the peripheral function node or peripheral function but ton selected or pressed when opening this panel See User s Manual for Microcontroller for details on the items to be set File menu Code Generator panel dedicated items Save Code Generator Report Outputs report files a file containing information configured using Code Generator and a file containing information regarding the source code Remarks 1 The output format for the report file either HTML or CSV is selected by clicking Generation tab gt gt Report type in the Property panel 2 The destination folder for the report file is specified by clicking Generation tab gt gt Output folder in the Property panel Help menu Code Generator panel dedicated items Open Help for Code Generator Displays the help of this panel Panel R20UT2138EJ0100 Rev 1 00 ztENESAS Page 71 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Code Generator Preview panel This panel allows you to confirm or configure on a per API function basis the setting that determines whether or not the source code device driver program is generated when the oH Generate Code button is pressed in the Code Genera tor panel It also allows you to confirm t
3. The following items are explained here How to open Description of each area Function buttons How to open In the Generation tab of the Property panel click the button in Output folder Description of each area 1 Folder location Select the folder to which the files source code report file etc are output Function buttons Button Function Make New Folder Creates a New Folder below the folder selected in the Folder location OK Specifies the folder selected in the Folder location as the destination for the files Cancel Ignores the setting and closes this dialog box R20UT2138EJ0100 Rev 1 00 ztENESAS Page 81 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Save As dialog box This dialog box allows you to name and save a file such as a report file Figure A 27 Save As Dialog Box 1 in B My Documents my Music Emy Pictures My Recent Emy videos Documents sample E Desktop My Documents ge My Computer m My Network gt File name vi Places A Save as type Microsoft Office Excel Bool Cancel Function buttons The following items are explained here How to open Description of each area Function buttons How to open From the File menu select Save lt object gt As Description of each area 1 Save in Select the folder to which the fi
4. i Q O O O O O Co 0 Q 0 0 0 0 0 Pa e e m a oe HH So Device Pin List 28 a Macro Name 4 Total wt Used Usecr ___ A D Converter ADC 13 0 0 Pin Nurabe R20UT2138EJ0100 Rev 1 00 ztENESAS Page 78 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Figure A 23 Operational Object External Peripheral Tab First Layer Device Pin List GEY a Total P6O0 SCLAO Se Free E External Peripheral a Total xy l leer Neat inal I 1 Pin Number 2 Displayed item selection area Select whether or not to display the item selected in the Operational object selection area in the device pin list Checked Displays the selected item in the device pin list Not checked Hides the selected item in the device pin list Function buttons Button Function New Column Opens the New Column dialog box for adding columns to the device pin list Delete Column Deletes the selected columns from the device pin list You can only delete the column which you added using the New Column dialog box Default Restores the column order to the default settings Close Closes this dialog box R20UT2138EJ0100 Rev 1 00 ztENESAS Page 79 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE New Column dialog box This dialog box allows you to add your own column to the device pin list Figure A 25 New Column Dialog
5. None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 221 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS C 3 9 Watchdog Timer Below is a list of API functions output by Code Generator for watchdog timer use Table C 10 API Functions Watchdog Timer WDT_Restart Clears the watchdog timer counter and resumes counting R20UT2138EJ0100 Rev 1 00 2tENESAS Page 222 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS WDT_Restart Clears the watchdog timer counter and resumes counting Classification CG_wdt c Syntax void WDT_Restart void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 223 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS C 3 10 Real time Clock Below is a list of API functions output by Code Generator for real time counter use Table C 11 API Functions Real time Clock API Function Name Function RTC_Init Performs initialization necessary to control real time counter functions RTC_Userlnit Performs user defined initialization relating to the real time counter RTC_PowerOff Halts the clock supplied to the real time counter RTC_CounterEnable Starts the count of the real time counter year month weekday day hour minute sec ond RTC_CounterDisable Ends the count of the real time counter year month weekday day hour minute sec ond
6. R20UT2138EJ0100 Rev 1 00 2tENESAS Page 130 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UART6_Stop Ends UART communication Classification CG_serial c Syntax void UART6_Stop void Argumenit s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 131 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UART6_SendData Starts UART data transmission Remarks 1 This API function repeats the byte level UART transmission from the buffer specified in parameter txbuf the number of times specified in parameter txnum 2 When performing a UART transmission UART6_Sitart must be called before this API function is called Classification CG_serial c Syntax include CG_macrodriver h MD_STATUS UART6_SendData UCHAR txbuf USHORT txnum Argument s UCHAR txbuf Pointer to a buffer storing the transmission data USHORT txnum Total amount of data to send Remark You can only set 1 for the total txnum of the sending data in case the serial interface UART6 operates in DALI mode Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification Example Below is an example of sending a UART transmission of four bytes of fixed length data one time CG_main c include CG_macrodriver h BOOL gFlag Transmission complete flag void main void UCHAR txbuf ABCD USHORT tx
7. Save project Save a project Remark See CubeSuite Integrated Development Environment User s Manual Start for details on Save project R20UT2138EJ0100 Rev 1 00 2tENESAS Page 9 of 280 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 2 FUNCTIONS Pin Configurator 2 2 Open Device Pin List Panel Open the Device Pin List panel where you enter information on the pins of the microcontroller To open the Device Pin List panel double click Project name Project gt gt Pin Configurator Design Tool gt gt Device Pin List in the Project Tree panel Figure 2 1 Open Device Pin List Panel Device Pin List Function VO 4 N ch 4 Defin P 1 SDAAO SI1 Free ZINTP10 P62 5011 INTP9 Free Remarks 1 If an unsupported microcontroller is defined in the project for Pin Configurator then Pin Configurator Design Tool node will hide under Project name Project in the Project Tree panel 2 The Device Pin List panel consists of three tabs Selecting one of the tabs changes the order in which information on each pin of the microcontroller is displayed Pin Number tab Information on each pin of the microcontroller is displayed in the order of pin number Macro tab Information on each pin of the microcontroller is displayed in the order it was grouped into peripheral functions External Peripheral tab Information about the pins connected to external peripherals is displayed in order grouped at the external pe
8. void main void INT_MaskableInterruptEnable INT_INTPO MD_TRUE Enable acceptance of maskable interrupt INTPO R20UT2138EJ0100 Rev 1 00 2tENESAS Page 121 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS INTPn_Disable Disables the acceptance of the maskable interrupts INTPn external interrupt requests Classification CG_int c Syntax void INTPn_Disable void Remark nis the interrupt factor number Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 122 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS INTPn_Enable Enables the acceptance of the maskable interrupts INTPn external interrupt requests Classification CG_int c Syntax void INTPn_Enable void Remark nis the interrupt factor number Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 123 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS KEY_Disable Disables the acceptance of the key interrupts INTKR Classification CG_int c Syntax void KEY_Disable void Argumenit s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 124 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS KEY_ Enable Enables the acceptance of the key interrupts INTKR Classification CG_int c Syntax void KEY_Enabl
9. CG_systeminit c Call initial function of peripheral function Call CG_ReadResetSource CG_macrodriver h Defines common macros used by all source files CG_userdefine h Empty file for user definitions CG_lk dr Link directive CG_option asm Option bytes secures ROM for MINICUBE2 B 2 Output File Below are the files peripheral function output by Code Generator Table B 2 File List Peripheral Function Peripheral Function Source File Name Names of API Functions Included System CG_system c CLOCK_Init CG_ChangeClockMode CG_ChangeFrequency CG_SelectPowerSaveMode CG_SelectStabTime CG_ChangePIlMode CG_system_user c CLOCK _Userlnit CG_ReadResetSource CG_system h Port CG_port c PORT_Init PORT_ChangePmnInput PORT_ChangePmnOutput CG_port_user c PORT _Userlnit CG_port h Interrupt CG_int c INTP_Init KEY _Init INT_MaskablelnterruptEnable INTPn_Disable R20UT2138EJ0100 Rev 1 00 tENESAS Page 84 of 280 Sep 01 2012 CubeSuite V1 03 00 Peripheral Function Source File Name Interrupt APPENDIX B OUTPUT FILES Names of API Functions Included INTPn_Enable KEY_Disable KEY_Enable CG_int_user c INTP_UserInit KEY_Userlnit MD_INTPn MD_INTKR CG_int h Serial CG_serial c UART6_Init UART6_Start UART6_Stop UART6_SendData UART6_ReceiveData CSlin_Init CSl1n_Start CSlin_Stop CSlin_ReceiveData CSlin_SendReceiveData IICA_Init IICA_Stop IICA_M
10. How to open From the start menu select All Programs gt gt Renesas Electronics CubeSuite gt gt CubeSuite Description of each area 1 Menu bar This area consists of the following menu items R20UT2138EJ0100 Rev 1 00 ztENESAS Page 39 of 280 Sep 01 2012 CubeSuite V1 03 00 a File menu Save Pin List APPENDIX A WINDOW REFERENCE Device Pin List panel dedicated item Saves a report file a file containing information configured using Pin Configura tor device pin list overwriting the existing file Save Pin List As Device Pin List panel dedicated item Opens the Save As dialog box for naming and saving a report file a file con taining information configured using Pin Configurator device pin list Save Top View Device Top View panel dedicated item Saves a report file a file containing information configured using Pin Configura tor device top view overwriting the existing file Save Top View As Device Top View panel dedicated item Opens the Save As dialog box for naming and saving a report file a file con taining information configured using Pin Configurator device top view Save Code Generator Report Code Generator panel Code Generator Preview panel dedicated item Outputs report files a file containing information configured using Code Gener ator and a file containing information regarding the source code The output format for the report
11. Performs initialization of the serial interface CSI1n channel CSl1n_Userlnit Performs user defined initialization of the serial interface CSI1n CSI1n_Start Sets CSI1n communication to standby mode CSlin_Stop Ends CSI1n communication CSlI1n_ReceiveData Starts CSI1n data reception CSlin_SendReceiveData Starts CSI1n data transmission reception CSlin_SendEndCallback Performs processing in response to the CSI1n communication complete interrupt INTCSI1n CSl1n_ReceiveEndCallback Performs processing in response to the CSI1n communication complete interrupt INTCSI1n IICA_Init Performs initialization of the serial interface IICA lIICA_Userlnit Performs user defined initialization of the serial interface IICA IICA_Stop Ends IICA communication IICA_MasterSendStart Starts IICA master transmission IICA_MasterReceiveStart Starts IICA master reception IICA_StopCondition Generates stop conditions IICA_MasterSendEndCallback Performs processing in response to the IICA communication complete interrupt INTIICAO IICA_MasterReceiveEndCallback Performs processing in response to the IICA communication complete interrupt INTIICAO 2tENESAS Page 90 of 280 CubeSuite V1 03 00 Peripheral Function API Function Name IICA_MasterErrorCallback APPENDIX C API FUNCTIONS Function Performs processing in response to dete
12. To change the output destination use the Browse For Folder dialog box which opens by pressing the button in the Output folder Figure 3 12 Change Output Destination Folder Browse For Folder Desktop B My Documents 4 My Computer E al My Network Places Unused Desktop Shortcuts Make New Folder R20UT2138EJ0100 Rev 1 00 ztENESAS Page 33 of 280 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 3 FUNCTIONS Code Generator 3 6 Output Report Files Output report files a file containing information configured using Code Generator and a file containing information regarding the source code by first activating the Code Generator panel or Code Generator Preview panel then selecting File menu gt gt Save Code Generator Report The destination folder for the report file is specified by clicking Generation tab gt gt Output folder in the Property panel Remarks 1 You can only use macro or function as a name of the report file Table 3 6 Output Report Files File Name Outline A file that contains the information configured using Code Generator function A file that contains the information regarding the source code 2 The output mode for the report file is fixed to Overwrite file Figure 3 13 Output Example of Report File macro Macro list Microsoft Internet Explorer File Edit View Favorites Tools Help MCU name 78K0 KC2 L Chip name uPD78F0588_48 Module Macro
13. 2 Select one of the following two types for Pin function whether to display it whether or not a function is selected for Function on the Device Pin List Display all Displays functions selected via the device pin list s Function feature in parentheses Selected function only Only display functions selected via the device pin list s Function feature in the device top view R20UT2138EJ0100 Rev 1 00 ztENESAS Page 18 of 280 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 2 FUNCTIONS Pin Configurator 2 4 Enter Information Enter information on the pins of the microcontroller in the Device Pin List panel which is opened as described in 2 2 Open Device Pin List Panel Remarks 1 You cannot add information in the Pin Number column Pin Name column Description column Recommend Connection for Unused column and Attention column because they contain fixed infor mation 2 Ifthe Free in the Function column is changed to a specific pin name color of the corresponding pin in the Device Top View panel changes from the color representing the unused pins to the color repre senting the used pins selected by clicking Device Top View Settings tab gt gt Color in the Property panel Figure 2 11 Change in Displayed Color Device Top View Device Top View oOrse 0___ E 33 a 3 LJ Use Be LJ Use ES a Pye Tor ental Tor aeaER defi BRwEE defi 2S 2ic OOo dO O POO SLAY _SKIN SIMTPIL P
14. CLOCK_Init 98 Clock Output 258 PCL_ChangeFreq 263 PCL_Init 259 PCL_Start 261 PCL_Stop 262 PCL_Userlnit 260 CLOCK_Userlnit 99 Code Generator panel 69 Code Generator Preview panel 72 Column Chooser dialog box 77 Comparator 176 Comparator_Init 177 Comparatorn_Start 179 Comparatorn_Stop 180 Comparator_Userlnit 178 Comparator_Init 177 Comparatorn_Start 179 Comparatorn_Stop 180 Comparator_Userlnit 178 CSlin_Init 141 CSlin_ReceiveData 145 CSI1n_ReceiveEndCallback 150 CSlin_SendEndCallback 149 CSlin_SendReceiveData 147 CSlin_Start 143 CSlin_Stop 144 CSlin_Userlnit 142 R20UT2138EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Page 272 of 280 CubeSuite V1 03 00 APPENDIX D INDEX D Device Pin List Information tab 49 Device Pin List panel 58 External Peripheral tab 64 Macro tab 62 Pin Number tab 60 Device Top View panel 66 Device Top View Settings tab 50 E External Peripheral tab 64 F File Setting tab 57 Functions 8 22 Code Generator 22 Pin Configurator 8 G Generation tab 53 l IICA_GetStopConditionCallback 165 IICA_Init 151 IICA_MasterErrorCallback 159 IICA_MasterReceiveEndCallback 158 IICA_MasterReceiveStart 155 IICA_MasterSendEndCallback 157 IICA_MasterSendStart 154 IICA_SlaveErrorCallback 164 IICA_
15. Changes the value of 8 bit timer compare register 5n CR5n M5n_ChangeDuty Changes the duty ratio of the PWM signal output to the TO5n pin MHn_Init Performs initialization necessary to control 8 bit timer Hn func tions TMHn_Userlnit Performs user defined initialization relating to the 8 bit timer Hn TMHn_ Start Starts the count for 8 bit timer Hn TMHn_Stop R20UT2138EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Ends the count for 8 bit timer Hn Page 92 of 280 CubeSuite V1 03 00 Peripheral Function API Function Name TMHn_ChangeTimerCondition APPENDIX C API FUNCTIONS Function Changes the value of 8 bit timer H compare register On 1n CMPOn CMP1 n TMHn_ChangeDuty Changes the duty ratio of the PWM signal output to the TOHn pin TMH1_CarrierOutputEnable Begins carrier pulse output of the 8 bit timer H1 carrier gener ator mode TMH1_CarrierOutputDisable Ends carrier pulse output of the 8 bit timer H1 carrier genera tor mode Watchdog Timer WDT_Restart Clears the watchdog timer counter and resumes counting Real time Clock RTC_Init Performs initialization necessary to control real time counter functions RTC_Userlnit Performs user defined initialization relating to the real time counter RTC_PowerOff Halts the clock supplied to the real time counter RTC_CounterEnable Starts the count of the real time counter
16. Classification CG_system c Syntax void CLOCK_Init void Argumenit s None Return value None R20UT2138EJ0100 Rev 1 00 ztENESAS Page 98 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CLOCK_Userlnit Performs user defined initialization relating to the clock generator on chip debug and etc Remark This API function is called as the CLOCK_Init callback routine Classification CG_system_user c Syntax void CLOCK_UserInit void Argumeni s None Return value None R20UT2138EJ0100 Rev 1 00 ztENESAS Page 99 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CG_ReadResetSource Performs processing in response to RESET signal Classification CG_system_user c Syntax void CG_ReadResetSource void Argumenit s None Return value None Example Below are examples of the different processes executing depending on the RESET signal trigger CG_Systeminit c void systeminit void CG_ReadResetSource Processes executed by RESET signal trigger CG_system_user c include CG_macrodriver h void CG_ReadResetSource void UCHAR flag RESF Reset control flag register Obtain RESF contents if flag amp Oxl Trigger identification Check LVIRF flag gee aces Internal reset request by low voltage detector else if flag amp 0x10 Trigger identif
17. Click the eS button to remove the external peripheral component in question from the Device top view area it the Device Top View panel 2 Device pin list area This area displays the device pin list for entering information on the pins of the microcontroller 3 Tab selection area Selecting the tab changes the order in which information on each pin of the microcontroller is displayed This panel has the following tabs Pin Number tab This tab displays information on each pin of the microcontroller in the order of pin number Macro tab This tab displays information on each pin of the microcontroller in the order it was grouped into peripheral functions External Peripheral tab This tab displays information about the pins connected to external peripherals in order grouped at the external peripheral component level File menu Device Pin List panel dedicated items Save Pin List Saves a report file a file containing information configured using Pin Configurator device pin list overwriting the existing file Save Pin List As Opens the Save As dialog box for naming and saving a report file a file containing infor mation configured using Pin Configurator device pin list Help menu Device Pin List panel dedicated items Open Help for Device Pin List Displays the help of this panel Panel R20UT2138EJ0100 Rev 1 00 ztENESAS Page 59 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERE
18. Comparator Comparator_Init Performs initialization necessary to control comparator func tions Comparator_Userlnit Performs user defined initialization relating to the comparator Comparatorn_Start Starts the operation of comparator n Comparatorn_Stop Ends the operation of comparator n A D Converter AD_Init Performs initialization necessary to control A D converter func tions AD_Userlnit Performs user defined initialization relating to the A D con verter AD_ComparatorOn Enables operation of voltage converter AD_ComparatorOff Disables operation of voltage converter AD_Start Starts A D conversion AD_Stop Ends A D conversion AD_SelectADChannel R20UT2138EJ0100 Rev 1 00 Sep 01 2012 ztENESAS Configures the analog voltage input pin for A D conversion Page 91 of 280 CubeSuite V1 03 00 Peripheral Function API Function Name A D Converter AD_Read APPENDIX C API FUNCTIONS Function Reads the results of A D conversion 10 bits AD_ReadByte Reads the results of A D conversion 8 bits most significant 8 bits of 10 bit resolution MX_Init Performs initialization necessary to control 16 bit timer Xn functions MXn_Start Starts the count for 16 bit timer Xn MXn_Stop Ends the count for 16 bit timer Xn MXn_ChangeDuty Changes the duty ratio of the PWM signal single output to the TOXOn pin MXn
19. Performs initialization necessary to control 16 bit timer Xn functions Classification CG_timer c Syntax void TMX_Init void Argumenit s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 192 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TMXn_Start Starts the count for 16 bit timer Xn Remark The time from the call to this API function to the start of counting depends on the type of the function in question e g PWMoutput or A D conversion start timing signal output Classification CG_timer c Syntax void TMXn_Start void Remark nis the channel number Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 193 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TMXn_Stop Ends the count for 16 bit timer Xn Classification CG_timer c Syntax void TMXn_Stop void Remark nis the channel number Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 194 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TMXn_ChangeDuty Changes the duty ratio of the PWM signal single output to the TOXn pin Remark This API function can only be called when the 16 bit timer Xn is being used for single output Classification CG_timer c Syntax include CG_macrodriver h void TMXn_ChangeDuty UCHAR ratio Re
20. RTC_SetHourSystem Sets the clock type 12 hour or 24 hour clock of the real time counter RTC_CounterSet Sets the counter value year month weekday day hour minute second of the real time counter RTC_CounterGet Reads the counter value year month weekday day hour minute second of the real time counter RTC_ConstPeriodInterruptEnable Sets the cycle of the interrupts INTRTC then starts the cyclic interrupt function RTC_ConstPeriodInterruptDisable Ends the cyclic interrupt function RTC_ConstPeriodInterruptCallback Performs processing in response to the cyclic interrupt INTRTC RTC_AlarmEnable Starts the alarm interrupt function RTC_AlarmDisable Ends the alarm interrupt function RTC_AlarmSet Sets the alarm conditions weekday hour minute RTC_AlarmGet Reads the alarm conditions weekday hour minute RTC_AlarmInterruptCallback Performs processing in response to the alarm interrupt INTRTC RTC_IntervalStart Starts the interval interrupt function RTC_IntervalStop Ends the interval interrupt function RTC_IntervallnterruptEnable Sets the cycle of the interrupts INTRTCI then starts the interval interrupt function RTC_IntervallnterruptDisable Ends the interval interrupt function RTC_RTC1HZ_OutputEnable Enables output of the real time counter correction clock 1 Hz to the RTC1HZ pin RTC_RTC1HZ_OutputDisab
21. gt Device Top View and then select Property from the View menu On the Project Tree panel select Project name Project gt gt Pin Configurator Design Tool gt gt Device Top View and then select Property from the context menu Remark If this panel is already open selecting a different Device Top View in the Project Tree panel changes the content displayed accordingly Description of each area 1 Color category Select the display colors to differentiate the pin groups Power pins Special pins etc in the device top view Power pins Selects the display color for power pins pins whose use is limited to power Special pins Selects the display color for special pins pins with specified uses R20UT2138EJ0100 Rev 1 00 ztENESAS Sep 01 2012 Page 50 of 280 CubeSuite V1 03 00 Unused pins APPENDIX A WINDOW REFERENCE Selects the display color for unused pins dual use pins with no use set in the Device Pin List panel Used pins Selects the display color for used pins dual use pins with a use set in the Device Pin List panel Device Selects the display color of the microcontroller Highlight color for a selected pin Selects the background color of a pin selected in the Device Pin List panel on the Pin Number tab Highlight color for macro pins Selects the background color of pins selected in the Device Pin List panel on the Macro tab High
22. 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS R20UT2138EJ0100 Rev 1 00 2tENESAS Page 235 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_ConsiPeriodInterruptEnable Sets the cycle of the interrupts INTRTC then starts the cyclic interrupt function Classification CG_rtc c Syntax include CG yto h MD_STATUS RTC_ConstPeriodInterruptEnable enum RTCINTPeriod period Argumeni s Argument Description enum RTCINTPeriod period Interrupt INTRTC cycle HALFSEC 0 5 seconds ONESEC 1 second ONEMIN 1 minute ONEHOUR 1 hour ONEDAY 1 day ONEMONTH 1 month Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification Example Below is an example of setting the cycle of the interrupts INTRTC then starting the cyclic interrupt function CG_main c include CG_rtewh void main void ee eee 3 End of cyclic interrupt function ee E EE HALFSEC Start of cyclic interrupt function R20UT2138EJ0100 Rev 1 00 RENESAS Page 236 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_ConsiPeriodinterruptDisable Ends the cyclic interrupt function Classification CG_rtc c Syntax void RTC_ConstPeriodInterruptDisable void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 237 of 280 Sep 01 2012 CubeSuite V1 03 0
23. API FUNCTIONS TMX_EnableHighImpedanceState Begins high impedance output of the 16 bit timer Xn Classification CG_timer c Syntax void TMX_EnableHighImpedanceState void Argumenit s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 197 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TMX_DisableHighImpedanceState Ends high impedance output of the 16 bit timer Xn Classification CG_timer c Syntax void TMX_DisableHighImpedanceState void Argumenit s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 198 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TMOO_Init Performs initialization necessary to control 16 bit timer event counter 00 functions Classification CG_timer c Syntax void TMOO_Init void Argumenit s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 199 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TMOO_Userlnit Performs user defined initialization relating to the 16 bit timer event counter 00 Remark This API function is called as the TM0O0_lnit callback routine Classification CG_timer_user c Syntax void TMOO_UserInit void Argumenit s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 200 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTI
24. CG_system c Syntax include CG_macrodriver h include CG_system h MD_STATUS CG_SelectPowerSaveMode enum PSLevel level Argument s enum PSLevel level Standby function type PSSTOP STOP mode PSHALT HALT mode Return value Macro Description MD_OK Normal completion MD_ERROR Exit with error abend Kx2 L If the CPU is operating by XT1 clock then STOP mode cannot be specified MD_ARGERROR Invalid argument specification Remark The value MD_ERROR will only be returned when the target device is a 78K0 KC2 L Example Below is an example of changing the standby function to STOP mode CG_main c include CG_macrodriver h include CG_system h void main void MD_STATUS ret TMOO_Stop Stop count ret CG_SelectPowerSaveMode PSSTOP Change to STOP mode if ret MD_OK while 1 R20UT2138EJ0100 Rev 1 00 ztENESAS Page 104 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TMOO_Init Initialize TMOO TMOO_Start Start count R20UT2138EJ0100 Rev 1 00 2tENESAS Page 105 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CG_SelectStabTime Configures the oscillation stabilization time of the X1 clock Classification CG_system c Syntax include CG_macrodriver h include CG_system h MD_STATUS CG_SelectStabTime enum StabTime waittime Argument
25. CSI1n communication CSI1n_ReceiveData Starts CSI1n data reception CSlin_SendReceiveData Starts CSI1n data transmission reception CSlin_SendEndCallback Performs processing in response to the CSI1n communication complete interrupt INTCSI1n CSlin_ReceiveEndCallback Performs processing in response to the CSI1n communication complete interrupt INTSClin IICA_Init Performs initialization of the serial interface IICA IICA_Userlnit Performs user defined initialization of the serial interface IICA IICA_Stop Ends IICA communication IICA_MasterSendStart Starts IICA master transmission lICA_MasterReceiveStart Starts IICA master reception IICA_StopCondition Generates stop conditions lICA_MasterSendEndCallback Performs processing in response to the IICA communication complete interrupt INTIICAO IICA_MasterReceiveEndCallback Performs processing in response to the IICA communication complete interrupt INTIICAO IICA_MasterErrorCallback Performs processing in response to detection of error in IICA master communication lICA_SlaveSendStart Starts IICA slave transmission lICA_SlaveReceiveStart R20UT2138EJ0100 Rev 1 00 Sep 01 2012 Starts IICA slave reception ztENESAS Page 126 of 280 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS API Function Name Function IICA_SlaveSendEndCallback Performs processing in response to
26. Comparator 176 C 3 7 A D Converter 181 C 3 8 Timer 191 84 89 166 C 3 9 Watchdog Timer 222 C 3 10 Real time Clock 224 C 3 11 Clock Output 258 C 3 12 LVI 264 APPENDIX D INDEX 272 CubeSuite V1 03 00 CHAPTER 1 GENERAL CHAPTER 1 GENERAL CubeSuite is an integrated development environment used to carry out tasks such as design coding build and debug for developing application systems This chapter gives an overview of the design tool Pin Configurator Code Generator 1 1 Overview The design tool which is one of the components provided by CubeSuite enables you to output the pin assignment of the microcontroller device pin list and device top view and the source code device driver programs C source files and header files necessary to control the peripheral functions provided by the microcontroller clock generator port functions etc by configuring various information using the GUI 1 2 Features The design tool Pin Configurator Code Generator has the following features Code generating function The Code Generator can output not only device driver programs in accordance with the information configured using the GUI but also a build environment such as sample programs containing main functions and link directive files Reporting function You can output configured information using Pin Configurator Code Generator as files in various formats for use as design do
27. Enables output of the real time counter clock 32 kHz cycle to the RTCDIV pin Classification CG_rtc c Syntax void RTC_RTCDIV_OutputEnable void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 255 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_RTCDIV_OutputDisable Disables output of the real time counter clock 32 kHz cycle to the RTCDIV pin Classification CG_rtc c Syntax void RTC_RTCDIV_OutputDisable void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 256 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_ChangeCorrectionValue Changes the timing and correction value for correcting clock errors Classification CG_rtc c Syntax include CG_macrodriver h include CGurtc ih MD_STATUS RTC_ChangeCorrectionValue enum RTCCorectionTiming timing UCHAR corectval Argument s Argument Description enum RTCCorectionTiming timing When clock errors are corrected EVERY20S When the seconds digits are 00 20 or 40 EVERY60S When the seconds digits are 00 UCHAR corectval Clock error correction value Remark This API function does not correct clock errors if correction value corectVal is set to 0x0 0x1 0x40 or 0x41 Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20U
28. MHz Internal low speed oscillation clock fIL setting V Gan be stopped by software Option byte 7 Stop Frequency 30 kHe RESET pin setting Unused Used P125 Remark If an unsupported microcontroller is defined in the project for Code Generator then Code Generator Design Tool node will hide under Project name Project in the Project Tree panel R20UT2138EJ0100 Rev 1 00 ztENESAS Page 23 of 280 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 3 FUNCTIONS Code Generator 3 3 Enter Information Configure the information necessary to control the peripheral functions in the information setting area of the Code Gen erator panel which is opened as described in 3 2 Open Code Generator Panel Remark When controlling multiple peripheral functions repeat the procedures described in 3 2 Open Code Gener ator Panel through 3 3 Enter Information 3 3 1 Input rule Following is the rules for input to the Code Generator panel 1 Character set Character sets that are allowed to input are as follows Table 3 1 List of Character Set Character Set Outline ASCII 1 byte alphabet number symbol Shift JIS 2 byte alphabet number symbol Hiragana Katakana Kanji and 1 byte Kata kana EUC JP 2 byte alphabet number symbol Hiragana Katakana Kanji and 1 byte Kata kana UTF 8 2 byte alphabet number symbol Hiragana Katakana Kanji include Chinese characte
29. Preview panel Output panel R20UT2138EJ0100 Rev 1 00 ztENESAS Page 41 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Project Tree panel This panel displays components of the project microcontroller design tool build tool etc in a tree structure Figure A 2 Project Tree Panel Project Tree Eri uPD78F0588_48 Microcontroller a A Pin Configurator Design Tool A Device Pin List a Device Top View B eel Code Generator Design Tool System Port Interrupt Serial Operational Amplifier A D Converter Timer Watchdog Timer Real time Clock Clock Output me LVI A CA78KO Build Tool SS 78K0 Simulator Debug Tool P Program Analyzer Analyze Tool E File The following items are explained here How to open Description of each area Help menu Project Tree panel dedicated items Context menu How to open From the View menu select Project Tree Description of each area 1 Project tree area This area displays components of the project microcontroller design tool build tool etc in a tree structure a Pin Configurator Design Tool This node consists of the following pin nodes R20UT2138EJ0100 Rev 1 00 ztENESAS Page 42 of 280 Sep 01 2012 CubeSuite V1 03 00 Device Pin List APPENDIX A WINDOW REFERENCE Opens the Device Pin List panel for entering information on the pins of the microcontr
30. Sub Setting _ Status System Used System Used Power voltage VDD setting 27 Vv YDD 5 5 V Main system clock setting Internal high speed oscillation fH Frequency fH AMZ a Operation XH Unused Operation SUB Unused CPU clock fCPU 2000 flH 2 kHz Peripheral hardware clock PRS 4 flH MHz R20UT2138EJ0100 Rev 1 00 2tENESAS Page 34 of 280 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 3 FUNCTIONS Code Generator Figure 3 14 Output Example of Report File function Function list Microsoft Internet Explorer MCU name 78K0 KC2 L Chip name uPD78F0588_48 systeminit void DI NaGWIiNnitivold R20UT2138EJ0100 Rev 1 00 RENESAS Page 35 of 280 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 3 FUNCTIONS Code Generator 3 6 1 Change output format The Code Generator is used to change the output format HTML file or CSV file of the report file by selecting Genera tion tab gt gt Report type in the Property panel Figure 3 15 Change Output Format Property Code Generator Property E Product Information iT VA Release date daiNViViyyyy E Generate File Mode Output control of API function Output all API functions according to the setting Generate file Merge file Output folder C Documents and Settings My Docume HTML file Iv Reaister files HTML file E PinConfigurator Reflect Mode CS file Mode ETECTE Report type The format of report file
31. area displays the device pin list for entering information on the pins of the microcontroller The device pin list in this area is organized in the order the pins were grouped into peripheral functions a First layer The following are the columns comprising the device pin list Column Heading Outline Macro Name Displays the name of the peripheral function Total Displays the total number of pins assigned to the peripheral function Used Displays the total number of pins for which the purpose has been set Used in Other Macro Displays the total number of pins for which the purpose has been set by other peripheral functions R20UT2138EJ0100 Rev 1 00 ztENESAS Page 62 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE b Second layer Column Heading Outline Pin Number Displays the pin number of the pin Pin Name Displays the pin name of the pin Function This area allows you to select which function to use when the pin has more than one functions 1 0 This area allows you to select the I O mode of the pin N ch This area allows you to select which output mode to apply when using the pin in the output mode Define Name This area allows you to assign a user defined pin name to the pin Within 256 characters can be entered in the Define Name Description Displays the summary of function of the pin Recommend Connection for Unuse
32. changes the content displayed accordingly Description of each area 1 Product Information category This area displays product information Version and Release date on Pin Configurator Version Displays the version of Pin Configurator Pin Configurator Plug in Release date Displays the release date of Pin Configurator Pin Configurator Plug in R20UT2138EJ0100 Rev 1 00 ztENESAS Page 49 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Device Top View Settings tab This tab allows you to view the information Color Tool Tip and Pin Name Display on and change the setting for the Device Top View selected in the Project Tree panel Figure A 6 Device Top View Settings Tab Property a Device Top View Property E Color Power pins Special pins Unused pins Used pins Device Be Mi Red v GB Green HB Black HM Blue C LightGray Highlight color for a selected pin Highlight color for macro pins Highlight color for external peripheral pins E Red E Yelow GB Green E ToolTip Tool tip E PinName Display Define name Pin function Display all Display Dsiplay all Power pins Select text color of power pins Device Top Yiew Settings The following items are explained here How to open Description of each area How to open On the Project Tree panel select Project name Project gt gt Pin Configurator Design Tool gt
33. debug tool etc provided by CubeSuite The messages are dassified by the message origination tool and displated on the individual tabs Remark The Message area can be zoomed in and out by 100 w in the tool bar or by operating the mouse wheel while holding down the Ctrl key Figure A 18 Output Panel MO409000 CG option asm was generated MO409004 CG system c was overwritten MO0409004 CG system_user c was overwritten M0409004 CG system h was overwritten MO409000 CG wdt c was generated M04039000 CG_wdt h was generated MO409003 The operation of generating file was successful EOF Code Generator Rapid Build The following items are explained here How to open Description of each area File menu Output panel dedicated items Edit menu Output panel dedicated items Context menu How to open From the View menu select Output Description of each area 1 Message area The output messages of each tool are displayed The colors of message display differ with the type of message as shown below character colors and background colors depend on the configuration in the General Font and Color category of the Option dialog box Message Type Display Example Default Description Normal message Character color Black Displayed with information notices ABCD abed 0123 Background color White Warning mes Character color Bule Displayed
34. file either HTML or CSV is selected by click ing Generation tab gt gt Report type in the Property panel The destination folder for the report file is specified by clicking Generation tab gt gt Output folder in the Property panel Save Output Tab Name Output panel dedicated item Saves the message corresponding to the specified tab overwriting the existing file Save Output Tab Name As b Edit menu Output panel dedicated item Opens the Save As dialog box for naming and saving the message correspond ing to the specified tab Property panel dedicated item Cancels the effect of an edit operation to restore the previous state Property panel dedicated item Sends the character string or lines selected with range selection to the clip board and deletes them Property panel Output panel dedicated item Sends the character string or lines selected with range selection to the clip board Property panel dedicated item Inserts the contents of the clipboard at the caret position Delete Property panel dedicated item Deletes the character string or the lines selected with the range selection Select All R20UT2138EJ0100 Rev 1 00 Sep 01 2012 Property panel Output panel dedicated item Selects all the strings displayed in the item being edited or all the strings dis played in the Message area 2tENESAS Page 40 of 280 CubeSuite V1 03 00 APPENDIX A WINDO
35. gt Pin Configurator Design Tool gt gt Device Pin List and then press the Enter key From the View menu select Pin Configurator gt gt Device Pin List Description of each area 1 Toolbar This area consists of the following buttons Displays the information in the Device pin list area in an expanded view Displays the information in the Device pin list area in a folded view only Clicks this button to automatically process the configuration information in the selected function I O N ch and other fields after selecting one of the peripheral functions displayed in the first level on the Macro tab R20UT2138EJ0100 Rev 1 00 2tENESAS Page 58 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Clicks this button to initialize the selected function I O N ch and other fields after selecting one of the peripheral functions displayed in the first level on the Macro tab Clicks this button to create an external peripheral controller from the external periph eral controller information on the External Peripheral tab and display it in the Device Top View panel Clicks this button to delete the information for the external peripheral controller dis played on the External Peripheral tab on the first layer Remarks 1 Click the ie button to add the information in question as a choice in the External Parts column of the Macro tab and the Pin Number tab 2
36. h MD_STATUS RTC_SetHourSystem enum RTCHourSystem hoursystem Argument s enum RTCHourSystem hoursystem Clock type HOUR12 12 hour clock HOUR24 24 hour clock Return value Macro Description MD_OK Normal completion MD_BUSY1 Executing count process before change to setting MD_BUSY2 Stopping count process after change to setting MD_ARGERROR Invalid argument specification Remark If MD_BUSY1 or MD_BUSY2 is returned it may be because the counter operation is stopped or the counter operation start wait time is too short so make the value of the RTC_WAITTIME macro defined in the header file CG_rtc h larger Example Below is an example of setting the clock type to the 24 hour clock CG_main c include CG_rte h void main void Start count RTC_SetHourSystem HOUR24 Set clock type R20UT2138EJ0100 Rev 1 00 2tENESAS Page 230 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS R20UT2138EJ0100 Rev 1 00 2tENESAS Page 231 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_CounterSet Sets the counter value year month weekday day hour minute second of the real time counter Classification CG_rtc c Syntax include CG_macrodriver h include CGurtc h MD_STATUS RTC_CounterSet struct RTCCounterValue counterwriteval Argument s Argument Description struct RTCCounterValue Count
37. highwidth Pointer to area storing the high level measurement width 0x0 to Oxffff ULONG lowwidth Pointer to area storing the low level measurement width 0x0 to Oxffff enum TMChannel channel The pin to measure TMCHANNELO T1000 pin TMCHANNEL1 T1010 pin Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 207 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TM5n_Init Performs initialization necessary to control 8 bit timer event counter 5n functions Classification CG_timer c Syntax void TM5n_Init void Remark nis the channel number Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 208 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TM5n_Userlnit Performs user defined initialization relating to the 8 bit timer event counter 5n Remark This API function is called as the TM5n_Init callback routine Classification CG_timer_user c Syntax void TM5n_UserInit void Remark nis the channel number Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 209 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TM5n_ Start Starts the count for 8 bit timer event counter 5n Remark The time from the call to this API function to the start of counting depends on the type of the function in question e g interval timer or ex
38. in interrupt generation mode Classification CG_lIvi c Syntax void LVI_InterruptModeStart void Argumenit s None Return value None Example The example below shows the detection of low voltage when the operation mode is interrupt generation mode gener ate the interrupt INTLVI CG_main c void main void LVI_InterruptModeStart Start low voltage detection CG_Ivi_user c __ interrupt void MD_INTLVI void Interrupt processing for INTLVI if IVI SS 1 f Trigger identification Check LVIF flag Handle case when power voltage Vpp lt detected voltage V y detected Handle case when power voltage Vpp gt detected voltage Vzyz detected R20UT2138EJ0100 Rev 1 00 ztENESAS Page 267 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS LVI_ResetModeStart Starts low voltage detection when in internal reset mode Classification CG_lIvi c Syntax MD_STATUS LVI_ResetModeStart void Argument s None Return value Description MD_OK Normal completion MD_ERROR Exit with error abend The object of low voltage detection is external voltage VDD and power voltage VDD lt detected voltage VLv1 The object of low voltage detection is external input voltage EXLVI and external input voltage EXLVI lt detected voltage VEXLvI R20UT2138EJ0100 Rev 1 00 2tENES
39. in the Information setting area to the Comparator for configuring the information necessary to control the function of comparator pro vided by the microcontroller Gli Changes the content displayed in the Information setting area to the A D Converter for configuring the information necessary to control the function of A D converter provided by the microcontroller A Changes the content displayed in the Information setting area to the Timer for configuring the information necessary to control the functions of timer array unit pro vided by the microcontroller E Changes the content displayed in the Information setting area to the Watchdog Timer for configuring the information necessary to control the functions of watchdog timer provided by the microcontroller E Changes the content displayed in the Information setting area to the Real time Clock for configuring the information necessary to control the functions of real time counter provided by the microcontroller a Changes the content displayed in the Information setting area to the Clock Output for configuring the information necessary to control the functions of clock output con troller provided by the microcontroller WE Changes the content displayed in the Information setting area to the LVI for config uring the information necessary to control the functions of low voltage detector pro vided by the microcontroller
40. in which items are displayed in the device pin list c Add column Allows you to add columns to the device pin list d Delete column Allows you to delete columns from the device pin list 4 Open Device Top View Panel Open the Device Top View panel where you can confirm the information entered for the pins a Select shape of microcontroller Allows you to select the shape of the microcontroller displayed in the Device Top View panel b Select color Allows you to select colors used to distinguish the type of pins power pins special pins used pins etc whose information is displayed in the Device Top View panel R20UT2138EJ0100 Rev 1 00 ztENESAS Page 8 of 280 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 2 FUNCTIONS Pin Configurator 5 6 7 lt c Select popup information Allows you to select the type of information that popups when you move the mouse cursor over each pin in the Device Top View panel d Select additional information Select the type of information to display in Pin area of the Device Top View panel Enter Information Enter information on the pins of the microcontroller in the Device Pin List panel Output Report Files Output report files files containing configured information using Pin Configurator device pin list and device top view to the specified folder a Output device pin list Output a device pin list b Output device top view Output a device top view
41. is displayed Generation Remark Output format is selected from the following two types Table 3 7 Output Mode of Source Code HTML file Outputs a report file in HTML format CSV file Outputs a report file in CSV format R20UT2138EJ0100 Rev 1 00 2tENESAS Page 36 of 280 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 3 FUNCTIONS Code Generator 3 6 2 Change output destination The Code Generator is used to change the output destination folder for the report file by selecting Generation tab gt gt Output folder in the Property panel To change the output destination use the Browse For Folder dialog box which opens by pressing the button in the Output folder Figure 3 16 Change Output Destination Browse For Folder Desktop B My Documents 4 My Computer E al My Network Places Unused Desktop Shortcuts Make New Folder R20UT2138EJ0100 Rev 1 00 ztENESAS Page 37 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE APPENDIX A WINDOW REFERENCE This appendix explains in detail the functions of the windows panels and dialog boxes of the design tool A 1 Description The design tool has the following windows panels and dialog boxes Window Panel Dialog Box Name Table A 1 Window Panel Dialog Box List Function Main window This is the first window to open when CubeSuite is launched This window is used to operate various components design t
42. of 280 CubeSuite V1 03 00 CHAPTER 3 FUNCTIONS Code Generator 3 5 1 Setting that determines whether or not to generate source code You can set the type of output API functions all API functions or only initialization API functions by selecting Output all API function according to the setting Output only initialization API function from Generation tab gt gt Output control of API function in the Property panel Figure 3 7 Setting That Determines Type of API Functions Code Generator Property E Product Information ersion V Ae AK ARK Release date dd yyyy E Generate File Mode Output control of API function Output all API functions according to the setting 1 Generate file Output all API furni ording to the setting Report type TETE Register files Output files to project E Pin Configurator Reflect Mode Mode Reflected Output control of API function All API function necessary to operation is output according to GUI setting of each peripheral Or only initialization API function is output according to GUI setting of each peripheral Generation You can set whether or not to generate the corresponding source code on a per API function basis by selecting Gener ate code Not generate code from the context menu displayed by right clicking the API function name in the Code Gener ator Preview panel Figure 3 8 Setting That Determines Whether or Not to Generate Source Code Code Generator Preview x a f F
43. pin M00_GetPulseWidth Captures the high low level width measured for the signal pulses input to the TIOnO pin M5n_Init Performs initialization necessary to control 8 bit timer event counter 5n functions M5n_Userlnit Performs user defined initialization relating to the 8 bit timer event counter 5n M5n_ Start Starts the count for 8 bit timer event counter 5n M5n_Stop Ends the count for 8 bit timer event counter 5n M5n_ChangeTimerCondition Changes the value of 8 bit timer compare register 5n CR5n M5n_ChangeDuty Changes the duty ratio of the PWM signal output to the TO5n pin MHn_Init Performs initialization necessary to control 8 bit timer Hn functions MHn_Userlnit Performs user defined initialization relating to the 8 bit timer Hn MHn_Start Starts the count for 8 bit timer Hn MHn_Stop Ends the count for 8 bit timer Hn MHn_ChangeTimerCondition Changes the value of 8 bit timer H compare register 0n 1n CMPOn CMP1n MHn_ChangeDuty Changes the duty ratio of the PWM signal output to the TOHn pin MH1_CarrierOutputEnable Begins carrier pulse output of the 8 bit timer H1 carrier generator mode MH1_CarrierOutputDisable R20UT2138EJ0100 Rev 1 00 Sep 01 2012 Ends carrier pulse output of the 8 bit timer H1 carrier generator mode ztENESAS Page 191 of 280 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TMX_Init
44. single AMP mode Classification CG_opamp c Syntax void AMP_Start void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 172 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS AMP_Stop Ends the operation of operational amplifier single AMP mode Classification CG_opamp c Syntax void AMP_Stop void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 173 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS Starts the operation of operational amplifier n single AMP mode Classification CG_opamp c Syntax void AMPn_Start void Remark nis the channel number Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 174 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS AMPn_Stop Ends the operation of operational amplifier n single AMP mode Classification CG_opamp c Syntax void AMPn_Stop void Remark nis the channel number Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 175 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS C 3 6 Comparator Below is a list of API functions output by Code Generator for comparator use Table C 7 API Functions Comparator API Function Name Function Comparator_Init Performs
45. source code by selecting Generation tab gt gt Generate file in the Property panel Figure 3 11 Change Output Mode Property 8 Code Generator Property E Product Informaton E Generate File Mode Output control of API function Output all API functions according to the setting Generate file Merge file iv Output folder Do nothing if file exists Report type Merge file Reaister files Overwrite file E Pin Configurator Reflect Mode Mode Reflected Generate file Generate file information Generation Remark The output mode is selected from the following three types Table 3 5 Output Mode of Source Code Output Mode Outline Do nothing if file exists If a file with the same name exists a new file will not be output Merge file If a file with the same name exists a new file is merged with the existing file Only the section between Start user code Do not edit comment generated here and End user code Do not edit comment generated here will be merged Overwrite file If a file with the same name exists the existing file is overwritten by a new file R20UT2138EJ0100 Rev 1 00 2tENESAS Page 32 of 280 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 3 FUNCTIONS Code Generator 3 5 5 Change output destination folder The Code Generator is used to change the output destination folder for the source code by selecting Generation tab gt gt Output folder in the Property panel
46. the IICA communication complete interrupt INTIICAO IICA_SlaveReceiveEndCallback Performs processing in response to the IICA communication complete interrupt INTIICAO IICA_SlaveErrorCallback Performs processing in response to detection of error in IICA slave communication lICA_GetStopConditionCallback Performs processing in response to detection of stop condition in IICA slave communi cation R20UT2138EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Page 127 of 280 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UART6_Init Performs initialization of the serial interface UART6 channel Classification CG_serial c Syntax void UART6_Init void Argumenit s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 128 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UART6_Userlnit Performs user defined initialization of the serial interface UART6 Remark This API function is called as the UART6_Init callback routine Classification CG_serial_user c Syntax void UART6_UserInit void Argumeni s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 129 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UART6_Siart Sets UART communication to standby mode Classification CG_serial c Syntax void UART6_Start void Argumenit s None Return value None
47. the microcontroller clock generator port functions etc The following sections describe the operation procedures for Code Generator 1 Start CubeSuite Launch CubeSuite from the Start menu of Windows Remark See CubeSuite Integrated Development Environment User s Manual Start for details on Start CubeSuite 2 Create Open project Create a new project that defines a kind of project microcontroller to be used build tools to be used etc or load an existing project Remark See CubeSuite Integrated Development Environment User s Manual Start for details on Create Open project 3 Open Code Generator Panel Open the Code Generator panel used to configure the information necessary to control the peripheral functions clock generator port functions etc 4 Enter Information Configure the information necessary to control the peripheral functions in the Code Generator panel 5 Confirm Source Code Confirm the source code device driver program that reflects the information configured in the Code Generator panel 6 Output Source Code Output the source code device driver program to the specified folder 7 Output Report Files Output report files a file containing information configured using Code Generator and a file containing information regarding the source code to the specified folder 8 Save project Save a project Remark See CubeSuite Integrated Development Environment User s Manua
48. type of the function in question e g interval timer square wave output or PWM output Classification CG_timer c Syntax void TMHn_Start void Remark nis the channel number Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 216 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TMHn_Stop Ends the count for 8 bit timer Hn Classification CG_timer c Syntax void TMHn_Stop void Remark nis the channel number Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 217 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TMHn_ChangeTimerCondition Changes the value of 8 bit timer H compare register 0n 1n CMPOn CMP1n Remark To change the contents of CMPOn CMP1n you must call TMHn_Stop before calling this API function Classification CG_timer c Syntax include CG_macrodriver h include CG_timer h MD_STATUS TMHn_ChangeTimerCondition UCHAR array_reg UCHAR array_num Remark nis the channel number Argumeni s Argument UCHAR array_reg Description Pointer to the area storing the value to set in the target register UCHAR array_num Return value The register to change 1 CMPOn 2 CMPOn CMP1n MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT2138EJ0100 Rev 1 00 Sep 01 2012 2
49. 0 APPENDIX C API FUNCTIONS RTC_ConsiPeriodInterruptCallback Performs processing in response to the cyclic interrupt INTRTC Remark This API function is called as the callback routine of interrupt process MD_INTRTC corresponding to the cyclic interrupt INTRTC Classification CG_rtc_user c Syntax void RTC_ConstPeriodInterruptCallback void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 238 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_AlarmEnable Starts the alarm interrupt function Classification CG_rtc c Syntax void RTC_AlarmEnable void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 239 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_AlarmDisable Ends the alarm interrupt function Classification CG_rtc c Syntax void RTC_AlarmDisable void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 240 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_AlarmSet Sets the alarm conditions weekday hour minute Classification CG_rtc c Syntax include OG rteH void RTC_AlarmSet struct RTCAlarmValue alarmval Argument s Argument Description ae struct RTCAlarmValue alarmval Alarm conditions weekday hour minute Remark Below is shown th
50. 0 Rev 1 00 ztENESAS Page 45 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Description of each area 1 Detail information display change area This area allows you to view the information on and change the setting for the node Pin Configurator Design Tool Device Pin List Device Top View Code Generator Design Tool or peripheral function node System Port etc selected in the Project Tree panel the peripheral function button E3 Sj etc pressed in the Code Generator panel or the file selected in the Code Generator Preview panel The content displayed in this area differs depending on the node selected in the Project Tree panel the peripheral function button pressed in the Code Generator panel or the file selected in the Code Generator Preview panel The following table displays the meaning of H and amp displayed to the left of each category Indicates that the items within the category are displayed as a collapsed view Indicates that the items within the category are displayed as an expanded view Remark To switch between and E click this mark or double click the category name 2 Tab selection area Categories for the display of the detailed information are changed when each tab is selected In this panel following tabs are contained see the section explaining each tab for details on the display setting on the tab Pin Configurator Settings tab Device P
51. 3 00 APPENDIX C API FUNCTIONS Comparatorn_Stop Ends the operation of comparator Classification CG_comparatorn c Syntax void Comparatorn_Stop void Remark nis the channel number Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 180 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS C 3 7 A D Converter Below is a list of API functions output by Code Generator for A D converter use Table C 8 API Functions A D Converter API Function Name Function AD_Init Performs initialization necessary to control A D converter functions AD_Userlnit Performs user defined initialization relating to the A D converter AD_ComparatorOn Enables operation of voltage converter AD_ComparatorOff Disables operation of voltage converter AD_Start Starts A D conversion AD_Stop Ends A D conversion AD_SelectADChannel Configures the analog voltage input pin for A D conversion AD_Read Reads the results of A D conversion 10 bits AD_ReadByte Reads the results of A D conversion 8 bits most significant 8 bits of 10 bit resolution R20UT2138EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Page 181 of 280 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS Performs initialization necessary to control A D converter functions Classification CG_ad c Syntax void AD_Init void Argumen
52. 38EJ0100 Rev 1 00 2tENESAS Page 14 of 280 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 2 FUNCTIONS Pin Configurator 2 3 1 Select shape of microcontroller Select the shape of the microcontroller displayed in the Device Top View panel which is opened as described in 2 3 Open Device Top View Panel To select the shape of the microcontroller click Pin Configurator Settings tab gt gt Package type in the Property panel and select the desired shape Figure 2 7 Select Shape of Microcontroller Property A Pin Configurator Property B Product Information ersion V E AR A AR ddi MIINEYYYY Package type Select package image displayed in the device top view panel _ Pin Configurator Settings Remark Selection of the shape of the microcontroller is made using the order name such as GC and GF R20UT2138EJ0100 Rev 1 00 ztENESAS Page 15 of 280 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 2 FUNCTIONS Pin Configurator 2 3 2 Select color Select the colors used to distinguish the type of pins power pins special pins unused pins etc whose information is displayed in the Device Top View panel which is opened as described in 2 3 Open Device Top View Panel To select the color to be displayed select the desired color in the color palette that opens by clicking Device Top View Settings tab gt gt Color in the Property panel Figure 2 8 Select Color Property a Device Top View Property E Color
53. 4 1 0 4 N ch 4 Define Nar aR P60 SCLA0 SCKITZINTP11 Free 43 Functia 1 0 4 ae ANTP11 Free 2 P61 SDAA0 S111 AINTPIO Free P61 SDAA0 S111INTPIO Free Remark To change the display order click the button in the upper left of the device pin list The Column Chooser dialog box opens Drag an item displayed in the dialog s select Items to display area and drop it to the desired destination in the device pin list This will change the display order R20UT2138EJ0100 Rev 1 00 ztENESAS Page 12 of 280 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 2 FUNCTIONS Pin Configurator 2 2 3 Add column The Pin Configurator is used to add the user s own column to the device pin list using the New Column button in the Column Chooser dialog box that opens by pressing the button in the upper left corner of the device pin list To add a column use the New Column dialog box that opens by pressing the New Column button in the Column Chooser dialog box Figure 2 4 Add Column New Column L Text Remark On the device pin list adding columns to the first level of Macro tab External Peripheral tab is restricted 2 2 4 Delete column The Pin Configurator is used to delete the user s own column from the device pin list using the Delete Column button in the Column Chooser dialog box that opens by pressing the button in the upper left corner of the device pin list To delete a column select the column you want t
54. API function repeats the byte level IICA master transmission from the buffer specified in parameter txbuf the number of times specified in parameter txnum Classification CG_serial c Syntax include CG_macrodriver h MD_STATUS IICA_MasterSendStart UCHAR adr UCHAR txbuf USHORT txnum UCHAR wait Argument s Argument UCHAR adr Description Slave address UCHAR txbuf Pointer to a buffer storing the transmission data USHORT txnum Total amount of data to send UCHAR wait Return value Setup time of start conditions Macro Description MD_OK Normal completion MD_ERROR1 Bus communication status MD_ERROR2 Bus not released status R20UT2138EJ0100 Rev 1 00 Sep 01 2012 ztENESAS Page 154 of 280 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS IICA_MasterReceiveStart Starts IICA master reception Remark This API function performs byte level IICA master reception the number of times specified by the parameter rxnum and stores the data in the buffer specified by the parameter rxbur Classification CG_serial c Syntax include CG_macrodriver h MD_STATUS ITICA_MasterReceiveStart UCHAR adr UCHAR rxbuf USHORT rxnum UCHAR wait Argument s Argument Description UCHAR adr Slave address UCHAR rxbuf Pointer to a buffer to store the received data USHORT rxnum Total amount of data to receive UCHAR wa
55. AS Page 268 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS LVI_Stop Stops low voltage detection Classification CG_lIvi c Syntax void LVI_Stop void Argumenit s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 269 of 280 Sep 01 2012 CubeSuite V1 03 00 LVI_SetLViLevel Sets the low voltage detection level APPENDIX C API FUNCTIONS Remarks 1 To change the low voltage detection level you must call LV _ Stop before calling this API function 2 The value specified in parameter level is set to low voltage detection level select register LVIS Classification CG_lIvi c Syntax include CG_macrodriver h include CG_lvi h MD_STATUS LVI_SetLVILevel enum LVILevel level Argument s Argument Description Voltage level to detect as low voltage LVILEVELO 4 22V 0 1V LVILEVEL1 4 07V 0 1V LVILEVEL2 3 92V 0 1V LVILEVEL3 3 76V 0 1V LVILEVEL4 3 61V 0 1V LVILEVEL5 3 45V 0 1V LVILEVEL6 3 30Vs0 1V LVILEVEL7 3 15V 0 1V LVILEVEL8 2 99V 0 1V LVILEVEL9 2 84V 0 1V enum LVILevel level Remark LVILEVEL10 to LVILEVEL15 can only be specified when the target device is a 78KO Kx2 L Return value LVILEVEL10 LVILEVEL11 LVILEVEL12 LVILEVEL13 LVILEVEL14 LVILEVEL15 2 68V 0 1 V 2 53V 0 1V 2 38 V 0 1V 2 22V 0 1V 2 07V 0 1V 1 91 V 0 1 V Macro Description MD_OK Normal completion MD_ERROR Exit wit
56. Box New Column Function buttons HE The following items are explained here How to open Description of each area Function buttons How to open Click the New Column button in the Column Chooser dialog box Description of each area 1 Name This area allows you to enter column headings of the columns added to the device pin list Within 256 characters can be entered in the Name 2 Type Select the input format of the column to add to the device pin list Text Only character strings can be entered in the column Cehck box Adds a column of check boxes Whole number Only integers can be entered in the column Real number Only real numbers can be entered in the column Date Only dates in YYYYMMDD format can be entered in the column Function buttons Adds a column that has the column heading specified in the Name to the right end of the device pin list Ignores the setting and closes this dialog box R20UT2138EJ0100 Rev 1 00 ztENESAS Page 80 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Browse For Folder dialog box This dialog box allows you to specify the output destination for files Source code report file etc Figure A 26 Browse For Folder Dialog Box Browse For Folder Desktop B My Documents 1 4 2 My Computer E a My Network Places O Unused Desktop Shortcuts Function buttons 4 Make New Folder f
57. C n D ms n lt A 5 D CENESAS CubeSuite V1 03 00 Integrated Development Environment User s Manual 78KO Design Target Device 78KO Microcontrollers All information contained in these matenals including products and product specifications represents information on the product at the time of publication and is subject to change by Renesas Electronics Corp without notice Please review the latest information published by Renesas Electronics Corp through various means including the Renesas Electronics Corp website http Awww renesas com Renesas Electronics Wwww renesas com Rev 1 00 Sep 2012 10 11 12 Notice 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 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
58. C1HZ_OutputEnable Enables output of the real time counter correction clock 1 Hz to the RTC1HZ pin Classification CG_rtc c Syntax void RTC_RTC1HZ_OutputEnable void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 251 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_RTC1HZ_OutputDisable Disables output of the real time counter correction clock 1 Hz to the RTC1HZ pin Classification CG_rtc c Syntax void RTC_RTC1HZ_OutputDisable void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 252 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_RTCCL_OutputEnable Enables output of the real time counter clock 32 kHz source to the RTCCL pin Classification CG_rtc c Syntax void RTC_RTCCL_OutputEnable void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 253 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_RTCCL_OutputDisable Disables output of the real time counter clock 32 kHz source to the RTCCL pin Classification CG_rtc c Syntax void RTC_RTCCL_OutputDisable void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 254 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_RTCDIV_OutputEnable
59. Cannot change fCPU fPRS to the external main system clock MD_ERRORS5 Exit with error abend Kx2 L Cannot change fCPU to the XT1 clock MD_ERROR6 Exit with error abend Kx2 L Cannot change fCPU to the external subsystem clock MD_ARGERROR Invalid argument specification R20UT2138EJ0100 Rev 1 00 ztENESAS Page 101 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS Remark The values MD_ERRORS5 and MD_ERROR6 will only be returned when the target device is a 78K0 KC2 L R20UT2138EJ0100 Rev 1 00 2tENESAS Page 102 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CG_ChangeFrequency Changes the division ratio of the CPU clock peripheral hardware clock Classification CG_system c Syntax include CG_macrodriver h include CG_system h MD_STATUS CG_ChangeFrequency enum CPUClock clock Argument s Argument Description enum CPUClock clock Division ratio type SYSTEMCLOCK fMAIN SYSONEHALF fMAIN 2 SYSONEFOURTH fMAIN 4 SYSONEEIGHTH fMAIN 8 SYSONESIXTEENTH fMAIN 16 Remark fMAIN signifies the frequency of the main system clock Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT2138EJ0100 Rev 1 00 2tENESAS Page 103 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CG_SelectPowerSaveMode Configures the CPU s standby function Classification
60. CubeSuite V1 03 00 APPENDIX C API FUNCTIONS Starts the operation of operational amplifier PGA mode Classification CG_opamp c Syntax void PGA_Start void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 169 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS PGA_Stop Ends the operation of operational amplifier PGA mode Classification CG_opamp c Syntax void PGA_Stop void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 170 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS PGA_ChangePGAFactor Sets the input voltage amplification factor of a operational amplifier PGA mode Remark The value specified in parameter factor is set to operational amplifier control register AMPOM Classification CG_opamp c Syntax include CG_macrodriver h include CG_opamp h MD_STATUS PGA_ChangePGAFactor enum PGAFactor factor Argumenit s Argument enum PGAFactor factor Return value Description Input voltage amplification factor PGAFACTORO x4 PGAFACTOR1 x8 PGAFACTOR2 PGAFACTOR3 MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT2138EJ0100 Rev 1 00 Sep 01 2012 ztENESAS Page 171 of 280 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS Starts the operation of operational amplifier
61. D_ERROR Invalid argument array_num specification R20UT2138EJ0100 Rev 1 00 ztENESAS Page 203 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TMO0_GetFreeRunningValue Captures the content of the capture register CROn0 Remark This API function can only be called when the 16 bit timer event counter 00 is running in free running timer mode and the 16 bit timer capture compare control register OnO CROn0 is being used as a capture regis ter Classification CG_timer c Syntax include CG_macrodriver h include CG_timer h MD_STATUS TMO0_GetFreeRunningValue ULONG count enum TMChannel channel Argumenit s Argument Description ULONG count Pointer to area in which to store the captured value enum TMChannel channel The pin to capture TMCHANNELO T1000 pin TMCHANNEL1 T1010 pin Return value Macro Description MD_OK Normal completion MD_ERROR Exit with error abend CROn0 is operating as a compare register MD_ARGERROR Invalid argument specification R20UT2138EJ0100 Rev 1 00 2tENESAS Page 204 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TMO0_SoftwareTriggerOn Generates the trigger software trigger for one shot pulse output Remark This API function can only be called when the 16 bit timer event counter 00 is being used for one shot pulse output Classification CG_timer c Syntax void
62. D_TRUE Switch I O mode R20UT2138EJ0100 Rev 1 00 tENESAS Page 112 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS PORT_ChangePmnOutput Switches the pin s I O mode from input mode to output mode Classification CG_port c Syntax The format for specifying this API function differs according to whether the target pin conducts N ch open drain output N ch open drain output none include CG_macrodriver h void PORT_ChangePmnOutput BOOL initialvalue N ch open drain output yes include CG_macrodriver h void PORT_ChangePmnOutput BOOL enablench BOOL initialvalue j Remark nm is the port number Argumenit s 1 0 Argument Description l BOOL enablench Output mode type MD_TRUE N ch open drain output VoD withstand voltage mode MD_FALSE Normal output mode BOOL initialvalue Initial output value MD_SET Output HIGH level 1 MD_CLEAR Output LOW level 0 Return value None Example 1 Below is shown an example where pin POO N ch open drain output none is changed as follows I O mode type Output mode Initial output value Output HIGH level 1 CG_main c include CG_macrodriver h void main void PORT_ChangePOOOutput MD_SET Switch I O mode R20UT2138EJ0100 Rev 1 00 2tENESAS Page 113 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS Example 2 Below is shown an example wher
63. Fe ee He He HF A Remarks 1 You can change the source code to be displayed by selecting the source file name or API function name in the Code Generator Preview panel 2 The following table displays the meaning of the color of the source code text displayed in the Code Generator Preview panel Table 3 3 Color of Source Code Color Outline Comment Reserved word for C compiler Numeric value Code section File name 3 You cannot edit the source code within the Code Generator Preview panel 4 For some of the API functions such as API functions for serial array units values such as the SFR register value are calculated and finalized when the source code is generated when the Generate Code button on the Code Generator panel is pressed For this reason the source code displayed in the Code Generator Preview panel may not be the same as that would actually be generated R20UT2138EJ0100 Rev 1 00 ztENESAS Page 27 of 280 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 3 FUNCTIONS Code Generator 3 5 Output Source Code Output the source code device driver program by pressing the Generate Code button on the Code Generator panel The destination folder for the source code is specified by clicking Generation tab gt gt Output folder in the Property panel Figure 3 5 Output Source Code Project Tree x Project Tree x Oo3 Be jsample Project FE uPD7SF0588_48 Microcon
64. GI S040 5 111 1NTPIO PXO 1 IMTPD Poa ITPA Poa i MTP Paa TIGH TOY IMTPS Pay TII TOSI INTRA PRO KRG P KRG PAARA Prd KRO PAARI P73 KR Pr2 KRZ P7z KRZ PTIARI P71 KRI POART PT KRO PZ INTA TOLO Paz IMTP3 TOULO O Ud O QO sEBESE SsSoBES gSEPEE BEEES ee Se E lt gt Ef se lt peze zc E E 7 gt fF gu ou R20UT2138EJ0100 Rev 1 00 ztENESAS Page 19 of 280 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 2 FUNCTIONS Pin Configurator 2 5 Output Report Files Output report files files containing information configured using Pin Configurator device pin list and device top view to the specified folder 2 5 1 Output device pin list Select File menu gt gt Save Pin List As to output a report file a file containing information configured using Pin Con figurator device pin list The destination folder for the device pin list is specified in the Save As dialog box which opens by selecting File menu gt gt Save Pin List As Figure 2 12 Output Device Pin List Save in My Documents A Bm Music 4 Emy Pictures My Recent Emy videos Documents sample Ej Desktop ka My Documents 8 My Computer My Network File name L E v iii Save as type Microsoft Office Excel Bool x Cance Remarks 1 If a device pin list has been already output that list will be overwritten by selecting File menu gt gt Save Pin List 2 The ou
65. Generate Code button is pressed Output all API functions Outputs all API functions according to the setting Output only initialization Outputs only initialization API functions API function Generate file Views or selects the operation mode applied when the Generate Code button is pressed Operation mode applied when you select File menu gt gt Save Code Generator Report is fixed to Overwrite file Do nothing if file exists If a file with the same name exists a new file will not be output Merge file If a file with the same name exists a new file is merged with the existing file Only the section between Start user code Do not edit comment generated here and End user code Do not edit comment generated here will be merged Overwrite file If a file with the same name exists the existing file is overwritten by a new file Output folder Views or selects the destination folder for various files Source code and report files which are output when the Generate Code button is pressed or when File menu gt gt Save Code Generator Report is selected Report type Views or selects the format of the report files a file containing information config ured using Code Generator and a file containing information regarding the source code which are output when File menu gt gt Save Code Generator Report is selected HTML file Outputs a report file
66. I function performs byte level IICA slave reception the number of times specified by the parameter rxnum and stores the data in the buffer specified by the parameter rxbur Classification CG_serial c Syntax include CG_macrodriver h void ITICA_SlaveReceiveStart UCHAR rxbuf USHORT rxnum Argument s UCHAR rxbuf Pointer to a buffer to store the received data USHORT rxnum Total amount of data to receive Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 161 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS IICA_SlaveSendEndCallback Performs processing in response to the IICA communication complete interrupt INTIICAO Remark This API function is called as the callback routine of interrupt process MD_INTIICAO corresponding to the IICA communication complete interrupt INTIICAO Classification CG_serial_user c Syntax void ITICA_SlaveSendEndCallback void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 162 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS IICA_SlaveReceiveEndCallback Performs processing in response to the IICA communication complete interrupt INTIICAO Remark This API function is called as the callback routine of interrupt process MD_INTIICAO corresponding to the IICA communication complete interrupt INTIICAO Classification CG_serial_user c Syntax voi
67. IICA_SlaveReceiveStart 161 IICA_SlaveSendEndCallback 162 IICA_SlaveSendStart 160 IICA_Stop 153 IICA_StopCondition 156 IICA_Userlnit 152 UART6_ErrorCallback 139 UART6_Init 128 UART6_ReceiveData 134 UART6_ReceiveEndCallback 137 UART6_SendData 132 UART6_SendEndCallback 136 UART6_SoftOverRunCallback 138 UART6_Start 130 UART6_Stop 131 UART6_Userlnit 129 System 97 CG_ChangeClockMode 101 CG_ChangeFrequency 103 CG_ChangePllMode 107 CG_ReadResetSource 100 CG_SelectPowerSaveMode 104 CG_SelectStabTime 106 CLOCK_Init 98 CLOCK_Userlnit 99 Timer 191 TMOO_ChangeDuty 206 TMOO_ChangeTimerCondition 203 TMOO_GetFreeRunningValue 204 TMOO_GetPulseWidth 207 TMOO_Init 199 TMOO_SoftwareTriggerOn 205 TMOO_Start 201 TMOO_Stop 202 TMOO_Userlnit 200 TM5n_ChangeDuty 213 TM5n_ChangeTimerCondition 212 TM5n_Init 208 TM5n_Start 210 TM5n_Stop 211 TM5n_Userlnit 209 TMH1_CarrierOutputDisable 221 TMH1_CarrierOutputEnable 220 TMHn_ChangeDuty 219 R20UT2138EJ0100 Rev 1 00 Sep 01 2012 ztENESAS Page 275 of 280 CubeSuite V1 03 00 APPENDIX D INDEX TMHn_ChangeTimerCondition 218 TMHn_Init 214 TMHn_Start 216 TMHn_Stop 217 TMHn_Userlnit 215 TMX_DisableHighImpedanceState 198 TMX_EnableHighImpedanceState 197 TMX_Init 192 TMXn_Chan
68. IX C API FUNCTIONS PCL Start Starts clock output Classification CG_pcl c Syntax void PCL_Start void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 261 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS PCL_Stop Ends clock output Classification CG_pcl c Syntax void PCL_Stop void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 262 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS PCL_ChangeFreq Changes the output clock to the PCL pin Remark The value specified in parameter clock is set to clock output select register CKS Classification CG_pcl c Syntax include CG_pclbuz h MD_STATUS PCL_ChangeFreq enum PCLclock clock Argumenit s I O Argument Description l enum PCLclock clock Output clock type FPRS fPRS FPRS2 fPRS 2 FPRS4 fPRS 4 FPRS8 fPRS 8 FPRS16 fPRS 16 FPRS32 fPRS 2048 FPRS64 fPRS 4096 FPRS128 fPRS 8192 SUBCLOCK fSUB Remark fPRS is the main system clock frequency fSUB is the subsystem clock frequency Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT2138EJ0100 Rev 1 00 2tENESAS Page 263 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS C 3 12 LVI Below is a list of API functions output by Code Generator for l
69. NCE Pin Number tab This tab displays information on each pin of the microcontroller in the order of pin number Figure A 12 Pin Number Tab Device Pin List i ee Pin Number Pin Name Function VO N ch a Defina 4 A0 SC Free 4 P 1 SDAAO SI1 Free ZINTP10 P62 5011 INTP9 Free The following items are explained here How to open Description of each area How to open On the Project Tree panel double click Project name Project gt gt Pin Configurator Design Tool gt gt Device Pin List On the Project Tree panel select Project name Project gt gt Pin Configurator Design Tool gt gt Device Pin List and then press the Enter key From the View menu select Pin Configurator gt gt Device Pin List Description of each area 1 Device pin list area This area displays the device pin list for entering information on the pins of the microcontroller The device pin list in this area is organized in the order of pin number The following are the columns comprising the device pin list Column Heading Outline Pin Number Displays the pin number of the pin Pin Name This area allows you to select which function to use when the pin has more than one functions Function This area allows you to select which function to use when the pin has more than one functions 1 0 This area allows you to select the I O mode of the pin N
70. NDIX C API FUNCTIONS RTC_PowerOff Halts the clock supplied to the real time counter Remark Calling this API function changes the real time counter to reset status For this reason writes to the control registers e g real time counter control register 0 RTCCO after this API function is called are ignored Classification CG_rtc c Syntax void RTC_PowerOff void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 227 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_CounterEnable Starts the count of the real time counter year month weekday day hour minute second Classification CG_rtc c Syntax void RTC_CounterEnable void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 228 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_CounterDisable Ends the count of the real time counter year month weekday day hour minute second Classification CG_rtc c Syntax void RTC_CounterDisable void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 229 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_SetHourSystem Sets the clock type 12 hour or 24 hour clock of the real time counter Classification CG_rtc c Syntax include CG_macrodriver h include CGurtc
71. NESAS Page 142 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CSlI1n_ Start Sets CSI1n communication to standby mode Classification CG_serial c Syntax void CSIln_Start void Remark nis the channel number Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 143 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CSI1n_Stop Ends CSI1n communication Classification CG_serial c Syntax void CSTla_ Stop void Remark nis the channel number Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 144 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CSl1n_ReceiveData Starts CSI1n data reception Remarks 1 This API function performs byte level CSI1n reception the number of times specified by the parameter rxnum and stores the data in the buffer specified by the parameter rxbur 2 When performing a CSI n reception CSI1n_Sitart must be called before this API function is called Classification CG_serial c Syntax include CG_macrodriver h MD_STATUS CSI1ln_ReceiveData UCHAR rxbuf USHORT rxnum Remark nis the channel number Argument s UCHAR rxbuf Pointer to a buffer to store the received data USHORT rxnum Total amount of data to receive Return value MD_OK Normal completion MD_ARGERROR Invalid argument spe
72. ONS TMOO_Start Starts the count for 16 bit timer event counter 00 Remark The time from the call to this API function to the start of counting depends on the type of the function in question e g interval timer square wave output or external event counter Classification CG_timer c Syntax void TMOO_Start void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 201 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TMO0_Stop Ends the count for 16 bit timer event counter 00 Classification CG_timer c Syntax void TMOO_Stop void Argumenit s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 202 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TMO0O_ChangeTimerCondition Changes the value of 16 bit timer capture compare control register OnO CROn0 Remark To change the contents of CROn0 you must call TM00_Stop before calling this API function Classification CG_timer c Syntax include CG_macrodriver h include CG_timer h MD_STATUS TMOO_ChangeTimerCondition USHORT array_reg USHORT array_num Argumenit s Argument Description USHORT array_reg Pointer to the area storing the value to set in the target register USHORT array_num The register to change 1 CR000 2 CR000 CRO10 Return value MD_OK Normal completion M
73. PI function performs byte level CSI1n reception the number of times specified by the parameter txnum and stores the data in the buffer specified by the parameter rxbuf 3 When performing a CSI n reception CS 1n_Siart must be called before this API function is called Classification CG_serial c Syntax include CG_macrodriver h MD_STATUS CSI1ln_SendReceiveData UCHAR txbuf USHORT txnum UCHAR rxbuf Remark nis the channel number Argumenit s VO Argument Description UCHAR txbuf Pointer to a buffer storing the transmission data USHORT txnum Total amount of data to send receive UCHAR rxbuf Pointer to a buffer to store the received data Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification Example Below is an example of sending and receiving a CSI10 transmission of four bytes of fixed length data from channel 10 one time CG_main c include CG_macrodriver h BOOL gSflag Transmission complete flag void main void UCHAR txbuf 0123 USHORT txnum 4 UCHAR rxbuf 10 R20UT2138EJ0100 Rev 1 00 ztENESAS Page 147 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS Initialize flag CSI10_Start Start CSI10 communication CSI10_SendReceiveData amp txbuf txnum amp rxbuf Start CSI10 send receive while gSlag Wait for txnum transmissions receptions CG_serial_us
74. Power pins Special pins Custom Web Unused pins T Used pins C white Device E DimGray Highlight color for a selected pin E Gray Highlight color for macro pins ea Highlight color for external peripheral pins E LightGray E ToolTip C Gainsboro Tool tip C WhiteSmoke E PinName Display aon d Define name Pin function Power pins Select text color of power pins Device Top Yiew Settings Remark Select the colors to be displayed for the following eight types of items Table 2 2 Select Color Item Outline Power pins Selects the display color for power pins pins whose use is limited to power Special pins Selects the display color for special pins pins with specified uses Unused pins Selects the display color for unused pins dual use pins with no use set in the Device Pin List panel Used pins Selects the display color for used pins dual use pins with a use set in the Device Pin List panel Device Selects the display color of the microcontroller Highlight color for a selected pin Selects the background color of a pin selected in the Device Pin List panel on the Pin Number tab Highlight color for macro pins Selects the background color of pins selected in the Device Pin List panel on the Macro tab Highlight color for external periph Selects the background color of pins selected in the Device Pin eral pins List panel on the External Peripheral tab
75. R20UT2138EJ0100 Rev 1 00 ztENESAS Page 16 of 280 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 2 FUNCTIONS Pin Configurator 2 3 3 Select popup information Select the type of information that popups when you move the mouse cursor over each pin in the Device Top View panel which is opened as described in 2 3 Open Device Top View Panel To select the popup information click Device Top View Settings tab gt gt Tool tip in the Property panel and select the desired type of information Figure 2 9 Select Popup Information Property e Device Top View Property E Color Power pins E Red Special pins BB Green Unused pins HB Black Used pins HB Blue Device E LightGray Highlight color for a selected pin E Red Highlight color for macro pins E Yelow Highlight color for external peripheral pins B Green E ToolTip Display al E PinName Display Display all Define name Description recommended connection for unused pin only Pin function Attention only Not display Tooltip Select contents displayed in the tool tip Device Top iew Settings Remark Popup information is selected from the following four types Table 2 3 Select Popup Information Popup Information Outline Display all Displays the Description Recommend Connection for Unused and Attention strings for the device pin list Description recommended con Displays the Description and Recommend Connection for nection for unused pin only Unused str
76. SlaveReceiveEndCallback 163 IICA_SlaveReceiveStart 161 IICA_SlaveSendEndCallback 162 IICA_SlaveSendStart 160 IICA_Stop 153 IICA_StopCondition 156 IICA_Userlnit 152 Interrupt 115 INT_MaskablelnterruptEnable 120 INTP_Init 116 INTPn_Disable 122 INTPn_Enable 123 INTP_Userlnit 117 KEY_Disable 124 KEY_Enable 125 KEY_Init 118 KEY _Userlnit 119 INT_MaskablelnterruptEnable 120 INTP_Init 116 INTPn_Disable 122 INTPn_Enable 123 INTP_Userlnit 117 K KEY_Disable 124 KEY_Enable 125 KEY_Init 118 KEY _Userlnit 119 L LVI 264 LVI_Init 265 LVI_InterruptModeStart 267 LVI_ResetModeStart 268 LVI_SetLViLevel 270 LVI_Stop 269 LVI_Userlnit 266 LVI_Init 265 LVI_InterruptModeStart 267 LVI_ResetModeStart 268 LVI_SetLVlLevel 270 LVI_Stop 269 LVI_Userlnit 266 M Macro Setting tab 56 Macro tab 62 Main window 39 N New Column dialog box 80 0 OPAMP _Init 167 R20UT2138EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Page 273 of 280 CubeSuite V1 03 00 APPENDIX D INDEX OPAMP_Userlnit 168 R Operational Amplifier 166 Real time Clock 224 AMPn_Start 174 RTC_AlarmDisable 240 AMPn_Stop 175 RTC_AlarmEnable 239 AMP_Start 172 RTC_AlarmGet 244 AMP_Sitop 173 RTC_AlarmInterruptCallback 245 OPAMP_Init 167 RTC_Ala
77. T2138EJ0100 Rev 1 00 ztENESAS Page 257 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS C 3 11 Clock Output Below is a list of API functions output by Code Generator for clock output use Table C 12 API Functions Clock Output API Function Name Function PCL_Init Performs initialization necessary to control clock output control circuit functions PCL_Userlnit Performs user defined initialization relating to the clock output control circuits PCL_Start Starts clock output PCL_Stop Ends clock output PCL_ChangeFreq Changes the output clock to the PCL pin R20UT2138EJ0100 Rev 1 00 2tENESAS Page 258 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS PCL_Init Performs initialization necessary to control clock output control circuit functions Classification CG_pcl c Syntax void PCL_Init void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 259 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS PCL_Userlnit Performs user defined initialization relating to the clock output control circuits Remark This API function is called as the PCL_Init callback routine Classification CG_pcl_user c Syntax void PCL_UserInit void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 260 of 280 Sep 01 2012 CubeSuite V1 03 00 APPEND
78. TMOO_SoftwareTriggerOn void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 205 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TMO0O_ChangeDuty Changes the duty ratio of the signal output to the TOOO pin Remark This API function can only be called when the 16 bit timer event counter 00 is being used for PPG output Classification CG_timer c Syntax include CG_macrodriver h void TMOO_ChangeDuty UCHAR ratio Argumenit s Remark The value set to duty ratio ratio must be in base 10 notation Return value None Example The example below shows changing the duty ratio to 25 CG_main c include CG_macrodriver h void main void UCHAR ratio 25 Start count TMOO_ChangeDuty ratio Change duty ratio R20UT2138EJ0100 Rev 1 00 2tENESAS Page 206 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TMO00_GetPulseWidth Captures the high low level width measured for the signal pulses input to the TIOnO pin Remark This API function can only be called when the 16 bit timer event counter 00 is being used for pulse width measurement Classification CG_timer c Syntax include CG_macrodriver h include CG_timer h void TMOO_GetPulseWidth ULONG highwidth ULONG lowwidth enum TMChannel channel Argumenit s Argument Description ULONG
79. V1 03 00 APPENDIX A WINDOW REFERENCE b Second layer Column Heading Outline Pin Number Displays the pin number of the pin Pin Name Displays the pin name of the pin Function This area allows you to select which function to use when the pin has more than one functions 1 0 This area allows you to select the I O mode of the pin N ch This area allows you to select which output mode to apply when using the pin in the output mode Define Name This area allows you to assign a user defined pin name to the pin Within 256 characters can be entered in the Define Name Description Displays the summary of function of the pin Recommend Connection for Displays instructions on how to handle the pin when it is not used Unused This column displays information only when the Free is selected in the Func tion column Attention Remarks 1 Displays the precaution on using the pin You cannot add information in the External Peripheral Name Connected Pins Pin Number Pin Name Description Recommend Connection for Unused and Attention columns because they contain fixed information If the Free in the Function column is changed to a specific pin name color of the corresponding pin in the Device Top View panel changes from the color representing the unused pins to the color representing the used pins selected by clicking Device Top View Settings tab g
80. W REFERENCE Device Pin List panel Code Generator Preview panel Output panel dedicated item Opens the Search and Replace dialog box for searching strings with the Quick Search tab selected Replace Output panel dedicated item Opens the Search and Replace dialog box for replacing strings with the Whole Replace tab selected c Help menu Open Help for Project Tree Panel Project Tree panel dedicated item Displays the help of Project Tree panel Open Help for Property Panel Property panel dedicated item Displays the help of Property panel Open Help for Device Pin List Device Pin List panel dedicated item Panel Displays the help of Device Pin List panel Open Help for Device Top View Device Top View panel dedicated item Panel Displays the help of Device Top View panel Open Help for Code Generator Code Generator panel dedicated item Panel Displays the help of Code Generator panel Open Help for Code Generator Code Generator Preview panel dedicated item Preview Panel Displays the help of Code Generator Preview panel Open Help for Output Panel Output panel dedicated item Displays the help of Output panel 2 Panel display area This area consists of multiple panels each dedicated to a different purpose See the following sections for details on this area Project Tree panel Property panel Device Pin List panel Device Top View panel Code Generator panel Code Generator
81. _ChangeDualDuty Changes the duty ratio of the PWM signal dulal output to the TOXOn pin MX_EnableHighImpedanceState Begins high impedance output of the 16 bit timer Xn MX_DisableHighImpedanceState Ends high impedance output of the 16 bit timer Xn MOO_Init Performs initialization necessary to control 16 bit timer event counter 00 functions M00 _Userlnit Performs user defined initialization relating to the 16 bit timer event counter 00 MOO_Start Starts the count for 16 bit timer event counter 00 M00_Stop Ends the count for 16 bit timer event counter 00 TM00_ChangeTimerCondition Changes the value of capture compare control register 00 CRCOO MO00_GetFreeRunningValue Captures the content of the capture register CROn0 MOO_SoftwareTriggerOn Generates the trigger software trigger for one shot pulse output MO00_ChangeDuty Changes the duty ratio of the signal output to the TOOO pin MOO_GetPulseWidth Captures the high low level width measured for the signal pulses input to the Tl0n0 pin M5n_Init Performs initialization necessary to control 8 bit timer event counter 5n functions M5n_Userlnit Performs user defined initialization relating to the 8 bit timer event counter 5n M5n_ Start Starts the count for 8 bit timer event counter 5n M5n_Stop Ends the count for 8 bit timer event counter 5n M5n_ChangeTimerCondition
82. _OK Normal completion MD_ARGERROR Invalid argument specification Remark You can only set 2 for the total rxnum of the receiving data in case the serial interface UART6 operates in DALI mode Example Below is an example of UART reception of four bytes of fixed length data one time CG_main c include CG_macrodriver h BOOL gFlag Reception complete flag void main void UCHAR rxbuf 10 USHORT rxnum 4 Initialize reception complete flag UART6_ReceiveData amp rxbuf rxnum Start UART data reception UART6_Start Start UART communication R20UT2138EJ0100 Rev 1 00 ztENESAS Page 134 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS while gFlag Wait for rxnum receptions CG_serial_user c include CG_macrodriver h extern BOOL gFlag Reception complete flag __ interrupt void MD_INTSR6 void Interrupt processing for INTSR6 gUart6RxLen gt gUart6RxCnt gUart6RxLen gUart6RxCnt UART6_ReceiveEndCallback Call callback routine void UART6_ReceiveEndCallback void Callback routine for INTSR6 gFlag 0 Set reception complete flag R20UT2138EJ0100 Rev 1 00 2tENESAS Page 135 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UART6_SendEndCallback Performs processing in response to the UART transmission complete interrupt INTST6 Remark This API function is called as the callback
83. ag and drop the IM button from this area to the Device top view area to creat and display an external peripheral controller 3 Device top view area This area displays the pin assignment of the microcontroller Settings of the pin assignment are displayed using the colors specified by selecting Device Top View Settings tab gt gt Color in the Property panel Remark Ifthe pin name in the diagram is double clicked the Device Pin List panel opens and the focus moves to the clicked pin in the list File menu Device Top View panel dedicated items Save Top View Saves a report file a file containing information configured using Pin Configurator device top view overwriting the existing file Save Top View As Opens the Save As dialog box for naming and saving a report file a file containing infor mation configured using Pin Configurator device top view Help menu Device Top View panel dedicated items Open Help for Device Top View Displays the help of this panel Panel Context menu When you right click on a pin or external peripheral controller in the Device top view area the following context menu displays R20UT2138EJ0100 Rev 1 00 ztENESAS Page 67 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE 1 When a pin is right clicked Use as If the pin has multiple functions select which function to use Connect to External Peripheral Selects which external peripheral contr
84. angePmnInput BOOL enablepu BOOL enablesmbus Remark mnis the port number Argumenit s 1 0 Argument Description BOOL enablepu Built in pull up resistance used MD_TRUE Yes MD_FALSE No BOOL enablesmbus Input buffer type MD_TRUE SMBus input buffer MD_FALSE Normal input buffer Return value None Example 1 Below is shown an example where pin POO built in pull up resistance yes SMBus input buffer none is changed as follows I O mode type Input mode Built in pull up resistance used Yes R20UT2138EJ0100 Rev 1 00 2tENESAS Page 111 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CG_main c include CG_macrodriver h void main void PORT_ChangePOOInput MD_TRUE Switch I O mode Example 2 Below is shown an example where pin POO built in pull up resistance yes SMBus input buffer none is changed as follows I O mode type Input mode Built in pull up resistance used No CG_main c include CG_macrodriver h void main void PORT_ChangePOOInput MD_FALSE Switch I O mode Example 3 Below is shown an example where pin P04 built in pull up resistance yes SMBus input buffer yes is changed as fol lows I O mode type Input mode Built in pull up resistance used No Input buffer type SMBus input buffer CG_main c include CG_macrodriver h void main void PORT_ChangePO04Input MD_FALSE M
85. asterSendStart IICA_MasterReceiveStart IICA_StopCondition IICA_SlaveSendStart IICA_SlaveReceiveStart CG_serial_user c R20UT2138EJ0100 Rev 1 00 Sep 01 2012 ztENESAS UART6_Userlnit UART6_SendEndCallback UART6_ReceiveEndCallback UART6_SoftOverRunCallback UART6_ErrorCallback CSl1n_Userlnit CSlin_SendEndCallback CSlin_ReceiveEndCallback IICA_Userlnit IICA_MasterSendEndCallback IICA_MasterReceiveEndCallback IICA_MasterErrorCallback IICA_SlaveSendEndCallback IICA_SlaveReceiveEndCallback IICA_SlaveErrorCallback IICA_GetStopConditionCallback MD_INTSR6 MD_INTSRE6 MD_INTST6 MD_INTCSlin MD_INTIICAO Page 85 of 280 CubeSuite V1 03 00 Peripheral Function Source File Name Serial CG_serial h APPENDIX B OUTPUT FILES Names of API Functions Included Operational Amplifier CG_opamp c OPAMP _Init PGA_ Start PGA_Stop PGA_ChangePGAFactor AMP_ Start AMP_Stop AMPn_ Start AMPn_Stop CG_opamp_user c OPAMP _Userlnit CG_opamp h Comparator CG_comparator c Comparator_Init Comparatorn_Start Comparatorn_Stop CG_comparator_user c Comparator_Userlnit MD_INTCMPn CG_comparator h A D Converter CG_ad c AD_Init AD_ComparatorOn AD_ComparatorOff AD_Start AD_Stop AD_SelectADChannel AD_Read AD_ReadByte CG_ad_user c AD_Userlnit MD_INTAD CG_ad h CG_timer c R20UT2138EJ0100 Rev 1 00 Sep 01 2012 ztENESAS TMX_Init TMXn_ Start TMXn_St
86. being edited Property Reset to Default Restores the selected item to its default state Property Reset All to Default Restores all items to their default state R20UT2138EJ0100 Rev 1 00 ztENESAS Page 47 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Pin Configurator Settings tab This tab displays information Product Information and Package on the Pin Configurator Design Tool selected in the Project Tree panel Figure A 4 Pin Configurator Settings Tab Property amp A Pin Configurator Property JL Product Information Version E Package Package type Version Pin configurator version information Pin Configurator Settings The following items are explained here How to open Description of each area How to open On the Project Tree panel select Project name Project gt gt Pin Configurator Design Tool and then select Property from the View menu On the Project Tree panel select Project name Project gt gt Pin Configurator Design Tool and then select Property from the context menu Remark _ If this panel is already open selecting a different Pin Configurator Design Tool in the Project Tree panel changes the content displayed accordingly Description of each area 1 Product Information category This area displays product information Version and Release date on Pin Configurator Version Disp
87. ce file name or API function name in this tree 2 To select whether or not to generate the source code use the context menu Generate code Not generate code which is displayed by right clicking the mouse while the mouse cursor is on the desired icon in the tree R20UT2138EJ0100 Rev 1 00 ztENESAS Page 72 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE 3 You can confirm the current setting that determines whether or not to generate the source code by checking the type of icon Table A 2 Setting That Determines Whether or Not to Generate the Source Code Type of Icon Outline Source code for the currently selected API function is gener ated If this icon is displayed next to the API function the corre sponding source code must be generated it is impossible to change the icon to el J Source code for the currently selected API function is gener ated Source code for the currently selected API function is not generated 2 Source code display area This area allows you to confirm the source code device driver program that reflects the information configured in the Code Generator panel The following table displays the meaning of the color of the source code text displayed in this area Table A 3 Color of Source Code Color Outline Comment Reserved word for C compiler Numeric value Code section File name Remarks 1 You cannot edit the source cod
88. cessary to control low voltage detec tor functions LVI_Userlnit Performs user defined initialization relating to the low voltage detector LVI_InterruptModeStart Starts low voltage detection when in interrupt generation mode LV _ResetModeStart Starts low voltage detection when in internal reset mode LVI_Stop Stops low voltage detection LVI_SetLVILevel ztENESAS Sets the low voltage detection level Page 94 of 280 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS C 3 Function Reference This section describes the API functions output by Code Generator using the following notation format Figure C 1 Notation Format of API Functions 1 0 Argument Description 6 Return value 7 Example 1 Name Indicates the name of the API function 2 Outline Outlines the functions of the API function 3 Classification Indicates the name of the C source file to which the API function is output 4 Syntax Indicates the format to be used when describing an API function to be called in C language R20UT2138EJ0100 Rev 1 00 2tENESAS Page 95 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS 5 Argument s API function arguments are explained in the following format a a 1 0 Argument classification l Input argument O Output argument b Argument Arg
89. cessing for INTSRE6 UCHAR err_type UART6_ErrorCallback err_type Call callback routine void UART6_ErrorCallback UCHAR err_type Callback routine for INTSRE6 if err_type amp 0x1 Determine trigger lback processing in response to overrun error else if err_type amp 0x2 Determine trigger lback processing in response to framing error else if err_type amp 0x4 Determine trigger lback processing in response to parity error R20UT2138EJ0100 Rev 1 00 ztENESAS Page 139 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS R20UT2138EJ0100 Rev 1 00 2tENESAS Page 140 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CSI n_Init Performs initialization of the serial interface CSI1n channel Classification CG_serial c Syntax void CSIln_Init void Remark nis the channel number Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 141 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CSI1 n_Userlnit Performs user defined initialization of the serial interface CSI1n Remark This API function is called as the CSI1n_Init callback routine Classification CG_serial_user c Syntax void CSI1ln_UserInit void Remark nis the channel number Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tE
90. ch This area allows you to select which output mode to apply when using the pin in the output mode R20UT2138EJ0100 Rev 1 00 ztENESAS Page 60 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Column Heading Outline Define Name This area allows you to assign a user defined pin name to the pin Within 256 characters can be entered in the Define Name Description Displays the summary of function of the pin Recommend Connection for Displays instructions on how to handle the pin when it is not used Unused This column displays information only when the Free is selected in the Function column Attention Displays the precaution on using the pin External Parts This area is for selecting which external peripheral controller to connect the pin to Remarks 1 You cannot add information in the Pin Number column Pin Name column Description col umn Recommend Connection for Unused column and Attention column because they contain fixed information 2 Ifthe Free in the Function column is changed to a specific pin name color of the corresponding pin in the Device Top View panel changes from the color representing the unused pins to the color representing the used pins selected by clicking Device Top View Settings tab gt gt Color in the Property panel 3 To move columns change the display order in the device pin list drag and drop the desired column to the desir
91. cification Example Below is an example of receiving a CSI10 transmission of four bytes of fixed length data from channel 10 one time CG_main c include CG_macrodriver h BOOL gFlag Reception complete flag void main void UCHAR rxbuf 10 USHORT rxnum 4 gFlag 1 Initialize reception complete flag CSI10_Start Start CSI10 communication CSI10_ReceiveData amp rxbuf rxnum Start CSI10 reception while gFlag Wait for rxnum receptions R20UT2138EJ0100 Rev 1 00 RENESAS Page 145 of 280 Sep 01 2012 CubeSuite V1 03 00 CG_serial_user c include CG_macrodriver h extern BOOL gFlag __ interrupt void MD_INTCSI10 void if gCsilORxCnt lt gCsilORxLen gCsilORxCnt gCsilORxLen CSI10_ReceiveEndCallback void CSI10_ReceiveEndCallback void gFlag 0 R20UT2138EJ0100 Rev 1 00 Sep 01 2012 APPENDIX C API FUNCTIONS Reception complete flag Interrupt processing for INTICSI10 Call callback routine Callback routine for INTCSI10 Set reception complete flag 2tENESAS Page 146 of 280 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CSI1n_SendReceiveData Starts CSI1n data transmission reception Remarks 1 This API function repeats the byte level CSI1n transmission from the buffer specified in parameter txbuf the number of times specified in parameter txnum 2 This A
92. ction of error in IICA master communication IICA_SlaveSendStart Starts IICA slave transmission IICA_SlaveReceiveStart Starts IICA slave reception IICA_SlaveSendEndCallback Performs processing in response to the IICA communication complete interrupt INTIICAO IICA_SlaveReceiveEndCallback Performs processing in response to the IICA communication complete interrupt INTIICAO IICA_SlaveErrorCallback Performs processing in response to detection of error in IICA slave communication IICA_GetStopConditionCallback Performs processing in response to detection of stop condition in IICA slave communication Operational Amplifier OPAMP_Init Performs initialization necessary to control operational ampli fier functions OPAMP _Userlnit Performs user defined initialization relating to the operational amplifier PGA_Start Starts the operation of operational amplifier PGA mode PGA_Stop Ends the operation of operational amplifier PGA mode PGA_ChangePGAFactor Sets the input voltage amplification factor of a operational amplifier PGA mode AMP_ Start Starts the operation of operational amplifier single AMP mode AMP_Stop Ends the operation of operational amplifier single AMP mode AMPn_Start Starts the operation of operational amplifier n single AMP mode AMPn_Stop Ends the operation of operational amplifier n single AMP mode
93. cuments Renaming function The user can change default names assigned to the files output by Code Generator and the API functions con tained in the source code R20UT2138EJ0100 Rev 1 00 ztENESAS Page 7 of 280 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 2 FUNCTIONS Pin Configurator CHAPTER 2 FUNCTIONS Pin Configurator This chapter describes the key functions provided by the design tool Pin Configurator along with operation proce dures 2 1 Overview The Pin Configurator is used to output report files such as a device pin list and a device top view by entering pin assign ment information of the microcontroller The following sections describe the operation procedures for Pin Configurator 1 Start CubeSuite Launch CubeSuite from the Start menu of Windows Remark See CubeSuite Integrated Development Environment User s Manual Start for details on Start CubeSuite 2 Create Open project Create a new project that defines a kind of project microcontroller to be used build tools to be used etc or load an existing project Remark See CubeSuite Integrated Development Environment User s Manual Start for details on Create Open project 3 Open Device Pin List Panel Open the Device Pin List panel where you enter information on the pins of the microcontroller a Select item Allows you to select items displayed in the device pin list b Change display order Allows you to change the order
94. d Displays instructions on how to handle the pin when it is not used This column displays information only when the Free is selected in the Function column Attention Displays the precaution on using the pin External Parts This area is for selecting which external peripheral controller to connect the pin to Remarks 1 You cannot add information in the Macro Name Total Used Used by other function Pin Number Pin Name Description Recommend Connection for Unused and Attention col umns because they contain fixed information If the Free in the Function column is changed to a specific pin name color of the corresponding pin in the Device Top View panel changes from the color representing the unused pins to the color representing the used pins selected by clicking Device Top View Settings tab gt gt Color in the Property panel To move columns change the display order in the device pin list drag and drop the desired col umn to the desired location To add the user s own column use the New Column dialog box which opens by pressing the New Column button in the Column Chooser dialog box which opens by pressing the E button in the upper left corner of the device pin list R20UT2138EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Page 63 of 280 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE External Peripheral tab This tab displays information about the pi
95. d IICA_SlaveReceiveEndCallback void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 163 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS IICA_SlaveErrorCallback Performs processing in response to detection of error in IICA slave communication Classification CG_serial_user c Syntax include CG_macrodriver h void IICA_SlaveErrorCallback MD_STATUS flag Argument s MD_STATUS flag Cause of communication error MD_ERROR Address mismatch detected MD_NACK Acknowledge not detected Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 164 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS IICA_GetStopConditionCallback Performs processing in response to detection of stop condition in IICA slave communication Classification CG_serial_user c Syntax void IICA_GetStopConditionCallback void Argumenit s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 165 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS C 3 5 Operational Amplifier Below is a list of API functions output by Code Generator for operational amplifiers use Table C 6 API Functions Operational Amplifier API Function Name Function OPAMP Init Performs initialization necessary to control operational amplifier functions OPAMP _Userlnit Performs user defined ini
96. d 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 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 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
97. dicated items Copy Sends the character string or lines selected with range selection to the clipboard Select All Selects all the messages displayed on the Message area Search Opens the Search and Replace dialog box for searching strings with the Quick Search tab selected Replace Opens the Search and Replace dialog box for replacing strings with the Whole Replace tab selected Context menu The following context menu items are displayed by right clicking the mouse Copy Sends the character string or lines selected with range selection to the clipboard Select All Selects all the messages displayed on the Message area Clear Deletes all the messages displayed on the Message area Stop Searching Cancels the search currently being executed This is invalid when a search is not being executed Open Help for Message Displays help for the message on the current caret location This only applies to warning messages and error messages R20UT2138EJ0100 Rev 1 00 ztENESAS Page 76 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Column Chooser dialog box This dialog box allows you to choose whether or not to display the item listed in this dialog box in the device pin list and add columns to or delete columns from the device pin list Figure A 19 Column Chooser Dialog Box Column Chooser Pin Number m mj Pin Number Pin Name 1 0 E N ch ical Def
98. e void Argumenit s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 125 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS C 3 4 Serial Below is a list of API functions output by Code Generator for serial array unit and serial interface use Table C 5 API Functions Serial API Function Name Function UARTE6_Init Performs initialization of the serial interface UART6 channel UART6_Userlnit Performs user defined initialization of the serial interface UART6 UARTE_ Start Sets UART communication to standby mode UART6_Stop Ends UART communication UART6_SendData Starts UART data transmission UART6_ReceiveData Starts UART data reception UART6_SendEndCallback Performs processing in response to the UART transmission complete interrupt INTST6 UART6_ReceiveEndCallback Performs processing in response to the UART reception complete interrupt INTSR6 UART6_SoftOverRunCallback Performs processing in response to the serial transfer end interrupt INTSR6 UART6_ErrorCallback Performs processing in response to the UART communication error interrupt INTSRE6 CSIn_Init Performs initialization of the serial interface CSI1n channel CSI1n_Userlnit Performs user defined initialization of the serial interface CSI1n CSlI1n_Start Sets CSI1n communication to standby mode CSlin_Stop Ends
99. e pin P04 N ch open drain output yes is changed as follows I O mode type Output mode Output mode type N ch open drain output VDD withstand voltage mode Initial output value Output LOW level 0 CG_main c include CG_macrodriver h void main void PORT_ChangePO40utput MD_TRUE MD_CLEAR Switch I O R20UT2138EJ0100 Rev 1 00 ztENESAS Page 114 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS C 3 3 Interrupt Below is a list of API functions output by Code Generator for interrupt and key interrupt use Table C 4 API Functions Interrupt API Function Name Function INTP_Init Performs initialization necessary to control the external interrupt INTPn functions INTP_UserInit Performs user defined initialization relating to the external interrupt INTPn functions KEY_Init Performs initialization necessary to control the key interrupt INTKR functions KEY_Userlnit Performs user defined initialization relating to the key interrupt INTKR functions INT_MaskablelnterruptEnable Disables enables the acceptance of the maskable interrupts INTPn_Disable Disables the acceptance of the maskable interrupts INTPn external interrupt requests INTPn_Enable Enables the acceptance of the maskable interrupts INTPn external interrupt requests KEY_Disable Disables the acceptance of the key interrupts INTKR KEY_Enable Enables the acc
100. e structure RTCAlarmValue alarm conditions struct RTCAlarmValue UCHAR Alarmwm Minute UCHAR Alarmwh Hour UCHAR Alarmww Weekday Alarmwm Minute Below are shown the meanings of each bit of the structure member Alarmwm BCD code minute digit 1 BCD code minute digit 10 Alarmwh Hour Below are shown the meanings of each bit of the structure member Alarmwh If the real time counter is set to the 12 hour clock then bit 5 has the following meaning 0 AM 1 PM R20UT2138EJ0100 Rev 1 00 2tENESAS Page 241 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS BOD code hour digit 1 BCD code hour digit 10 L_________ QQ Fixed Alarmww Weekday Below are shown the meanings of each bit of the structure member Alarmww E 1 Sunday 1 Monday 1 Tuesday 1 Wednesday 1 Thursday 1 Friday 1 Saturday 0 Fixed Return value None Example 1 The example below shows the alarm conditions being set to Monday Tuesday Wednesday at 17 30 CG_main c include OG rte h void main void struct RTCAlarmValue alarmval RTC_AlarmEnable Start alarm interrupt function RTC_CounterEnable Start count RTC_SetHourSystem HOUR24 Set clock type alarmval Alarmww Oxe alarmval Alarmwh 0x17 alarmval Alarmwm 0
101. e within this panel 2 For some of the API functions such as API functions for serial array units values such as the SFR register value are calculated and finalized when the source code is generated when the Generate Code button on the Code Generator panel is pressed For this reason the source code displayed in this panel may not be the same as that would actually be generated 3 You can change the source code to be displayed by selecting the source file name or API function name in the preview tree File menu Code Generator Preview panel dedicated items Save Code Generator Report Outputs report files a file containing information configured using Code Generator and a file containing information regarding the source code Remarks 1 The output format for the report file either HTML or CSV is selected by clicking Generation tab gt gt Report type in the Property panel 2 The destination folder for the report file is specified by clicking Generation tab gt gt Output folder in the Property panel R20UT2138EJ0100 Rev 1 00 2tENESAS Page 73 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Help menu Code Generator Preview panel dedicated items Open Help for Code Generator Displays the help of this panel Preview Panel Context menu The following context menu items are displayed by right clicking the mouse Generate code Makes a setting so that the source c
102. ected is selected in the PinPart Combination Mode category of the Gen eration tab ciil Generate Code Outputs the source code device driver program to the folder specified by selecting Generation tab gt gt Output folder in the Property panel E3 Changes the content displayed in the Information setting area to the System for configuring the information necessary to control the functions of clock generator on chip debug function and etc provided by the microcontroller sia Changes the content displayed in the Information setting area to the Port for con figuring the information necessary to control the port functions provided by the microcontroller i Changes the content displayed in the Information setting area to the Interrupt for configuring the information necessary to control the interrupt functions and the key interrupt function provided by the microcontroller Changes the content displayed in the Information setting area to the Serial for configuring the information necessary to control the functions of serial array unit and functions of serial interface provided by the microcontroller La Changes the content displayed in the Information setting area to the Operational Amplifier for configuring the information necessary to control the functions of com parator programmable gain amplifier provided by the microcontroller gull Changes the content displayed
103. ed location 4 To add the user s own column use the New Column dialog box which opens by pressing the New Column button in the Column Chooser dialog box which opens by pressing the E button in the upper left corner of the device pin list R20UT2138EJ0100 Rev 1 00 ztENESAS Page 61 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Macro tab This tab displays information on each pin of the microcontroller in the order it was grouped into peripheral functions Figure A 13 Macro Tab Device Pin List E3 B BSE i E Macro Name a Toal Used a Usecs 4 D Converter ADC On chip Debug Function OCD Port 2 PORTI 2 3 wire Serial LYOW CSIN1 Power POWER 8 bit Timer Event Counter O TM50 Port 2 PORT2 Port 3 PORT3 aina nmen oo E3 E a i Sl Os A ro oc ccc O O roo ccc coo A Pin Number Macro External Peripheral The following items are explained here How to open Description of each area How to open On the Project Tree panel double click Project name Project gt gt Pin Configurator Design Tool gt gt Device Pin List On the Project Tree panel select Project name Project gt gt Pin Configurator Design Tool gt gt Device Pin List and then press the Enter key From the View menu select Pin Configurator gt gt Device Pin List Description of each area 1 Device pin list area This
104. eiveData Classification CG_serial_user c Syntax Ix2 void UART6_SoftOverRunCallback USHORT rx_data Kx2 L void UART6_SoftOverRunCallback UCHAR rx_data Argumenit s Argument Description USHORT rx_data Received data data received greater than the number specified in the parameter rxnum for UART6_ReceiveData UCHAR rx_data Received data data received greater than the number specified in the parameter rxnum for UART6_ReceiveData Return value None R20UT2138EJ0100 Rev 1 00 ztENESAS Page 138 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UART6_ErrorCallback Performs processing in response to the UART communication error interrupt INTSRE6 Remark This API function is called as the callback routine of interrupt process MD_INTSRE6 corresponding to the UART communication error interrupt INTSRE6 Classification CG_serial_user c Syntax include CG_macrodriver h void UART6_ErrorCallback UCHAR err_type Argument s Argument Description UCHAR err_type Trigger for UART communication error interrupt 00000xx1B Overrun error 00000x1xB Framing error 000001 xxB Parity error Return value None Example Below are examples of callback processing by the trigger for the UART communication error interrupt CG_serial_user c include CG_macrodriver h __interrupt void MD_INTSRE6 void Interrupt pro
105. electing Rename from the context menu dis played by right clicking the API function name in the Code Generator Preview panel Figure 3 10 Change API Function Name Code Generator Preview Zi g File ft f w Common a a a a a a a a a a a a a a a a a a H CG_main c Copyright C 2008 2012 Renesas Electroni g CG_systeminit c RENESAS ELECTRONICS CONFIDENTIAL AND PROP a EES rogram must be used solely for the 2 hdwi Ge ea NI furnished by Renesas Electronics Ci Not Generate Code may be reproduced or disclosed to without the prior written permissio ation Rename Default evice driver was created by CodeGen 6 Bit Single Chip Microcontrollers Interrupt Filename CG main c Serial Abstract This file implements main funct Operational Amplifier APIlib CodeGenerator for 78KO Kx2 L V1 A D Converter Device uPD78F0588_48 Timer Compiler CC78KO Watchdog Timer Creation date 7 11 2012 Real time Clock RATTTTRRTTAATTTTETTATAATTTTERAAATTTTTTRATAETTAE Clock Output af LVI lt Hw Ew Ce d EH E EH Ew EH Ew E Ew gt Remark To restore the default name of the API function defined by Code Generator select Default from the context menu R20UT2138EJ0100 Rev 1 00 ztENESAS Page 31 of 280 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 3 FUNCTIONS Code Generator 3 5 4 Change output mode The Code Generator is used to change the output mode Do nothing if file exists Merge file Overwrite file for the
106. eptance of the key interrupts INTKR R20UT2138EJ0100 Rev 1 00 Sep 01 2012 ztENESAS Page 115 of 280 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS INTP_Init Performs initialization necessary to control the external interrupt INTPn functions Classification CG_int c Syntax void INTP_Init void Argumenit s None Return value None R20UT2138EJ0100 Rev 1 00 ztENESAS Page 116 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS INTP_Userlnit Performs user defined initialization relating to the external interrupt INTPn functions Remark This API function is called as the INTP_Init callback routine Classification CG_int_user c Syntax void INTP_UserInit void Argumenit s None Return value None R20UT2138EJ0100 Rev 1 00 ztENESAS Page 117 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS KEY Init Performs initialization necessary to control the key interrupt INTKR functions Classification CG_int c Syntax void KEY_Init void Argumenit s None Return value None R20UT2138EJ0100 Rev 1 00 ztENESAS Page 118 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS KEY_Userlnit Performs user defined initialization relating to the key interrupt INTKR functions Remark This API function is called as the KEY_Init callback routine Classification CG_int_user c S
107. er c include CG_macrodriver h extern BOOL gSflag Transmission complete flag __interrupt void MD_INTCSI10 void Interrupt processing for INTCSI10 af oCsil0Textnt gt 0 CSI10_SendEndCallback Call callback routine void CS1I10_SendEndCallback void Callback routine for INTCSI10 gSflag 0 Set transmission complete flag R20UT2138EJ0100 Rev 1 00 2tENESAS Page 148 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CSI1n_SendEndCallback Performs processing in response to the CSI1n communication complete interrupt INTCSI1n Remark This API function is called as the callback routine of interrupt process MD_INTCSI1n corresponding to the CSl1n communication complete interrupt INTCSI1n performed when number of transmission data speci fied by CSlin_SendReceiveData parameter txnum has been completed Classification CG_serial_user c Syntax void CSI1ln_SendEndCallback void Remark nis the channel number Argumenit s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 149 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CSI1n_ReceiveEndCallback Performs processing in response to the CSI1n communication complete interrupt INTCSI1n Remark This API function is called as the callback routine of interrupt process MD_INTCSI1n corresponding to the CSl1n communication complete interrupt INTCSI1n performed when
108. er value counterwriteval Remark Below is an example of the structure RTCCounterValue counter value for the real time counter RTCCounterValue Sec second Min Minute Hour Hour Day Day Week Weekday 0 Sunday 6 Saturday Month Month Year Year Return value Macro Description MD_OK Normal completion MD_BUSY1 Executing count process before change to setting MD_BUSY2 Stopping count process after change to setting Remark If MD_BUSY1 or MD_BUSY2 is returned it may be because the counter operation is stopped or the counter operation start wait time is too short so make the value of the RTC_WAITTIME macro defined in the header file CG_rtc h larger Example The example below shows the counter value of the real time counter being set to 2008 12 25 Thu 17 30 00 R20UT2138EJ0100 Rev 1 00 ztENESAS Page 232 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CG_main c include CG _rtec void main main struct RTCCount RTC_CounterEnabl counterwriteval counterwriteval counterwriteval counterwriteval counterwriteval counterwriteval counterwriteval RTC_SetHourSyste RTC_CounterSet Week Bour h erValue counterwriteval e Year 0x08 Month 0x12 Day 0x25 0x05 Ox17 Min 0x30 Sec 0 m HOUR24 Start count Set cl
109. g and etc CLOCK_Userlnit Performs user defined initialization relating to the clock gener ator on chip debug and etc CG_ReadResetSource Performs processing in response to RESET signal CG_ChangeClockMode Changes the CPU clock peripheral hardware clock CG_ChangeFrequency Changes the division ratio of the CPU clock peripheral hard ware clock CG_SelectPowerSaveMode Configures the CPU s standby function CG_SelectStabTime Configures the oscillation stabilization time of the X1 clock CG_ChangePIlMode Controls the operation of PLL function PORT_Init Performs initialization necessary to control port functions PORT _Userlnit Performs user defined initialization relating to the port PORT_ChangePmninput Switches the pin s I O mode from output mode to input mode PORT_ChangePmnOutput Switches the pin s I O mode from input mode to output mode Interrupt R20UT2138EJ0100 Rev 1 00 Sep 01 2012 INTP_Init Performs initialization necessary to control the external inter rupt INTPn functions INTP_UserInit Performs user defined initialization relating to the external interrupt INTPn functions KEY_Init Performs initialization necessary to control the key interrupt INTKR functions KEY_Userlnit Performs user defined initialization relating to the key interrupt INTKR functions INT_MaskablelnterruptEnable Disables enables t
110. geDualDuty 196 TMXn_ChangeDuty 195 TMXn_Start 193 TMXn_Stop 194 TMOO_ChangeDuty 206 TMO00_ChangeTimerCondition 203 TMOO_GetFreeRunningValue 204 TMO0O_GetPulseWidth 207 TMOO_Init 199 TMO0_SoftwareTriggerOn 205 TMOO_Start 201 TMOO_Stop 202 TMOO_Userlnit 200 TM5n_ChangeDuty 213 TM5n_ChangeTimerCondition 212 TM5n_Init 208 TM5n_Start 210 TM5n_Stop 211 TM5n_Userlnit 209 TMH1_CarrierOutputDisable 221 TMH1_CarrierOutputEnable 220 TMHn_ChangeDuty 219 TMHn_ChangeTimerCondition 218 TMHn_Init 214 TMHn_Start 216 TMHn_Stop 217 TMHn_Userlnit 215 TMX_DisableHighImpedanceState 198 TMX_EnableHighImpedanceState 197 TMX_Init 192 TMXn_ChangeDualDuty 196 TMXn_ChangeDuty 195 TMXn_Start 193 TMXn_Stop 194 U UART6_ErrorCallback 139 UART6_Init 128 UARTE6_ReceiveData 134 UART6_ReceiveEndCallback 137 UART6_SendData 132 UART6_SendEndCallback 136 UART6_SoftOverRunCallback 138 UARTE6_Start 130 UART6_Stop 131 UART6_Userlnit 129 WwW Watchdog Timer 222 WDT_Restart 223 WDT_Restart 223 Window reference 38 R20UT2138EJ0100 Rev 1 00 Sep 01 2012 ztENESAS Page 276 of 280 Revision Record Description Rev Sep 01 2012 f ee First Edition issued CubeSuite V1 03 00 User s Manual 78K0 Design Publication Date Rev 1 00 Sep 01 2012 Pub
111. h error abend The target of low voltage detection is external input voltage EXLVI from the external input pin MD_ARGERROR Invalid argument specification R20UT2138EJ0100 Rev 1 00 Sep 01 2012 ztENESAS Page 270 of 280 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS Remark The value MD_ERROR will only be returned when the target device is a 78K0 KB2 L or 78K0 KC2 L R20UT2138EJ0100 Rev 1 00 2tENESAS Page 271 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX D INDEX A AD_ComparatorOff 185 AD_ComparatorOn 184 A D Converter 181 AD_ComparatorOff 185 AD_ComparatorOn 184 AD_Init 182 AD_Read 189 AD_ReadByte 190 AD_SelectADChannel 188 AD_Start 186 AD_Stop 187 AD_Userlnit 183 AD_Init 182 AD_Read 189 AD_ReadByte 190 AD_SelectADChannel 188 AD_Start 186 AD_Stop 187 AD_Userlnit 183 AMPn_ Start 174 AMPn_Stop 175 AMP_Start 172 AMP_Stop 173 API functions 89 A D Converter 181 Clock Output 258 Comparator 176 Interrupt 115 LVI 264 Operational Amplifier 166 Port 108 Real time Clock 224 Serial 126 System 97 Timer 191 Watchdog Timer 222 APPENDIX D INDEX Browse For Folder dialog box 81 Cc CG_ChangeClockMode 101 CG_ChangeFrequency 103 CG_ChangePllMode 107 CG_ReadResetSource 100 CG_SelectPowerSaveMode 104 CG_SelectStabTime 106
112. he acceptance of the maskable interrupts INTPn_Disable 2tENESAS Disables the acceptance of the maskable interrupts INTPn external interrupt requests Page 89 of 280 CubeSuite V1 03 00 Peripheral Function Interrupt API Function Name INTPn_Enable APPENDIX C API FUNCTIONS Function Enables the acceptance of the maskable interrupts INTPn external interrupt requests KEY_Disable Disables the acceptance of the key interrupts INTKR KEY_Enable Enables the acceptance of the key interrupts INTKR Serial R20UT2138EJ0100 Rev 1 00 Sep 01 2012 UART6_Init Performs initialization of the serial interface UART6 channel UART6_Userlnit Performs user defined initialization of the serial interface UART6 UARTE_ Start Sets UART communication to standby mode UART6_Stop Ends UART communication UART6_SendData Starts UART data transmission UART6_ReceiveData Starts UART data reception UART6_SendEndCallback Performs processing in response to the UART transmission complete interrupt INTST6 UART6_ReceiveEndCallback Performs processing in response to the UART reception com plete interrupt INTSR6 UART6_SoftOverRunCallback Performs processing in response to the UART reception com plete interrupt INTSR6 UART6_ErrorCallback Performs processing in response to the UART communication error interrupt INTSRE6 CSln_Init
113. he peripheral function node System Port etc selected in the Project Tree panel or the peripheral function button j etc pressed in the Code Generator panel Macro name Displays the type of peripheral function node selected in the Project Tree panel or the type of peripheral function button pressed in the Code Generator panel R20UT2138EJ0100 Rev 1 00 ztENESAS Page 56 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE File Setting tab This tab allows you to view the information File Information on and change the setting for the file selected in the Code Generator Preview panel Figure A 10 File Setting Tab Property E3 c Code Generator Property JEJ O File Information Default name Yes v File name CG_main c Default name Default operation File Setting The following items are explained here How to open Description of each area How to open On the Code Generator Preview panel select a file and then select Property from the View menu On the Code Generator Preview panel select a file and then select Property from the context menu Remark If this panel is already open selecting a different file in the Code Generator Preview panel changes the con tent displayed accordingly Description of each area 1 File Information category This area allows you to view the information Default name and File name on and change the setting f
114. he source code that reflects the information configured in the Code Generator panel Figure A 17 Code Generator Preview Panel Code Generator Preview A Common De a a a a a a a a a a a System Copyright C 2008 2012 Renesas Electronics Port RENESAS ELECTRONICS CONFIDENTIAL AND PROPRIE Interrupt This program must be used solely for the pur Serial it was furnished by Renesas Electronics Corp Operational Amplifier program may be reproduced or disclosed to ot A D Converter form without the prior written permission o Timer Corporation Watchdog Timer Real time Clock Clock Output amp nal i Ht E7 8 i This device driver was created by CodeGenera 6 Bit Single Chip Microcontrollers H H a E CEUCLE A 1 2 The following items are explained here How to open Description of each area File menu Code Generator Preview panel dedicated items Help menu Code Generator Preview panel dedicated items Context menu How to open From the View menu select Code Generator Preview Description of each area 1 Preview tree This area allows you to confirm or configure on a per API function basis the setting that determines whether or not the source code device driver program is generated when the cti Generate Code button is pressed in the Code Generator panel Remarks 1 You can change the source code to be displayed by selecting the sour
115. herein 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 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 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 anti crime systems and safety equipment etc Renesas Electronics products are neither intende
116. ication Check WDTRF flag fee ie Internal reset request by watchdog timer R20UT2138EJ0100 Rev 1 00 2tENESAS Page 100 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CG_ChangeClockMode Changes the CPU clock peripheral hardware clock Classification CG_system c Syntax include CG_macrodriver h include CG_system h MD_STATUS CG_ChangeClockMode enum ClockMode mode Argument s VO Argument Description enum ClockMode mode CPU clock fCPU peripheral hardware clock fPRS type HIOCLK fCPU fPRS gt gt Internal high speed oscillation clock HIOSYSCLK fCPU gt gt Internal high speed oscillation clock fPRS gt gt High spped system clock SYSX1CLK fCPU fPRS gt gt X1 clock SYSEXTCLK fCPU fPRS gt gt External main system clock SUBXT1CLK fCPU gt gt XT1 clock SUBEXTCLK fCPU gt gt External subsystem clock Remark SUBXT1CLK and SUBEXTCLK can only be specified when the target device is a 78KO0 KC2 L Return value Description MD_OK Normal completion MD_ERROR1 Exit with error abend Cannot change fCPU fPRS to the internal high speed osillation clock MD_ERROR2 Exit with error abend Cannot change fCPU to the internal high speed oscillation clock Cannot change fPRS to the high speed system clock MD_ERROR3 Exit with error abend Cannot change fCPU fPRS to the X1 clock MD_ERROR4 Exit with error abend
117. iew the information Macro Information on and change the setting for the peripheral function node System Port etc selected in the Project Tree panel or the peripheral function button iaj etc pressed in the Code Generator panel Figure A 9 Macro Setting Tab Property B System Property J 1 fE Macro lnformation Macro name Macro name Macro name of selected macro Macro Setting The following items are explained here How to open Description of each area How to open On the Project Tree panel select Project name Project gt gt Code Generator Design Tool gt gt Peripheral func tion node System Port etc and then select Property from the View menu On the Project Tree panel select Project name Project gt gt Code Generator Design Tool gt gt Peripheral func tion node System Port etc and then select Property from the context menu Remarks 1 If this panel is already open selecting a different peripheral function node System Port etc in the Project Tree panel changes the content displayed accordingly 2 _ If this panel is already open pressing a different type of peripheral function button E3 etc in the Code Generator panel changes the content displayed accordingly Description of each area 1 Macro Information category This area allows you to view the information Macro name on and change the setting for t
118. ile a Be Common RRR M CG_main c Copyright C 2008 2012 Renesas Electroni a ls SAS ELECTRONICS CONFIDENTIAL AND PROP a te Code program must be used solely for the as furnished by Renesas Electronics Ci pecyram may be reproduced or disclosed to form without the prior written permissio Corporation G_userdefine h Q CG_Ik dr CG_option asm System Port Interrupt Serial Operational Amplifier A D Converter Timer Watchdog Timer This device driver was created by CodeGen 6 Bit Single Chip Microcontrollers Filename CG main c Abstract This file implements main funct APT1lib CodeGenerator for 78KO0 Kx2 L V1 Device uPD SFO588 46 Compiler CC78K0 ae Me a ok i ak ok ot gt R20UT2138EJ0100 Rev 1 00 ztENESAS Page 29 of 280 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 3 FUNCTIONS Code Generator Remark You can confirm the current setting for the generation of source code by checking the type of icon in the Code Generator Preview panel Table 3 4 Setting That Determines Whether or Not to Generate Source Code Type of Icon Outline Source code for the currently selected API function is gener ated If this icon is displayed next to the API function the correspond ing source code must be generated it is impossible to change the icon to y Source code for the currently selected API function is gener ated Source code for the currently selected API function is not gen erated
119. illation clock setting Operation High speed system clock setting Frequency 4 v MHz Operation XI oscillation x Frequency Stable time Subsystem clock fSUB setting External clock input fEXCLK 15 MH 13107 20 2167x w us Information of valid j input value range 1 10 Operation XT1 oscillation fXT Frequency X71 oscillator oscillation mode selection OPU and peripheral clock setting External clock input fEXCLKS 32768 kHe Low power consumption GPU clock GPL Peripheral hardware clock fPRS _Thternal low speed oscillation clock IL setting Gan be stopped by software Option byte Frequency RESET pin setting kHz MHz 2500 fXH 2 C Stop 30 kHz Unused Used P125 R20UT2138EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Page 25 of 280 CubeSuite V1 03 00 CHAPTER 3 FUNCTIONS Code Generator 3 3 3 Icon indicating pin conflict If a conflict occurs between the pins while setting various peripheral functions in the Code Generator panel the icon is displayed at the location where the conflict occurs to warn the user of a conflict between the pins Remark If the mouse cursor is moved over the icon information regarding the conflict between the pins tips for avoiding the conflict popups Figure 3 3 Icon Indicating Pin Conflict Code Generato
120. in HTML format CSV file Outputs a report file in CSV format Register files Selects whether source code generated by pressing the Generate Code button should be added to the project Output files to project Adds output source code to the project The source code will be added to the Project Tree panel under the File Code Generator node Not output files to project Does not add output source code to the project Remark To change the output destination use the Browse For Folder dialog box which opens by pressing the button in this area 3 Pin Configurator Reflect Mode category Configure the information linking Mode between Code Generator and Pin Configurator R20UT2138EJ0100 Rev 1 00 ztENESAS Page 54 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Selects whether to reflect the settings made in the Code Generator panel in the Device Pin List panel when the Reflect in Pin button is pressed Reflected Reflects Code Generator panel settings in the Device Pin List panel Not reflected Does not reflect Code Generator panel settings in the Device Pin List panel Remark If Not reflected is selected then the H Reflect in Pin button will be grayed out deselected R20UT2138EJ0100 Rev 1 00 ztENESAS Page 55 of 280 Sep 01 2012 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Macro Setting tab This tab allows you to v
121. in List Information tab Device Top View Settings tab Generation tab Macro Setting tab File Setting tab Edit menu Property panel dedicated items Undo Cancels the effect of an edit operation to restore the previous state Cut Sends the character string or lines selected with range selection to the clipboard and deletes them Copy Sends the character string or lines selected with range selection to the clipboard Paste Inserts the contents of the clipboard at the caret position Delete Deletes the character string or the lines selected with the range selection Select All Selects all strings displayed in the item being edited Context menu The following context menu items are displayed by right clicking the mouse 1 While the item is being edited Cancels the effect of an edit operation to restore the previous state Sends the character string or lines selected with range selection to the clipboard and deletes them R20UT2138EJ0100 Rev 1 00 ztENESAS Page 46 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Copy Sends the character string or lines selected with range selection to the clipboard Paste Inserts the contents of the clipboard at the caret position Delete Deletes the character string or the lines selected with the range selection Select All Selects all strings displayed in the item being edited 2 While the item is not
122. ine Name Joan Description M Recommend Connection for Unused cae Attention L wy External Peripheral The following items are explained here How to open Description of each area Function buttons How to open In the Pin Number tab of the Device Pin List panel click the E button In the Macro tab of the Device Pin List panel click the E button In the External Peripheral tab of the Device Pin List panel click the E button Description of each area 1 Operational object selection area This area allows you to select the device pin list to be configured in this dialog box Pin Number Configures the device pin list corresponding to the Pin Number tab Macro Configures the device pin list belonging to the first layer of the Macro tab Macro Pin Configures the device pin list belonging to the second layer of the Macro tab External Peripheral Configures the device pin list belonging to the first layer of the External Peripheral tab External Peripheral Pin Configures the device pin list belonging to the second layer of the External Periph eral tab R20UT2138EJ0100 Rev 1 00 ztENESAS Page 77 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Figure A 20 Operational Object Pin Number Tab Device Pin List Used Useca chip Debug Function OCD Porti PORTI 2 3 wire Serial 0O11 0501 Power POWER Scbit Timer Event Counter O TM50
123. ings for the device pin list Attention only Displays the Attention string for the device pin list Not display Hides tooltips when the mouse cursor hovers over a pin R20UT2138EJ0100 Rev 1 00 ztENESAS Page 17 of 280 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 2 FUNCTIONS Pin Configurator 2 3 4 Select additional information Select the type of information to display in Pin area in the Device Top View panel opened in 2 3 Open Device Top View Panel Note that additional information is selected from the Property panel on the Device Top View Settings tab by selecting the corresponding information under Pin Name Display Figure 2 10 Select Additional Information Property eg Device Top View Property E Color Power pins Red Special pins Green Unused pins Black Used pins Blue Device LightGray Highlight color for a selected pin Highlight color for macro pins Highlight color for external peripheral pins E ToolTip Tool tip Display all E PinName Display Define name Display Pin function Display Not display Define name Select to show or hide the define name Device Top iew Settings Remarks 1 Select one of the following two types for Define name whether to display the Define Name string of the Device Pin List in appended format Display Displays the Define Name string of the device pin list in appended format Not display Hides the Define Name string of the device pin list
124. initialization necessary to control comparator functions Comparator_Userlnit Performs user defined initialization relating to the comparator Comparatorn_Start Starts the operation of comparator n Comparatorn_Stop Ends the operation of comparator n R20UT2138EJ0100 Rev 1 00 2tENESAS Page 176 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS Comparator_Init Performs initialization necessary to control comparator functions Classification CG_comparator c Syntax void Comparator_Init void Argumenit s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 177 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS Comparator_Userlnit Performs user defined initialization relating to the comparator Remark This API function is called as the Comparator_Init callback routine Classification CG_comparator_user c Syntax void Comparator_UserInit void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 178 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS Comparatorn_Start Starts the operation of comparator n Classification CG_comparator c Syntax void Comparatorn_Start void Remark nis the channel number Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 179 of 280 Sep 01 2012 CubeSuite V1 0
125. ional amplifier output pin ADCHANNEL12V Internal voltage 1 2 V Remark See the header file CG_ad h for details about the analog voltage input pin ADCHANNELn Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT2138EJ0100 Rev 1 00 2tENESAS Page 188 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS AD_Read Reads the results of A D conversion 10 bits Remark The contents of the 10 bit A D conversion result register ADCR are stored in the area specified by param eter buffer Classification CG_ad c Syntax include CG_macrodriver h void AD_Read USHORT buffer Argument s Ea USHORT buffer Pointer to area in which to store read results of A D conversion Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 189 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS AD_ReadByte Reads the results of A D conversion 8 bits most significant 8 bits of 10 bit resolution Remark The contents of the 8 bit A D conversion result register H ADCRH are stored in the area specified by parameter buffer Classification CG_ad c Syntax include CG_macrodriver h void AD_ReadByte UCHAR buffer Argument s o UCHAR buffer Pointer to area in which to store the results of A D conversion Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 190 of 280 Sep 01 2012 CubeS
126. ist Panel 10 2 2 1 Select item 11 2 2 2 Change display order 12 2 2 3 Add column 13 2 2 4 Delete column 13 2 3 Open Device Top View Panel 14 2 3 1 Select shape of microcontroller 15 2 3 2 Select color 16 2 3 3 Select popup information 17 2 3 4 Select additional information 18 2 4 Enter Information 19 2 5 Output Report Files 20 2 5 1 Output device pin list 20 2 5 2 Output device top view 21 CHAPTER 3 FUNCTIONS Code Generator 22 3 1 Overview 22 3 2 Open Code Generator Panel 23 3 3 Enter Information 24 3 3 1 Input rule 24 3 3 2 Icon indicating incorrect entry 25 3 3 3 Icon indicating pin conflict 26 3 4 Confirm Source Code 27 3 5 Output Source Code 28 3 5 1 Setting that determines whether or not to generate source code 29 3 5 2 Change file name 30 3 5 3 Change API function name 31 3 5 4 Change output mode 32 3 5 5 Change output destination folder 33 3 6 Output Report Files 34 3 6 1 Change output format 36 3 6 2 Change output destination 37 APPENDIX A WINDOW REFERENCE 38 A 1 Description 38 APPENDIX B OUTPUT FILES B 1 Overview 84 B 2 Output File 84 APPENDIX C API FUNCTIONS C 1 Overview 89 C 2 Output Function 89 C 3 Function Reference 95 C 3 1 System 97 C 3 2 Port 108 C 3 3 Interrupt 115 C 3 4 Serial 126 C 3 5 Operational Amplifier C 3 6
127. it Setup time of start conditions Return value Macro Description MD_OK Normal completion MD_ERROR1 Bus communication status MD_ERROR2 Bus not released status R20UT2138EJ0100 Rev 1 00 ztENESAS Page 155 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS IICA_StopCondition Generates stop conditions Classification CG_serial c Syntax void IICA_StopCondition void Argumenit s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 156 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS IICA_MasterSendEndCallback Performs processing in response to the IICA communication complete interrupt INTIICAO Remark This API function is called as the callback routine of interrupt process MD_INTIICAO corresponding to the IICA communication complete interrupt INTIICAO Classification CG_serial_user c Syntax void IICA_MasterSendEndCallback void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 157 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS IICA_MasterReceiveEndCallback Performs processing in response to the IICA communication complete interrupt INTIICAO Remark This API function is called as the callback routine of interrupt process MD_INTIICAO corresponding to the IICA communication complete interrupt INTIICAO Classification CG_serial_
128. ite V1 03 00 APPENDIX A WINDOW REFERENCE Define name Selects whether to display the Define Name string of the device pin list appended to the pin in the device top view Display Displays the Define Name string of the device pin list in appended format Not display Hides the Define Name string of the device pin list Pin function Selects whether to also display unselected functions in the device top view when a function has been selected from the device pin list s Function feature Display all Displays functions selected via the device pin list s Function feature in parentheses Selected function only Only display functions selected via the device pin list s Function feature in the device top view R20UT2138EJ0100 Rev 1 00 ztENESAS Page 52 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Generation tab This tab allows you to view the information Product Information Generate File Mode and Pin Configurator Reflect Mode on and change the setting for the Code Generator Design Tool selected in the Project Tree panel Figure A 8 Generation Tab Property oH Code Generator Property LW O Product Information Version E Generate File Mode Output control of API function Output all API functions according to the setting Generate file Merge file Output folder C Documents and Settings My Documen Report type HTML file Reaister files Output files to pro
129. ject E Pin Configurator Reflect Mode Mode Reflected Version The version information of the product is displayed Generation The following items are explained here How to open Description of each area How to open On the Project Tree panel select Project name Project gt gt Code Generator Design Tool and then select Property from the View menu On the Project Tree panel select Project name Project gt gt Code Generator Design Tool and then select Property from the context menu Remark _ If this panel is already open selecting a different Code Generator Design Tool in the Project Tree panel changes the content displayed accordingly Description of each area 1 Product Information category This area displays product information Version and Release date on Code Generator Version Displays the version of Code Generator Code Library Release date Displays the release date of Code Generator Code Library R20UT2138EJ0100 Rev 1 00 2tENESAS Page 53 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE 2 Generate File Mode category This area allows you to view and change the setting for the file generation mode Output control of API function Generate file etc of Code Generator Output control of API function Views or Selects the type of output API functions all API functions or only initialization API functions when the
130. k f1L setting Can be stopped by software Option byte Frequency RESET pin setting Unused Used P125 The following items are explained here How to open Description of each area File menu Code Generator panel dedicated items Help menu Code Generator panel dedicated items How to open On the Project Tree panel double click Project name Project gt gt Code Generator Design Tool gt gt Peripheral function node System Port etc On the Project Tree panel select Project name Project gt gt Code Generator Design Tool gt gt Peripheral func tion node System Port etc and then press the Enter key Remark If this panel is already open pressing a different peripheral function button i etc changes the content displayed in the Information setting area accordingly R20UT2138EJ0100 Rev 1 00 ztENESAS Page 69 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Description of each area 1 Toolbar This area consists of the following peripheral function buttons When there is peripheral function target microcontroller is not supporting peripheral functionbutton is not disokayed EA Reflect in Pin Reflects settings made on this panel in the Device Pin List panel and then output the changed contents to the Output panel This button will be grayed out disabled if Not refl
131. l Start for details on Save project R20UT2138EJ0100 Rev 1 00 ztENESAS Page 22 of 280 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 3 FUNCTIONS Code Generator 3 2 Open Code Generator Panel Open the Code Generator panel to configure the information necessary to control the peripheral functions clock gener ator port functions etc To open the Code Generator panel double click Project name Project gt gt Code Generator Design Tool gt gt Periph eral function node System Port etc in the Project Tree panel Figure 3 1 Open Code Generator Panel Code Generator H Reflect in Pin Generate Code s a my e em 2 Power voltage VDD setting 27 V lt VDD lt 55 V O18 V s VDD lt 27 WY Main system clock selection Internal high speed oscillation f1H High speed system clock fXH Internal high speed oscillation clock setting Operation Frequency MHz High speed system clock setting Operation X1 oscillation x External clock input FEXCLK Frequency 5 MHz Stable time 1310720 26 4 v us Subsystem clock SUB setting Operation X71 oscillation XT External clock input fEXCLKS Frequency 32 768 kHz XT1 oscillator oscillation mode selection Low power consumption OPU and peripheral clock setting GPU clock fCPU 2500 fXH 2 kHz Peripheral hardware clock PRS 5 fXH
132. lays the version of Pin Configurator Pin Configurator Plug in Release date Displays the release date of Pin Configurator Pin Configurator Plug in 2 Package category Change the shape Package type and settings of the microcontroller to display as the device top view in the Device Top View panel Package type Selects the shape of the microcontroller displayed in the device top view R20UT2138EJ0100 Rev 1 00 ztENESAS Page 48 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Device Pin List Information tab This tab displays information Product Information on the Device Pin List selected in the Project Tree panel Figure A 5 Device Pin List Information Tab Property E EA Device Pin List Property JEJ E Product Information 0 Version Pin configurator version information Device Pin List Information A The following items are explained here How to open Description of each area How to open On the Project Tree panel select Project name Project gt gt Pin Configurator Design Tool gt gt Device Pin List and then select Property from the View menu On the Project Tree panel select Project name Project gt gt Pin Configurator Design Tool gt gt Device Pin List and then select Property from the context menu Remark If this panel is already open selecting a different Device Pin List in the Project Tree panel
133. le Disables output of the real time counter correction clock 1 Hz to the RTC1HZ pin RTC_RTCCL_OutputEnable Enables output of the real time counter clock 32 kHz source to the RTCCL pin RTC_RTCCL_OutputDisable Disables output of the real time counter clock 32 kHz source to the RTCCL pin RTC_RTCDIV_OutputEnable Enables output of the real time counter clock 32 kHz cycle to the RTCDIV pin RTC_RTCDIV_OutputDisable Disables output of the real time counter clock 32 kHz cycle to the RTCDIV pin RTC_ChangeCorrectionValue R20UT2138EJ0100 Rev 1 00 Sep 01 2012 Changes the timing and correction value for correcting clock errors ztENESAS Page 224 of 280 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_Init Performs initialization necessary to control real time counter functions Classification CG_rtc c Syntax void RTC_Init void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 225 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_UserlInit Performs user defined initialization relating to the real time counter Remark This API function is called as the RTC_Init callback routine Classification CG_rtc_user c Syntax void RTC_UserInit void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 226 of 280 Sep 01 2012 CubeSuite V1 03 00 APPE
134. les report files etc are output 2 List of files This area displays a list of files matching the conditions selected in Save in and Save as type Page 82 of 280 R20UT2138EJ0100 Rev 1 00 2tENESAS Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE 3 File name Specify the name of the file to be output 4 Save as type Select the type of the file to be output Microsoft Office Excel Book xls Microsoft Office Excel Book format Bitmap bmp Bitmap format PNG png PNG format JPEG jpg JPEG format EMF emf EMF format Function buttons Save Outputs a file having the name specified in the File name and Save as type to the folder specified in the Save in Cancel Ignores the setting and closes this dialog box R20UT2138EJ0100 Rev 1 00 ztENESAS Page 83 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX B OUTPUT FILES APPENDIX B OUTPUT FILES This appendix describes the files output by Code Generator B 1 Overview Below is a list of files output by Code Generator Table B 1 File List Unit of Output File Name Description Peripheral function CG_PeripheralFunctionName c Initial function API function CG_PeripheralFunctionName_user c Interrupt function MD_INTxxx callback function CG_PeripheralFunctionName h Defines macros for assigning values to registers Project CG_main c main function R_ MAIN_Userlnit function
135. light color for external peripheral pins Selects the background color of pins selected in the Device Pin List panel on the External Peripheral tab Remark To change the setting of the color use the following color palette which opens by making a selection from the dropdown list in this area 2 Tool Tip category Figure A 7 Color Palette Custom Web System El E mt LLIT BEES BEES e EEE EE IRE e B Bee Select whether to display a tooltip with information about a pin when the mouse cursor is moved over the pin in the device top view Tool tip 3 Pin Name Display category Selects whether to display a tooltip with information about a pin when the mouse cursor is moved over the pin in the device top view panel Display all Displays the Description Recommend Connection for Unused and Attention strings for the device pin list Description recommended connection for unused pin only Displays the Description and Recommend Connection for Unused strings for the device pin list Attention only Displays the Attention string for the device pin list Not display Hides tooltips when the mouse cursor hovers over a pin Select whether to display additional information about the pin in the device top view R20UT2138EJ0100 Rev 1 00 Sep 01 2012 ztENESAS Page 51 of 280 CubeSu
136. lished by Renesas Electronics Corporation tENESAS 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 Dusseldorf 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 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 Electr
137. lopment environment for developing applications and systems for 78KO microcontrollers and provides an outline of its features CubeSuite is an integrated development environment IDE for 78KO microcontrollers integrating the necessary tools for the development phase of software e g design implementation and debugging into a single platform By providing an integrated environment it is possible to perform all development using just this product without the need to use many different tools separately Readers Purpose Organization How to Read This Manual Conventions This manual is intended for users who wish to understand the functions of the CubeSuite and design software and hardware application systems This manual is intended to give users an understanding of the functions of the CubeSuite to use for reference in developing the hardware or software of systems using these devices This manual can be broadly divided into the following units CHAPTER 1 GENERAL CHAPTER 2 FUNCTIONS Pin Configurator CHAPTER 3 FUNCTIONS Code Generator APPENDIX A WINDOW REFERENCE APPENDIX B OUTPUT FILES APPENDIX C API FUNCTIONS APPENDIX D INDEX It is assumed that the readers of this manual have general knowledge of electricity logic circuits and microcontrollers Data significance Higher digits on the left and lower digits on the right Active low representation XXX overscore over pin or signal name Note Footnote for i
138. mark nis the channel number Argument s Remark The value set to duty ratio ratio must be in base 10 notation Return value None Example The example below shows changing the duty ratio to 25 CG_main c include CG_macrodriver h void main void UCHAR ratio 25 Start count TMXO_ChangeDuty ratio Change duty ratio R20UT2138EJ0100 Rev 1 00 2tENESAS Page 195 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TMXn_ChangeDualDuty Changes the duty ratio of the PWM signal dual output to the TOXn pin Remark This API function can only be called when the 16 bit timer Xn is being used for dual output Classification CG_timer c Syntax include CG_macrodriver h void TMXn_ChangeDualDuty UCHAR ratio UCHAR ratiol UCHAR delay Remark nis the channel number Argument s I O Argument Description l ratio Duty ratio of TOXn0 0 to 100 unit ratiol Duty ratio of TOXn1 0 to 100 unit delay Delay time of TOXn0 0 to 100 unit Remarks 1 The value set to duty ratio ratio ratio and delay must be in base 10 notation 2 The following figure displays the meaning of each argument Cycle tH delay ratio t TOXn0 ratio1 _ _ TOXn1 l Return value None R20UT2138EJ0100 Rev 1 00 ztENESAS Page 196 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C
139. mation necessary to control the function of A D converter provided by the microcontroller Timer Opens the Timer for configuring the information necessary to control the func tions of timer array unit provided by the microcontroller Watchdog Timer Opens the Watchdog Timer for configuring the information necessary to con trol the functions of watchdog timer provided by the microcontroller Real time Clock Opens the Real time Clock for configuring the information necessary to con trol the functions of real time counter provided by the microcontroller Clock Output Opens the Clock Output for configuring the information necessary to control the functions of clock output controller provided by the microcontroller LVI c Icons The table below displays the meaning of the icon displayed to the left of the string representing the peripheral function node Opens the LVI for configuring the information necessary to control the func tions of low voltage detector provided by the microcontroller Operation in the corresponding Code Generator panel has been carried out Operation in the corresponding Code Generator panel has not been carried out R20UT2138EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Page 43 of 280 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE l t lar The problem occurs on the settings became the manipulation to the other peripheral function node influences Hel
140. n this dialog box in the device pin list and add columns to or delete columns from the device pin list New Column dialog box This dialog box allows you to add your own column to the device pin list Browse For Folder dialog box This dialog box allows you to specify the output destination for files source code report file etc Save As dialog box R20UT2138EJ0100 Rev 1 00 Sep 01 2012 This dialog box allows you to name and save a file such as a report file ztENESAS Page 38 of 280 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE This is the first window to open when CubeSuite is launched This window is used to operate various components design tool build tool etc provided by CubeSuite Figure A 1 Main Window 3 sample CubeSuite Project Tree File Edit View Project Build Debug Tool Window Help A x ey Property R sample Property peraan a ik E File uPD 8F0588_48 Microcontroller File name ji i bsolute Path A Pin Configurator Design Tool E ezi Code Generator Design Tool Notes A CA78K0 Build Tool S 78K0 Simulator Debug Tool File name CD Program Analyzer Analyze Tool This is the name of the file to which the P i information of this main project is to be a G File saved EOF All Output Messages j Fa e n Fe J Disconnected The following items are explained here How to open Description of each area
141. nds the interval interrupt function RTC_RTC1HZ_OutputEnable R20UT2138EJ0100 Rev 1 00 Sep 01 2012 ztENESAS Enables output of the real time counter correction clock 1 Hz to the RTC1HZ pin Page 93 of 280 CubeSuite V1 03 00 Peripheral Function Real time Clock API Function Name RTC_RTC1HZ_OutputDisable APPENDIX C API FUNCTIONS Function Disables output of the real time counter correction clock 1 Hz to the RTC1HZ pin RTC_RTCCL_OutputEnable Enables output of the real time counter clock 32 kHz source to the RTCCL pin RTC_RTCCL_OutputDisable Disables output of the real time counter clock 32 kHz source to the RTCCL pin RTC_RTCDIV_OutputEnable Enables output of the real time counter clock 32 kHz cycle to the RTCDIV pin RTC_RTCDIV_OutputDisable Disables output of the real time counter clock 32 kHz cycle to the RTCDIV pin RTC_ChangeCorrectionValue Changes the timing and correction value for correcting clock errors Clock Output PCL_Init Performs initialization necessary to control clock output control circuit functions PCL_Userlnit Performs user defined initialization relating to the clock output control circuits PCL_Start Starts clock output PCL_Stop Ends clock output PCL_ChangeFreq Changes the output clock to the PCL pin R20UT2138EJ0100 Rev 1 00 Sep 01 2012 LVI_Init Performs initialization ne
142. nfigurator Design Tool Device Pin List Device Top View Code Generator Design Tool peripheral function node System Port etc and then select Property from the View menu On the Project Tree panel select a node Pin Configurator Design Tool Device Pin List Device Top View Code Generator Design Tool peripheral function node System Port etc and then select Property from the context menu On the Code Generator Preview panel select a file and then select Property from the View menu On the Code Generator Preview panel select a file and then select Property from the context menu Remarks 1 If this panel is already open selecting a different node Pin Configurator Design Tool Device Pin List Device Top View Code Generator Design Tool or peripheral function node System Port etc in the Project Tree panel changes the content displayed in the Detail information display change area and explanation area accordingly 2 If this panel is already open pressing a different peripheral function button etc in the Code Generator panel changes the content displayed in the Detail information display change area and explanation area accordingly 3 If this panel is already open selecting a different file in the Code Generator Preview panel changes the content displayed in the Detail information display change area and explanation area accordingly R20UT2138EJ010
143. 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 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 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 application
144. ns connected to external peripherals in order grouped at the external periph eral component level Figure A 14 External Peripheral Tab Device Pin List 2 8 ES ee E External Peripheral a User Define 1 User Define 2 User Define 3 _ Pin Number The following items are explained here How to open Description of each area How to open On the Project Tree panel double click Project name Project gt gt Pin Configurator Design Tool gt gt Device Pin List On the Project Tree panel select Project name Project gt gt Pin Configurator Design Tool gt gt Device Pin List and then press the Enter key From the View menu select Pin Configurator gt gt Device Pin List Description of each area 1 Device pin list area This area displays the device pin list for entering information on the pins connected to external peripheral parts Note that items in this area s device pin list are sorted by groups at the external peripheral controller level a First layer The following are the columns comprising the device pin list Column Heading Outline External Peripheral Displays the name of the external peripheral controller To change the name select this field and then press the F2 key Displays the total number of pins allocated for connection with the microcontrol ler R20UT2138EJ0100 Rev 1 00 ztENESAS Page 64 of 280 Sep 01 2012 CubeSuite
145. num 4 Initialize transmission complete flag UART6_Start Start UART communication UART6_SendData amp txbuf txnum Start UART data transmission R20UT2138EJ0100 Rev 1 00 ztENESAS Page 132 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS while gFlag Wait for txnum transmissions CG_serial_user c include CG_macrodriver h extern BOOL gFlag Transmission complete flag __ interrupt void MD_INTST6 void Interrupt processing for INTST6 if qUart6TxCnt gt 0 UART6_SendEndCallback Call callback routine void UART6_SendEndCallback void Callback routine for INTST6 gFlag 0 Set transmission complete flag R20UT2138EJ0100 Rev 1 00 2tENESAS Page 133 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UART6_ReceiveData Starts UART data reception Remarks 1 This API function performs byte level UART reception the number of times specified by the parameter rxnum and stores the data in the buffer specified by the parameter rxbur 2 Actual UART reception starts after this API function is called and UART6_Start is then called Classification CG_serial c Syntax include CG_macrodriver h MD_STATUS UART6_ReceiveData UCHAR rxbuf USHORT rxnum Argument s UCHAR rxbuf Pointer to a buffer to store the received data USHORT rxnum Total amount of data to receive Return value MD
146. number of received data specified by CSlin_ReceiveData parameter rxnum has been completed Classification CG_serial_user c Syntax void CSI1ln_ReceiveEndCallback void Remark nis the channel number Argumenit s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 150 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS IICA_Init Performs initialization of the serial interface IICA Classification CG_serial c Syntax void IICA Init void Argumenit s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 151 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS IICA_Userlnit Performs user defined initialization of the serial interface IICA Remark This API function is called as the ICA_Init callback routine Classification CG_serial_user c Syntax void IICA_UserInit void Argumenit s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 152 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS IICA_Stop Ends IICA communication Classification CG_serial c Syntax void IICA_Stop void Argumenit s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 153 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS IICA_MasterSendStart Starts IICA master transmission Remark This
147. o delete in the displayed item selection area of the Column Chooser dialog box and press the Delete Column button Figure 2 5 Delete Column Column Chooser M _ Pin Name Function M Pin Number Define Name Remark You can only delete the column which you added using the New Column dialog box R20UT2138EJ0100 Rev 1 00 2tENESAS Page 13 of 280 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 2 FUNCTIONS Pin Configurator 2 3 Open Device Top View Panel Open the Device Top View panel where you can confirm the information entered for the pins of the microcontroller To open the Device Top View panel double click Project name Project gt gt Pin Configurator Design Tool gt gt Device Top View in the Project Tree panel Figure 2 6 Open Device Top View Panel Device Top View PIZQXTZ EX KS O RESETPIZ6 PIZO INTPOsEXLYI SII Pizza ECK MOL PAO RTCCL RTCOIV _ScKII O PIARTGIKE SI II Pizifx TOOLGa PEVSLAYV _SKII IMTFII POI SOO S III TMTPID O PG2 SOl If IMTPS O ANID PRY APO 78KO KC2 L aN P21 AMPOOUT PGAIN uPD 8F0581_46 Qamiz F2z auPo SELICE O ANIG P26 PRINTTOOL PUI IMTP2 TOLG P3q IHTPI O P16 TOHI IMTPG PIZ 1G AM IAM i O PISI 0 fan I3 AP IOUT PIG 30K 10 44 1a ALP l Remark In the Property panel on the Pin Configurator Settings tab if BGA is selected for the Package type then Device Top View panel cannot be opened R20UT21
148. o output mode R20UT2138EJ0100 Rev 1 00 2tENESAS Page 108 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS PORT_Init Performs initialization necessary to control port functions Classification CG_port c Syntax void PORT_Init void Argumenit s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 109 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS PORT_Userlnit Performs user defined initialization relating to the port Remark This API function is called as the PORT_Init callback routine Classification CG_port_user c Syntax void PORT_UserInit void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 ztENESAS Page 110 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS PORT_ChangePmninput Switches the pin s I O mode from output mode to input mode Classification CG_port c Syntax The format for specifying this API function differs according to whether the target pin has built in pull up resistance a SMBus input buffer Built in pull up resistance none SMBus input buffer none void PORT_ChangePmniInput void Built in pull up resistance yes SUBus input buffer none include CG_macrodriver h void PORT_ChangePmnInput BOOL enablepu Built in pull up resistance yes SMBus input buffer yes include CG_macrodriver h void PORT_Ch
149. ock type counterwriteval Set counter value R20UT2138EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Page 233 of 280 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_CounterGet Reads the counter value year month weekday day hour minute second of the real time counter Classification CG_rtc c Syntax include CG_macrodriver h include CGurte H MD_STATUS RTC_CounterGet struct RTCCounterValue counterreadval Argument s Argument Description struct RTCCounterValue Pointer to structure in which to store the counter value being read counterreadval Remark See RTC_CounterSet for details about the RTCCounterValue counter value Return value Macro Description MD_OK Normal completion MD_BUSY1 Executing count process before reading MD_BUSY2 Stopping count process after reading Remark If MD_BUSY1 or MD_BUSY2 is returned it may be because the counter operation is stopped or the counter operation start wait time is too short so make the value of the RTC_WAITTIME macro defined in the header file CG_rtc h larger Example Below is an example of reading the counter value of the real time counter CG_main c include CG_rte h void main void struct RTCCounterValue counterreadval RTC_CounterEnable Start count RTC_CounterGet amp counterreadval Read count value R20UT2138EJ0100 Rev 1 00 ztENESAS Page 234 of
150. ode of the currently selected API function is gener ated to the folder specified by selecting Generation tab gt gt Output folder in the Prop erty panel Selecting this context menu item changes the icon of the currently selected API function from to Ea This item will be grayed out disabled if the currently selected API function is not initialization API function and Output only initialization API function is selected Gener ation tab gt gt Output control of API function in the Property panel Not generate code Makes a setting so that the source code of the currently selected API function is not gen erated when the l button is pressed in the Code Generator panel Selecting this context menu item changes the icon of the currently selected API function from to l Rename Selecting this menu item changes the name portion of the currently selected file or API function into an edit box for editing the name You can change the name of the file or API function by editing its name in the edit box Default Reverts the file name or API function name to its original name before it was edited Property Opens the Property panel that contains the information for the currently selected file R20UT2138EJ0100 Rev 1 00 ztENESAS Page 74 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Output panel This panel is used to display operating logs for various components design tool build tool
151. oller Device Top View Opens the Device Top View panel that displays the information entered in the Device Pin List panel b Code Generator Design Tool This node consists of the following peripheral function nodes When there is peripheral function target microcontroller is not supporting peripheral functionbutton is not disokayed Opens the System for configuring the information necessary to control the functions of clock generator on chip debug function and etc provided by the microcontroller Port Opens the Port for configuring the information necessary to control the port functions provided by the microcontroller Interrupt Opens the Interrupt for configuring the information necessary to control the interrupt functions and the key interrupt function provided by the microcontrol ler Serial Opens the Serial for configuring the information necessary to control the func tions of serial array unit and functions of serial interface provided by the micro controller Operational Amplifier Opens the Operational Amplifier for configuring the information necessary to control the functions of comparator programmable gain amplifier provided by the microcontroller Comparator Opens the Comparator for configuring the information necessary to control the functions of comparator provided by the microcontroller A D Converter Opens the A D Converter for configuring the infor
152. oller to connect the pin to 2 When an external peripheral controller is right clocked Disconnect Pin Disconnects from the pin Delete External Peripheral Removes the external peripheral controller R20UT2138EJ0100 Rev 1 00 ztENESAS Page 68 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Code Generator panel This panel allows you to configure the information necessary to control the peripheral functions provided by the micro controller Figure A 16 Code Generator Panel System Code Generator GF Reflect in Pin j Generate Code sie gt PM Si oe a 3 On chip debug setting Confirming reset source ge VDD setting 27 Vs VDD lt 55 V O 18 V lt VDD lt 27 V Main system clock selection Internal high speed oscillation f1H High speed system clock fXH Internal high speed oscillation clock setting Operation Frequency 4 MHz High speed system clock setting Uperatior X1 oscillation fX External clock input fEXCLK Frequency 5 O MHz Stable time 13107 20 2416 4 us Subsystem clock fSUB setting Operation XT1 oscillation XT External clock input fEXCLKS Frequency 32 768 kHe XTI oscillator oscillation mode selection Low power consumption OPU and peripheral clock setting GPU clock CPU 2500 fXH 2 Peripheral hardware clock fPRS 5 fXH Internal low speed oscillation cloc
153. onics 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 1 3 CubeSuite V1 03 00 7rCENESAS Renesas Electronics Corporation R20UT2138EJ0100
154. ool build tool etc provided by CubeSuite Project Tree panel This panel displays the components of the project microcontroller design tool build tool etc in a tree structure Property panel This panel allows you to view the information and change the setting for the node selected in the Project Tree panel the peripheral function button pressed in the Code Generator panel or the file selected in the Code Generator Preview panel Device Pin List panel This panel allows you to enter information on each pin of the microcontroller Device Top View panel This panel displays the information entered in the Device Pin List panel Code Generator panel This panel allows you to configure the information necessary to control the peripheral functions provided by the microcontroller Code Generator Preview panel This panel allows you to confirm or configure on a per API function basis the setting that determines whether or not the source code device driver program is generated when the Generate Code button is pressed in the Code Generator panel It also allows you to confirm the source code that reflects the information configured in the Code Generator panel Output panel This panel displays operation logs for various components design tool build tool etc provided by CubeSuite Column Chooser dialog box This dialog box allows you to choose whether or not to display the item listed i
155. op TMXn_ChangeDuty TMXn_ChangeDualDuty TMX_EnableHighImpedanceState TMX_DisableHighImpedanceState TMOO_Init TMOO_ Start TMO0_ Stop TMO0_ChangeTimerCondition TMOO_GetFreeRunningValue TMO0_SoftwareTriggerOn TMO0O_ChangeDuty TMO00_GetPulseWidth TM5n_Init TM5n_Start Page 86 of 280 CubeSuite V1 03 00 Peripheral Function Source File Name CG_timer c APPENDIX B OUTPUT FILES Names of API Functions Included TM5n_Stop TM5n_ChangeTimerCondition TM5n_ChangeDuty TMHn_Init TMHn_ Start TMHn_ Stop TMHn_ChangeTimerCondition TMHn_ChangeDuty TMH1_CarrierOutputEnable TMH1_CarrierOutputDisable CG_timer_user c TMO0_UserlInit TM5n_UserlInit TMHn_Userlnit MD_INTTMXn MD_INTTMOn0 MD_INTTM5n MD_INTMHn CG_timer h Watchdog Timer CG_wdt c WDT_Restart CG_wadt h Real time Clock CG_rtc c RTC_Init RTC_PowerOff RTC_CounterEnable RTC_CounterDisable RTC_SetHourSystem RTC_CounterSet RTC_CounterGet RTC_ConstPeriodInterruptEnable RTC_ConstPeriodInterruptDisable RTC_AlarmEnable RTC_AlarmDisable RTC_AlarmSet RTC_AlarmGet RTC_IntervalStart RTC_IntervalStop RTC_IntervallnterruptEnable RTC_IntervallnterruptDisable RTC_RTC1HZ_OutputEnable RTC_RTC1HZ_OutputDisable RTC_RTCCL_OutputEnable RTC_RTCCL_OutputDisable RTC_RTCDIV_OutputEnable RTC_RTCDIV_OutputDisable RTC_ChangeCorrectionValue CG_rtc_user c R20UT2138EJ0100 Rev 1 00 Sep 01 2012 ztENESAS RTC_Userlnit RTC_ConstPeriodInter
156. or the file selected in the Code Generator Preview panel Default name Views or selects the setting that determines whether the name of the file selected in the Code Generator Preview panel is a default name or not Yes The file name is a default name Changing this area from No to Yes changes the name of the file to its default name No The file name is not a default name File name Displays or change the name of the file selected on the Code Generator Preview panel R20UT2138EJ0100 Rev 1 00 ztENESAS Page 57 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Device Pin List panel This panel allows you to enter information on each pin of the microcontroller Remark The Device pin list area can be zoomed in and out by 100 in the tool bar or by operating the mouse wheel while holding down the Ctrl key Figure A 11 Device Pin List Panel Device Pin List ace oe Function I O 4 N ch 4 Defin P 1 SDAAO SII1 Free ZINTP10 P62 5011 INTP9 Free The following items are explained here How to open Description of each area File menu Device Pin List panel dedicated items Help menu Device Pin List panel dedicated items How to open On the Project Tree panel double click Project name Project gt gt Pin Configurator Design Tool gt gt Device Pin List On the Project Tree panel select Project name Project gt
157. ow voltage detector use Table C 13 API Functions LVI API Function Name Function LVI_Init Performs initialization necessary to control low voltage detector functions LVI_Userlnit Performs user defined initialization relating to the low voltage detector LV _InterruptModeStart Starts low voltage detection when in interrupt generation mode LVI_ResetModeStart Starts low voltage detection when in internal reset mode LVI_Stop Stops low voltage detection LVI_SetLVILevel Sets the low voltage detection level R20UT2138EJ0100 Rev 1 00 2tENESAS Page 264 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS LVI_Init Performs initialization necessary to control low voltage detector functions Classification CG_lIvi c Syntax void LVI_Init void Argumenit s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 265 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS LVI Userlnit Performs user defined initialization relating to the low voltage detector Remark This API function is called as the LV _ Init callback routine Classification CG_lvi_user c Syntax void LVI_UserInit void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 266 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS LVI_InterruptModeSitart Starts low voltage detection when
158. p menu Project Tree panel dedicated items Open Help for Project Tree Panel Displays the help of this panel Context menu The following context menu items are displayed by right clicking the mouse Return to Reset Value Restores the information for the selected peripheral function node to its default state Opens the Property panel containing the information for the selected node Pin Configu Property rator Design Tool Device Pin List Device Top View Code Generator Design Tool peripheral function node System Port etc R20UT2138EJ0100 Rev 1 00 ztENESAS Page 44 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Property panel This panel allows you to view the information on and change the setting for the node selected in the Project Tree panel the peripheral function button pressed in the Code Generator panel or the file selected in the Code Generator Preview panel Figure A 3 Property Panel Selected Pin Configurator Design Tool Property EJ A Pin Configurator Property JEJ E Product Information Version O Package Package type Version Pin configurator version information 2 Pin Configurator Settings The following items are explained here How to open Description of each area Edit menu Property panel dedicated items Context menu How to open On the Project Tree panel select a node Pin Co
159. panel double click Project name Project gt gt Pin Configurator Design Tool gt gt Device Top View On the Project Tree panel select Project name Project gt gt Pin Configurator Design Tool gt gt Device Top View and then press the Enter key From the View menu select Pin Configurator gt gt Device Top View R20UT2138EJ0100 Rev 1 00 2tENESAS Page 66 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Remark In the Property panel on the Pin Configurator Settings tab if BGA is selected for the Package type then this panel cannot be opened Description of each area 1 Toolbar This area consists of the following buttons Clicks this button to enable changing of the display in the Device top view area by drag and drop By pressing this button the shape of the mouse cursor in the Device top view area changes from the arrow to the hand Clicks this button to enable moving external peripheral components in the Device top view area to arbitrary locations and select pins By pressing this button the shape of the mouse cursor which has changed into the hand by pressing the button reverts back to the arrow Rotates the content in the Device top view area 90 degrees counter clockwise Rotates the content in the Device top view area 90 degrees clockwise Expands or reduces the content in the Device top view area 2 User Define area Dr
160. r and 1 byte Katakana 2 Number Notations allowed when entering numbers are as follows Table 3 2 List of Notation Notation Outline Decimal number A numeric value that starts with a number between 1 and 9 and followed by numbers between 0 and 9 and the numeric value 0 Hex number A numeric value that starts with Ox and followed by a combination of numbers from 0 to 9 and characters from A to F characters are not case sensitive R20UT2138EJ0100 Rev 1 00 2tENESAS Page 24 of 280 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 3 FUNCTIONS Code Generator 3 3 2 Icon indicating incorrect entry When performing code generation if you enter an invalid string in the Code Generator panel or a required input is missing then a icon displays next to the incorrect input and the text is displayed in red to warn that there is a problem with the input Remark for correcting the entry popups If the mouse cursor is moved over the icon information regarding the string that should be entered tips Figure 3 2 Icon Indicating Incorrect Entry Code Generator F Reflect in Pin Generate Code naes E FM Si EE On chip debug setting Confirming reset source Power voltage VDD setting 27 WV s VDD lt 55 V Main system clock selection O 186 s VDD lt 27 WY Internal high speed oscillation f1H High speed system clock fH _Internal high speed osc
161. r x Reflect in Pin Generate Code Port2 Port3 Port4 Port Port Port12 Oh Ow Pull up W0403004 The following pin conflicts have been detected You must change the setting in that module before you can Unused O h ice it for other purpose P12 P10 was used as ANIS Unused Oh Ot O Pul up P13 Unused Ol Out C Pull up mia lt R20UT2138EJ0100 Rev 1 00 ztENESAS Page 26 of 280 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 3 FUNCTIONS Code Generator 3 4 Confirm Source Code Confirm the source code device driver program that reflects the information configured as described in 3 3 Enter Information To confirm the source code use the Code Generator Preview panel that opens by selecting View menu gt gt Code Generator Preview Figure 3 4 Confirm Source Code Code Generator Preview a Common FEKETE K KKK AS Ee Ge Ee System Copyright C 20065 2012 Renesas Electronics Port RENESAS ELECTRONICS CONFIDENTIAL AND PROPRIE Interrupt This program must be used solely for the pur Serial it was furnished by Renesas Electronics Corp Operational Amplifier program may be reproduced or disclosed to ot A D Converter form without the prior written permission o Timer Corporation Watchdog Timer Real time Clock Clock Output LYI a sa ee E E E E This device driver was created by CodeGenera 8 Bit Single Chip Microcontrollers ov a
162. ripheral component level R20UT2138EJ0100 Rev 1 00 ztENESAS Page 10 of 280 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 2 FUNCTIONS Pin Configurator 2 2 1 Select item The Pin Configurator is used to select items to be displayed in the device pin list using the button in the upper left corner of the device pin list To select the item to be displayed use the Column Chooser dialog box that opens by pressing the button in the upper left corner of the device pin list Figure 2 2 Select Item Column Chooser Pin Number M Pin Number Pin Name W Function Ea 1 0 M Nch ww Define Name Description Recommend Connection for Unused Attention ri External Peripheral Remark To select the item to be displayed check the check box that corresponds to the item Table 2 1 Select Item Checked Displays the selected item in the device pin list Not checked Hides the selected item in the device pin list R20UT2138EJ0100 Rev 1 00 2tENESAS Page 11 of 280 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 2 FUNCTIONS Pin Configurator 2 2 2 Change display order In Pin Configurator you can change the display order of columns in the device pin list move columns by dragging and dropping columns Figure 2 3 Change Display Order Device Pin List ae ae I Pin Name 4 Functia 1 0 4 N ch 4 Define Nar 60 SCLA0 SCKIT INTP11 Free 2 P61 SDAA0 S111 INTPIO Free Device Pin List Pin Name H Functi
163. rmSet 241 OPAMP_Userlnit 168 RTC_ConstPeriodinterruptCallback 238 PGA_ChangePGAFactor 171 RTC_ChangeCorrectionValue 257 PGA _Start 169 RTC_ConstPeriodinterruptDisable 237 PGA_Stop 170 RTC_ConstPeriodinterruptEnable 236 Output panel 75 RTC_CounterDisable 229 RTC_CounterEnable 228 P RTC_CounterGet 234 PCL_ChangeFreq 263 RTC_CounterSet 232 PCL_Init 259 2 RTC_Init 225 RTC_IntervallnterruptDisable 250 RTC_IntervallnterruptEnable 248 RTC_IntervalStart 246 RTC_IntervalStop 247 RTC_RTC1HZ_ OutputDisable 252 RTC_RTC1HZ_OutputEnable 251 PCL_Start 261 PCL_Stop 262 PCL_Userlnit 260 PGA_ChangePGAFactor 171 PGA _Start 169 PGA_Stop 170 Pin Configurator Settings tab 48 RTC_RTCCL_OutputDisable 254 Pin Number tab 60 RTC_RTCCL_OutputEnable 253 Port 108 RTC_RTCDIV_OutputDisable 256 PORT_ChangePmninput 111 RTC_RTCDIV_OutputEnable 255 PORT_ChangePmnOutput 113 PORT_Init 109 PORT_Userlnit 110 RTC_SetHourSystem 230 RTC_Userlnit 226 RTC_PowerOff 227 PORT_ChangePmninput 111 RTC_AlarmDisable 240 PORT_ChangePmnOutput 113 RTC AlarmEnable 239 PORT_Init 109 J PORT_Userlnit 110 RTC_AlarmGet 244 RTC_AlarminterruptCallback 245 Project Tree panel 42 RTC AlarmSet 241 Property panel 45 RTC_ChangeCorrectionValue 257 Device Pin Li
164. ro second of stabilization time is required when changing the voltage converter from operation stopped to operation enabled status Consequently about 1 micro second must be left free between the call to AD_ComparatorOn and the call to this API function Classification CG_ad c Syntax void AD_Start void Argumenit s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 186 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS AD_Stop Ends A D conversion Remark The voltage converter continues to operate after the process of this API function completes Consequently to stop the operation of the voltage converter you must call AD_ComparatorOff after the pro cess of this API function completes Classification CG_ad c Syntax void AD_Stop void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 187 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS AD_SelectADChannel Configures the analog voltage input pin for A D conversion Remark The value specified in parameter channel is set to analog input channel specification register ADS Classification CG_ad c Syntax include CG_ad h MD_STATUS AD_SelectADChannel enum ADChannel channel Argumenit s I O Argument Description l enum ADChannel channel Analog voltage input pin ADCHANNELn Input pin ADCHANNELPGAIN Operat
165. rocessing in response to the alarm interrupt INTRTC Remark This API function is called as the callback routine of interrupt process MD_INTRTC corresponding to the alarm interrupt INTRTC Classification CG_rtc_user c Syntax void RTC_AlarmInterruptCallback void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 245 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_IntervalStart Starts the interval interrupt function Remark After setting the cycle of the interrupts INTRTCI call RTC_IntervallnterruptEnable to start the interval inter rupt function Classification CG_rtc c Syntax void RTC_IntervalStart void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 246 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_IntervalStop Ends the interval interrupt function Classification CG_rtc c Syntax void RTC_IntervalStop void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 247 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_IntervallnterruptEnable Sets the cycle of the interrupts INTRTCI then starts the interval interrupt function Remark Call RTC_IntervalStart to start the interval interrupt function without setting the cycle of the interrupts INTRTCI Classification CG_r
166. routine of interrupt process MD_INTST6 corresponding to the UART transmission complete interrupt INTST6 performed when number of transmission data specified by UART6_SendData parameter txnum has been completed Classification CG_serial_user c Syntax void UART6_SendEndCallback void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 136 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UART6_ReceiveEndCallback Performs processing in response to the UART reception complete interrupt INTSR6 Remark This API function is called as the callback routine of interrupt process MD_INTSR6 corresponding to the UART reception complete interrupt INTSR6 performed when number of received data specified by UART6_ReceiveData parameter rxnum has been completed Classification CG_serial_user c Syntax void UART6_ReceiveEndCallback void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 137 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UART6_SoftOverRunCallback Performs processing in response to the UART reception complete interrupt INTSR6 Remark This API function is called as the callback routine of interrupt process MD_INTSR6 corresponding to the UART reception complete interrupt INTSR6 process performed when the amount of data received is greater than the parameter rxnum specified for UART6_Rec
167. ruptCallback Page 87 of 280 CubeSuite V1 03 00 APPENDIX B OUTPUT FILES Peripheral Function Source File Name Names of API Functions Included Real time Clock CG_rtc_user c RTC_AlarmInterruptCallback MD_INTRTC MD_INTRTCI Clock Output PCL_Init PCL_Start PCL_Stop PCL_ChangeFreq CG_pcl_user c PCL_Userlnit CG_pcl h CG_lvi c LVI_Init LVI_InterruptModeStart LVI_ResetModeStart LVI_Stop LVI_SetLVILevel CG_lvi_user c LVI_Userlnit MD_INTLVI CG_lIvi h z R20UT2138EJ0100 Rev 1 00 ztENESAS Page 88 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS APPENDIX C API FUNCTIONS This appendix describes the API functions output by Code Generator C 1 Overview Below are the naming conventions for API functions output by Code Generator Macro names are in ALL CAPS The number in front of the macro name is a hexadecimal value this is the same value as the macro value Local variable names are in all lower case Global variable names start with a g and use Camel Case Names of pointers to global variables start with a gp and use Camel Case Names of elements in enum statements are in ALL CAPS C 2 Output Function Below is a list of API functions output by Code Generator Peripheral Function Table C 1 API Function Name CLOCK_Init API Function List Function Performs initialization required to control the clock generator on chip debu
168. s Argument Description enum StabTime waittime Oscillation stabilization time type STLEVELO 2 11 fx STLEVEL1 213 fx STLEVEL2 2 14 fx STLEVEL3 2 15 fx STLEVEL4 2 16 fx Remark fx signifies the frequency of the X1 clock Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT2138EJ0100 Rev 1 00 2tENESAS Page 106 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CG_ChangePIIMode Controls the operation of PLL function Classification CG_system c Syntax include CG_macrodriver h include CG_system h MD_STATUS CG_ChangePllMode enum PllMode plimode Argument s enum PllMode pllmode Control of operation SYSPLLON Enable operation SYSPLLOFF Stop operation Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT2138EJ0100 Rev 1 00 ztENESAS Page 107 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS C 3 2 Port Below is a list of API functions output by Code Generator for port use Table C 3 API Functions Port API Function Name Function PORT_lInit Performs initialization necessary to control port functions PORT_Userlnit Performs user defined initialization relating to the port PORT_ChangePmninput Switches the pin s I O mode from output mode to input mode PORT_ChangePmnOutput Switches the pin s I O mode from input mode t
169. s 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 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 This document may not be reproduced or duplicated in any form in whole or in part without prior written consent of Renesas Electronics 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 How to Use This Manual This manual describes the role of the CubeSuite integrated deve
170. st Information tab 49 RTC_ConstPeriodInterruptCallback 238 Device Top View Settings tab 50 RTC_ConstPeriodinterruptDisable 237 File Setting tab 57 RTC_ConstPeriodinterruptEnable 236 Generation tab 53 RTC_CounterDisable 229 Macro Setting tab 56 RTC_CounterEnable 228 Pin Configurator Settings tab 48 RTC CounterGet 234 R20UT2138EJ0100 Rev 1 00 tENESAS Page 274 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX D INDEX RTC_CounterSet 232 RTC_Init 225 RTC_IntervallnterruptDisable 250 RTC_IntervallnterruptEnable 248 RTC_IntervalStart 246 RTC_IntervalStop 247 RTC_PowerOff 227 RTC_RTC1HZ_OutputDisable 252 RTC_RTC1HZ_OutputEnable 251 RTC_RTCCL_OutputDisable 254 RTC_RTCCL_OutputEnable 253 RTC_RTCDIV_OutputDisable 256 RTC_RTCDIV_OutputEnable 255 RTC_SetHourSystem 230 RTC_Userlnit 226 S Save As dialog box 82 Serial 126 CSiin_Init 141 CSl1n_ReceiveData 145 CSI1n_ReceiveEndCallback 150 CSl1n_SendEndCallback 149 CSlin_SendReceiveData 147 CSlin_Start 143 CSlin_Stop 144 CSlin_Userlnit 142 IICA_GetStopConditionCallback 165 IICA_Init 151 IICA_MasterErrorCallback 159 IICA_MasterReceiveEndCallback 158 IICA_MasterReceiveStart 155 IICA_MasterSendEndCallback 157 IICA_MasterSendStart 154 IICA_SlaveErrorCallback 164 IICA_SlaveReceiveEndCallback 163
171. t gt Color in the Property panel To move columns change the display order in the device pin list drag and drop the desired col umn to the desired location To add the user s own column use the New Column dialog box which opens by pressing the New Column button in the Column Chooser dialog box which opens by pressing the E button in the upper left corner of the device pin list R20UT2138EJ0100 Rev 1 00 ztENESAS Page 65 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Device Top View panel This panel displays the information entered in the Device Pin List panel Remark The Device top view area can be zoomed in and out by 100 in the tool bar Figure A 15 Device Top View Panel Device Top View PaO RTGGL RTGOIN _SGKII PIZA INTPO EXLYI I Piz xi moca O PIIR Bice TA O PIRTIK II O PIZY XTI XAKS O REETPI G PEVSLAY _SKIN IMTFII P6104051 INTI O PEXSOI 1 IHTP O ANID PZY APO 78KO KC2 L ANIL P2I AMPOOUT PGAIM uPD 8F0581_48 Oaniz mra auras Pa INTP TOLOI Cami P27 PUI IMTP2 TOLG O Pig INPI P16 TOHI INTS PIZZI GAH IAP I O PLISI O ANI3 AMP OUT Play _ 36k 10 44 1a AMP 1 The following items are explained here How to open Description of each area File menu Device Top View panel dedicated items Help menu Device Top View panel dedicated items Context menu How to open On the Project Tree
172. t s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 182 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS Performs user defined initialization relating to the A D converter Remark This API function is called as the AD_ Init callback routine Classification CG_ad_user c Syntax void AD_UserInit void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 183 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS AD_ComparatorOn Enables operation of voltage converter Remark About 1 microsecond of stabilization time is required when changing the voltage converter from operation stopped to operation enabled status Consequently about 1 micro second must be left free between the call to this API function and the call to AD_ Start Classification CG_ad c Syntax void AD_ComparatorOn void Argumenit s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 184 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS AD_ComparatorOff Disables operation of voltage converter Classification CG_ad c Syntax void AD_ComparatorOff void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 185 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS Starts A D conversion Remark About 1 mic
173. tENESAS Page 218 of 280 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TMHn_ChangeDuty Changes the duty ratio of the PWM signal output to the TOHn pin Remark This API function can only be called when the 8 bit timer Hn is being used for PWM output Classification CG_timer c Syntax include CG_macrodriver h void TMHn_ChangeDuty UCHAR ratio Remark nis the channel number Argument s Remark The value set to duty ratio ratio must be in base 10 notation Return value None Example The example below shows changing the duty ratio to 25 CG_main c include CG_macrodriver h void main void UCHAR ratio 25 Start count TMHO_ChangeDuty ratio Change duty ratio R20UT2138EJ0100 Rev 1 00 2tENESAS Page 219 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TMH1_CarrierOutputEnable Begins carrier pulse output of the 8 bit timer H1 carrier generator mode Classification CG_timer c Syntax void TMH1_CarrierOutputEnable void Argumenit s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 220 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TMH1_CarrierOutputDisable Ends carrier pulse output of the 8 bit timer H1 carrier generator mode Classification CG_timer c Syntax void TMH1_CarrierOutputDisable void Argumenit s None Return value
174. tc c Syntax include CGurt d A MD_STATUS RTC_IntervalInterruptEnable enum RTCINTInterval interval Argument s Argument Description enum RTCINTInterval interval Interrupt INTRTCI cycle INTERVALO 246 fSUB INTERVAL1 247 fSUB INTERVAL2 248 fSUB INTERVAL3 2 9 fSUB INTERVAL4 210 fSUB INTERVALS 2411 fSUB INTERVALE6 2412 fSUB Remark fSUB is the frequency of the subsystem clock Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification Example Below is an example of changing the interval the restarting the interval interrupt function CG_main c include CG rte H void main void RTC_IntervalStart Start interval interrupt function R20UT2138EJ0100 Rev 1 00 2tENESAS Page 248 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_IntervalStop End interval interrupt function RTC_IntervaliInterruptEnable INTERVAL6 Start interval interrupt function R20UT2138EJ0100 Rev 1 00 2tENESAS Page 249 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_IntervallnterruptDisable Ends the interval interrupt function Classification CG_rtc c Syntax void RTC_IntervalInterruptDisable void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 250 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_RT
175. tem marked with Note in the text Caution Information requiring particular attention Remark Supplementary information Numeric representation Decimal XXXX Hexadecimal OXXXXX Related Documents The related documents indicated in this publication may include preliminary versions However preliminary versions are not marked as such CubeSuite Start R20UT2133E Integrated Development Environment V850 Design R20UT2134E User s Manual R8C Design R20UT2135E RL78 Design R20UT2136E 78KOR Design R20UT2137E 78K0 Design This manual RX Coding R20UT0767E V850 Coding R20UT0553E Coding for CX Compiler R20UT2139E R8C Coding R20UT0576E RL78 78KOR Coding R20UT2140E 78KO Coding R20UT2141E RX Build R20UT0768E V850 Build R20UT0557E Build for CX Compiler R20UT2142E R8C Build R20UT0575E RL78 78KOR Build R20UT2143E 78K0 Build R20UT0783E RX Debug R20UT2175E V850 Debug R20UT2144E R8C Debug R20UT0770E RL78 Debug R20UT2145E 78KOR Debug R20UT0732E 78KO Debug R20UT0731E Analysis R20UT2146E Message R20UT2147E Caution The related documents listed above are subject to change without notice Be sure to use the latest edition of each document when designing All trademarks or registered trademarks in this document are the property of their respective owners TABLE OF CONTENTS CHAPTER 1 GENERAL 7 1 1 Overview 7 1 2 Features 7 CHAPTER 2 FUNCTIONS Pin Configurator 8 2 1 Overview 8 2 2 Open Device Pin L
176. ternal event counter Classification CG_timer c Syntax void TM5n_Start void Remark nis the channel number Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 210 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TM5n_Stop Ends the count for 8 bit timer event counter 5n Classification CG_timer c Syntax void TM5n_Stop void Remark nis the channel number Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 211 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TM5n_ChangeTimerCondition Changes the value of 8 bit timer compare register 5n CR5n Remark To change the contents of CR5n you must call TM5n_Stop before calling this API function Classification CG_timer c Syntax include CG_macrodriver h void TM5n_ChangeTimerCondition UCHAR value Remark nis the channel number Argument s a UCHAR valueg The value to set in CR5n Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 212 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TM5n_ChangeDuty Changes the duty ratio of the PWM signal output to the TO5n pin Remark This API function can only be called when the 8 bit timer event counter 5n is being used for PWM output Classification CG_timer c Syntax include CG_macrodriver h void TM5n_ChangeDu
177. tialization relating to the operational amplifier PGA_Start Starts the operation of opeational amplifier PGA mode PGA_Stop Ends the operation of operational amplifier PGA mode PGA_ChangePGAFactor Sets the input voltage amplification factor of a operational amplifier PGA mode AMP_ Start Starts the operation of opeational amplifier single AMP mode AMP_Stop Ends the operation of operational amplifier single AMP mode AMPn_Start Starts the operation of opeational amplifier n single AMP mode AMPn_Stop Ends the operation of operational amplifier n single AMP mode R20UT2138EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Page 166 of 280 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS OPAMP Init Performs initialization necessary to control operational amplifier functions Classification CG_opamp c Syntax void OPAMP _Init void Argumenit s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 167 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS OPAMP _Userlnit Performs user defined initialization relating to the operational amplifier Remark This API function is called as the OPAMP_Init callback routine Classification CG_opamp_user c Syntax void OPAMP_UserInit void Argumeni s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 168 of 280 Sep 01 2012
178. tput format for the device pin list is limited to Microsoft Office Excel Book R20UT2138EJ0100 Rev 1 00 ztENESAS Page 20 of 280 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 2 FUNCTIONS Pin Configurator 2 5 2 Output device top view Select File menu gt gt Save Top View As to output a report file a file containing information configured using Pin Configurator device top view The destination folder for the device top view is specified in the Save As dialog box which opens by selecting File menu gt gt Save Top View As Figure 2 13 Output Device Top View My Documents Amy Music Z My Pictures My Recent Emy videos Documents sample Desktop r My Documents p My Computer My Network File name vi Places Save as type Bitmap bmp v Cance Remark If a device top view has been already output that view will be overwritten by selecting File menu gt gt Save Top View R20UT2138EJ0100 Rev 1 00 2tENESAS Page 21 of 280 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 3 FUNCTIONS Code Generator CHAPTER 3 FUNCTIONS Code Generator This chapter describes the key functions provided by the design tool Code Generator along with operation proce dures 3 1 Overview The Code Generator outputs source code device driver programs based on information selected entered on CubeSu ite panels that is needed to control peripheral functions provided by
179. troller E sample Project BE uPD78F0588_48 Microcontroller rs A Pin Configurator Design Tool m P Code Generator Design Tool A CA78KO Build Tool SS 78K0 Simulator Debug Tool Program Analyzer Analyze Tool 5 0 File Ex Startup Fs A Pin Configurator Design Tool w P Code Generator Design Tool aS CA 8KO Build Tool S 78K0 Simulator Debug Tool ey Program Analyzer Analyze Tool 5 0 File Pl Build Tool Output Files E sJ Startup E LI CodeGenerator dir CG_Ik dir Remark In order to both output source files and add them to the project display the corresponding source file names in the Project Tree panel when you click the ol Generate Code button you must open the Property panel and under Generation tab gt gt Register files specify Output files to project Figure 3 6 Configure Whether to Register zij Code Generator Property E Product Information ersion V E AE Ae AX Release date daiMiiyyyy E Generate File Mode Output control of API function Output all API functions according to the setting Generate file Merge file Output folder C Documents and Settings My Docume Report type HTML file Reaister files Output files to project nal E Pin Configurator Reflect Mode anja Mode Not output files to project Register files The register mode of the output files is displayed Generation R20UT2138EJ0100 Rev 1 00 Sep 01 2012 ztENESAS Page 28
180. ty UCHAR ratio Remark nis the channel number Argument s Remark The value set to duty ratio ratio must be in base 10 notation Return value None Example The example below shows changing the duty ratio to 25 CG_main c include CG_macrodriver h void main void UCHAR ratio 25 Start count TM50_ChangeDuty ratio Change duty ratio R20UT2138EJ0100 Rev 1 00 2tENESAS Page 213 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TMHn_Init Performs initialization necessary to control 8 bit timer Hn functions Classification CG_timer c Syntax void TMHn_Init void Remark nis the channel number Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 214 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TMHn_Userlnit Performs user defined initialization relating to the 8 bit timer Hn Remark This API function is called as the TMHn_Init callback routine Classification CG_timer_user c Syntax void TMHn_UserInit void Remark nis the channel number Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 215 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TMHn_Siart Starts the count for 8 bit timer Hn Remark The time from the call to this API function to the start of counting depends on the
181. uite V1 03 00 APPENDIX C API FUNCTIONS C 3 8 Timer Below is a list of API functions output by Code Generator for timer array unit use Table C 9 API Functions Timer API Function Name Function MX_Init Performs initialization necessary to control 16 bit timer Xn functions MXn_Start Starts the count for 16 bit timer Xn MXn_Stop Ends the count for 16 bit timer Xn MXn_ChangeDuty Changes the duty ratio of the PWM signal single output to the TOXOn pin MXn_ChangeDualDuty Changes the duty ratio of the PWM signal dulal output to the TOXOn pin MX_EnableHighImpedanceState Begins high impedance output of the 16 bit timer Xn MX_DisableHighImpedanceState Ends high impedance output of the 16 bit timer Xn MOO_Init Performs initialization necessary to control 16 bit timer event counter 00 functions M00 _Userlnit Performs user defined initialization relating to the 16 bit timer event counter 00 M00_Start Starts the count for 16 bit timer event counter 00 M00_Stop Ends the count for 16 bit timer event counter 00 M00_ChangeTimerCondition Changes the value of capture compare control register 00 CRC00 M00_GetFreeRunningValue Captures the content of the capture register CROn0 M00_SoftwareTriggerOn Generates the trigger software trigger for one shot pulse output M00_ChangeDuty Changes the duty ratio of the signal output to the TOOO
182. ument data type c Description Description of argument 6 Return value API function return value is explained in the following format a Macro Macro of return value b Description Description of return value 7 Example Shows an example of the API function in use R20UT2138EJ0100 Rev 1 00 ztENESAS Page 96 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS C 3 1 System Below is a list of API functions output by Code Generator for system use Table C 2 API Functions System API Function Name Function CLOCK_Init Performs initialization required to control the clock generator on chip debug and etc CLOCK_Userlnit Performs user defined initialization relating to the clock generator on chip debug and etc CG_ReadResetSource Performs processing in response to RESET signal CG_ChangeClockMode Changes the CPU clock peripheral hardware clock CG_ChangeFrequency Changes the division ratio of the CPU clock peripheral hardware clock CG_SelectPowerSaveMode Configures the CPU s standby function CG_SelectStabTime Configures the oscillation stabilization time of the X1 clock CG_ChangePIlMode Controls the operation of PLL function R20UT2138EJ0100 Rev 1 00 ztENESAS Page 97 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CLOCK Init Performs initialization required to control the clock generator on chip debug and etc
183. user c Syntax void IICA_MasterReceiveEndCallback void Argument s None Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 158 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS IICA_MasterErrorCallback Performs processing in response to detection of error in IICA master communication Classification CG_serial_user c Syntax include CG_macrodriver h void IICA_MasterErrorCallback MD_STATUS flag Argument s MD_STATUS flag Cause of communication error MD_SPT Stop condition detected MD_NACK Acknowledge not detected Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 159 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS IICA_SlaveSendSitart Starts IICA slave transmission Remark This API function repeats the byte level IICA slave transmission from the buffer specified in parameter txbuf the number of times specified in parameter txnum Classification CG_serial c Syntax include CG_macrodriver h void IICA_SlaveSendStart UCHAR txbuf USHORT txnum Argument s UCHAR txbuf Pointer to a buffer storing the transmission data USHORT txnum Total amount of data to send Return value None R20UT2138EJ0100 Rev 1 00 2tENESAS Page 160 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS IICA_SlaveReceiveStart Starts IICA slave reception Remark This AP
184. with warnings about opera ABCD abed 0123 tions sage Background color Standard color aii Error message Character color Red Displayed when there is a critical ABCD abed 0123 error or when execution is not possi Background color Light gra g gnt gray ble due to a operational mistake R20UT2138EJ0100 Rev 1 00 2tENESAS Page 75 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE 2 Tab selection area Select the tab that indicates the origin of message The following tabs are available for the debug tool Tab Name Description All Messages Displays operation logs for all components design tool build tool debug tool etc provided by Cube Suite in order of output Code Generator Display only operation logs for the Code Generator out of those for various components design tool build tool debug tool etc provided by CubeSuite Caution Even if anew message is output on a deselected tab tab selection will not automatically switch In this case mark will be added in front of the tab name indicating that a new message has been output File menu Output panel dedicated items Save Output Tab Name Saves the message corresponding to the specified tab overwriting the existing file Save Output Tab Name As Opens the Save As dialog box for naming and saving the message corresponding to the specified tab Edit menu Output panel de
185. x30 RTC_AlarmSet alarmval Set conditions R20UT2138EJ0100 Rev 1 00 2tENESAS Page 242 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS Example 2 The example below shows the alarm conditions being set to Saturday Sunday time left unchanged CG_main c include CG rte H void main void struct RTCAlarmValue alarmval RTC_AlarmEnable Start alarm interrupt function RTC_AlarmSet alarmval Change conditions R20UT2138EJ0100 Rev 1 00 2tENESAS Page 243 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_AlarmGet Reads the alarm conditions weekday hour minute Classification CG_rtc c Syntax include OG rte h void RTC_AlarmGet struct RTCAlarmValue alarmval Remark See RTC_AlarmSet for details about RTCAlarmValue alarm conditions Argumenit s eq struct RTCAlarmValue alarmval Pointer to structure in which to store the conditions being read Return value None Example The example below shows the alarm conditions being read CG_main c include oG rte n void main void struct RTCAlarmValue alarmval RTC_AlarmEnable Start alarm interrupt function RTC_AlarmGet amp alarmval Read conditions R20UT2138EJ0100 Rev 1 00 2tENESAS Page 244 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_AlarminterruptCallback Performs p
186. year month week day day hour minute second RTC_CounterDisable Ends the count of the real time counter year month weekday day hour minute second RTC_SetHourSystem Sets the clock type 12 hour or 24 hour clock of the real time counter RTC_CounterSet Sets the counter value year month weekday day hour minute second of the real time counter RTC_CounterGet Reads the counter value year month weekday day hour minute second of the real time counter RTC_ConstPeriodInterruptEnable Sets the cycle of the interrupts INTRTC then starts the cyclic interrupt function RTC_ConstPeriodInterruptDisable Ends the cyclic interrupt function RTC_ConstPeriodInterruptCallback Performs processing in response to the cyclic interrupt INTRTC RTC_AlarmEnable Starts the alarm interrupt function RTC_AlarmDisable Ends the alarm interrupt function RTC_AlarmSet Sets the alarm conditions weekday hour minute RTC_AlarmGet Reads the alarm conditions weekday hour minute RTC_AlarminterruptCallback Performs processing in response to the alarm interrupt INTRTC RTC_IntervalStart Starts the interval interrupt function RTC_IntervalStop Ends the interval interrupt function RTC_IntervallnterruptEnable Sets the cycle of the interrupts then starts the interval interrupt INTRTCI function RTC_IntervallnterruptDisable E
187. yntax void KEY_UserInit void Argumenit s None Return value None R20UT2138EJ0100 Rev 1 00 ztENESAS Page 119 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS INT_MaskablelnterruptEnable Disables enables the acceptance of the maskable interrupts Classification CG_int c Syntax include CG_macrodriver h include CG_int h MD_STATUS INT_MaskableInterruptEnable enum MaskableSource name BOOL enableflag Argument s Argument Description enum MaskableSource name Maskable interrupt type INT_xxx Maskable interrupt BOOL enableflag Acceptance enabled disabled MD_TRUE Acceptance enabled MD_FALSE Acceptance disabled Remark See the header file CG_int h for details about the maskable interrupt type INT_xxx Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification Example 1 Below is an example of disabling acceptance of the maskable interrupt INTPO CG_main c include CG_macrodriver h include CG_int h void main void INT_MaskableInterruptEnable INT_INTPO MD_FALSE Disable acceptance of maskable interrupt INTPO R20UT2138EJ0100 Rev 1 00 2tENESAS Page 120 of 280 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS Example 2 Below is an example of enabling acceptance of the maskable interrupt INTPO CG_main c include CG_macrodriver h include OG int hh

Download Pdf Manuals

image

Related Search

Related Contents

Casio EX-Z450 Owner's Manual  NEUFCHEF - Citéline    Ficha técnica  New OS Pocket PC 2002  Samsung 750ST Manual de Usuario  CDMA2000-1X Tracker GL300VC User Manual  Intel MPRTM0020 User's Manual  Service Manual - Manuales de Service  Meco 6623S8E641 User's Manual  

Copyright © All rights reserved.
Failed to retrieve file