Home
CubeSuite+ V1.03.00 Integrateg Development Environment User`s
Contents
1. Argument s 1 0 Argument Description Macro Description 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 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 98 of 351 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 Input argument O Output argument b Argument Argument 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 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 99 of 351 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
2. Example 2 Below is shown an example where 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_ChangeP040utput MD_TRUE MD_CLEAR Switch I O mode R20UT2137EJ0100 Rev 1 00 ztENESAS Page 121 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS C 3 4 Interrupt Below is a list of API functions output by Code Generator for interrupt and key interrupt use Table C 5 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 KEY_Enable Disables th
3. R20UT2137EJ0100 Rev 1 00 2tENESAS Page 143 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UARTn_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 UARTn_Start is then called Classification CG_serial c Syntax include CG_macrodriver h MD_STATUS UARTn_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 specification Example Below is an example of UART reception of four bytes of fixed length data from channel 0 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 UARTO_ReceiveData amp rxbuf rxnum Start UART data reception UARTO_Start Start UART communication while gFlag Wait for rxnum receptions R20UT2137EJ0100 Rev 1 00 tENESAS Page 144 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS
4. 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 100 of 351 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 Classification CG_system c Syntax void CLOCK_Init void Argumenit s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 101 of 351 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 102 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CG_ReadResetSource Performs processing in respo
5. Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 308 of 351 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 void PCL_ChangeFreq enum PCLclock clock Argumenit s I O Argument Description enum PCLclock clock Output clock type Remark MAINCLOCK MAIN2 MAIN4 MAINS MAIN16 MAIN2048 MAIN4096 MAIN8192 PLLCLOCK PLL2 PLL4 PLL8 PLL16 PLL2048 PLL4096 PLL8192 ILCLOCK SUBCLOCK fMAIN fMAIN 2 fMAIN 4 fMAIN 8 fMAIN 16 fMAIN 2048 fMAIN 4096 fMAIN 8192 fPLL fPLL 2 fPLL 4 fPLL 8 fPLL 16 fPLL 2048 fPLL 4096 fPLL 8192 fIL fSUB fMAIN is the main system clock frequency fPLL is the PLL clock frequency fIL is the internal low speed oscillation clock frequency fSUB is the subsystem clock frequency Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Sep 01 2012 Page 309 of 351 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS C 3 14 Clock Output Buzzer Output Below is a list of API functions output by Code Generator for clock output buzzer output use Table C 15 API Functions Clock Output Buzzer Output API Function Name Function PCLBUZn_Init Performs initializati
6. Page 91 of 351 CubeSuite V1 03 00 Peripheral Function API Function Name Serial lICmn_MasterSendStart APPENDIX C API FUNCTIONS Function Starts simple IIC master transmission lICmn_MasterReceiveStart Starts simple IIC master reception ICmn_StartCondition Generates start conditions ICmn_StopCondition Generates stop conditions lICmn_MasterSendEndCallback Performs processing in response to the IIC mn communication complete interrupt INTIIC mn lICmn_MasterReceiveEndCallback Performs processing in response to the IIC mn communication complete interrupt INTIIC mn lICmn_MasterErrorCallback Performs processing in response to detection of parity error ACK error in simple IIC communication UARTFn_Init Performs initialization of the serial interface UARTFn UARTFn_PowerOff Halts the clock supplied to the serial interface UARTFn UARTFn_ Start Sets UARTF communication to standby mode UARTFn_Stop UARTFn_SendData UARTFn_ReceiveData UARTFn_SetComparisonData UARTFn_DataComparisonEnable Ends UARTF communication Starts UARTF data transmission Starts UARTF data reception Sets the data to compare to the received data Starts the data comparison UARTFn_DataComparisonDisable Ends the data comparison UARTFn_SendEndCallback Performs processing in response to the transmission interrupt INTLTn UARTFn_ReceiveEndCallback Perf
7. ble due to a operational mistake R20UT2137EJ0100 Rev 1 00 ztENESAS Page 75 of 351 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 dedicated 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 select
8. Argumenit s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 131 of 351 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_Enable void Argumenit s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 132 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS C 3 5 Serial Below is a list of API functions output by Code Generator for serial array unit and serial interface use Table C 6 API Functions Serial API Function Name Function SAUm_Init Performs initialization necessary to control the serial array unit and serial interface functions SAUm_Userlnit Performs user defined initialization related to the serial array unit and serial interface functions SAUm_PowerOff Halts the clock supplied to the serial array unit UARTn_Init Performs initialization of the serial interface UART channel UARTn_Start Sets UART communication to standby mode UARTn_Stop Ends UART communication UARTn_SendData Starts UART data transmission UARTn_ReceiveData UARTn_SendEndCallback Starts UART data reception Performs processing in response to the UART transmission complete interrupt INTSTn UARTn_ReceiveEndCallback Performs processing in response to the UART reception
9. UCHAR wait Setup time of start conditions Return value Macro Description MD_OK Normal completion MD_ERROR1 Bus communication status MD_ERROR2 Bus not released status R20UT2137EJ0100 Rev 1 00 ztENESAS Page 192 of 351 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 193 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS IICA_MasterSendEndCallback Performs processing in response to the IICA communication complete interrupt INTIICA Remark This API function is called as the callback routine of interrupt process MD_INTIICA corresponding to the IICA communication complete interrupt INTIICA Classification CG_serial_user c Syntax void IICA_MasterSendEndCallback void Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 194 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS IICA_MasterReceiveEndCallback Performs processing in response to the IICA communication complete interrupt INTIICA Remark This API function is called as the callback routine of interrupt process MD_INTIICA corresponding to the IICA communication complete interrupt INTIICA Classification CG
10. gFlag 0 Set transmission complete flag R20UT2137EJ0100 Rev 1 00 2tENESAS Page 155 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CSImn_ReceiveData Starts CSI data reception Remarks 1 This API function performs byte level CSI reception the number of times specified by the parameter rxnum and stores the data in the buffer specified by the parameter rxbuf 2 When performing a CSI reception CSImn_Start must be called before this API function is called Classification CG_serial c Syntax include CG_macrodriver h MD_STATUS CSImn_ReceiveData UCHAR rxbuf USHORT rxnum Remark mis the unit number and nis the channel number Argumeni 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 specification Example Below is an example of receiving a CSI transmission of four bytes of fixed length data from channel 00 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 CSIOO_Start Start CSI communication CSI00_ReceiveData amp rxbuf rxnum Start CSI reception while gFlag Wait for rxnum receptions R20UT2137EJ0100 Rev 1 00 RENESAS Page 15
11. Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 313 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS PCLBUZn_Stop Ends clock buzzer output Classification CG_pclbuz c Syntax void PCLBUZn_Stop void Remark nis the output pin Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 314 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS PCLBUZn_ChangeFreq Changes the output clock to the PCLBUZn pin Remark The value specified in parameter clock is set to clock output select register n CKSn Classification CG_pclbuz c Syntax include CG_pclbuz h MD_STATUS PCLBUZn_ChangeFreq enum PCLBUZclock clock Remark nis the output pin Argument s VO Argument Description enum PCLBUZclock clock Output clock type Remark MAINCLOCK MAIN2 MAIN4 MAINS8 MAIN16 MAIN2048 MAIN4096 MAIN8192 SUBCLOCK SUB2 SUB4 SUB8 SUB16 SUB32 SUB64 SUB128 fMAIN fMAIN 2 fMAIN 4 fMAIN 8 fMAIN 16 fMAIN 2048 fMAIN 4096 fMAIN 8192 fSUB fSUB 2 fSUB 4 fSUB 8 fSUB 16 fSUB 32 fSUB 64 fSUB 128 fMAIN is the main system clock frequency fSUB is the subsystem clock frequency Return value Normal completion MD_OK MD_ARGERROR Invalid argument specification R20UT2137EJ0100 Rev 1 00 ztENESAS Sep 01 2012 Page 315 of 351
12. PCL_Stop Ends clock output PCL_ChangeFreq Changes the output clock to the PCL pin Clock Output Buzzer Output PCLBUZn_Init Performs initialization necessary to control clock buzzer output control circuit functions PCLBUZn_Userlnit Performs user defined initialization relating to the clock buzzer output control circuits PCLBUZn_ Start Starts clock buzzer output PCLBUZn_Stop Ends clock buzzer output PCLBUZn_ChangeFreq Changes the output clock to the PCLBUZn pin LCD Controller Driver LCD_Init LCD_Userlnit LCD_DisplayOn LCD_DisplayOff R20UT2137EJ0100 Rev 1 00 Sep 01 2012 ztENESAS Performs initialization necessary to control LCD controller driver functions Performs user defined initialization relating to the LCD controller driver Sets the LCD controller driver to display on status Sets the LCD controller driver to display off status Page 96 of 351 CubeSuite V1 03 00 Peripheral Function LCD Controller Driver API Function Name LCD_VoltageOn APPENDIX C API FUNCTIONS Function Enables operation of the LCD controller driver s voltage boost circuit and capacitor split circuit then outputs the deselect sig nal from the segment pin LCD_VoltageOff Halts operation of the LCD controller driver s voltage boost cir cuit and capacitor split circuit then outputs the groundlevel signal from the segment common pin
13. 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 58 of 351 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 E 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 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 follow
14. J Internal low speed oscillation clock fIL setting Operation Frequency 30 kHz Stops internal low speed oscillation in STOP mode Enables internal low speed oscillation fIL operation setting for system clock fGLK GPU and peripheral clock setting PLL clock frequency fPLL 16 PLL mode fPLL MAIN X 4 MHz PLL lockup time 128 2 O MAIN us GPU and peripheral clock fCLK 8000 fPLL 2 kHz Glock monitor setting nm Unused O Used RESOUT pin setting Unused Used P130 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 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 23 of 351 Sep 01 2012 CHAPTER 3 FUNCTIONS Code Generator 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 foll
15. MD_STATUS UARTFn_ReceiveData UCHAR rxbuf USHORT rxnum Remark nis the channel number Argumenit 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 specification R20UT2137EJ0100 Rev 1 00 ztENESAS Page 177 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UARTFn_SetComparisonData Sets the data to compare to the received data Remark The value specified in parameter comdata is set to LIN UART ID setting register UFnID Classification CG_serial c Syntax include CG_macrodriver h void UARTFn_SetComparisonData UCHAR comdata Remark nis the channel number Argument s za UCHAR comdata Data to compare Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 178 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UARTFn_DataComparisonEnable Starts the data comparison Remark Calling this API function switches the serial interface UARTFn to expansion bit mode with data compari son Classification CG_serial_user c Syntax void UARTFn_DataComparisonEnable void Remark nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 179 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UARTFn_Dat
16. Pin Configurator Settings tab 48 Real time Clock 270 RTC_AlarmDisable 286 RTC_AlarmEnable 285 RTC_AlarmGet 290 RTC_AlarminterruptCallback 291 RTC_AlarmSet 287 RTC_ChangeCorrectionValue 303 RTC_ConstPeriodinterruptCallback 284 RTC_ConstPeriodIinterruptDisable 283 RTC_CounterDisable 275 RTC_CounterEnable 274 RTC_CounterGet 280 RTC_CounterPeriodInterruptEnable 282 RTC_CounterSet 278 RTC_Init 271 RTC_IntervalinterruptDisable 296 RTC_IntervallnterruptEnable 294 RTC_IntervalStart 292 RTC_IntervalStop 293 RTC_PowerOff 273 RTC_RTC1HZ_OutputDisable 298 RTC_RTC1HZ_ OutputEnable 297 RTC_RTCCL_OutputDisable 300 RTC_RTCCL_OutputEnable 299 RTC_RTCDIV_OutputDisable 302 RTC_RTCDIV_OutputEnable 301 RTC_SetHourSystem 276 R20UT2137EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Page 344 of 351 CubeSuite V1 03 00 APPENDIX D INDEX RTC_Userlnit 272 RTC_AlarmDisable 286 RTC_AlarmEnable 285 RTC_AlarmGet 290 RTC_AlarmInterruptCallback 291 RTC_AlarmSet 287 RTC_ChangeCorrectionValue 303 RTC_ConstPeriodinterruptCallback 284 RTC_ConstPeriodinterruptDisable 283 RTC_ConstPeriodinterruptEnable 282 RTC_CounterDisable 275 RTC_CounterEnable 274 RTC_CounterGet 280 RTC_CounterSet 278 RTC_Init 271 RTC_IntervallnterruptDisable 296 RTC_IntervallnterruptEnable 294 RTC_Inter
17. 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 J Source code for the currently selected API function is gener ated Source code for the currently selected API function is not gen erated 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 f File F Ea Common KERR EEEEKKERETETEEKKREETETEEEKAEEERETEEEEEE Copyright C 2008 2012 Renesas Electronic RENESAS ELECTRONICS CONFIDENTIAL AND PROPR This program must be used solely for the p it was furnished by Renesas Electronics Co program may be reproduced or disclosed to form without the prior written permission Corporation Rename Property Interrupt Serial 4 D Converter Timer Watchdog Timer Clock Output DMA LVI This device driver was created by CodeGene 16 Bit Single Chip Microcontrollers Filename CG main c Abstract This file implements main functi APTlib CodeGenerator for 78KOR Fx3 V1 0 Device uPD78F1845_40 gt HF 4 Ge ee ee H H H E H H A Remark To restore the default file name defined by Code Gene
18. iC mn_MasterReceiveStart Starts simple IIC master reception Remark This API function performs byte level simple IIC master reception the number of times specified by the parameter rxnum and stores the data in the buffer specified by the parameter rxbuf Classification CG_serial c Syntax include CG_macrodriver h void IICmn_MasterReceiveStart UCHAR adr UCHAR rxbuf USHORT rxnum Remark mis the unit number and nis the channel number Argumenit s I O Argument Description UCHAR adr Device address UCHAR rxbuf Pointer to a buffer to store the received data USHORT rxnum Total amount of data to receive Remark Below is shown the format for specifying device address aar 7 0 B7 B6 BS B4 B3 B2 Bi BO lt gt 4 gt Fes Slave address Device type lt Device address Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 166 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS iC mn_StartCondition Generates start conditions Remark This API function is used as an internal function of Cmn_MasterSendStart and Cmn_MasterReceiveStart For this reason there is normally no need to call it from a user program Classification CG_serial c Syntax void ITiCmn_StartCondition void Remark mis the unit number and nis the channel number Argumenit s None Return value None
19. 199 IICA_SlaveSendStart 197 IICA_Stop 190 IICA_StopCondition 193 IICA_Userlnit 188 llCmn_lnit 163 lICmn_MasterErrorCallback 171 lICmn_MasterReceiveEndCallback 170 lICmn_MasterReceiveStart 166 lICmn_MasterSendEndCallback 169 lICmn_MasterSendStart 165 lICmn_StartCondition 167 lICmn_Stop 164 ICmn_StopCondition 168 IICn_GetStopConditionCallback 216 IICn_Init 203 ICn_MasterErrorCallback 210 lICn_MasterReceiveEndCallback 209 lICn_MasterReceiveStart 207 lICn_MasterSendEndCallback 208 lICn_MasterSendStart 206 IICn_SlaveErrorCallback 215 lICn_SlaveReceiveEndCallback 214 lICn_SlaveReceiveStart 212 IICn_SlaveSendEndCallback 213 IICn_SlaveSendStart 211 IICn_Stop 205 ICn_Userlnit 204 Interrupt 122 INT_MaskableinterruptEnable 127 INTP_Init 123 INTPn_Disable 129 INTPn_Enable 130 INTP_Userlnit 124 KEY_Disable 131 KEY_Enable 132 KEY_Init 125 KEY_Userlnit 126 INT_MaskableInterruptEnable 127 INTP_Init 123 INTPn_Disable 129 INTPn_Enable 130 INTP_Userlnit 124 K KEY_Disable 131 KEY_Enable 132 KEY_Init 125 KEY_Userlnit 126 L LCD Controller Driver LCD_DisplayOff 321 LCD_DisplayOn 320 LCD_Init 318 LCD_Userlnit 319 LCD_VoltageOff 323 LCD_VoltageOn 322 LCD_DisplayOff 321 LCD_DisplayOn 320 LCD_Init 318 LCD_Userlnit
20. Argumenit s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 187 of 351 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 188 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS IICA_PowerOff Halts the clock supplied to the serial interface IICA Remark Calling this API function changes the serial interface IICA to reset status For this reason writes to the control registers e g IICA control register n IICCTLn after this API function is called are ignored Classification CG_serial c Syntax void IICA_PowerOff void Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 189 of 351 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 190 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS IICA_MasterSendStart Starts IICA master transmission
21. 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 ZA Pin Configurator Property JJ E Product Information a E Package L Package type Yersion Pin configurator version information Pin Configurator Settings 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 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 Displays 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 m
22. 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 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 Remarks 1 pin to 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
23. CubeSuite V1 03 00 APPENDIX C API FUNCTIONS Example Below is an example of changing the output clock of pin PCLBUZO each time an externally connected button is pressed in a system that generates the interrupt INTPO each time the button is pressed CG_main c include CG_macrodriver h include CG_pclbuz h BOOL gFlag Button pressed flag define PCLBUZ_FREQUENCY 8 Total number of output clock types const enum PCLBUZclock gClock PCLBUZ_FREQUENCY Output clock type PCLBUZ_OUTCLK_fSUBO PCLBUZ_OUTCLK_fSUB1 PCLBUZ_OUTCLK_fSUB2 PCLBUZ_OUTCLK_fSUB3 PCLBUZ_OUTCLK_fSUB4 PCLBUZ_OUTCLK_fSUB5 PCLBUZ_OUTCLK_fSUB6 PCLBUZ_OUTCLK_fSUB7 void main void index 0 Initialize button pressed flag PCLBUZO_Start Start clock buzzer output while 1 if gFlag Wait for INTPO PCLBUZ_ChangeFreq gClock indext Change output clock if index gt PCLBUZ_FREQUENCY index 0 gFlag 0 Clear button pressed flag CG_int_user c include CG_macrodriver h extern BOOL gFlag Button pressed flag __interrupt void MD_INTPO void Interrupt processing for INTPO gFlag 1 Set button pressed flag R20UT2137EJ0100 Rev 1 00 ztENESAS Page 316 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS C 3 15 LCD Controller Driver Below is a list of API functions output by Code Generator for LCD controller driver use Table
24. Sets the initial analog voltage 8 bits output to the ANOn pin Sets the initial analog voltage 12 bits output to the ANOn pin Performs initialization necessary to control timer array unit functions Page 94 of 351 CubeSuite V1 03 00 Peripheral Function API Function Name Timer TAUm_Userlnit APPENDIX C API FUNCTIONS Function Performs user defined initialization relating to the timer array unit TAUm_PowerOff Halts the clock supplied to the timer array unit TAUm_Channeln_ Start Starts the count for channel n TAUm_Channeln_Stop Ends the count for channel n TAUm_Channeln_ChangeCondition Changes the counter value TAUm_Channeln_ChangeTimerCon dition Changes the counter value TAUm_Channeln_GetPulseWidth Captures the high low level width measured between pulses of the signal pulses input to the Tlmn pin TAUm_Channeln_ChangeDuty Changes the duty ratio of the PWM signal output to the TOmn pin TAUm_Channeln_SoftWareTrigger On Generates the trigger software trigger for one shot pulse output Watchdog Timer WDT_Init WDT_Userlnit WDT_Restart Performs initialization necessary to control watchdog timer functions Performs user defined initialization relating to the watchdog timer Clears the watchdog timer counter and resumes counting Real time Clock RTC_Init Performs initialization necessary to control real time counter functions
25. 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 TLL input buffer yes is changed as fol lows I O mode type Input mode Built in pull up resistance used No Input buffer type TTL input buffer CG_main c include CG_macrodriver h void main void PORT_ChangePO04Input MD_FALSE MD_TRUE Switch I O mode R20UT2137EJ0100 Rev 1 00 tENESAS Page 119 of 351 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 If the target device is a 78KOR Fx3 then the format for specifying this API function differs depending on whether N ch open drain output is being performed via the target pin and whether slow mode is specified N ch open drain output none Slow mode none Fx3 include CG_macrodriver h void PORT_ChangePmnOutput BOOL initialvalue N ch open drain output yes Slow mode none Fx3 include CG_macrodriver h void PORT_ChangePmnOutput BOOL enablench BOOL initialvalue N ch open drain output none Slow mode yes Fx3 include CG_macrodriver h void PORT_ChangePmnOutput BOOL enableslow BOOL initialvalue N ch open drain output yes Slow mode yes Fx3 include CG_macrod
26. 55 1 8 lt VDD lt 2 7 N Main system clock MAIN setting Internal high speed oscillation FIH High speed system clock fM Internal high speed oscillation clock setting Operation Frequency MHz High speed system clock setting X1 oscillation Extemal clock input fEX Frequency 5 MHz Stable time 52428 80 2 18 MX v us Subsystem clock SUB setting Unused XT1 oscillation XT 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 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 69 of 351 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 t
27. CG int void main void INT_MaskableInterruptEnable INT_INTPO MD_FALSE Disable acceptance of maskable interrupt INTPO Example 2 Below is an example of enabling acceptance of the maskable interrupt INTPO CG_main c include CG_macrodriver h include CGuaint A void main void INT_MaskableInterruptEnable INT_INTPO MD_TRUE Enable acceptance of maskable interrupt INTPO R20UT2137EJ0100 Rev 1 00 2tENESAS Page 128 of 351 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 129 of 351 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 130 of 351 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
28. 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 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 67 of 351 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 controller 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 68 of 351 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 Fy Reflect inPin Generate Code S Wi Se CP OG BA a E V 24a Clock setting On chip debug setting Confirming reset source Power ae VDD setting 27 lt VDD lt
29. R20UT2137EJ0100 Rev 1 00 2tENESAS Page 163 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS iC mn_Stop Ends simple IIC communication Classification CG_serial c Syntax void IICmn_Stop void Remark mis the unit number and nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 164 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS li1C mn_MasterSendStart Starts simple IIC master transmission Remark This API function repeats the byte level simple IIC master transmission from the buffer specified in parame ter txbuf the number of times specified in parameter txnum Classification CG_serial c Syntax include CG_macrodriver h void IICmn_MasterSendStart UCHAR adr UCHAR txbuf USHORT txnum Remark mis the unit number and nis the channel number Argumenit s I O Argument Description UCHAR adr Device address UCHAR txbuf Pointer to a buffer storing the transmission data USHORT txnum Total amount of data to send Remark Below is shown the format for specifying device address aar 7 0 B7 B6 BS B4 B3 B2 Bi BO lt gt 4 gt Fes Slave address Device type lt Device address Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 165 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS
30. 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 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 RTC_ConstPeriodInterruptCallback RTC_AlarmEnable RTC_AlarmDisable RTC_AlarmSet RTC_AlarmGet R20UT2137EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Ends the cyclic interrupt function Performs processing in response to the cyclic interrupt INTRTC Starts the alarm interrupt function Ends the alarm interrupt function Sets the alarm conditions weekday hour minute Reads the alarm conditions weekday hour minute Page 95 of 351 CubeSuite V1 03 00 Peripheral Function API Function Name Real time Clock RTC_AlarmInterruptCallb
31. Remark This 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 R20UT2137EJ0100 Rev 1 00 Sep 01 2012 ztENESAS Page 191 of 351 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 rxbuf 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
32. Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS C 3 11 Watchdog Timer Below is a list of API functions output by Code Generator for watchdog timer use Table C 12 API Functions Watchdog Timer API Function Name Function WDT_Init Performs initialization necessary to control watchdog timer functions WDT_Userlnit Performs user defined initialization relating to the watchdog timer WDT_Restart Clears the watchdog timer counter and resumes counting R20UT2137EJ0100 Rev 1 00 2tENESAS Page 266 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS WDT Init Performs initialization necessary to control watchdog timer functions Classification CG_wdt c Syntax void WDT_Init void Argumenit s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 267 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS WDT_Userlnit Performs user defined initialization relating to the watchdog timer Remark This API function is called as the WDT_ Init callback routine Classification CG_wdt_user c Syntax void WDT_UserInit void Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 268 of 351 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_Restar
33. 1 C 3 2 C 3 3 C 3 4 C 3 5 C 3 6 C 3 7 C 3 8 C 3 9 C 3 10 C 3 11 C 3 12 C 3 13 C 3 14 C 3 15 C 3 16 C 3 17 APPENDIX D System 100 External Bus 111 Port 115 Interrupt 122 Serial 133 Operational Amplifier 217 Comparator PGA 222 A D Converter 230 D A Converter 243 Timer 252 Watchdog Timer 266 Real time Clock 270 Clock Output 304 Clock Output Buzzer Output 310 LCD Controller Driver 317 DMA 324 LVI 334 INDEX 341 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 i
34. 100 Initialize A D conversion complete flag AD_ComparatorOn Move to operation enabled status while wait Ensure stabilization time at least 1 micro second AD_Start Start A D conversion while gFlag Wait for INTAD AD_Read amp buffer Read results of A D conversion AD_SelectADChannel ADCHANNEL1 Switch input pins gFlag 1 Initialize A D conversion complete flag while gFlag Wait for INTAD AD_Read amp buffer Read results of A D conversion R20UT2137EJ0100 Rev 1 00 ztENESAS Page 236 of 351 Sep 01 2012 CubeSuite V1 03 00 AD_SelectADChannel ADCHANNEL1 gFlag 1 while gFlag AD_Read amp buffer AD_Stop AD_ComparatorOff CG_ad_user c include CG_macrodriver h extern BOOL gFlag __interrupt void MD_INTAD void gFlag 0 Example 2 APPENDIX C API FUNCTIONS Switch input pins Initialize A D conversion complete flag Wait for INTAD Read results of A D conversion End A D conversion Move to operation disabled status A D conversion complete flag Interrupt processing for INTAD Set A D conversion complete flag Below is an example of starting analog voltage via the conversion start pin selected in the Code Generator panel A Dj then converting the analog voltage from the ANI1 input pin to digital In the example Operation is se
35. 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 ab Tree aba Tree a ie le Project a i sample Project uPD78F1845_A0 Microcontroller uPD78F1845_A40 Microcontroller mA Pin Configurator Design Tool A Pin Configurator Design Tool Code Generator Design Tool rs sij Code Generator Design Tool A CA78KOR Build Tool Aa CATSKOR Build Tool 78KOR Simulator Debug Tool gt 78KOR Simulator Debug Tool cD Program Analyzer Analyze Tool Program Analyzer Analyze Tool LB File o File 5x Startup E ral Build Tool Output Files sJ Startup E l CodeGenerator dir CG_kdir 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 l 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 Property e Code Generator Property E Product Information Versior VERR Ae AW Release date dd NVIVEYYYY E Generate File Mode Output control of API function Output all API functions accord
36. 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 x Code Generator Property JJ amp File Information O CERES yes File name CG_main c Default name Default operation 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 for 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
37. C 16 API Functions LCD Controller Driver API Function Name Function LCD_Init Performs initialization necessary to control LCD controller driver functions LCD_Userlnit Performs user defined initialization relating to the LCD controller driver LCD_DisplayOn Sets the LCD controller driver to display on status LCD_DisplayOff Sets the LCD controller driver to display off status LCD_VoltageOn Enables operation of the LCD controller driver s voltage boost circuit and capacitor split circuit then outputs the deselect signal from the segment pin LCD_VoltageOff Halts operation of the LCD controller driver s voltage boost circuit and capacitor split circuit then outputs the groundlevel signal from the segment common pin R20UT2137EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Page 317 of 351 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS LCD_Init Performs initialization necessary to control LCD controller driver functions Classification CG_lcd c Syntax void LCD_Init void Argumenit s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 318 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS LCD_Userlnit Performs user defined initialization relating to the LCD controller driver Remark This API function is called as the LCD_Init callback routine Classification CG_lIcd_user c Syntax void LCD_UserInit vo
38. CG_serial_user c include CG_macrodriver h extern BOOL gFlag Reception complete flag __ interrupt void MD_INTSRO void Interrupt processing for INTSRO gUartORxLen gt gUartORxCnt gUartORxLen gUartORxCnt UARTO_ReceiveEndCallback Call callback routine void UARTO_ReceiveEndCallback void Callback routine for INTSRO gFlag 0 Set reception complete flag R20UT2137EJ0100 Rev 1 00 2tENESAS Page 145 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UARTn_SendEndCallback Performs processing in response to the UART transmission complete interrupt INTSTn Remark This API function is called as the callback routine of interrupt process MD_INTSTn corresponding to the UART transmission complete interrupt INTSTn performed when number of transmission data specified by UARTn_SendData parameter txnum has been completed Classification CG_serial_user c Syntax void UARTn_SendEndCallback void Remark nis the channel number Argumenit s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 146 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UARTn_ReceiveEndCallback Performs processing in response to the UART reception complete interrupt INTSRn Remark This API function is called as the callback routine of interrupt process MD_INTSRn corresponding to the UART reception complete interrupt INTSRn perf
39. Figure A 7 Color Palette Custom Web System IB BER e B Bee 2 Tool Tip category 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 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 Displays the Description and Recommend connection for unused pin Connection for Unused strings for the device pin list only Attention only Displays the Attention string for the device pin list Not display Hides tooltips when the mouse cursor hovers over a pin 3 Pin Name Display category Select whether to display additional information about the pin in the device top view R20UT2137EJ0100 Rev 1 00 ztENESAS Page 51 of 351 Sep 01 2012 CubeSuite 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 devi
40. R20UT2137EJ0100 Rev 1 00 2tENESAS Page 167 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS IC mn_StopCondition Generates stop conditions Classification CG_serial c Syntax void IICmn_StopCondition void Remark mis the unit number and nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 168 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS IC mn_MasterSendEndCallback Performs processing in response to the simple IC mn communication complete interrupt INTIIC mn Remark This API function is called as the callback routine of interrupt process MD_INTIIC mn corresponding to the simple IICmn communication complete interrupt INTIIC mn performed when number of transmission data specified by ICmn_MasterSendSiart parameter txnum has been completed Classification CG_serial_user c Syntax void IICmn_MasterSendEndCallback void Remark mis the unit number and nis the channel number Argumenit s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 169 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS lIC mn_MasterReceiveEndCallback Performs processing in response to the simple IC mn communication complete interrupt INTIIC mn Remark This API function is called as the callback routine of interrupt process MD_INTIIC mn corresponding to the simple IICmn
41. Syntax void AD_ComparatorOn void Argumenit s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 234 of 351 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 235 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS Starts A D conversion Remark About 1 micro 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 Example 1 Below is an example of starting analog voltage via the conversion start pin selected in the Code Generator panel A D then converting the analog voltage from the ANI1 input pin to digital In the example Stop is selected in the Com parator operation setting area of the Code Generator panel A D when performing the call to AD_ComparatorOn CG_main c include CG_macrodriver h include CG_ad h BOOL gFlag A D conversion complete flag void main void USHORT buffer 0 wait
42. Syntax void RTC_AlarmEnable void Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 285 of 351 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 286 of 351 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 Lae struct RTCAlarmValue alarmval Alarm conditions weekday hour minute Remark Below is shown the 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 L BCD code minute digit 1 BCD code minute digit 10 0 Fixed 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 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 287 of 351 Sep 01 2012 CubeSuite V1
43. 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 operational amplifier provided by the microcontroller Comparator PGA Opens the Comparator PGA for configuring the information necessary to con trol the functions of comparator programmable gain amplifier provided by the microcontroller A D Converter Opens the A D Converter for configuring the information necessary to control the function of A D converter provided by the microcontroller D A Converter Opens the D A Converter for configuring the information necessary to control the function of D A 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 Clock Output Buzzer Out
44. communication complete interrupt INTIIC mn performed when number of received data spec ified by IICmn_MasterReceiveStart parameter rxnum has been completed Classification CG_serial_user c Syntax void IICmn_MasterReceiveEndCallback void Remark mis the unit number and nis the channel number Argumenit s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 170 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS 11Cmn_MasterErrorCallback Performs processing in response to detection of parity error ACK error in simple IIC communication Classification CG_serial_user c Syntax include CG_macrodriver h void IICmn_MasterErrorCallback MD_STATUS flag Remark mis the unit number and nis the channel number Argumenit s MD_STATUS flag Cause of communication error MD_NACK Acknowledge not detected Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 171 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UARTFn Init Performs initialization of the serial interface UARTFn Classification CG_serial c Syntax void UARTFn_Init void Remark nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 172 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UARTFn_PowerOff Halts the clock supplied to the serial interface UAR
45. complete interrupt INTSRn UARTn_SoftOverRunCallback Performs processing in response to the serial transfer end interrupt INTSRn UARTn_ErrorCallback Performs processing in response to the UART communication error interrupt INTSREn CSImn_Init Performs initialization of the serial interface CSI channel CSImn_Start Sets CSI communication to standby mode CSImn_Stop Ends CSI communication CSImn_SendData Starts CSI data transmission CSImn_ReceiveData Starts CSI data reception CSImn_SendReceiveData Starts CSI data transmission reception CSImn_SendEndCallback Performs processing in response to the CSI communication complete interrupt INTCSImn CSImn_ReceiveEndCallback Performs processing in response to the CSI communication complete interrupt INTCSImn CSImn_ErrorCallback Performs processing in response to the CSI communication error interrupt INTSREn IlCmn_lnit Performs initialization of the serial interface simple IIC channel IlCmn_Stop Ends simple IIC communication IlCmn_MasterSendStart Starts simple IIC master transmission lICmn_MasterReceiveStart lICmn_StartCondition lICmn_StopCondition lICmn_MasterSendEndCallback lICmn_MasterReceiveEndCallback R20UT2137EJ0100 Rev 1 00 Sep 01 2012 Starts simple IIC master reception Generates start conditions Generates stop conditions Performs processing in response to the simple I
46. h include CG_cmppga h MD_STATUS CMPPGA_ChangeCMPnRefVoltage enum CMPRefVoltage voltage Remark nis the channel number Argument s Argument Description enum CMPRefVoltage voltage Comparator n internal reference voltage n 0 In the case of the channel 0 CMPREFVOLO 2AVREF 16 CMPREFVOL1 4AVREF 16 CMPREFVOL2 6AVREF 16 CMPREFVOL3 8AVREF 16 CMPREFVOL4 10AVREF 16 CMPREFVOLS5 12AVREF 16 n 1 In the case of the channel 1 CMPREFVOLO 3AVREF 16 CMPREFVOL1 5AVReEF 16 CMPREFVOL2 7AVREF 16 CMPREFVOL3 QAVREF 16 CMPREFVOL4 11AVREF 16 CMPREFVOL5 13AVREF 16 Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT2137EJ0100 Rev 1 00 ztENESAS Page 228 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CMPPGA_ChangePGAFactor Sets the input voltage amplification factor of a programmable gain amplifier Remark The value specified in parameter factor is set to programmable gain amplifier control register OAM Classification CG_cmppga c Syntax include CG_macrodriver h include CG_cmppga h MD_STATUS CMPPGA_ChangePGAFactor enum PGAFactor factor Argumenit s Argument Description enum PGAFactor factor Input voltage amplification factor PGAFACTORO x4 PGAFACTOR1 x6 PGAFACTOR2 x8 PGAFACTOR3 PGAFACTOR4 Return value MD_OK Normal completion MD_ARGERROR Invalid argument spec
47. in parameter txbuf the number of times specified in parameter txnum Classification CG_serial c Syntax include CG_macrodriver h void IICn_SlaveSendStart UCHAR txbuf USHORT txnum Remark nis the channel number Argumenit s UCHAR txbuf Pointer to a buffer storing the transmission data USHORT txnum Total amount of data to send Return value None R20UT2137EJ0100 Rev 1 00 ztENESAS Page 211 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS liCn_SlaveReceiveStart Starts IICn slave reception Remark This API function performs byte level IICn slave reception the number of times specified by the parameter rxnum and stores the data in the buffer specified by the parameter rxbuf Classification CG_serial c Syntax include CG_macrodriver h void IICn_SlaveReceiveStart UCHAR rxbuf USHORT rxnum Remark nis the channel number Argumenit s UCHAR rxbuf Pointer to a buffer to store the received data USHORT rxnum Total amount of data to receive Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 212 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS liCn_SlaveSendEndCallback Performs processing in response to the IICn communication complete interrupt INTIICn Remark This API function is called as the callback routine of interrupt process MD_INTIICn corresponding to the IICn communication co
48. 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 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 278 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CG_main c include CG rts void main main struct RTCCounterValue counterwriteval RTC_CounterEnable Start count counterwriteval Year 0x08 counterwriteval Month 0x12 counterwriteval Day 0x25 counterwriteval Week 0x05 counterwriteval Hour Ox17 counterwriteval Min 0x30 counterwriteval Sec 0 RTC_SetHourSystem HOUR24 Set clock type RTC_CounterSet counterwriteval Set counter value R20UT2137EJ0100 Rev 1 00 2tENESAS Page 279 of 351 Sep 01 2012 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 CGurtc ih 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 Re
49. main void USHORT value TAU_TDROO_VALUE gt gt 1 TAU_TDROO_VALUE Current interval time TAUO_Channel0_Start Start count TAUO_Channel0_ChangeTimerCondition value Change counter value R20UT2137EJ0100 Rev 1 00 2tENESAS Page 261 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TAUm_Channeln_GetPulseWidth Captures the high low level width measured between pulses of the signal pulses input to the Tlmn pin Classification CG_timer c Syntax include CG_macrodriver h void TAUm_Channeln_GetPulseWidth ULONG width Remark mis the unit number and nis the channel number Argument s O urone wiaem 0 Pointer to an area to store the measurement width 0x0 to 0x1ffff Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 262 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TAUm_Channeln_ChangeDuty Changes the duty ratio of the PWM signal output to the TOmn pin Remark The timing for calling these API functions differs as follows depending on the type of function e g interval timer square wave output or external event counter Function Type Timing for Calling Interval timer Cannot be called Square wave output Cannot be called Divider function Cannot be called External event counter Cannot be called Input pulse interval measurement Cannot be called Input pulse high low level
50. of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UARTn Init Performs initialization of the serial interface UART channel Remark This API function is used as an internal function of SAUm_lnit For this reason there is normally no need to call it from a user program Classification CG_serial c Syntax void UARTn_Init void Remark nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 139 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UARTn_Start Sets UART communication to standby mode Classification CG_serial c Syntax void UARTn_Start void Remark nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 140 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UARTn_Stop Ends UART communication Classification CG_serial c Syntax void UARTn_Stop void Remark nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 141 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UARTn_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 transm
51. 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 5 File me Common ee eee eee ee ee ee ee ee ee ee ee ee a a ee eee CG_main c Copyright C 2008 2012 Renesas Electronic a 45 ELECTRONICS CONFIDENTIAL AND PROPR x cut program must be used solely for the p s furnished by Renesas Electronics Co am may be reproduced or disclosed to form without the prior written permission Corporation CG_userdefine h CG_Ik dr System Port Interrupt Serial A D Converter Timer Watchdog Timer Clock Output This device driver was created by CodeGene 16 Bit Single Chip Microcontrollers Filename CG main c Abstract This file implements main functi APIlib CodeGenerator for 78KOR Fx3 V1 0 Device uPD78F1845 A40 Mi gt mt Fe te R20UT2137EJ0100 Rev 1 00 ztENESAS Page 29 of 351 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
52. 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 d Device Top View Property E Color Power pins Special pins Unused pins Used pins C white Device E DimGray Highlight color for a selected pin E Gray Highlight color for macro pins Aga Highlight color for external peripheral pins E LightGray E ToolTip C Gainsboro Tool tip C WhiteSmoke S Pin Name Display sea d Define name Pin function Custom 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 fo
53. pacsi Save as type Microsoft Office Excel Bool v 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 output format for the device pin list is limited to Microsoft Office Excel Book R20UT2137EJ0100 Rev 1 00 ztENESAS Page 20 of 351 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 Save in B My Recent Documents E Desktop fe My Documents 3 My Computer My Network Places Remark Top View Figure 2 13 Output Device Top View O My Documents my Music Emy Pictures 5 My Videos sample File name Je Save as type Bitmap bmp v Cancel If a device top view has been already output that view will be overwritten by selecting File menu gt gt Save R20UT2137EJ0100 Rev 1 00 Sep 01 2012 ztENESAS Page 21 of 351 CubeSuite V1 03 00 CHAPTER 3 FUNCTIONS Code Generator CHAPTER 3 FUNCTIONS Code Generator This chapter describes the key functions
54. selecting the source 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 3 You can confirm the current setting that determines whether or not to generate the source code by checking the type of icon R20UT2137EJ0100 Rev 1 00 2tENESAS Page 72 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE 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 Ja 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
55. show or hide the define name Device Top iew Settings the Device Pin List in appended format Display format a LJ E Red GB Green WM Black HM Blue E LightGray E Red E Yelow GB Green Display all Display iv Display Not display Select one of the following two types for Define name whether to display the Define Name string of Displays the Define Name string of the device pin list in appended Not display Hides the Define Name string of the device pin list 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 R20UT2137EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Page 18 of 351 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 Functi
56. the source code 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 oH 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 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 73 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Help menu Code Generator Preview panel dedicated items Open Help for Code Generator Preview Panel Displays the help of this panel Context menu The following context menu items are displayed by right clicking the mouse Generate code Makes a setting
57. 013 OUEFS oMtian owani EFI OMWERU AEM OMVERSAINTN OMSERKHINTIN OMNERNTANS OMMERN DNS OMKER ARIEL F8KOR KG3 OMWERATCOVTOICE RS uPD78F1166_40 OHNEBNTISTIR ONNENS ORREN ORENA OnsWEN ORREN OnvEnS OVEN OKEN DEIN OMKRATANR OMKER 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 R20UT2137EJ0100 Rev 1 00 Sep 01 2012 ztENESAS Page 14 of 351 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 E Product Information Versior VE AK Ae AK ddi VIIVEYYYY 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 15 of 351 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
58. 03 00 APPENDIX C API FUNCTIONS BCD code hour digit 1 BCD code hour digit 10 00 Fixed Alarmww Weekday Below are shown the meanings of each bit of the structure member Alarmww A A A A A L______ 4 Sunday 1 Monday 1 Tuesday 1 Wednesday 1 Thursday 1 Friday L 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 0x30 RTC_AlarmSet alarmval Set conditions R20UT2137EJ0100 Rev 1 00 2tENESAS Page 288 of 351 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 alarmval Alarmww 0x41 RTC_AlarmSet alarmval Change conditions R20UT2137EJ0100 Rev 1 00 2tENESAS Page 289 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_Alarm
59. 08 CG_SelectStabTime 110 CLOCK Init 101 Clock Output 304 PCL_ChangeFreq 309 PCL_Init 305 PCL_Start 307 PCL_Stop 308 PCL_Userlnit 306 Clock Output Buzzer Output 310 PCLBUZn_ChangeFreq 315 PCLBUZn_Init 311 PCLBUZn_ Start 313 PCLBUZn_Stop 314 PCLBUZn_Userlnit 312 CLOCK_Userlnit 102 CMPPGA_ChangeCMPnRefVoltage 228 CMPPGA_ChangePGAFactor 229 CMPPGA_Init 223 CMPPGA_PowerOff 225 CMPPGA_Start 226 CMPPGA_Stop 227 CMPPGA_Userlnit 224 Code Generator panel 69 R20UT2137EJ0100 Rev 1 00 Sep 01 2012 ztENESAS Page 341 of 351 CubeSuite V1 03 00 APPENDIX D INDEX Code Generator Preview panel 72 Column Chooser dialog box 77 Comparator PGA 222 CMPPGA_ChangeCMPnRefVoltage 228 CMPPGA_ChangePGAFactor CMPPGA_Init 223 CMPPGA_PowerOff 225 CMPPGA_Start 226 CMPPGA_Stop 227 CMPPGA_Userlnit 224 CSImn_ErrorCallback 162 CSImn_Init 151 CSImn_ReceiveData 156 CSImn_ReceiveEndCallback 161 CSImn_SendData 154 CSImn_SendEndCallback 160 CSImn_SendReceiveData 158 CSImn_Start 152 CSImn_Stop 153 D D A Converter 243 DA_Init 244 DAn_Set12BitsValue 251 DAn_Set8BitsValue 250 DAn_SetValue 249 DAn_Start 247 DAn_Stop 248 DA_PowerOff 246 DA _Userlnit 245 DA Init 244 DAn_Set12BitsValue 251 DAn_Set8BitsValue 250 DAn_SetValue
60. 1_ Start Start D A conversion DAO_SetValue Ox7f Set analog voltage CG_timer_user c include CG_macrodriver h UCHAR gValue 0 __interrupt void MD_INTTMO5 void Interrupt processing for INTTMO5 DA1_SetValue gValuet Set analog voltage R20UT2137EJ0100 Rev 1 00 2tENESAS Page 249 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS DAn_Set8BitsValue Sets the analog voltage 8 bits output to the ANOn pin Classification CG_da c Syntax include CG_macrodriver h void DAn_Set8BitsValue UCHAR value Remark nis the channel number Argument s Return value None Example Below is an example of setting analog voltage to channels 0 and 1 CG_main c void main void DAO_Start Start D A conversion DA1_Start Start D A conversion DAO_Set8BitsValue Ox7f Set analog voltage CG_timer_user c include CG_macrodriver h UCHAR gValue 0 __interrupt void MD_INTTMO5 void Interrupt processing for INTTMO5 DA1_Set8BitsValue gValuet Set analog voltage R20UT2137EJ0100 Rev 1 00 2tENESAS Page 250 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS DAn_Set12BitsValue Sets the analog voltage 12 bits output to the ANOn pin Classification CG_da c Syntax include CG_macrodriver h void DAn_Set12BitsValue U
61. 20UT2137EJ0100 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 ztENESAS Page 40 of 351 CubeSuite V1 03 00 APPENDIX A WINDOW 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 a
62. 249 DAn_Start 247 DAn_Stop 248 DA_PowerOff 246 DA _Userlnit 245 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 DMA 324 DMAn_CheckStatus 331 DMAn_Disable 328 DMAn_Enable 327 DMAn_Hold 329 DMAn_Init 325 DMAn_Restart 330 DMAn_SetData 332 DMAn_SoftwareTriggerOn 333 DMAn_Userlnit 326 DMAn_CheckStatus 331 DMAn_Disable 328 DMAn_Enable 327 DMAn_Hold 329 DMAn_Init 325 DMAn_Restart 330 DMAn_SetData 332 DMAn_SoftwareTriggerOn 333 DMAn_Userlnit 326 E External Bus 111 BUS _Init 112 BUS_PowerOff 114 BUS _Userlnit 113 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 202 R20UT2137EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Page 342 of 351 CubeSuite V1 03 00 APPENDIX D INDEX IICA_Init 187 IICA_MasterErrorCallback 196 IICA_MasterReceiveEndCallback 195 IICA_MasterReceiveStart 192 IICA_MasterSendEndCallback 194 IICA_MasterSendStart 191 IICA_PowerOff 189 IICA_SlaveErrorCallback 201 IICA_SlaveReceiveEndCallback 200 IICA_SlaveReceiveStart 198 IICA_SlaveSendEndCallback
63. 3 Cannot change to the external main system clock Exit with error abend Kx3 Cannot change to the subsystem clock because the XT1 and XT2 pins are in input mode MD_ERROR4 Exit with error abend Ix3 Kx3 A Kx3 L Lx3 Cannot change to the subsystem clock MD_ARGERROR Invalid argument specification R20UT2137EJ0100 Rev 1 00 2tENESAS Page 105 of 351 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 Fx3 SYSTEMCLOCK fPLL SYSONEHALF fPLL 2 SYSONEFOURTH fPLL 4 SYSONEEIGHTH fPLL 8 SYSONESIXTEENTH fPLL 16 SYSONETHIRTYSECOND PLL 32 Ix3 Kx3 Kx3 L SYSTEMCLOCK fMAIN SYSONEHALF fMAIN 2 SYSONEFOURTH fMAIN 4 SYSONEEIGHTH fMAIN 8 SYSONESIXTEENTH fMAIN 16 SYSONETHIRTYSECOND fMAIN 32 Kx3 A Lx3 SYSTEMCLOCK fMAIN SYSONEHALF fMAIN 2 SYSONEFOURTH fMAIN 4 SYSONEEIGHTH fMAIN 8 SYSONESIXTEENTH fMAIN 16 SYSONETHIRTYSECOND fMAIN 32 SUB fSUB SUBONEHALF fSUB 2 Remark fPLL signifies the frequency of the PLL clock fMAIN signifies the frequency of the main system clock and fSUB signifies the frequency of the subsystem cl
64. 319 LCD_VoltageOff 323 LCD_VoltageOn 322 LVI 334 LVI_Init 335 LVI_InterruptModeStart 337 LVI_ResetModeStart 338 LVI_SetLViLevel 340 LVI_Stop 339 LVI_Userlnit 336 LVI_Init 335 R20UT2137EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Page 343 of 351 CubeSuite V1 03 00 APPENDIX D INDEX LVI_InterruptModeStart 337 LVI_ResetModeStart 338 LVI_SetLViLevel 340 LVI_Stop 339 LVI_Userlnit 336 M Macro Setting tab 56 Macro tab 62 Main window 39 N New Column dialog box 80 O OPAMP_Init 218 OPAMP _Userlnit 219 Operational Amplifier 217 AMPn_Start 220 AMPn_Stop 221 OPAMP _Init 218 OPAMP _Userlnit 219 Output panel 75 P PCLBUZn_ChangeFreq 315 PCLBUZn_Init 311 PCLBUZn_Start 313 PCLBUZn_Stop 314 PCLBUZn_Userlnit 312 PCL_ChangeFreq 309 PCL_Init 305 PCL_Start 307 PCL_Stop 308 PCL_Userlnit 306 Pin Configurator Settings tab 48 Pin Number tab 60 Port 115 PORT_ChangePmninput 118 PORT_ChangePmnOutput 120 PORT_Init 116 PORT_Userlnit 117 PORT_ChangePmninput 118 PORT_ChangePmnOutput 120 PORT_Init 116 PORT_Userlnit 117 Project Tree panel 42 Property panel 45 Device Pin List Information tab 49 Device Top View Settings tab 50 File Setting tab 57 Generation tab 53 Macro Setting tab 56
65. 6 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CG_serial_user c include CG_macrodriver h extern BOOL gFlag Reception complete flag __interrupt void MD_INTCSIOO void Interrupt processing for INTCSIOO if gCsi0ORxCnt lt gCsi0ORxLen gCsi0ORxCnt gCsi0ORxLen CSI00_ReceiveEndCallback Call callback routine void CSI00_ReceiveEndCallback void Callback routine for INTCSIOO gFlag 0 Set reception complete flag R20UT2137EJ0100 Rev 1 00 2tENESAS Page 157 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CSImn_SendReceiveData Starts CSI data transmission reception Remarks 1 This API function repeats the byte level CSI transmission from the buffer specified in parameter txbuf the number of times specified in parameter txnum 2 This API function performs byte level CSI 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 reception CSImn_Start must be called before this API function is called Classification CG_serial c Syntax include CG_macrodriver h MD_STATUS CSImn_SendReceiveData UCHAR txbuf USHORT txnum UCHAR rxbuf Remark mis the unit number and nis the channel number Argument s Argument Description UCHAR txbuf Pointer to a buffer storing the transmission data U
66. 8 TAUm_Channeln_ChangeDuty 263 TAUm_Channeln_ChangeTimerCondition 260 TAUm_Channeln_GetPulseWidth 262 TAUm_Channeln_SoftWareTriggerOn 265 TAUm_Channeln_Start 256 TAUm_Channeln_Stop 257 TAUm_Init 253 TAUm_PowerOff 255 TAUm_Userlnit 254 Timer 252 TAUm_Channeln_ChangeCondition 258 TAUm_Channeln_ChangeDuty 263 TAUm_Channeln_ChangeTimerCondition 260 TAUm_Channeln_GetPulseWidth 262 TAUm_Channeln_SoftWareTriggerOn 265 TAUm_Channeln_Start 256 TAUm_Channeln_Stop 257 TAUm_Init 253 TAUm_PowerOff 255 TAUm_Userlnit 254 U UARTFn_DataComparisonDisable 180 UARTFn_DataComparisonEnable 179 UARTFn_ErrorCallback 186 UARTFn_ExpBitCetectCallback 184 UARTFn_IDMatchCallback 185 UARTFn_Init 172 UARTFn_PowerOff 173 UARTFn_ReceiveData 177 UARTFn_ReceiveEndCallback 182 UARTFn_SendData 176 UARTFn_SendEndCallback 181 UARTFn_SetComparisonData 178 UARTFn_SoftOverRunCallback 183 UARTFn_Start 174 UARTFn_Stop 175 UARTn_ErrorCallback 149 UARTn_Init 139 UARTn_ReceiveData 144 UARTn_ReceiveEndCallback 147 UARTn_SendData 142 UARTn_SendEndCallback 146 R20UT2137EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Page 346 of 351 CubeSuite V1 03 00 APPENDIX D INDEX UARTn_SoftOverRunCallback 148 UARTn_Start 140 UARTn_Stop 141 Ww Watchdog Timer 266 WDT_Init 267 WD
67. API FUNCTIONS C 3 3 Port Below is a list of API functions output by Code Generator for port use Table C 4 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 to output mode R20UT2137EJ0100 Rev 1 00 ztENESAS Page 115 of 351 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 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 116 of 351 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 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 117 of 351 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 s
68. APPENDIX C API FUNCTIONS CSImn_Init Performs initialization of the serial interface CSI channel Remark This API function is used as an internal function of SAUm_Init For this reason there is normally no need to call it from a user program Classification CG_serial c Syntax void CSImn_Init void Remark mis the unit number and nis the channel number Argumenit s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 151 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CSImn_Start Sets CSI communication to standby mode Classification CG_serial c Syntax void CSImn_Start void Remark mis the unit number and nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 152 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CSImn_Stop Ends CSI communication Classification CG_serial c Syntax void CSIma_Stop void Remark mis the unit number and nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 153 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CSImn_SendData Starts CSI data transmission Remarks 1 This API function repeats the byte level CSI transmission from the buffer specified in parameter txbuf the number of times specified in parameter txnum 2 Whe
69. C n D ms n lt A 5 D 2CENESAS CubeSuite V1 03 00 Integrated Development Environment User s Manual 78KOR Design Target Device 78KOR 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 How to Use This Manual This manual describes the role of the CubeSuite integrated development environment for developing applications and systems for 78KOR microcontrollers and provides an outline of its features CubeSuite is an integrated development environment IDE for 78KOR 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 syst
70. CA_SlaveSendStart Starts IICA slave transmission IICA_SlaveReceiveStart Starts IICA slave reception IICA_SlaveSendEndCallback Performs processing in response to the IICA communication complete interrupt INTIICA IICA_SlaveReceiveEndCallback Performs processing in response to the IICA communication complete interrupt INTIICA 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 ICn_Init llCn_Userlnit IlCn_Stop IlCn_MasterSendStart Performs initialization of the serial interface IICn Performs user defined initialization of the serial interface IICn Ends IICn communication Starts IICn master transmission lICn_MasterReceiveStart Starts IICn master reception lICn_MasterSendEndCallback Performs processing in response to the IICn communication complete interrupt INTIICn lICn_MasterReceiveEndCallback Performs processing in response to the IICn communication complete interrupt INTIICn lICn_MasterErrorCallback Performs processing in response to detection of error in IICn master communication lICn_SlaveSendStart Starts IICn slave transmission lICn_SlaveReceiveStart Starts IICn slave reception lICn_SlaveSendEndCallback Performs processing in response to th
71. CHAR value Remark nis the channel number Argument s Return value None Example Below is an example of setting analog voltage to channels 0 and 1 CG_main c void main void DAO_Start Start D A conversion DA1_Start Start D A conversion DAO_Set12BitsValue Oxlff Set analog voltage CG_timer_user c include CG_macrodriver h UCHAR gValue 0 __interrupt void MD_INTTMO5 void Interrupt processing for INTTMO5 DA1_Set12BitsValue gValuet Set analog voltage R20UT2137EJ0100 Rev 1 00 2tENESAS Page 251 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS C 3 10 Timer Below is a list of API functions output by Code Generator for timer array unit use Table C 11 API Functions Timer API Function Name Function TAUm_Init Performs initialization necessary to control timer array unit functions TAUm_Userlnit Performs user defined initialization relating to the timer array unit TAUm_PowerOff Halts the clock supplied to the timer array unit TAUm_Channeln_Start Starts the count for channel n TAUm_Channeln_Stop Ends the count for channel n TAUm_Channeln_ChangeCondition Changes the counter value TAUm_Channeln_ChangeTimerCond ition Changes the counter value TAUm_Channeln_GetPulseWidth Captures the high low level width measured between pulses of the s
72. CTRONICS CONFIDENTIAL AND PROPRIETARY Interrupt This program must be used solely for the purpose Serial it was furnished by Renesas Electronics Corporat A D Converter program may be reproduced or disclosed to others Timer form without the prior written permission of Re Watchdog Timer Corporation Clock Output DMA LYI This device driver was created by CodeGenerator y m gt p3 p H H p 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 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 27 of 351 Sep 01 2012 CubeSuite V1 03 00 CHAPTER
73. Calling this API function changes the D A converter to reset status For this reason writes to the control reg isters e g D A converter mode register DAM after this API function is called are ignored Classification CG_da c Syntax void DA_PowerOff void Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 246 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS Starts D A conversion Classification CG_da c Syntax void DAn_Start void Remark nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 247 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS DAn_Stop Ends D A conversion Classification CG_da c Syntax void DAn_Stop void Remark nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 248 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS DAn_SetValue Sets the analog voltage output to the ANOn pin Classification CG_da c Syntax include CG_macrodriver h void DAn_SetValue UCHAR value Remark nis the channel number Argument s Return value None Example Below is an example of setting analog voltage to channels 0 and 1 CG_main c void main void DAO_Start Start D A conversion DA
74. Figure A 13 Macro Tab Device Pin List E3 a G EH y ee Macro Name H Used Used in Other Macro 4 Pin Number H PinNa Function AVREFO AVREFO ASS AVSS 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 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 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 62 of 351 Sep 01 2012
75. Get 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 Argument s o 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 290 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_AlarminterruptCallback Performs processing 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 291 of 351 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
76. IC mn communication complete inter rupt INTIIC mn Performs processing in response to the simple IIC mn communication complete inter rupt INTIIC mn ztENESAS Page 133 of 351 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS API Function Name Function lICmn_MasterErrorCallback Performs processing in response to detection of parity error ACK error in simple IIC communication UARTFn_Init Performs initialization of the serial interface UARTFn UARTFn_PowerOff Halts the clock supplied to the serial interface UARTFn UARTFn_ Start Sets UARTF communication to standby mode UARTFn_Stop Ends UARTF communication UARTFn_SendData Starts UARTF data transmission UARTFn_ReceiveData Starts UARTF data reception UARTFn_SetComparisonData Sets the data to compare to the received data UARTFn_DataComparisonEnable Starts the data comparison UARTFn_DataComparisonDisable Ends the data comparison UARTFn_SendEndCallback Performs processing in response to the transmission interrupt INTLTn UARTFn_ReceiveEndCallback UARTFn_SoftOverRunCallback UARTFn_ExpBitCetectCallback UARTFn_IDMatchCallback UARTFn_ErrorCallback Performs processing in response to the reception complete interrupt INTLRn Performs processing in response to the reception complete interrupt INTLRn Performs processing in response to the status interrupt INTLSn Performs processing in response to th
77. Init PCLBUZn_ Start PCLBUZn_Stop PCLBUZn_ChangeFreq CG_pclbuz_user c PCLBUZn_Userlnit CG_pclbuz h LCD Controller Driver CG_lcd c LCD_Init LCD_DisplayOn LCD_DisplayOff LCD_VoltageOn LCD_VoltageOff CG_lIcd_user c LCD_Userlnit CG_lcd h CG_dma c DMAn_Init DMAn_Enable DMAn_Disable DMAn_Hold DMAn_Restart DMAn_CheckStatus DMAn_SetData DMAn_SoftwareTriggerOn CG_dma_user c DMAn_Userlnit MD_INTDMAn CG_dma h CG_lIvi c LVI_Init LV _InterruptModeStart LVI_ResetModeStart LVI_Stop LVI_SetLVILevel CG_lvi_user c LVI_Userlnit MD_INTLVI CG_lIvi h R20UT2137EJ0100 Rev 1 00 Sep 01 2012 ztENESAS Page 89 of 351 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 F
78. Kx3 L Lx3 MD_OK Normal completion MD_ARGERROR Invalid argument specification Kx3 None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 294 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS 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 RTC_IntervalStop RTC_IntervalInterruptEnable INTERVAL6 Start interval interrupt function End interval interrupt function Start interval interrupt function R20UT2137EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Page 295 of 351 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 296 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_RTC1HZ_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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 297 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_RTC1HZ_OutputDisable Disabl
79. NEMONTH 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 CGurte h void main void ee ee ee 3 End of cyclic interrupt function ee E een re HALFSEC Start of cyclic interrupt function R20UT2137EJ0100 Rev 1 00 2tENESAS Page 282 of 351 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 283 of 351 Sep 01 2012 CubeSuite V1 03 00 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 284 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_AlarmEnable Starts the alarm interrupt function Classification CG_rtc c
80. NESAS Page 184 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UARTFn_IDMatchCallback Performs processing in response to the status interrupt INTLSn Remark This API function is called as the callback routine of interrupt process MD_INTLSn corresponding to the status interrupt INTLSn Classification CG_serial_user c Syntax void UARTFn_IDMatchCallback void Remark nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 185 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UARTFn_ErrorCallback Performs processing in response to the status interrupt INTLSn Remark This API function is called as the callback routine of interrupt process MD_INTLSn corresponding to the status interrupt INTLSn Classification CG_serial_user c Syntax include CG_macrodriver h void UARTFn_ErrorCallback UCHAR err_type Remark nis the channel number Argumenit s I O Argument Description O UCHAR err_type Trigger for status interrupt 00000xx1B Overrun errot 00000x1xB Framing error 000001xxB Parity error Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 186 of 351 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
81. OR Fx3 or 78KOR Ix3 then keyword that can be specified for evel is limited to LVILEVELO to LVILEVEL9 Return value Macro Description MD_OK Normal completion MD_ERROR Exit with error abend MD_ARGERROR Invalid argument specification R20UT2137EJ0100 Rev 1 00 Sep 01 2012 ztENESAS Page 340 of 351 CubeSuite V1 03 00 APPENDIX D INDEX A AD_ComparatorOff 235 AD_ComparatorOn 234 A D Converter 230 AD_ComparatorOff 235 AD_ComparatorOn 234 AD_Init 231 AD_PowerOff 233 AD_Read 241 AD_ReadByte 242 AD_SelectADChannel 240 AD_Start 236 AD_Stop 239 AD_Userlnit 232 AD_Init 231 AD_PowerOff 233 AD_Read 241 AD_ReadByte 242 AD_SelectADChannel 240 AD_Start 236 AD_Stop 239 AD_Userlnit 232 AMPn_Start 220 AMPn_Stop 221 API functions 90 A D Converter 230 Clock Output 304 Clock Output Buzzer Output 310 Comparator PGA 222 D A Converter 243 DMA 324 External Bus 111 Interrupt 122 LVI 334 Operational Amplifier 217 Port 115 Real time Clock 270 Serial 133 APPENDIX D INDEX System 100 Timer 252 Watchdog Timer 266 B Browse For Folder dialog box 81 BUS Init 112 BUS _PowerOff 114 BUS _Userlnit 113 Cc CG_ChangeClockMode 104 CG_ChangeFrequency 106 CG_ReadResetSource 103 CG_SelectPowerSaveMode 1
82. PENDIX C API FUNCTIONS TAUm_Channeln_ChangeTimerCondition Changes the counter value Remarks 1 The value specified in parameter regvalue is set to timer data register mn TDRmn 2 The timing for calling these API functions differs as follows depending on the type of function e g interval timer square wave output or external event counter Function Type Interval timer Timing for Calling Can call at user discretion Square wave output Can call at user discretion Divider function Can call at user discretion External event counter Can call at user discretion Input pulse interval measurement Cannot be called Input pulse high low level width measurement Cannot be called PWM output Cannot be called One shot pulse output Cannot be called during operation Multiple PWM output Cannot be called Classification CG_timer c Syntax include CG_macrodriver h TAUm_Channeln_ChangeTimerCondition USHORT regvalue j void Remark mis the unit number and nis the channel number Argument s Return value None Example The example below shows changing the interval time to one half In this example channel 0 has been selected for the interval timer CG_main c include CG_macrodriver h R20UT2137EJ0100 Rev 1 00 RENESAS Sep 01 2012 Page 260 of 351 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS void
83. PI function is called 3 Ifthe serial interface UARTFn is used in expansion bit mode then store the data to send in the buffer specified by parameter txbuf in the following format 8 bit data Expansion bit 8 bit data Expansion bit Classification CG_serial c Syntax include CG_macrodriver h MD_STATUS UARTFn_SendData UCHAR txbuf USHORT txnum Remark nis the channel number Argumenit s UCHAR txbuf Pointer to a buffer storing the transmission data USHORT txnum Total amount of data to send Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification MD_DATAEXISTS Executing transmission process R20UT2137EJ0100 Rev 1 00 ztENESAS Page 176 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UARTFn_ReceiveData Starts UARTF data reception Remarks 1 This API function performs byte level UARTF reception the number of times specified by the parameter rxnum and stores the data in the buffer specified by the parameter rxbur 2 Actual UARTF reception starts after this API function is called and UARTFn_Siart is then called 3 Ifthe serial interface UARTFn is used in expansion bit mode then the received data is stored in the buffer specified by parameter rxbuf in the following format 8 bit data Expansion bit 8 bit data Expansion bit Classification CG_serial c Syntax include CG_macrodriver h
84. 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 Save project Save a project Remark See CubeSuite Integrated Development Environment User s Manual Start for details on Save project R20UT2137EJ0100 Rev 1 00 2tENESAS Page 9 of 351 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 x Description Pin Number Pin Name 4 Function 1 0 4 N ch 1 P142 _SCK20 SCL20 2 PI41 PCLBUZTAINTP Free 3 P1I40 PCLBUZOAINTPE Free 4 P120 INTPO EXLM Free 5 P47 INTP2 Free 6 P46 INTP1 T105 T006 Free CE 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 wh
85. R20UT2137EJ0100 Rev 1 00 Sep 01 2012 DMAn_Init Performs initialization necessary to control DMA controller functions DMAn_Userlnit Performs user defined initialization relating to the DMA con troller DMAn_Enable Enables operation of channel n DMAn_Disable Disables operation of channel n DMAn_Hold Holds a DMA start request DMAn_Restart Releases hold on a DMA start request DMAn_CheckStatus DMAn_SetData DMAn_SoftwareTriggerOn LVI_Init Reads the transfer status transfer complete transfer ongoing Sets the RAM address of the transfer source destination and the number of times the data has been transferred Starts DMA transfer when DMA operation is enabled Performs initialization necessary to control low voltage detec tor 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 2tENESAS Sets the low voltage detection level Page 97 of 351 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
86. S 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 source code by selecting Generation tab gt gt Generate file in the Property panel Figure 3 11 Change Output Mode Property x e Code Generator Property J E Product Information 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 Register 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 32 of 351 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 3 FUNCTIONS Code Generator 3 5 5 Change output destination folde
87. SHORT 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 CSI transmission of four bytes of fixed length data from channel 00 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 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 158 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS Initialize flag CSI0O_Start Start CSI communication CSI00_SendReceiveData amp txbuf txnum amp rxbuf Start CSI send receive while gSlag Wait for txnum transmissions receptions CG_serial_user c include CG_macrodriver h extern BOOL gSflag Transmission complete flag __interrupt void MD_INTCSIOO void Interrupt processing for INTCSIOO if gCsi00TxCnt gt 0 CSI00_SendEndCallback Call callback routine void CSI00_SendEndCallback void Callback routine for INTCSIOO gSflag 0 Set transmission complete flag R20UT2137EJ0100 Rev 1 00 2tENESAS Page 159 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CSImn_SendEndCallback Performs processing in response to the CSI communication complete int
88. SImn_Stop CSImn_SendData CSImn_ReceiveData CSImn_SendReceiveData llCmn_lnit lICmn_Stop llCmn_MasterSendStart llCmn_MasterReceiveStart llICmn_StartCondition lICmn_StopCondition UARTFn_lnit UARTFn_PowerOff UARTFn_Start UARTFn_Stop UARTFn_SendData UARTFn_ReceiveData UARTFn_SetComparisonData UARTFn_DataComparisonEnable UARTFn_DataComparisonDisable IICA_Init IICA_PowerOff IICA_Stop IICA_MasterSendStart IICA_MasterReceiveStart IICA_StopCondition IICA_SlaveSendStart IICA_SlaveReceiveStart Page 85 of 351 CubeSuite V1 03 00 Peripheral Function CG_serial c Source File Name WCn_Init ICn_Stop APPENDIX B OUTPUT FILES Names of API Functions Included IICn_MasterSendStart IICn_MasterReceiveStart IICn_SlaveSendStart lICn_SlaveReceiveStart R20UT2137EJ0100 Rev 1 00 Sep 01 2012 CG_serial_user c ztENESAS SAUm_UserlInit UARTn_SendEndCallback UARTn_ReceiveEndCallback UARTn_SoftOverRunCallback UARTn_ErrorCallback CSImn_SendEndCallback CSImn_ReceiveEndCallback CSImn_ErrorCallback IICmn_MasterSendEndCallback lICmn_MasterReceiveEndCallback l Cmn_MasterErrorCallback UARTFn_SendEndCallback UARTFn_ReceiveEndCallback UARTFn_SoftOverRunCallback UARTFn_ExpBitCetectCallback UARTFn_IDMatchCallback UARTFn_ErrorCallback IICA_Userlnit IICA_MasterSendEndCallback IICA_MasterReceiveEndCallback IICA_MasterErrorCallback IICA_SlaveSendEndCallback IICA_SlaveReceiveEndCallback IICA_SlaveErrorCallback IICA_Get
89. Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS DMAn_Userlnit Performs user defined initialization relating to the DMA controller Remark This API function is called as the DMAn_ Init callback routine Classification CG_dma_user c Syntax void DMAn_UserInit void Remark nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 326 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS DMAn Enable Enables operation of channel n Classification CG_dma c Syntax void DMAn_Enable void Remark nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 327 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS DMAn_Disable Disables operation of channel n Remarks 1 This API function does not forcibly terminate DMA transfer 2 Before using this API function you must confirm that transmission has ended via DMAn_CheckSiatus Classification CG_dma c Syntax void DMAn_Disable void Remark nis the channel number Argument s None Return value None Example The example below shows setting the operation mode of channel 0 to disabled CG_main c include CG_macrodriver h void main void while MD_COMPLETED DMAO_CheckStatus Check transfer status DMAO_Disable Cha
90. StopConditionCallback lICn_Userlnit IICn_MasterSendEndCallback lICn_MasterReceiveEndCallback lICn_MasterErrorCallback IICn_SlaveSendEndCallback lICn_SlaveReceiveEndCallback ICn_SlaveErrorCallback IICn_GetStopConditionCallback MD_INTSRn MD_INTSREn MD_INTSTn MD_INTCSImn MD_INTIICmn MD_INTLTn MD_INTLRn MD_INTLSn MD_INTIICn Page 86 of 351 CubeSuite V1 03 00 Peripheral Function Source File Name CG_serial_user c APPENDIX B OUTPUT FILES Names of API Functions Included MD_INTIICA CG_serial h Operational Amplifier CG_opamp c OPAMP _Init AMPn_ Start AMPn_Stop CG_opamp_user c OPAMP _Userlnit CG_opamp h Comparator PGA CG_cmppga c CMPPGA Init CMPPGA_PowerOff CMPPGA_ Start CMPPGA_Stop CMPPGA_ChangeCMPrRefVoltage CMPPGA_ChangePGAFactor CG_cmppga_user c CMPPGA_Userlnit MD_INTCMPn CG_cmppga h A D Converter CG_ad c AD_Init AD_PowerOff 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 D A Converter CG_da c DA_Init DA_PowerOff DAn_Start DAn_Stop DAn_SetValue DAn_Set8BitsValue DAn_Set12BitsValue CG_da_user c DA_UserlInit CG_da h R20UT2137EJ0100 Rev 1 00 Sep 01 2012 CG_timer c ztENESAS TAUm_ Init TAUm_PowerOff TAUm_Channeln_Start TAUm_Channeln_Stop TAUm_Channeln_ChangeCondition TAUm_Channeln_Chan
91. TER 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 E E ae ee Pin Name H Function 1 0 4 N ch 4 DefineN Pin Number Macro External Peripheral Device Pin List Ce E r Pin Number Macro External Periphera Yoo y 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 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 12 of 351 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 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 Confi
92. TFn Remark Calling this API function changes the serial interface UARTFn to reset status For this reason writes to the control registers e g LIN UARTn status register UFnSTR after this API function is called are ignored Classification CG_serial c Syntax void UARTFn_PowerOff void Remark nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 173 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UARTFn _ Start Sets UARTF communication to standby mode Classification CG_serial c Syntax void UARTFn_Start void Remark nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 174 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UARTFn_Stop Ends UARTF communication Classification CG_serial c Syntax void UARTFn_Stop void Remark nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 175 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UARTFn_SendData Starts UARTF data transmission Remarks 1 This API function repeats the byte level UARTF transmission from the buffer specified in parameter txbuf the number of times specified in parameter txnum 2 When performing a UARTF transmission UARTFn_Siart must be called before this A
93. T_Restart 269 WDT_Userlnit 268 WDT_Init 267 WDT_Restart 269 WDT_Userlnit 268 Window reference 38 R20UT2137EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Page 347 of 351 Revision Record Description Sep 01 2012 aa First Edition issued CubeSuite V1 03 00 User s Manual 78KOR Design Publication Date Rev 1 00 Sep 01 2012 Published by Renesas Electronics Corporation CubeSuite V1 03 00 7rCENESAS Renesas Electronics Corporation R20UT2137EJ0100
94. This API 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 IICA_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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 198 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS IICA_SlaveSendEndCallback Performs processing in response to the IICA communication complete interrupt INTIICA Remark This API function is called as the callback routine of interrupt process MD_INTIICA corresponding to the IICA communication complete interrupt INTIICA Classification CG_serial_user c Syntax void ITICA_SlaveSendEndCallback void Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 199 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS IICA_SlaveReceiveEndCallback Performs processing in response to the IICA communication complete interrupt INTIICA Remark This API function is called as the callback routine of interrupt process MD_INTIICA corresponding to the IICA communication complete interrupt INTIICA Classification CG_serial_user c Syntax voi
95. X1CLK X1 clock SYSEXTCLK External main system clock FILCLK Internal low speed oscillation clock Ix3 HIOCLK Internal high speed oscillation clock HIO40CLK 40 MHZ internal high speed oscillation clock SYSX1CLK X1 clock SYSEXTCLK External main system clock SUBCLK Subsystem clock Kx3 HIOCLK Internal high speed oscillation clock SYSX1CLK X1 clock SYSEXTCLK External main system clock SUBCLK Subsystem clock Kx3 A Kx3 L Lx3 HIOCLK Internal high speed oscillation clock HIO20CLK 20 MHZ internal high speed oscillation clock SYSX1CLK X1 clock SYSEXTCLK External main system clock SUBCLK Subsystem clock Return value MD_OK Normal completion R20UT2137EJ0100 Rev 1 00 2tENESAS Page 104 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS Macro Description MD_ERROR1 Exit with error abend Fx3 Kx3 Cannot change to the X1 clock Exit with error abend Ix3 Cannot change to the 40 MHz internal high speed oscillation clock Exit with error abend Kx3 A Kx3 L Lx3 Cannot change to the 20 MHz internal high speed oscillation clock MD_ERROR2 Exit with error abend Fx3 Kx3 Cannot change to the external main system clock Exit with error abend Ix3 Kx3 A Kx3 L Lx3 Cannot change to the X1 clock MD_ERROR3 Exit with error abend Fx3 Cannot change to the internal low speed oscillation clock Exit with error abend Ix3 Kx3 A Kx3 L Lx
96. _MasterErrorCallback 210 lICn_MasterReceiveEndCallback 209 lICn_MasterReceiveStart 207 lICn_MasterSendEndCallback 208 ICn_MasterSendStart 206 ICn_SlaveErrorCallback 215 lICn_SlaveReceiveEndCallback 214 lICn_SlaveReceiveStart 212 IICn_SlaveSendEndCallback 213 IICn_SlaveSendStart 211 IlCn_Stop 205 R20UT2137EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Page 345 of 351 CubeSuite V1 03 00 APPENDIX D INDEX ICn_Userlnit 204 SAUm_Init 136 SAUm_PowerOff 138 SAUm_Userlnit 137 UARTFn_DataComparisonDisable 180 UARTFn_DataComparisonEnable 179 UARTFn_ErrorCallback 186 UARTFn_ExpBitCetectCallback 184 UARTFn_IDMatchCallback 185 UARTFn_Init 172 UARTFn_PowerOff 173 UARTFn_ReceiveData 177 UARTFn_ReceiveEndCallback 182 UARTFn_SendData 176 UARTFn_SendEndCallback 181 UARTFn_SetComparisonData 178 UARTFn_SoftOverRunCallback 183 UARTFn_Start 174 UARTFn_Stop 175 UARTn_ErrorCallback 149 UARTn_Init 139 UARTn_ReceiveData 144 UARTn_ReceiveEndCallback 147 UARTn_SendData 142 UARTn_SendEndCallback 146 UARTn_SoftOverRunCallback 148 UARTn_Start 140 UARTn_Stop 141 System 100 CG_ChangeClockMode 104 CG_ChangeFrequency 106 CG_ReadResetSource 103 CG_SelectPowerSaveMode 108 CG_SelectStabTime 110 CLOCK Init 101 CLOCK_Userlnit 102 T TAUm_Channeln_ChangeCondition 25
97. _Userlnit Performs user defined initialization of the serial interface IICn Remark This API function is called as the Cn_Init callback routine Classification CG_serial_user c Syntax void IICn_UserInit void Remark nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 204 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS liCn_Stop Ends IICn communication Classification CG_serial c Syntax void IICn_Stop void Remark nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 205 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS 1ICn_MasterSendSitart Starts IICn master transmission Remark This API function repeats the byte level IICn 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 IICn_MasterSendStart UCHAR adr UCHAR txbuf USHORT txnum UCHAR wait Remark nis the channel number Argumenit s Argument UCHAR adr Slave address Description UCHAR txbuf Pointer to a buffer storing the transmission data USHORT txnum Total amount of data to send Return value UCHAR wait Setup time of start conditions MD_OK Normal comple
98. _serial_user c Syntax void IICA_MasterReceiveEndCallback void Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 195 of 351 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 196 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS IICA_SlaveSendSiart 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 197 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS IICA_SlaveReceiveStart Starts IICA slave reception Remark
99. aComparisonDisable Ends the data comparison Remark Calling this API function switches the serial interface UARTFn to expansion bit mode no data compari son Classification CG_serial_user c Syntax void UARTFn_DataComparisonDisable void Remark nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 180 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UARTFn_SendEndCallback Performs processing in response to the transmission interrupt INTLTn Remark This API function is called as the callback routine of interrupt process MD_INTLTn corresponding to the transmission interrupt INTLTn performed when number of transmission data specified by UARTFn_SendData parameter txnum has been completed Classification CG_serial_user c Syntax void UARTFn_SendEndCallback void Remark nis the channel number Argumenit s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 181 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UARTFn_ReceiveEndCallback Performs processing in response to the reception complete interrupt INTLRn Remark This API function is called as the callback routine of interrupt process MD_INTLRn corresponding to the reception complete interrupt INTLRn performed when number of received data specified by UARTFn_ReceiveData parameter rxnum has been complete
100. able 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 Drag and drop the 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
101. ack APPENDIX C API FUNCTIONS Function 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 inter val 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_OutputDisable 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 RTC_RTCDIV_OutputEnable RTC_RTCDIV_OutputDisable RTC_ChangeCorrectionValue Disables output of the real time counter clock 32 kHz source to the RTCCL pin Enables output of the real time counter clock 82 kHz cycle to the RTCDIV pin Disables output of the real time counter clock 32 kHz cycle to the RTCDIV pin 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
102. 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 tool 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 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
103. andle the pin when it is not used Unused This column displays information only when the Free is selected in the Func tion column Attention Displays the precaution on using the pin Remarks 1 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 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 col umn to the desired 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 65 of 351 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 Devi
104. andle 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 desired 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 61 of 351 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
105. ark Calling this API function while a transfer is ongoing will end the transfer Classification CG_dma c Syntax Fx3 Ix3 Kx3 A Kx3 L Lx3 include CG_macrodriver h MD_STATUS DMAn_SetData USHORT sfraddr USHORT ramaddr USHORT count Kx3 include CG_macrodriver h MD_STATUS DMAn_SetData USHORT ramaddr USHORT count Remark nis the channel number Argument s 1 0 Argument Description USHORT sfrcaddr SFR address of source destination USHORT ramcaddr RAM address of source destination USHORT count Number of data transmissions 1 to 1024 Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT2137EJ0100 Rev 1 00 ztENESAS Page 332 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS DMAn_SoftwareTriggerOn Starts DMA transfer when DMA operation is enabled Classification CG_dma c Syntax void DMAn_SoftwareTriggerOn void Remark nis the channel number Argument s None Return value None Example Below is an example of software trigger as a DMA transfer start trigger CG_main c void main void DMAO_Enable Change to operation enabled status DMAO_SoftwareTriggerOn Start DMA transfer R20UT2137EJ0100 Rev 1 00 ztENESAS Page 333 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS C 3 17 LVI Below is a l
106. arts the channel 0 count R20UT2137EJ0100 Rev 1 00 2tENESAS Page 109 of 351 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 s Argument enum StabTime waittime Remark fx signifies the frequency of the X1 clock Return value 2 8 fx 2 9 fx 2 10 fx 2 11 fx 2 13 fx 2 15 fx 2 17 fx 2 18 fx Description Oscillation stabilization time type STLEVELO STLEVEL1 STLEVEL2 STLEVEL3 STLEVEL4 STLEVELS STLEVEL6 STLEVEL7 MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT2137EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Page 110 of 351 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS C 3 2 External Bus Below is a list of API functions output by Code Generator for external bus interface use Table C 3 API Functions External Bus API Function Name Function BUS_Init Performs initialization necessary to control external bus interface functions functions to connect an external bus to areas other than onboard ROM ROM and RAM BUS_Userlnit Performs user defined initialization relating to the external bus interface BUS_PowerOff Halts the clock supplied to the external bus inter
107. ator programmable gain amplifiers Remark Calling this API function changes the comparator programmable gain amplifiers to reset status For this rea son writes to the control registers e g programmable gain amplifier control register OAM after this API function is called are ignored Classification CG_cmppga c Syntax void CMPPGA_PowerOff void Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 225 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CMPPGA Start Starts the operation of comparator programmable gain amplifier Classification CG_cmppga c Syntax void CMPPGA_Start void Argumenit s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 226 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CMPPGA_ Stop Ends the operation of comparator programmable gain amplifier Classification CG_cmppga c Syntax void CMPPGA_Stop void Argumenit s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 227 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CMPPGA_ChangeCMPnRefVoltage Sets comparator n internal reference voltage Remark The value specified in parameter voltage is set to comparator n internal reference voltage setting register CnRVM Classification CG_cmppga c Syntax include CG_macrodriver
108. callback routine Classification CG_int_user c Syntax void KEY_UserInit void Argumenit s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 126 of 351 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 Fx3 Ix3 Kx3 A Kx3 L Lx3 include CG_macrodriver h include CG_int h MD_STATUS INT_MaskableInterruptEnable enum MaskableSource name BOOL enableflag Kx3 include CG_macrodriver h include CG_int h void INT_MaskableInterruptEnable enum MaskableSource name BOOL enableflag Argumeni 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 Fx3 Ix3 Kx3 A Kx3 L Lx3 MD_OK Normal completion MD_ARGERROR Invalid argument specification Kx3 None Example 1 Below is an example of disabling acceptance of the maskable interrupt INTPO R20UT2137EJ0100 Rev 1 00 ztENESAS Page 127 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CG_main c include CG_macrodriver h include
109. ce T op View OMGIR val Om OMA at MAPANA O Ole LAL TLETIN TD LLE MHXIN DLI O WAIN O NERIA OST HS O Nii o OMKER AEN Ni ihi oO OHVENKAINNN FOXIN O OMSEHEHINTIN RETON O OMENAN LALLE Ee OMVENI DN PILI O OMMERS WAR NKL Esto F8KOR KG3 OMMERATCONTONICEES Hivi o uPD73F1 166_A0 OMNEDIUISTIR MiX o OF NENS RIHO OPKRENI PHURIBELE O OKRENI M oO OVEN itii o OWEN 30 OSENI LEE OnVED mo OWEN BHO OEM BILE O ELELEE LEN IELTS KIII O OMNED PIETER NIXITN 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 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 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 66 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Description of each area 1 Toolbar This area consists of the following buttons Clicks this button to en
110. ce 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 52 of 351 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 eH Code Generator Property a E Product Information Version 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 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 Tr
111. cro Beerd Pa 7 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 78 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Figure A 23 Operational Object External Peripheral Tab First Layer Device Pin List 2 B Be sacDefinelAl llser Detinel Figure A 24 Operational Object External Peripheral Tab Second Layer Device Pin List x 2 BG C eS External Peripheral EE F SRR Definell 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 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 79 of 351 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 Box New Column Function buttons ail The following items are explained here How
112. d Classification CG_serial_user c Syntax void UARTFn_ReceiveEndCallback void Remark nis the channel number Argumenit s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 182 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UARTFn_SoftOverRunCallback Performs processing in response to the reception complete interrupt INTLRn Remark This API function is called as the callback routine of interrupt process MD_INTLRn corresponding to the reception complete interrupt INTLRn process performed when the amount of data received is greater than the parameter rxnum specified for UARTFn_ReceiveData Classification CG_serial_user c Syntax void UARTFn_SoftOverRunCallback void Remark nis the channel number Argumenit s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 183 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UARTFn_ExpBitCetectCallback Performs processing in response to the status interrupt INTLSn Remark This API function is called as the callback routine of interrupt process MD_INTLSn corresponding to the status interrupt INTLSn processing when the expansion bit is received Classification CG_serial_user c Syntax void UARTFn_ExpBitCetectCallback void Remark nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tE
113. d IICA_SlaveReceiveEndCallback void Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 200 of 351 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 201 of 351 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 202 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS 1iCn_Init Performs initialization of the serial interface IICn Classification CG_serial c Syntax void IICn_Init void Remark nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 203 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS 1iCn
114. de Generator Report Save Output Tab Name 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 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 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 R
115. e 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 241 of 351 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 Classification CG_ad c Syntax include CG_macrodriver h void AD_ReadByte UCHAR buffer Argument s UCHAR buffer Pointer to area in which to store the results of A D conversion 8 bits most significant 8 bits of 10 bit resolution Remark Below is an example of the results of A D conversion to be stored in buffer Fx3 Ix3 Kx3 Kx3 L 15 8 7 0 B10 B9 B8 B7 B6 BS B4 B3 B2 B1 e gt 1 Results of A D conversion to be stored in buffer Kx3 A Lx3 15 12 11 4 3 0 B12 B11 B10 B9 B8 B7 B6 B5 B4 B3 B2 B1 i gt L Results of A D conversion to be stored in buffer Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 242 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS C 3 9 D A Converter Below is a list of API functions output by Code Generator for D A converter use Table C 10 API Functions D A Converter API Function Name Func
116. e IICn communication complete interrupt INTIICn lICn_SlaveReceiveEndCallback Performs processing in response to the IICn communication complete interrupt INTIICn ICn_SlaveErrorCallback Performs processing in response to detection of error in IICn slave communication lICn_GetStopConditionCallback Performs processing in response to detection of stop condition in In slave communication Operational Amplifier OPAMP_Init OPAMP _Userlnit AMPn_ Start R20UT2137EJ0100 Rev 1 00 Sep 01 2012 ztENESAS Performs initialization necessary to control operational ampli fier functions Performs user defined initialization relating to the operational amplifier Starts the operation of opeational amplifier n single AMP mode Page 93 of 351 CubeSuite V1 03 00 Peripheral Function API Function Name Operational Amplifier AMPn_Stop APPENDIX C API FUNCTIONS Function Ends the operation of operational amplifier n single AMP mode Comparator PGA CMPPGA Init Performs initialization necessary to control comparator pro grammable gain amplifiers functions CMPPGA_Userlnit Performs user defined initialization relating to the comparator programmable gain amplifiers CMPPGA_PowerOff Halts the clock supplied to the comparator programmable gain amplifiers CMPPGA_ Start Starts the operation of comparator programmable gain ampli fier CMPPGA_Stop Ends the operation
117. e acceptance of the key interrupts INTKR Enables the acceptance of the key interrupts INTKR R20UT2137EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Page 122 of 351 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 123 of 351 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 124 of 351 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 125 of 351 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
118. e status interrupt INTLSn Performs processing in response to the status interrupt INTLSn IICA_Init Performs initialization of the serial interface IICA IICA_Userlnit Performs user defined initialization of the serial interface IICA IICA_PowerOff Halts the clock supplied to 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 INTI ICA IICA_MasterReceiveEndCallback Performs processing in response to the IICA communication complete interrupt INTI ICA IICA_MasterErrorCallback Performs processing in response to detection 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 INTI ICA IICA_SlaveReceiveEndCallback IICA_SlaveErrorCallback lICA_GetStopConditionCallback IICn_Init R20UT2137EJ0100 Rev 1 00 Sep 01 2012 Performs processing in response to the IICA communication complete interrupt INTI ICA Performs processing in response to detection of error in IICA slave c
119. e 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 A 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 Hl and E 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 HE 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 Pin 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
120. e timing and correction value for correcting clock errors ztENESAS Page 270 of 351 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 271 of 351 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 272 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 273 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_CounterEnable Starts the count of the real time counter
121. ed 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 76 of 351 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 KI Pin Name Function 1 0 N ch Define Name KK Description Recommend Connection for Unused EEEE Attention x 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
122. ed 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 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 n
123. ee 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 53 of 351 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 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 fix
124. emark This API function is called as the callback routine of interrupt process MD_INTSREn corresponding to the UART communication error interrupt INTSREn Classification CG_serial_user c Syntax include CG_macrodriver h void UARTn_ErrorCallback UCHAR err_type Remark nis the channel number Argumenit s Argument Description UCHAR err_type Trigger for error interrupt 00000xx1B Overrun error 00000x1xB Parity error 000001xxB Framing 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_INTSREO void Interrupt processing for INTSREO UCHAR err_type UARTO_ErrorCallback err_type Call callback routine void UARTO_ErrorCallback UCHAR err_type Callback routine for INTSREO if err_type amp 0x1 Determine trigger Callback processing in response to overrun error else if err_type amp 0x2 Determine trigger Callback processing in response to parity error else if err_type amp 0x4 Determine trigger R20UT2137EJ0100 Rev 1 00 2tENESAS Page 149 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS Callback processing in response to framing error R20UT2137EJ0100 Rev 1 00 2tENESAS Page 150 of 351 Sep 01 2012 CubeSuite V1 03 00
125. ems 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 item 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 Integrated Development Environment User s Manual 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 Feature
126. eport File macro Macro list Microsoft Internet Explorer File Edit View Favorites Tools Help MCU name 78KOR FG3 Clip name uPD78F1845_A0 Module Macro Sub Setting Status System Used System Used Main system clock MAIN setting Internal high speed oscillation fH Internal high speed oscillation flH Frequency sla High speed system clock iX Operation Subsystem clock fSUB setting Unused Unused Internal low speed oscillation clock ML setting fllFrequency 30 kHz Used 4 clock through mode fPLL MAIN MHz PLL clock frequency PLL R20UT2137EJ0100 Rev 1 00 ztENESAS Page 34 of 351 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 3 FUNCTIONS Code Generator Figure 3 14 Output Example of Report File function a Function list Microsoft Internet Explorer MCU name 78KOR FG3 Chip name uPD78F1845_A0 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 35 of 351 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 E Generate File Mode Output control of API function Output all API functions according to t
127. era tor panel It also allows you to confirm the source code that reflects the information configured in the Code Generator panel Figure A 17 Code Generator Preview Panel Code Generator Preview Common te viewed versa sect uarvdureericcveuesessevenvic a System Copyright C 2005 2012 Renesas Electronics Corr Port RENESAS ELECTRONICS CONFIDENTIAL AND PROPRIETARY Interrupt This program must be used solely for the purpose Serial it was furnished by Renesas Electronics Corporat A D Converter program may be reproduced or disclosed to others Timer form without the prior written permission of Re Watchdog Timer Corporation Clock Output DMA a 2 This device driver was created by CodeGenerator y g p3 E 4 H 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 cz Generate Code button is pressed in the Code Generator panel Remarks 1 You can change the source code to be displayed by
128. errupt INTCSImn Remark This API function is called as the callback routine of interrupt process MD_INTCSImn corresponding to the CSI communication complete interrupt INTCSImn performed when number of transmission data specified by CSlmn_SendData parameter txnum has been completed Classification CG_serial_user c Syntax void CSImn_SendEndCallback void Remark mis the unit number and nis the channel number Argumenit s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 160 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CSImn_ReceiveEndCallback Performs processing in response to the CSI communication complete interrupt INTCSImn Remark This API function is called as the callback routine of interrupt process MD_INTCSImn corresponding to the CSI communication complete interrupt INTCSImn performed when number of received data specified by CSImn_ReceiveData parameter rxnum has been completed Classification CG_serial_user c Syntax void CSImn_ReceiveEndCallback void Remark mis the unit number and nis the channel number Argumenit s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 161 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CSImn_ErrorCallback Performs processing in response to the CSI communication error interrupt INTSREn Remark This API function is called as the callback routi
129. es 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 Manual Start for details on Save project R20UT2137EJ0100 Rev 1 00 ztENESAS Page 22 of 351 Sep 01 2012 CubeSuite V1 03 00 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 Fl Reflect in Pin Generate Code J sw POS wo A O Clock setting On chip debug setting Confirming reset source Main system clock fMAIN setting Internal high speed oscillation IH High speed system clock EMX hternal high speed oscillation clock setting Operation Frequency MHz High speed system clock setting Operation XI oscillation 9 External clock input fEX Frequency 5 MHz Stable time 5242880 2418 fMX us Subsystem clock fSUB setting Unused External subclock input fEXS Frequency 32768 kHz
130. es 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 298 of 351 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 299 of 351 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 300 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_RTCDIV_OutputEnable 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 301 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS RTC_RTCDIV_OutputDisable Disables output of the real t
131. face R20UT2137EJ0100 Rev 1 00 2tENESAS Page 111 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS Performs initialization necessary to control external bus interface functions functions to connect an external bus to areas other than onboard ROM ROM and RAM Classification CG_bus c Syntax void BUS_Init void Argumeni s None Return value None R20UT2137EJ0100 Rev 1 00 ztENESAS Page 112 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS BUS_Userlnit Performs user defined initialization relating to the external bus interface Remark This API function is called as the BUS _Init callback routine Classification CG_bus_user c Syntax void BUS_UserInit void Argumenit s None Return value None R20UT2137EJ0100 Rev 1 00 ztENESAS Page 113 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS BUS_PowerOff Halts the clock supplied to the external bus interface Remark Calling this API function changes the external bus interface to reset status For this reason writes to the control registers memory extension mode control register MEM after this API function is called are ignored Classification CG_bus c Syntax void BUS_PowerOff void Argument s None Return value None R20UT2137EJ0100 Rev 1 00 ztENESAS Page 114 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C
132. geOff void Argumeni s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 323 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS C 3 16 DMA Below is a list of API functions output by Code Generator for DMA Direct Memory Access controller use Table C 17 API Functions DMA API Function Name Function DMAn_Init Performs initialization necessary to control DMA controller functions DMAn_Userlnit Performs user defined initialization relating to the DMA controller DMAn_Enable Enables operation of channel n DMAn_Disable Disables operation of channel n DMAn_Hold Holds a DMA start request DMAn_Restart Releases hold on a DMA start request DMAn_CheckStatus Reads the transfer status transfer complete transfer ongoing DMAn_SetData Sets the RAM address of the transfer source destination and the number of times the data has been transferred DMAn_SoftwareTriggerOn Starts DMA transfer when DMA operation is enabled R20UT2137EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Page 324 of 351 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS Performs initialization necessary to control DMA controller functions Classification CG_dma c Syntax void DMAn_Init void Remark nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 325 of 351
133. geTimerCondition TAUm_Channeln_GetPulseWidth Page 87 of 351 CubeSuite V1 03 00 APPENDIX B OUTPUT FILES Peripheral Function Source File Name Names of API Functions Included CG_timer c TAUm_Channeln_ChangeDuty TAUm_Channeln_SoftWareTriggerOn CG_timer_user c TAUm_Userlnit MD_INTTMmn CG_timer h Watchdog Timer CG_wadt c WDT_Init WDT_Restart CG_wadt_user c WDT_Userlnit MD_INTWDTI 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 RTC_Userlnit RTC_ConstPeriodInterruptCallback RTC_AlarminterruptCallback MD_INTRTC MD_INTRTCI Clock Output PCL_Init PCL_Start PCL_Stop PCL_ChangeFreq CG_pcl_user c PCL_Userlnit R20UT2137EJ0100 Rev 1 00 ztENESAS Page 88 of 351 Sep 01 2012 CubeSuite V1 03 00 Peripheral Function Clock Output Source File Name CG_pcl h APPENDIX B OUTPUT FILES Names of API Functions Included Clock Output Buzzer Output CG_pclbuz c PCLBUZn_
134. gurator 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 b Second layer Displays the pin number of the pin R20UT2137EJ0100 Rev 1 00 ztENESAS Page 64 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Column Heading Outline 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 VO 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 h
135. gurator 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 to 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 Pin Number Pin Name Function 170 N ch V Pin Number Define Name Description Recommend Connection for Unused Attention External Peripheral New Column Remark You can only delete the column which you added using the New Column dialog box R20UT2137EJ0100 Rev 1 00 2tENESAS Page 13 of 351 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 T op View Dit Pel Py RITIN OTe L 7 A O PAPANO O HEPAT O MHKIN DLN O wA O NEXITHITOSTHS NSH O NACHO AEN FETOUTH MEL PRLI O Etro MN o Maro GOES Pear EKLE O HANO BT 30 Diit O mo omo NASLI O KIII O PVA WIN oMa
136. he name of the file to which the e Programi a i lal information of this main project is to be a E File saved EOF All Output Messages X Disconnected The following items are explained here How to open Description of each area 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 39 of 351 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 Co
137. he setting Generate file Merge file Output folder C Documents and Settings My Docume Report type HTML file iv Register files HTML file Pin Configurator Reflect Mode CS file Mode 0 Report type The format of report file 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 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 36 of 351 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 i i R20UT2137EJ0100 Rev 1 00 2tENESAS Page 37 of 351 Sep 01 2012 A 1 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 Description The design tool has the following windows panels
138. here is peripheral function target microcontroller is not supporting peripheral functionbutton is not disokayed H 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 reflected is selected in the PinPart Combination Mode category of the Gen eration tab cH 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 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 Changes the content displayed in the Information setting area to the External Bus for configuring the information necessary to control the functions of external bus interface functions to connect an external bus to the area other than the built in ROM RAM or SFR provided by the microcontroller 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 Changes the content displayed in the Information setting area to the Interrupt for configuring the information necessary to control the interrupt functions a
139. ial interface UART channel Sets UART communication to standby mode Ends UART communication Starts UART data transmission Starts UART data reception UARTn_SendEndCallback Performs processing in response to the UART transmission complete interrupt INTSTn UARTn_ReceiveEndCallback Performs processing in response to the UART reception com plete interrupt INTSRn UARTn_SoftOverRunCallback Performs processing in response to the UART reception com plete interrupt INTSRn UARTn_ErrorCallback Performs processing in response to the UART communication error interrupt INTSREn CSImn_Init Performs initialization of the serial interface CSI channel CSiImn_Start Sets CSI communication to standby mode CSImn_Stop Ends CSI communication CSImn_SendData Starts CSI data transmission CSImn_ReceiveData Starts CSI data reception CSImn_SendReceiveData Starts CSI data transmission reception CSImn_SendEndCallback Performs processing in response to the CSI communication complete interrupt INTCSImn CSImn_ReceiveEndCallback CSImn_ErrorCallback IlCmn_lnit IlCmn_Stop ztENESAS Performs processing in response to the CSI communication complete interrupt INTCSImn Performs processing in response to the CSI communication error interrupt INTSREn Performs initialization of the serial interface simple IIC chan nel Ends simple IIC communication
140. ich 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 peripheral component level R20UT2137EJ0100 Rev 1 00 ztENESAS Page 10 of 351 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 Pin Number Eog Pin Name Function 120 N ch ETE Define Name Description Recommend Connection for Unused Attention 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 11 of 351 Sep 01 2012 CubeSuite V1 03 00 CHAP
141. icrocontroller 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 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 48 of 351 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 amp E Device Pin List Property J O Product Information Wie Version Pin configurator version information Device Pin List Information 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 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 Pi
142. id Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 319 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS LCD_DisplayOn Sets the LCD controller driver to display on status Classification CG_lcd c Syntax void LCD_DisplayOn void Argumenit s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 320 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS LCD_DisplayOff Sets the LCD controller driver to display off status Classification CG_lcd c Syntax void LCD_DisplayOff void Argumenit s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 321 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS LCD_VoltageOn Enables operation of the LCD controller driver s voltage boost circuit and capacitor split circuit then outputs the dese lect signal from the segment pin Classification CG_lcd c Syntax void LCD_VoltageOn void Argumeni s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 322 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS LCD_VoltageOff Halts operation of the LCD controller driver s voltage boost circuit and capacitor split circuit then outputs the ground level signal from the segment common pin Classification CG_lcd c Syntax void LCD_Volta
143. ification R20UT2137EJ0100 Rev 1 00 2tENESAS Page 229 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS C 3 8 A D Converter Below is a list of API functions output by Code Generator for A D converter use Table C 9 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_PowerOff Halts the clock supplied 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 AD_ReadByte Reads the results of A D conversion 8 bits most significant 8 bits of 10 bit resolution R20UT2137EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Page 230 of 351 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 Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 231 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS Performs user defined initiali
144. ignal pulses input to the TImn pin TAUm_Channeln_ChangeDuty Changes the duty ratio of the PWM signal output to the TOmn pin TAUm_Channeln_SoftWareTriggerOn Generates the trigger software trigger for one shot pulse output R20UT2137EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Page 252 of 351 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TAUm Init Performs initialization necessary to control timer array unit functions Classification CG_timer c Syntax void TAUm_Init void Remark mis the unit number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 253 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TAUm_Userlnit Performs user defined initialization relating to the timer array unit Remark This API function is called as the TAUm_Init callback routine Classification CG_timer_user c Syntax void TAUm_UserInit void Remark mis the unit number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 254 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TAUm_PowerOff Halts the clock supplied to the timer array unit Remark Calling this API function changes the timer array unit to reset status For this reason writes to the control registers e g timer clock select register 0 TPSO after this API function is called are ignored Classification CG_
145. ime 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 302 of 351 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 h 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 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 303 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS C 3 13 Clock Output Below is a list of API functions output by Code Generator for clock output use Table C 14 API Functions Clock Output API Function Name Function PCL_Init Performs initialization necessary to control clock output control circuit functions PCL_Use
146. ined 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 OG rte h void main void RTC_CounterEnable Start count RTC_SetHourSystem HOUR24 Set clock type R20UT2137EJ0100 Rev 1 00 2tENESAS Page 276 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS R20UT2137EJ0100 Rev 1 00 2tENESAS Page 277 of 351 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 CGurte A MD_STATUS RTC_CounterSet struct RTCCounterValue counterwriteval Argument s Argument Description struct RTCCounterValue Counter value counterwriteval Remark Below is an example of the structure RTCCounterValue counter value for the real time counter struct RTCCounterValue UCHAR Sec second UCHAR Min Minute UCHAR Hour Hour UCHAR Day Day UCHAR Week Weekday 0 Sunday 6 Saturday UCHAR Month Month UCHAR 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
147. ing 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 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 59 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE 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 E E EA eS P141 PGLBUZ1 INTP P140 PGLBUZO INTP6 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 Pi
148. ing to the setting Generate file Merge file Output folder C Documents and Settings My Docume Report type HTML file Register files Output files to project E PinConfigurator Reflect Mode fim m fs mage Mode Not output files to project Register files The register mode of the output files is displayed R20UT2137EJ0100 Rev 1 00 2tENESAS Page 28 of 351 Sep 01 2012 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 Property Code Generator Property E Product Information VE AK AE AE ddNIVEYYYY Output control of API function Output all API functions according to the setting v Generate file Output all API functions according to the setting Output folder Output only initialization API function 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
149. 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 ztENESAS Performs initialization necessary to control the key interrupt INTKR functions Page 90 of 351 CubeSuite V1 03 00 Peripheral Function Interrupt API Function Name KEY_Userlnit APPENDIX C API FUNCTIONS Function 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 acceptance of the key interrupts INTKR R20UT2137EJ0100 Rev 1 00 Sep 01 2012 SAUm_Init Performs initialization necessary to control the serial array unit and serial interface functions SAUm_UserlInit Performs user defined initialization related to the serial array unit and serial interface functions SAUm_PowerOff Halts the clock supplied to the serial array unit UARTn_Init UARTn_ Start UARTn_Stop UARTn_SendData UARTn_ReceiveData Performs initialization of the ser
150. inter rupt function Classification CG_rtc c Syntax void RTC_IntervalStart void Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 292 of 351 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 293 of 351 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_rtc c Syntax Ix3 excluding IB3 Kx3 A Kx3 L Lx3 include CG_rte h MD_STATUS RTC_IntervalInterruptEnable enum RTCINTInterval interval Kx3 include nC rte HT void RTC_IntervalInterruptEnable enum RTCINTInterval interval Argument s I O Argument Description enum RTCINTInterval interval Interrupt INTRTCI cycle INTERVALO 246 fXT INTERVAL1 247 fXT INTERVAL2 248 fXT INTERVALS 249 fXT INTERVAL4 241 0 fXT INTERVALS 2 11 fXT INTERVAL 2412 fXT Remark fXT is the frequency of the subsystem clock Return value Ix3 excluding IB3 Kx3 A
151. ip N Device Top Yiew 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 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 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 17 of 351 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 Remarks 1 Figure 2 10 Select Additional Information Property ye Device Top View Property E Color Power pins Special pins Unused pins Used pins Device Highlight color for a selected pin Highlight color for macro pins Highlight color for external peripheral pins E ToolTip Tool tip E PinName Display Define name Pin function Define name Select to
152. ission UARTn_Start must be called before this API function is called Classification CG_serial c Syntax include CG_macrodriver h MD_STATUS UARTn_SendData UCHAR txbuf USHORT txnum Remark nis the channel number Argument s UCHAR txbuf Pointer to a buffer storing the transmission data USHORT txnum Total amount of data to send 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 from channel 0 one time CG_main c include CG_macrodriver h BOOL gFlag Transmission complete flag void main void UCHAR txbuf ABCD USHORT txnum 4 gFlag 1 Initialize transmission complete flag UARTO_Start Start UART communication UARTO_SendData amp txbuf txnum Start UART data transmission while gFlag Wait for txnum transmissions R20UT2137EJ0100 Rev 1 00 tENESAS Page 142 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CG_serial_user c include CG_macrodriver h extern BOOL gFlag Transmission complete flag __ interrupt void MD_INTSTO void Interrupt processing for INTSTO if gUartOTxCnt gt 0 UARTO_SendEndCallback Call callback routine void UARTO_SendEndCallback void Callback routine for INTSTO gFlag 0 Set transmission complete flag
153. ist of API functions output by Code Generator for low voltage detector use Table C 18 API Functions LVI API Function Name Function LVI_Init Performs initialization necessary to control low voltage detector functions LVI_UserlInit Performs user defined initialization relating to the low voltage detector LVI_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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 334 of 351 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 335 of 351 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 336 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS LVI_Inter
154. itialization 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 219 of 351 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 220 of 351 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 221 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS C 3 7 Comparator PGA Below is a list of API functions output by Code Generator for comparator programmable gain amplifiers use Table C 8 API Functions Comparator PGA API Function Name Function CMPPGA_Init Performs initialization necessary to control comparator programmable gain amplifiers functions CMPPGA_UserlInit Performs user defined initialization relating to the co
155. lected in the Comparator operation setting area of the Code Generator panel A D when not performing the call to AD_ComparatorOn CG_main c include CG_macrodriver h include CG_ad h BOOL gFlag void main void USHORT buffer 0 AD_Start while gFlag AD_Read amp buffer AD_SelectADChannel ADCHANNEL1 gFlag 1 while gFlag AD_Read amp buffer AD_Stop CG_ad_user c A D conversion complete flag Initialize A D conversion complete flag Start A D conversion Wait for INTAD Read results of A D conversion Switch input pins Initialize A D conversion complete flag Wait for INTAD Read results of A D conversion End A D conversion include CG_macrodriver h R20UT2137EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Page 237 of 351 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS extern BOOL gFlag A D conversion complete flag __interrupt void MD_INTAD void Interrupt processing for INTAD gFlag 0 Set A D conversion complete flag R20UT2137EJ0100 Rev 1 00 2tENESAS Page 238 of 351 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 f
156. lic 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_OutputDisable 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 RTC_ChangeCorrectionValue R20UT2137EJ0100 Rev 1 00 Sep 01 2012 Disables output of the real time counter clock 32 kHz cycle to the RTCDIV pin Changes th
157. list of files matching the conditions selected in Save in and Save as type R20UT2137EJ0100 Rev 1 00 stENESAS Page 82 of 351 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 83 of 351 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 Peripheral function File Name CG_PeripheralFunctionName c Description Initial function API function CG_PeripheralFunctionName_user c Interrupt function MD_INT xxx callback function CG_PeripheralFunctionName h Defines macros for assigning values to registers Project B 2 Output File CG_main c main function R_MAIN_UserInit function CG_systeminit c Call initial func
158. mark 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 rten void main void struct RTCCounterValue counterreadval RTC_CounterEnable Start count RTC_CounterGet amp counterreadval Read count value R20UT2137EJ0100 Rev 1 00 2tENESAS Page 280 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS R20UT2137EJ0100 Rev 1 00 2tENESAS Page 281 of 351 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 O
159. mparator programmable gain amplifiers CMPPGA_PowerOff Halts the clock supplied to the comparator programmable gain amplifiers CMPPGA_ Start Starts the operation of comparator programmable gain amplifier CMPPGA_Stop Ends the operation of comparator programmable gain amplifier CMPPGA_ChangeCMPnRefVoltage Sets comparator n internal reference voltage CMPPGA_ChangePGAFactor Sets the input voltage amplification factor of a programmable gain amplifier R20UT2137EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Page 222 of 351 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CMPPGA_Init Performs initialization necessary to control comparator programmable gain amplifiers functions Classification CG_cmppga c Syntax void CMPPGA_Init void Argumenit s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 223 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CMPPGA_Userlnit Performs user defined initialization relating to the comparator programmable gain amplifiers Remark This API function is called as the CMPPGA_Init callback routine Classification CG_cmppga_user c Syntax void CMPPGA_UserInit void Argumenit s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 224 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CMPPGA_PowerOff Halts the clock supplied to the compar
160. mplete interrupt INTIICn Classification CG_serial_user c Syntax void IICn_SlaveSendEndCallback void Remark nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 213 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS lICn_SlaveReceiveEndCallback Performs processing in response to the IICn communication complete interrupt INTIICn Remark This API function is called as the callback routine of interrupt process MD_INTIICn corresponding to the IICn communication complete interrupt INTIICn Classification CG_serial_user c Syntax void TICn_SlaveReceiveEndCallback void Remark nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 214 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS liCn_SlaveErrorCallback Performs processing in response to detection of error in IICn slave communication Classification CG_serial_user c Syntax include CG_macrodriver h void IICn_SlaveErrorCallback MD_STATUS flag Remark nis the channel number Argumenit s MD_STATUS flag Cause of communication error MD_ERROR Address mismatch detected MD_NACK Acknowledge not detected Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 215 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS lICn_GetSt
161. n 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 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 8 of 351 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
162. n 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 VO 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 60 of 351 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 h
163. n Configurator Pin Configurator Plug in Release date Displays the release date of Pin Configurator Pin Configurator Plug in R20UT2137EJ0100 Rev 1 00 ztENESAS Page 49 of 351 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 J E Color e Red iv Special pins GB Green Unused pins WM Black Used pins HB Blue Device C 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 Tool tip Display all E Pin Name Display Define name Display Pin function 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 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 i
164. n performing a CSI transmission CSlmn_Start must be called before this API function is called Classification CG_serial c Syntax include CG_macrodriver h MD_STATUS CSImn_SendData UCHAR txbuf USHORT txnum Remark mis the unit number and nis the channel number Argumeni s UCHAR txbuf Pointer to a buffer storing the transmission data USHORT txnum Total amount of data to send Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification Example Below is an example of sending a CSI transmission of four bytes of fixed length data from channel 00 one time CG_main c include CG_macrodriver h BOOL gFlag Transmission complete flag void main void UCHAR txbuf ABCD USHORT txnum 4 gFlag 1 Initialize transmission complete flag CSI0O_Start Start CSI communication CSI00_SendData amp txbuf txnum Start CSI transmission while gFlag Wait for txnum transmissions R20UT2137EJ0100 Rev 1 00 RENESAS Page 154 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CG_serial_user c include CG_macrodriver h extern BOOL gFlag Transmission complete flag __ interrupt void MD_INTCSIOO void Interrupt processing for INTCSIOO if gCsi00TxCnt gt 0 CSI00_SendEndCallback Call callback routine void CSI00_SendEndCallback void Callback routine for INTCSIOO
165. nd 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 Changes the content displayed in the Information setting area to the Operational Amplifier for configuring the information necessary to control the functions of operational amplifier provided by the microcontroller Changes the content displayed in the Information setting area to the Comparator PGA for configuring the information necessary to control the functions of compara tor programmable gain amplifier provided by the microcontroller 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 Changes the content displayed in the Information setting area to the D A Converter for configuring the information necessary to control the function of D A converter provided by the microcontroller 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 la Changes the content displayed in the Info
166. ne of interrupt process MD_INTSREn corresponding to the UART communication error interrupt INTSREn Classification CG_serial_user c Syntax include CG_macrodriver h void CSImn_ErrorCallback UCHAR err_type Remark mis the unit number and nis the channel number Argumenit s UCHAR err_type Trigger for error interrupt 00000xx1B Overrun error Return value None Example Below are examples of callback processing by the trigger for the CSI communication error interrupt CG_serial_user c include CG_macrodriver h __ interrupt void MD_INTSREO void Interrupt processing for INTSREO UCHAR err_type CSI00_ErrorCallback err type Call callback routine void CSI00_ErrorCallback UCHAR err_type Callback routine for INTSREO if err_type amp 0x1 Determine trigger e Callback processing in response to overrun error R20UT2137EJ0100 Rev 1 00 2tENESAS Page 162 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS tC mn_Init Performs initialization of the serial interface simple IIC channel Remark This API function is used as an internal function of SAUm_Init For this reason there is normally no need to call it from a user program Classification CG_serial c Syntax void IICmn_Init void Remark mis the unit number and nis the channel number Argumenit s None Return value None
167. nformation 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 documents 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 7 of 351 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 o
168. nge to operation disabled status R20UT2137EJ0100 Rev 1 00 ztENESAS Page 328 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS DMAn_Hold Holds a DMA start request Remark Call DMAn_ Restart to release the hold on DMA start requests Classification CG_dma c Syntax void DMAn_Hold void Remark nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 329 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS DMAn_Restart Releases hold on a DMA start request Classification CG_dma c Syntax void DMAn_Restart void Remark nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 330 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS DMAn_CheckStatus Reads the transfer status transfer complete transfer ongoing Classification CG_dma c Syntax include CG_macrodriver h MD_STATUS DMAn_CheckStatus void Remark nis the channel number Argument s None Return value MD_UNDEREXEC Transfer ongoing MD_COMPLETED Transfer complete R20UT2137EJ0100 Rev 1 00 2tENESAS Page 331 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS DMAn_SetData Sets the RAM address of the transfer source destination and the number of times the data has been transferred Rem
169. nse 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 Erra Internal reset request by low voltage detector else if flag amp 0x10 Trigger identification Check WDRF flag e Internal reset request by watchdog timer else if flag amp 0x80 Trigger identification Check TRAP flag srdranecdeis Internal reset request by execution of illegal instruction R20UT2137EJ0100 Rev 1 00 2tENESAS Page 103 of 351 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 Argument Description enum ClockMode mode Clock generator type Fx3 HIOCLK Internal high speed oscillation clock SYS
170. o 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 the peripheral function node System Port etc selected in the Project Tree panel or the peripheral function button 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 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 56 of 351 Sep 01 2012 CubeSuite V1 03 00
171. ock R20UT2137EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Page 106 of 351 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT2137EJ0100 Rev 1 00 2tENESAS Page 107 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CG_SelectPowerSaveMode Configures the CPU s standby function Classification 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 If the CPU is operating by a subsystem clock XT1 oscillator then STOP mode cannot be speci fied MD_ARGERROR Invalid argument specification 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 TAUO_PowerOff Stop clock supply ret CG_SelectPowerSaveMode PSSTOP Change to STOP mode if ret MD_OK while 1 TAUO_Init Initialize timer array unit R20UT2137EJ0100 Rev 1 00 RENESAS Page 108 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TAUO_Channel0O_Start St
172. ode 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 eaplanation 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 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 45 of 351 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 chang
173. of comparator programmable gain ampli fier CMPPGA_ChangeCMPrRefVoltag e Sets comparator n internal reference voltage CMPPGA_ChangePGAFactor A D Converter AD_Init AD_UserlInit Sets the input voltage amplification factor of a programmable gain amplifier Performs initialization necessary to control A D converter func tions Performs user defined initialization relating to the A D con verter AD_PowerOff Halts the clock supplied 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 AD_ReadByte Reads the results of A D conversion 8 bits most significant 8 bits of 10 bit resolution D A Converter DA_Init Performs initialization necessary to control D A converter func tions DA_UserlInit Performs user defined initialization relating to the D A con verter DA_PowerOff Halts the clock supplied to the D A converter DAn_Start Starts D A conversion DAn_Stop Ends D A conversion DAn_SetValue DAn_Set8BitsValue DAn_Set12BitsValue TAUm_Init R20UT2137EJ0100 Rev 1 00 Sep 01 2012 ztENESAS Sets the initial analog voltage output to the ANOn pin
174. ommunication Performs processing in response to detection of stop condition in IICA slave communi cation Performs initialization of the serial interface IICn ztENESAS Page 134 of 351 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS API Function Name Function llCn_Userlnit Performs user defined initialization of the serial interface IlCn lICn_Stop Ends IICn communication lICn_MasterSendStart Starts IICn master transmission lICn_MasterReceiveStart Starts IICn master reception IICn_MasterSendEndCallback Performs processing in response to the IICn communication complete interrupt INTIICn IlCn_MasterReceiveEndCallback Performs processing in response to the IICn communication complete interrupt INTIICn IlCn_MasterErrorCallback Performs processing in response to detection of error in IICn master communication lICn_SlaveSendStart Starts IICn slave transmission lICn_SlaveReceiveStart Starts IICn slave reception ICn_SlaveSendEndCallback Performs processing in response to the IICn communication complete interrupt INTIICn IlCn_SlaveReceiveEndCallback IlCn_SlaveErrorCallback IlCn_GetStopConditionCallback R20UT2137EJ0100 Rev 1 00 Sep 01 2012 Performs processing in response to the IICn communication complete interrupt INTIICn Performs processing in response to detection of error in IICn slave communication Performs processing in res
175. omponents design tool build tool debug tool etc provided by CubeSuite The messages are dassified by the message origination tool and displayed 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 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 with warnings about opera ABCD abed 0123 tions Sags l E Background color Standard color SA Error message Character color Red Displayed when there is a critical ABCD abcd 0123 error or when execution is not possi Background color Light gray
176. on 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 T op View Device T op View s2 0 oraz 0 OLIQHTIN IL HIRTI OTOT wawonany Pete erst ONS Mae ALS Marami ara Marama arr MHKIN DLI warn NEXIA TOST AS Ni Ni ni TETTA EEEN LLEI R20UT2137EJ0100 Rev 1 00 2tENESAS Page 19 of 351 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 O My Documents E My music 4 2 j 2 my Pictures My Recent Emy Videos Documents sample E Desktop Fan My Documents Pe My Computer My Network File name a
177. on necessary to control clock buzzer output control circuit func tions PCLBUZn_Userlnit Performs user defined initialization relating to the clock buzzer output control circuits PCLBUZn_ Start Starts clock buzzer output PCLBUZn_Stop Ends clock buzzer output PCLBUZn_ChangeFreq Changes the output clock to the PCLBUZn pin R20UT2137EJ0100 Rev 1 00 2tENESAS Page 310 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS PCLBUZn Init Performs initialization necessary to control clock buzzer output control circuit functions Classification CG_pclbuz c Syntax void PCLBUZn_Init void Remark nis the output pin Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 311 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS PCLBUZn_Userlinit Performs user defined initialization relating to the clock buzzer output control circuits Remark This API function is called as the PCLBUZn_Init callback routine Classification CG_pclbuz_user c Syntax void PCLBUZn_UserInit void Remark nis the output pin Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 312 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS PCLBUZn Start Starts clock buzzer output Classification CG_pclbuz c Syntax void PCLBUZn_Start void Remark nis the output pin
178. opConditionCallback Performs processing in response to detection of stop condition in IICn slave communication Classification CG_serial_user c Syntax void IICn_GetStopConditionCallback void Remark nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 216 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS C 3 6 Operational Amplifier Below is a list of API functions output by Code Generator for operational amplifiers use Table C 7 API Functions Operational Amplifier API Function Name Function OPAMP_Init Performs initialization necessary to control operational amplifier functions OPAMP_Userlnit Performs user defined initialization relating to the operational amplifier AMPn_Start Starts the operation of opeational amplifier n single AMP mode AMPn_Stop Ends the operation of operational amplifier n single AMP mode R20UT2137EJ0100 Rev 1 00 2tENESAS Page 217 of 351 Sep 01 2012 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 218 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS OPAMP _Userlnit Performs user defined in
179. ormation setting area to the LVI for config uring the information necessary to control the functions of low voltage detector pro vided by the microcontroller 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 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 71 of 351 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 cij Generate Code button is pressed in the Code Gen
180. ormed when number of received data specified by UARTn_ReceiveData parameter rxnum has been completed Classification CG_serial_user c Syntax void UARTn_ReceiveEndCallback void Remark nis the channel number Argumenit s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 147 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UARTn_SoftOverRunCallback Performs processing in response to the UART reception complete interrupt INTSRn Remark This API function is called as the callback routine of interrupt process MD_INTSRn corresponding to the UART reception complete interrupt INTSRn process performed when the amount of data received is greater than the parameter rxnum specified for UARTn_ReceiveData Classification CG_serial_user c Syntax Fx3 void UARTn_SoftOverRunCallback void Ix3 Kx3 Kx3 A Kx3 L Lx3 include CG_macrodriver h void UARTn_SoftOverRunCallback UCHAR rx_data Remark nis the channel number Argument s Fx3 None Ix3 Kx3 Kx3 A Kx3 L Lx3 UCHAR rx_data Receive data greater than the parameter rxnum specified for UARTn_ReceiveData Return value None R20UT2137EJ0100 Rev 1 00 ztENESAS Page 148 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS UARTn_ErrorCallback Performs processing in response to the UART communication error interrupt INTSREn R
181. orms processing in response to the reception complete interrupt INTLRn UARTFn_SoftOverRunCallback Performs processing in response to the reception complete interrupt INTLRn UARTFn_ExpBitCetectCallback Performs processing in response to the status interrupt INTLSn UARTFn_IDMatchCallback Performs processing in response to the status interrupt INTLSn UARTFn_ErrorCallback Performs processing in response to the status interrupt INTLSn IICA_Init Performs initialization of the serial interface IICA IICA_Userlnit Performs user defined initialization of the serial interface IICA IICA_PowerOff Halts the clock supplied to the serial interface IICA IICA_Stop IICA_MasterSendStart IICA_MasterReceiveStart IICA_StopCondition IICA_MasterSendEndCallback R20UT2137EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Ends IICA communication Starts IICA master transmission Starts IICA master reception Generates stop conditions Performs processing in response to the IICA communication complete interrupt INTIICA Page 92 of 351 CubeSuite V1 03 00 Peripheral Function API Function Name Serial IICA_MasterReceiveEndCallback APPENDIX C API FUNCTIONS Function Performs processing in response to the IICA communication complete interrupt INTIICA IICA_MasterErrorCallback Performs processing in response to detection of error in IICA master communication II
182. ot 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 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 54 of 351 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 A Reflect in Pin button will be grayed out deselected R20UT2137EJ0100 Rev 1 00 2tENESAS Page 55 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Macro Setting tab This tab allows you to view 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 E etc pressed in the Code Generator panel Figure A 9 Macro Setting Tab Property E System Property J 1 fE Macro lnformation Macro name Macro name Macro name of selected macro Macr
183. owing pin nodes Device Pin List Opens the Device Pin List panel for entering information on the pins of the microcontroller R20UT2137EJ0100 Rev 1 00 ztENESAS Page 42 of 351 Sep 01 2012 CubeSuite V1 03 00 Device Top View APPENDIX A WINDOW REFERENCE 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 External Bus Opens the External Bus for configuring the information necessary to control the functions of external bus interface functions to connect an external bus to the area other than the built in ROM RAM or SFR provided by the microcon troller 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
184. ows 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 character 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 24 of 351 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 If the mouse cursor is moved over the icon information regarding the string that should be entered tips for correcting the entry popups Figure 3 2 Icon Indicating Incorrect Entr
185. panel click the E button In the Macro tab of the Device Pin List panel click the 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 77 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Figure A 20 Operational Object Pin Number Tab Device Pin List P142 SCK20 SCL20 Free P141 PGLBUZ1 INTP Free Figure A 21 Operational Object Macro Tab First Layer Device Pin List E ock Generator CG D A Converter DACTL External Memory EXMEM lash contro Block FCB Ee tt o oo of 1 Macro Name 4 Used Used in Other Macro A D Converter ADC Pin Numbe Pinna H AVREFO AVREFO AVSS AVSS gt En Neer Ma
186. 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 in 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 R20UT2137EJ0100 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 351 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 S sample CubeSuite Project Tree File Edit View Project Build Debug Tool Window Help GR stat a XS BDO a BB A 4 ty Oy Di se ce Ms OG Project Tree iz sample Property a i sample Project E File uPD78F1845_A0 Microcontroller File name sample mtpj A Pin Configurator Design Tool w P Code Generator Design Tool D sample sample cs A CA78KOR Build Tool S 78KOR Simulator Debug Tool File name D This is t
187. pecifying this API function differs according to whether the target pin has built in pull up resistance a TLL input buffer Built in pull up resistance none TLL input buffer none void PORT_ChangePmniInput void Built in pull up resistance yes TLL input buffer none include CG_macrodriver h void PORT_ChangePmniInput BOOL enablepu Built in pull up resistance yes TLL input buffer yes include CG_macrodriver h void PORT_ChangePmnInput BOOL enablepu BOOL enablettl Remark mnis the port number Argumenit s I O Argument Description BOOL enablepu Built in pull up resistance used MD_TRUE Yes MD_FALSE No BOOL enablettl Input buffer type MD_TRUE TTL 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 TLL input buffer none is changed as fol lows I O mode type Input mode Built in pull up resistance used Yes R20UT2137EJ0100 Rev 1 00 2tENESAS Page 118 of 351 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 TLL input buffer none is changed as fol lows I O mode type Input mode Built in pull up resistance used No CG_main c
188. ponse to detection of stop condition in IICn slave communi cation 2tENESAS Page 135 of 351 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS Performs initialization necessary to control the serial array unit and serial interface functions Classification CG_serial c Syntax void SAUm_Init void Remark mis the unit number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 136 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS Performs user defined initialization related to the serial array unit and serial interface functions Remark This API function is called as the SAUm_Init callback routine Classification CG_serial_user c Syntax void SAUm_UserInit void Remark mis the unit number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 137 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS SAUm_PowerOff Halts the clock supplied to the serial array unit Remark Calling this API function changes the serial array unit to reset status For this reason writes to the control registers e g serial clock select register n SPSn after this API function is called are ignored Classification CG_serial c Syntax void SAUm_PowerOff void Remark mis the unit number Argumenit s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 138
189. 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 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 Fil
190. put Opens the Clock Output Buzzer Output for configuring the information neces sary to control the functions of clock output buzzer output controller provided by the microcontroller LCD Controller Driver Opens the LCD Controller Driver for configuring the information necessary to control the function of LCD controller driver provided by the microcontroller R20UT2137EJ0100 Rev 1 00 Sep 01 2012 Opens the DMA for configuring the information necessary to control the func tions of DMA Direct Memory Access controller provided by the microcontrol ler ztENESAS Page 43 of 351 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Opens the LVI for configuring the information necessary to control the func tions of low voltage detector provided by the microcontroller c Icons The table below displays the meaning of the icon displayed to the left of the string representing the peripheral function node Operation in the corresponding Code Generator panel has been carried out Operation in the corresponding Code Generator panel has not been carried out The problem occurs on the settings became the manipulation to the other peripheral function node influences Help 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 Val
191. r 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 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 E B My Documents E 4 My Computer E R My Network Places Unused Desktop Shortcuts Make New Folder i i R20UT2137EJ0100 Rev 1 00 2tENESAS Page 33 of 351 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 R
192. r 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 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 16 of 351 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 4e Device Top View Property E Color Power pins GS Red Special pins GB Green Unused pins WM Black Used pins GB Blue Device C 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 Tool tip Display all 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 t
193. rator select Default from the context menu R20UT2137EJ0100 Rev 1 00 ztENESAS Page 30 of 351 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 selecting 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 g File me Common k a a a a a a a a a a a a a a e a a a a a a a e a a a H CG_main c Copyright C 2008 2012 Renesas Electronic g g RENESAS ELECTRONICS CONFIDENTIAL AND PROPR E program must be used solely for the p ls furnished by Renesas Electronics Co Not Generate Code am may be reproduced or disclosed to without the prior written permission Rename ration Generate Code Default weao device driver was created by CodeGene Interrupt 16 Bit Single Chip Microcontrollers Serial Filename CG main c A D Converter Abstract This file implements main functi Timer APIlib CodeGenerator for 78KOR Fx3 V1 0 Watchdog Timer Device uPD78F1845_40 Clock Output Compiler CC78KOR DMA Creation date 7 12 2012 LVI Remark To restore the default name of the API function defined by Code Generator select Default from the context menu R20UT2137EJ0100 Rev 1 00 2tENESAS Page 31 of 351 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 3 FUNCTION
194. rea 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 Preview panel Output panel R20UT2137EJ0100 Rev 1 00 ztENESAS Page 41 of 351 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 R Er sample Project FE uPD78F1845_A0 Microcontroller A Pin Configurator Design Tool A Device Pin List a Device Top View a ez Code Generator Design Tool e System Port Interrupt Serial A D Converter Timer e Watchdog Timer Clock Output DMA we LVI A CA78KOR Build Tool S 78KOR Simulator Debug Tool P Program Analyzer Analyze Tool E g 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 foll
195. 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 63 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE External Peripheral tab This tab displays information about the pins connected to external peripherals in order grouped at the external periph eral component level Figure A 14 External Peripheral Tab Device Pin List x GETH E External Peripheral Total i S _ gt lle Delinel Pin Number Pin Name Function P142 SCK202 SC 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 Confi
196. river h void PORT_ChangePmnOutput BOOL enablench BOOL enableslow BOOL initialvalue If the target device is 78KOR Ix3 78KOR Kx3 78KOR Kx3 A 78KOR Kx3 L or 78KOR LX3 then the format for specify ing this API function differs according to whether the target pin conducts N ch open drain output N ch open drain output none x3 Kx3 Kx3 A Kx3 L Lx3 include CG_macrodriver h void PORT_ChangePmnOutput BOOL initialvalue N ch open drain output yes Ix3 Kx3 Kx3 A Kx3 L Lx3 include CG_macrodriver h void PORT_ChangePmnOutput BOOL enablench BOOL initialvalue j Remark nm is the port number R20UT2137EJ0100 Rev 1 00 ztENESAS Page 120 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS Argument s Argument Description BOOL enablench Output mode type MD_TRUE N ch open drain output Vpop withstand voltage mode MD_FALSE Normal output mode BOOL enableslow Output mode type MD_TRUE Slow mode MD_FALSE Normal 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
197. rlnit 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 304 of 351 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 305 of 351 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 306 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS PCL Start Starts clock output Classification CG_pcl c Syntax void PCL_Start void Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 307 of 351 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
198. rmation 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 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 70 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE 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 Changes the content displayed in the Information setting area to the Clock Output Buzzer Output for configuring the information necessary to control the functions of clock output buzzer output controller provided by the microcontroller Changes the content displayed in the Information setting area to the LCD Controller Driver for configuring the information necessary to control the function of LCD controller driver provided by the microcontroller Changes the content displayed in the Information setting area to the DMA for con figuring the information necessary to control the functions of DMA Direct Memory Access controller provided by the microcontroller Changes the content displayed in the Inf
199. ruptModeStart Starts low voltage detection when 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 V y detected R20UT2137EJ0100 Rev 1 00 2tENESAS Page 337 of 351 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 Macro Description MD_OK Normal completion MD_ERROR Exit with error abend The program is configured to not use the low voltage detector function The object of low voltage detection is external voltage VDD and power voltage VDD lt detected voltage VLvI The object of low voltage detection is external inpu
200. s 7 CHAPTER 2 FUNCTIONS Pin Configurator 8 2 1 Overview 8 2 2 Open Device Pin List 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 84 B 1 Overview 84 B 2 Output APPENDIX C File 84 API FUNCTIONS 90 C 1 Overview 90 C 2 Output Function 90 C 3 Function Reference 98 C 3
201. s 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 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 50 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE 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 Selects the background color of pins selected in the Device Pin List panel on the peripheral pins 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
202. s 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 Generator Fy Reflect in Pin ci Generate Code Eee PHSB ems D Port0 Porti Port Porta Port4 Port5 Port6 Port Port8 Porti1 Port12 Po lt A L a E Unused Oh Out Pull up Salil Unused Ong uO Pull up P12 W0403004 The following conflicts have been detected Unused Oh You must change the setting in that module before you can use it for other purpose SPIS P11 was used as RxDO Unused Oh Out Pull up R20UT2137EJ0100 Rev 1 00 2tENESAS Page 26 of 351 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 Common EE EAEAN TE PEACE I E EEN ERA A A System Copyright C 2008 2012 Renesas Electronics Corp Port RENESAS ELE
203. so that the source code 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 i 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 el button is pressed in the Code Generator panel Selecting this context menu item changes the icon of the currently selected API function from to 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 R20UT2137EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Page 74 of 351 CubeSuite V1 03 00 APPENDIX A WINDOW REFERENCE Output panel This panel is used to display operation logs for various c
204. 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 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 46 of 351 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 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 47 of 351 Sep 01 2012
205. t void Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 269 of 351 Sep 01 2012 CubeSuite V1 03 00 C 3 12 Real time Clock APPENDIX C API FUNCTIONS Below is a list of API functions output by Code Generator for real time counter use Table C 13 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 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 cyc
206. t voltage EXLVI and external input voltage EXLVI lt detected voltage VEXLvI R20UT2137EJ0100 Rev 1 00 2tENESAS Page 338 of 351 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 339 of 351 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 evel 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 LVILEVEL10 LVILEVEL11 LVILEVEL12 LVILEVEL13 LVILEVEL14 LVILEVEL15 2 68 V 0 1 V 2 53 V 0 1 V 2 38 V 0 1 V 2 22 V 0 1 V 2 07 V 0 1 V 1 91 V 0 1 V Remark If the target device is 78K
207. the file selected on the Code Generator Preview panel R20UT2137EJ0100 Rev 1 00 2tENESAS Page 57 of 351 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 E3 ay CT R A H i Function a IO N ch Defin A SCL20 2 4 9 P141 PCLBUZ1 INTP Free P140 PGLBUZO INTP6 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 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
208. timer c Syntax void TAUm_PowerOff void Remark mis the unit number Argumenit s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 255 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TAUm_Channeln_Start Starts the count for channel n 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 TAUm_Channeln_Start void Remark mis the unit number and nis the channel number Argumenit s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 256 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TAUm_Channeln_Stop Ends the count for channel n Classification CG_timer c Syntax void TAUm_Channeln_Stop void Remark mis the unit number and nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 257 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TAUm_Channeln_ChangeCondition Changes the counter value Remarks 1 The value specified in parameter regvalue is set to timer data register mn TDRmn 2 The timing for calling these API functions differs as follows depending on the type of function e g interval timer square wave ou
209. tion MD_ERROR Exit with error abend R20UT2137EJ0100 Rev 1 00 RENESAS Sep 01 2012 Page 206 of 351 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS IICn_MasterReceiveStart Starts IICn master reception Remark This API function performs byte level IICn 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 IICn_MasterReceiveStart UCHAR adr UCHAR rxbuf USHORT rxnum UCHAR wait Remark nis the channel number Argumenit s I O 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 wait Setup time of start conditions Return value MD_OK Normal completion MD_ERROR Exit with error abend R20UT2137EJ0100 Rev 1 00 ztENESAS Page 207 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS li1Cn_MasterSendEndCallback Performs processing in response to the IICn communication complete interrupt INTIICn Remark This API function is called as the callback routine of interrupt process MD_INTIICn corresponding to the IICn communication complete interrupt INTIICn Classification CG_serial_user c Syntax void IICn_MasterSendEndCallback void Remark nis the channel n
210. tion DA_Init Performs initialization necessary to control D A converter functions DA_Userlnit Performs user defined initialization relating to the D A converter DA_PowerOff Halts the clock supplied to the D A converter DAn_Start Starts D A conversion DAn_Stop Ends D A conversion DAn_SetValue Sets the initial analog voltage output to the ANOn pin DAn_Set8BitsValue Sets the initial analog voltage 8 bits output to the ANOn pin DAn_Set12BitsValue Sets the initial analog voltage 12 bits output to the ANOn pin R20UT2137EJ0100 Rev 1 00 Sep 01 2012 2tENESAS Page 243 of 351 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS Performs initialization necessary to control D A converter functions Classification CG_da c Syntax void DA_Init void Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 244 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS Performs user defined initialization relating to the D A converter Remark This API function is called as the DA_Init callback routine Classification CG_da_user c Syntax void DA_UserInit void Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 245 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS DA_PowerOff Halts the clock supplied to the D A converter Remark
211. tion 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 Below are the files peripheral function output by Code Generator Peripheral Function Table B 2 File List 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_system_user c CLOCK_Userlnit CG_ReadResetSource CG_system h External Bus CG_bus c BUS Init BUS_PowerOff CG_bus_user c BUS _Userlnit CG_bus h s Port CG_port c PORT_lnit PORT_ChangePmninput PORT_ChangePmnOutput CG_port_user c PORT _Userlnit CG_port h 2 Interrupt CG_int c INTP_Init R20UT2137EJ0100 Rev 1 00 ztENESAS Page 84 of 351 Sep 01 2012 CubeSuite V1 03 00 Peripheral Function Source File Name Interrupt APPENDIX B OUTPUT FILES Names of API Functions Included KEY_Init INT_MaskablelnterruptEnable INTPn_Disable 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 R20UT2137EJ0100 Rev 1 00 Sep 01 2012 ztENESAS SAUm_Init SAUm_PowerOff UARTn_Init UARTn_ Start UARTn_Stop UARTn_SendData UARTn_ReceiveData CSImn_Init CSImn_Start C
212. 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 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 80 of 351 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 E3 B My Documents 1 4 4 My Computer E R My Network Places C Unused Desktop Shortcuts Function buttons Make New Folder j The following items are explained here How to open Description of each area F
213. tput or external event counter Function Type Interval timer Timing for Calling Can call at user discretion Square wave output Can call at user discretion Divider function Can call at user discretion External event counter Can call at user discretion Input pulse interval measurement Cannot be called Input pulse high low level width measurement Cannot be called PWM output Cannot be called One shot pulse output Cannot be called during operation Multiple PWM output Cannot be called Classification CG_timer c Syntax include CG_macrodriver h TAUm_Channeln_ChangeCondition USHORT regvalue void Remark mis the unit number and nis the channel number Argument s Return value None Example The example below shows changing the interval time to one half In this example channel 0 has been selected for the interval timer CG_main c include CG_macrodriver h R20UT2137EJ0100 Rev 1 00 RENESAS Sep 01 2012 Page 258 of 351 CubeSuite V1 03 00 void main void USHORT value TAU_TDROO_VALUE gt gt 1 TAUO_Channel0O_Start TAUO_Channel0O_ChangeCondition value APPENDIX C API FUNCTIONS TAU_TDROO_VALUE Current interval time Start count Change counter value R20UT2137EJ0100 Rev 1 00 RENESAS Sep 01 2012 Page 259 of 351 CubeSuite V1 03 00 AP
214. ue Restores the information for the selected peripheral function node to its default state Property Opens the Property panel containing the information for the selected node Pin Configurator Design Tool Device Pin List Device Top View Code Generator Design Tool peripheral function node System Port etc R20UT2137EJ0100 Rev 1 00 2tENESAS Page 44 of 351 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 amp ZA Pin Configurator Property JAJ 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 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 View menu On the Project Tree panel select a n
215. umber Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 208 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS 1ICn_MasterReceiveEndCallback Performs processing in response to the IICn communication complete interrupt INTIICn Remark This API function is called as the callback routine of interrupt process MD_INTIICn corresponding to the IICn communication complete interrupt INTIICn Classification CG_serial_user c Syntax void IICn_MasterReceiveEndCallback void Remark nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 209 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS 11Cn_MasterErrorCallback Performs processing in response to detection of error in IICn master communication Classification CG_serial_user c Syntax include CG_macrodriver h void IICn_MasterErrorCallback MD_STATUS flag Remark nis the channel number Argumenit s MD_STATUS flag Cause of communication error MD_SPT Stop condition detected MD_NACK Acknowledge not detected Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 210 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS llCn_SlaveSendStart Starts IICn slave transmission Remark This API function repeats the byte level IICn slave transmission from the buffer specified
216. unction Name CLOCK_Init API Function List Function Performs initialization required to control the clock generator on chip debug 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 hardware clock CG_SelectPowerSaveMode Configures the CPU s standby function CG_SelectStabTime Configures the oscillation stabilization time of the X1 clock External Bus BUS_Init Performs initialization necessary to control external bus inter face functions functions to connect an external bus to areas other than onboard ROM ROM and RAM BUS_Userlnit Performs user defined initialization relating to the external bus interface BUS _PowerOff Halts the clock supplied to the external bus interface 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 R20UT2137EJ0100 Rev 1 00 Sep 01 2012 INTP_Init Performs
217. unction 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 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 81 of 351 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 My Documents E My Music E My Pictures My Recent Emy videos Documents sample Desktop Fan My Documents z My Computer My Network gt File name be 4 Places gt Save as type Microsoft Office Excel Bool 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 As Description of each area 1 Save in Select the folder to which the files report files etc are output 2 List of files This area displays a
218. unction completes Classification CG_ad c Syntax void AD_Stop void Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 239 of 351 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 Fx3 Ix3 Kx3 A Kx3 L Lx3 include CG_ad h MD_STATUS AD_SelectADChannel enum ADChannel channel Kx3 include CGuad hi void AD_SelectADChannel enum ADChannel channel Argumeni s enum ADChannel channel Analog voltage input pin ADCHANNELn Input pin Remark See the header file CG_ad h for details about the analog voltage input pin ADCHANNELn Return value Fx3 Ix3 Kx3 A Kx3 L Lx3 MD_OK Normal completion MD_ARGERROR Invalid argument specification Kx3 None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 240 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS AD_Read Reads the results of A D conversion Remark If the target device is 78KOR Fx3 78KOR Kx3 78KOR Kx3 L then the results of A D conversion will be 10 bits If the target device is 78KOR Kx3 A 78KOR Lx3 then the results of A D conversion will be 12 bits Classification CG_ad c Syntax includ
219. valStart 292 RTC_IntervalStop 293 RTC_PowerOff 273 RTC_RTC1HZ_OutputDisable 298 RTC_RTC1HZ_OutputEnable 297 RTC_RTCCL_OutputDisable 300 RTC_RTCCL_OutputEnable 299 RTC_RTCDIV_OutputDisable 302 RTC_RTCDIV_OutputEnable 301 RTC_SetHourSystem 276 RTC_Userlnit 272 S SAUm_Init 136 SAUm_PowerOff 138 SAUm_Userlnit 137 Save As dialog box 82 Serial 133 CSImn_ErrorCallback 162 CSImn_Init 151 CSImn_ReceiveData 156 CSImn_ReceiveEndCallback 161 CSlImn_SendData 154 CSImn_SendEndCallback 160 CSImn_SendReceiveData 158 CSlImn_Start 152 CSImn_Stop 153 IICA_GetStopConditionCallback 202 IICA_Init 187 IICA_MasterErrorCallback 196 IICA_MasterReceiveEndCallback 195 IICA_MasterReceiveStart 192 IICA_MasterSendEndCallback 194 IICA_MasterSendStart 191 IICA_PowerOff 189 IICA_SlaveErrorCallback 201 IICA_SlaveReceiveEndCallback 200 IICA_SlaveReceiveStart 198 IICA_SlaveSendEndCallback 199 IICA_SlaveSendStart 197 IICA_Stop 190 IICA_StopCondition 193 IICA_Userlnit 188 llCmn_lnit 163 lICmn_MasterErrorCallback 171 lICmn_MasterReceiveEndCallback 170 lICmn_MasterReceiveStart 166 lICmn_MasterSendEndCallback 169 lICmn_MasterSendStart 165 ICmn_StartCondition 167 ICmn_Stop 164 IICmn_StopCondition 168 ICn_GetStopConditionCallback 216 ICn_Init 203 lICn
220. width measurement Cannot be called PWM output After INTTMmn master channel interrupt One shot pulse output Cannot be called Multiple PWM output After INTTMmn master channel interrupt Classification CG_timer c Syntax include CG_macrodriver h void TAUm_Channeln_ChangeDuty UCHAR ratio Remark mis the unit number and nis the slave side 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 In this example channels 0 and 1 have been selected for PWM output or multiplex PWM output R20UT2137EJ0100 Rev 1 00 2tENESAS Page 263 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS CG_main c include CG_macrodriver h void main void UCHAR ratio 25 TAUO_Channel0O_Start Start count TAUO_Channell_ChangeDuty ratio Change duty ratio R20UT2137EJ0100 Rev 1 00 2tENESAS Page 264 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS TAUm_Channeln_SoftWareTriggerOn Generates the trigger software trigger for one shot pulse output Classification CG_timer c Syntax void TAUm_Channeln_SoftWareTriggerOn void Remark mis the unit number and nis the channel number Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 265 of 351
221. y Code Generator a Reflect in Pin amp Generate Code Ree PSB ews OG Glock setting On chip debug setting Confirming reset source Main system clock fMAIN setting i Internal high speed oscillation fIH High speed system clock fMX Internal high speed oscillation clock setting Operation Frequency High speed system clock setting Operation XI oscillation 3 Frequency Stable time Subsystem clock fSUB setting Unused Frequency External clock input EX 30 MHz Q 52428 80 218 fMx us Information of valid input value range External subclock input EXS aed 32768 o kHz Internal low speed oscillation clock fIL setting Operation Frequency 30 kHz Stops internal low speed oscillation in STOP mode Enables internal low speed oscillation f1L operation setting for system clock fGLK GPU and peripheral clock setting PLL clock frequency fPLL 16 PLL mode fPLL fMAIN X4 MHz PLL lockup time 128 279A MAIN us GPU and peripheral clock fCLK 8000 fPLL 2 tkHe Clock monitor setting Unused RESOUT pin setting Unused O Used Used P130 R20UT2137EJ0100 Rev 1 00 ztENESAS Page 25 of 351 Sep 01 2012 CubeSuite V1 03 00 CHAPTER 3 FUNCTIONS Code Generator 3 3 3 Icon indicating pin conflict If a conflict occurs between the pin
222. year month weekday day hour minute second Classification CG_rtc c Syntax void RTC_CounterEnable void Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 274 of 351 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 275 of 351 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 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 def
223. zation 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 R20UT2137EJ0100 Rev 1 00 2tENESAS Page 232 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS AD_PowerOff Halts the clock supplied to the A D converter Remark Calling this API function changes the A D converter to reset status For this reason writes to the control reg isters e g A D converter mode register ADCM after this API function is called are ignored Classification CG_ad c Syntax void AD_PowerOff void Argument s None Return value None R20UT2137EJ0100 Rev 1 00 2tENESAS Page 233 of 351 Sep 01 2012 CubeSuite V1 03 00 APPENDIX C API FUNCTIONS AD_ComparatorOn Enables operation of voltage converter Remarks 1 About 1 microsecond of stabilization time is required when changing the voltage converter from opera tion 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 2 On the Code Generator panel A D in the Comparator operation setting area if Operation is selected then the voltage converter will be switched to always on There is thus no need to call this API function in this case Classification CG_ad c
Download Pdf Manuals
Related Search
Related Contents
Philips Magnavox MX3690B User's Manual CTA Digital PAD-RSTP mobile headset ビジネスぷららフォン for フレッツ レギュラープラン編 Palmarès Concours Général Agricole Istruzioni per l`installazione Grundig Sonoclock 660 Accueil familial : un nouveau «chez-soi » Sat@Once - IP via Sky LG G1500 User's Manual Copyright © All rights reserved.
Failed to retrieve file