Home

CubeSuite Ver.1.40 Integrated Development Environment User`s

image

Contents

1. Changes the view in the Information setting area to Timer in order to configure the information required to control the 16 bit timer event counter P TMP 16 bit timer event counter Q TMQ and 16 bit interval timer M TMM functions provided by the microcontroller Changes the content displayed in the Information setting area to the Watch Timer for configuring the information necessary to control the functions of watchdog timer provided by the microcontroller Changes the content displayed in the Information setting area to the RTC for con figuring the information necessary to control the functions of real time counter pro vided by the microcontroller Changes the content displayed in the Information setting area to the Real Time Output for configuring the information necessary to control the functions of real time counter 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 R20UT0257EJ0100 Rev 1 00 tENESAS Page 75 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Changes the content displayed in the Information setting area to the LVI for config uring the information necessary to control the functions of low voltage detector pro vided by the microcontroller 2 Information setting
2. R20UT0257EJ0100 Rev 1 00 tENESAS Page 320 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 321 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 mMmacrodriver h include CG FEeech MD_STATUS RTC_SetHourSystem enum RTCHourSystem hoursystem Argumeni s enum RTCHourSystem hoursystem Clock type HOUR12 12 hour clock HOUR24 24 hour clock Return value MD_ARGERROR Invalid argument specification Remark If MD_BUSY1 or MD_BUSY2 is returned it may be because the counter operation is stopped or the counter operation start wait time is too short so make the value of the RTC_WAITTIME macro defined in the header file CG_rtc h larger Example Below is an example of setting the clock type to the 24 hour clock CG_main c include CG macrodra ver include Ce fee void main void RTC_CounterEnable 4 Start count RTC_SetHourSystem HOUR24 Set clock type R20UT0257EJ0100 Rev 1 00 tENESAS Page 3
3. R20UT0257EJ0100 Rev 1 00 tENESAS Page 287 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TABn_Stop Ends the count for 16 bit timer event counter AB TAB Remark The length of time between the call to this API function and the end of counting will vary depending on the function type e g interval timer external event counter or external trigger pulse output Classification CG_timer c Syntax void TABn_Stop void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 288 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TABn_ChangeTimerCondition Changes the counter value for 16 bit timer event counter AB TAB Remark The value specified in parameter arrar_reg is set in TABn capture compare register m TABnCCRm Classification CG_timer c Syntax include CG macrodriver hi MD_STATUS TABn ChangeTimerCondition USHORT array_reg UCHAR array_num Remark nis the channel number Argumeni s 1 usnont terrae Pointer to an area storing the count value 0x0 to Oxf UCHAR array_num Register to change 1 TABnCCRO TABnCCRO TABnCCR1 TABnCCRO TABnCCR1 TABnCCR2 TABnCCRO TABnCCR1 TABnCCR2 TABnCCR3 Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT0257EJ0100 Rev 1 00 tENESAS Page 289 of 394 Sep 01 2010 CubeSu
4. RTC _RTCCL_OutputDisable RTC_RTCCL_OutputEnable RTC _RTCDIV_OutputDisable RTC _RTCDIV_OutputEnable RTC _SetHourSystem 322 RTC_Userlnit 319 RTOn_ Disable 358 RTOn_ Enable 357 RTOn_GetValue 367 RTOn_Init 355 347 350 349 352 351 353 329 328 340 338 342 341 346 345 344 343 348 347 350 349 352 351 R20UT0257EJ0100 Rev 1 00 Sep 01 2010 tENESAS Page 386 of 394 CubeSuite Ver 1 40 APPENDIX D INDEX RTOn_Set2BitData 359 RTOn_Set4BitData 360 RTOn_Set6BitData 361 RTOn_Set8BitData 362 RTOn_SetHigh2BitData 363 RTOn_SetHigh4BitData 365 RTOn_SetLow2BitData 364 RTOn_SetLow4BitData 366 RTOn_Userlnit 356 S Save As dialog box 102 Serial 81 Serial 157 CSIBn_ErrorCallback 201 CSIBn_Init 192 CSIBn_ReceiveData 197 CSIBn_ReceiveEndCallback 200 CSIBn_SendData 196 CSIBn_SendEndCallback 199 CSIBn_SendReceiveData 198 CSIBn_Start 194 CSIBn_Stop 195 CSIBn_Userlnit 193 CSIEn_ErrorCallback 211 CSIEn_Init 202 CSIEn_ReceiveData 207 CSIEn_ReceiveEndCallback 210 CSIEn_SendData 206 CSIEn_SendEndCallback 209 CSIEn_SendReceiveData 208 CSIEn_Start 204 CSIEn_Stop 205 CSIEn_Userlnit 203 CSIFn_ErrorCallback 221 CSIFn_Init 212 CSIFn_ReceiveData 217 CSIFn_ReceiveEndCallback 220 CSIFn_SendData 216 CSIFn_S
5. Remark This API function performs byte level IICOn 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 1icOn SlaveReceiveStart UCHAR rxbuf USHORT rxnum Remark nis the channel number Argument s Co ocn rsu Pointer to a buffer to store the received data EE USHORT rxnum Total amount of data to receive Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 232 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS liCOn_SlaveSendEndCallback Performs processing in response to the IICOn slave transfer completion interrupt INTIICn Remark This API function is called as the callback routine of interrupt process MD_INTIICn corresponding to the simple IICOn slave transfer completion interrupt INTIICn performed when total number of simple IICOn slave transmissions specified by COn_SlaveSendStart parameter txnum has been completed Classification CG_serial_ user c Syntax void TICOn_SlaveSendEndCallback void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 233 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS liCOn_SlaveReceiveEndCallback Performs processing in response to the IICOn slave transfer completion
6. Classification CG_wt c Syntax void WI Stop void Argument s None Return value None Example The example below illustrates use of the watch timer function CG_main c include CG macrodra ver ULONG INT_flg 0 void main void WTIT_Start Start count while INT flg WT_Stop End count CG_wt_user c include CG_macrodriver extern ULONG INI_flg _ interrupt void MD_INTWT void Interrupt processing for INTWT INT_flg 1 R20UT0257EJ0100 Rev 1 00 tENESAS Page 316 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS C 3 10 RTC Below is a list of API functions output by Code Generator for real time counter use Table C 11 API Functions RTC RTC_Init Performs initialization necessary to control real time counter functions RTC_UserlInit Performs user defined initialization relating 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
7. Example Below is an example of software trigger as a DMA transfer start trigger CG_main c void Main void 4 DMAO_ Enable Change to operation enabled status DMAO_SoftwareTriggerOn Start DMA transfer 7 R20UT0257EJ0100 Rev 1 00 tENESAS Page 375 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS C 3 13 LVI Below is a list of API functions output by Code Generator for low voltage detector use Table C 14 API Functions LVI LVI_ResetModeStart Starts low voltage detection when in internal reset mode LVI Start Starts low voltage detection LVI Stop Stops low voltage detection R20UT0257EJ0100 Rev 1 00 tENESAS Page 376 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS LVI Init Performs initialization necessary to control low voltage detector functions Classification CG _Ivi c Syntax void LVI_Init void Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 377 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 R20UT0257EJ0100 Rev 1 00 tENESAS Page 378 of 394 Sep 01 2010
8. 19 2 3 2 Select color 20 2 3 3 Select popup information 22 2 3 4 Select additional infomration 23 2 4 Enter Information 24 2 5 Output Report Files 25 2 5 1 Output device pin list 25 2 5 2 Output device top view 26 CHAPTER 3 FUNCTIONS Code Generator 27 3 1 Overview 27 3 2 Open Code Generator Panel 28 3 3 Enter Information 29 3 3 1 Inputrule 29 3 3 2 Icon indicating incorrect entry 30 3 3 3 Icon indicating pin conflict 31 3 4 Confirm Source Code 32 3 5 Output Source Code 33 3 5 1 Setting that determines whether or not to generate source code 34 3 5 2 Change file name 35 3 5 3 Change API function name 36 3 5 4 Change output mode 37 3 5 5 Change output destination folder 38 3 6 Output Report Files 39 3 6 1 Change output format 41 3 6 2 Change output destination 42 APPENDIX A WINDOW REFERENCE 43 A 1 Description 43 APPENDIX B OUTPUT FILES 104 B 1 Overview 104 B 2 Output File 104 APPENDIX C API FUNCTIONS 111 C 1 Overview 111 C 2 Output Function 111 C 3 Function Reference 121 C 3 1 System 123 C 3 2 External Bus 137 C 3 3 Port 140 C 3 4 INT 146 C 3 5 Serial 157 C 3 6 A D 237 C 3 7 D A 246 C 3 8 Timer 252 C 3 9 Watch Timer 312 C 3 10 RTC 317 C 3 11 Real Time Output 354 C 3 12 DMA 368 C 3 13 LVI 376 APPENDIX D INDEX 383 CubeSuite
9. 2 2 4 Delete column The Pin Configurator is used to delete the user s own column from the device pin list using the Delete Column button in the Column Chooser dialog box that opens by pressing the EF 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 x Pin Number Pin Hame Function LO H ch Define Name Description Recommend Connection For Unused Attention External Peripheral Hew Column New Column Column Delete Colum Remark You can only delete the column which you added using the New Column dialog box R20UT0257EJ0100 Rev 1 00 sQENESAS Page 17 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 select 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 lop View PUF MA IA FIF a EFF FAT A LAF mF AT AF AE CHH TEEDE SiJJ3 E aE PIE m MEARE AR g PRC LRA PT E A T FRET TPA 2 PRETIA PB TPF PRETIALY I APZAADAADUUAALTAAAAD ABA
10. CG system c CRC Macro Function void main void void systeminit void void CLOCK_Initivaid WD STATUS CG ChangeFrequency enum CPUCIock clock MD STATUS CG SelectPowersaveModefenum PSLevel level MD STATUS CG ChangeClockModefenum ClockMode mode WD STATUS CG_SelectStabTime enum StabTime waitime WD STATUS Ct SelectPiiMode enum PilMode pllmode vaid WOT Restartivoid void CRC_ Start void Default CG _main c main CG systeminit c systeminit CG macrodriver h CG _userdefine h CG_Ik dir CG starts CG_inttab s CG_system c CLOCK Init CG ChangeFrequency CG SelectPowerSavelo CG ChangeClockMode CG SelectStabTime CG SelectPilMode WDT2 Restart CRG Start 4 ia R20UT0257EJ0100 Rev 1 00 Sep 01 2010 tENESAS Page 40 of 394 CubeSuite Ver 1 40 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 14 Change Output Format Property ee Code Generator Property El Product Information El Generate File Mode Generate tile Merge file Output folder C Documents and Settings Report type HTML file Register tiles El Pin Configurator Reftle Mode Reflected Report type The format of report file i displayed Genaration Remark Output format is selected from
11. How to open Description of each area Function buttons How to open In the Pin Number tab of the Device Pin List panel click the Eg 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 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 Configures the device pin list corresponding to the Pin Number tab Configures the device pin list belonging to the first layer of the Macro tab 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 R20UT0257EJ0100 Rev 1 00 sLENESAS Page 97 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Figure A 35 Operational Object Pin Number Tab Device Pin List AV REFO PIO ANO0 PIL ANGT Pin Number A Macro External Peripheral Figure A 36 Operational Object Macro Tab First Layer Device Pin List ff Port PORT Port 6CPORTE Port APORT H Part ae F Port ie RTE eS m mmm tl Macro Name Port SUPORTS P30 TXDAD Free P31 RDA Free
12. Remark nis the channel number Argumeni s Pe eee Pointer to an area storing the high level width that was read 0x0 to Ox1 ffff nena Pointer to an area storing the low level width that was read 0x0 to Ox1 ffff Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 291 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TABn_GetFreeRunningValue Reads the value captured by 16 bit timer event counter AB TAB Remark This API function can only be called when 16 bit timer event counter AB TAB is used as a free running timer and TABn capture compare register m TABnCCR m is selected as the capture register Classification CG_timer c Syntax include CG Macrodriver h include CG timer h MD_STATUS TABn_GetFreeRunningValue ULONG count enum TMChannel channel Remark nis the channel number Argument s o Awe CCOO Pointer to area in which to store the width that was rea enum TMChannel channel Channel to read TMCHANNELO Channel 0 TMCHANNEL1 Channel 1 TMCHANNEL2 Channel 2 TMCHANNEL3 Channel 3 TABnCCRO TABnCCRI1 TABnCGR2 TABnCCR3 ee ES a a Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT0257EJ0100 Rev 1 00 tENESAS Page 292 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TABn_ChangeDuty Changes the duty ratio of the PWM signal Remark This AP
13. man a Lnn R20UT0257EJ0100 Rev 1 00 sQENESAS Page 98 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Figure A 38 Operational Object External Peripheral Tab First Layer Device Pin List B E L Pin Number A Macro hi 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 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 the column order to the default Restores the column order to the default settings ae Closes this dialog box R20UT0257EJ0100 Rev 1 00 7tENESAS Page 99 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 40 New Column Dialog Box Hew Column Functon batons The following items are explained here How to open Description of each area Function buttons How to open Click the New Column button in the Column Chooser dialog box Desc
14. C OD D me o lt S C D CubeSuite Ver 1 40 Integrated Development Environment User s Manual V850 Design Target Device V850 Microcontroller All information contained in these materials including products and product specifications represents information on the product at the time of publication and is subject to change by Renesas Electronics Corp without notice Please review the latest information published by Renesas Electronics Corp through various means including the Renesas Electronics Corp website http www renesas com Renesas Electronics www renesas com Rev 1 00 Sep 2010 8 10 11 12 Notice All information included in this document is current as of the date this document is issued Such information however is subject to change without any prior notice Before purchasing or using any Renesas Electronics products listed herein please confirm the latest product information with a Renesas Electronics sales office Also please pay regular and careful attention to additional and different information to be disclosed by Renesas Electronics such as that disclosed through our website Renesas Electronics does not assume any liability for infringement of patents copyrights or other intellectual property rights of third parties by or arising from the use of Renesas Electronics products or technical information described in this document No license express implied or otherwise is granted he
15. Ce ee Pointer to a buffer to store the received data USHORT rxnum Total amount of data to receive Return value MD MDK Normal completion Normal completion a _ARGERROR Invalid argument specification rxnumis not a multiple of receive FIFO as trigger R20UT0257EJ0100 Rev 1 00 tENESAS Page 175 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTBn_SendEndCallback Performs processing consequent to the transmission enable interrupt INTUBnTIT and the FIFO transmission comple tion interrupt INTUBnTIF Remark This API function is called as a callback routine of the interrupt process MD_INTUBnTIT corresponding to a transmission enable interrupt INTUBnTIT of UARTBn single mode and interrupt process MD_INTUBnTIF corresponding to a FIFO transmission completion interrupt INTUBnTIF of UARTBn FIFO mode performed when total number of UARTBn transmissions specified by UARTBn_SendData parameter txnum has been completed Classification CG_serial_ user c Syntax void UARTBn_ SendEndCallback void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 176 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTBn_ReceiveEndCallback Performs processing in response to the reception completion interrupt INTUBnTIR Remark This API function is called as the callback routine of interrupt process MD_I
16. Clock output function setting Unused Used Clock monitor setting Unused Used 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 select Project name Project gt gt Code Generator Design Tool gt gt Peripheral func tion node System External Bus Port etc Remark _ If this panel is already open pressing a different peripheral function button such as de changes the content displayed in the Information setting area accordingly R20UT0257EJ0100 Rev 1 00 7tENESAS Page 74 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Description of each area 1 Toolbar This area consists of the following peripheral function buttons When there is peripheral function target microcontroller is not supporting peripheral functionbutton is not disokayed Reflects settings made on this panel in the Device Pin List panel This button will be grayed out disabled if the Not reflected is selected in the PinPart Combination Mode category of the Generation tab 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 view in the Information setting area to System
17. GOGO GGG GGG CGR CGE CCE BOF SAK include CG_macrodriver h include CG systemh Lo Start user code for include Do not edit comment generated here Ve End user code Do not edit comment generated here Ftinclude CG_userdefine h Remark To restore the default name of the API function defined by the Code Generator select Default from the context menu R20UT0257EJ0100 Rev 1 00 Sep 01 2010 tENESAS Page 36 of 394 CubeSuite Ver 1 40 CHAPTER 3 FUNCTIONS Code Generator 3 5 4 Change output mode The Code Generator is used to change the output mode Overwrite file Merge file Keep file for the source code by selecting Generation tab gt gt Generate file in the Property panel Figure 3 10 Change Output Mode Property ee Code Generator Property El Product Information EO Generate File Mode Generate file Meree file Output tolder Overwrite file Report type berge file Register files Do nothing if file exists EO PinGontieurator Reflect Mode Generate file Generate file information Genaration Remark The output mode is selected from the following three types Table 3 5 Output Mode of Source Code Overwrite file If a file with the same name exists the existing file is overwrit ten by a new file 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
18. None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 188 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTCn_ReceiveEndCallback Performs processing in response to the UARTCn reception completion interrupt INTUCnR Remark This API function is called as the callback routine of interrupt process MD_INTUCnR corresponding to the UARTCn reception completion interrupt INTUCnR performed when total number of UARTCn receptions specified by UARTCn_ReceiveData parameter rxnum has been completed Classification CG_serial_ user c Syntax void UARTCn_ReceiveEndCallback void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 189 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTCn _ErrorCallback Performs processing in response to the UARTCn reception error interrupt INTUCnR overrun error framing error parity error Remark This API function is called as the callback routine of interrupt process MD_INTUCnR corresponding to the UARTCn reception error interrupt INTUCoR Classification CG_serial_ user c Syntax include CG macrodriver h void UARTCn_ErrorCallback UCHAR err_type Remark nis the channel number Argumeni s Description Argument Trigger for UARTCn reception error interrupt 00000xx1B Overrun error 00000x1xB Framing error 000001xxB Parity
19. R20UT0257EJ0100 Rev 1 00 tENESAS Page 295 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMTO_Userlnit Performs user defined initialization relating to the 16 bit timer event counter T TMT Remark This API function is called as the TMTO_ Init callback routine Classification CG_timer_user c Syntax void TMTO_UserInit void Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 296 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMTO_ Start Starts the count for 16 bit timer event counter T TMT Remark The length of time between the call to this API function and the start of counting will vary depending on the function type e g interval timer external event counter or external trigger pulse output Classification CG_timer c Syntax void TMTO Starc void Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 297 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMTO_Stop Ends the count for 16 bit timer event counter T TMT Remark The length of time between the call to this API function and the end of counting will vary depending on the function type e g interval timer external event counter or external trigger pulse output Classification CG_timer c Syntax void TMTO_Stop void Argument s None Return value Non
20. tENESAS Page 324 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CG_main c include include CG Fee void main main CG macrodriver h hh RTCCounterValue counterwriteval RTC_CounterEnable counterwriteval counterwriteval counterwriteval counterwriteval counterwriteval counterwriteval counterwriteval RTC_SetHoursSystem RLC Countersec Year 0x08 Month 0x12 Day 0x25 Week Hour Min Sec counterwriteval Start count Set clock type Set counter value R20UT0257EJ0100 Rev 1 Sep 01 2010 00 7tENESAS Page 325 of 394 CubeSuite Ver 1 40 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 mMmacrodriver h include CG FLGsh MD STATUS RTC_CounterGet struct RTCCounterValue counterreadval Argumeni s Argument Description struct RTCCounterValue Pointer to structure in which to store the counter value being read counterreadval Remark See RIC CounierSet for details about the RTCCounterValue counter value Return value 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 h
21. CSIFn_Start Enables 3 wire variable length serial I O F CSIF Classification CG_serial c Syntax void CSiIfn Stare void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 sQENESAS Page 214 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CSIFn_Stop Disables 3 wire variable length serial I O F CSIF Classification CG_serial c Syntax void CSifn stop void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 215 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CSIFn_SendData Starts CSIFn data transmission Remarks 1 This API function repeats the byte level CSIFn transmission from the buffer specified in parameter txbuf the number of times specified in parameter txnum 2 When performing a CSIFn transmission CSIFn_ Start must be called before this API function is called Classification CG_serial c Syntax include CG macrodriver h MD STATUS CSIFn_SendData UCHAR txbur USHORT txnum Remark nis the channel number Argument s o oe o o ee ee Pointer oa buffer storing the wansmission data USHORT txnum Total amount of data to send Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT0257EJ0100 Rev 1 00 tENESAS Page 216 of 394 Sep 01 20
22. Code Generator Design Tool peripheral function node System External Bus Port etc and then select Property from the View menu On the Project Tree panel select a node Pin Configurator Design Tool Device Pin List Device Top View Code Generator Design Tool peripheral function node System External Bus 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 such as System External Bus or Port in the Project Tree panel changes the content displayed in the Detail informa tion display change area and Explanation area accordingly 2 If this panel is already open pressing a different peripheral function button such as t 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 R20UT0257EJ0
23. CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS LVL InterruptModeStart Starts low voltage detection when in interrupt generation mode Classification CG _Ivi c Syntax void LVI_InterruptModeStart void Argumeni 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 _ interrupt void MD_INTLVI void Interrupt processing for INTLVI LVIF 1 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 R20UT0257EJ0100 Rev 1 00 tENESAS Page 379 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS LVI_ResetModeStart Starts low voltage detection when in internal reset mode Classification CG _Ivi c Syntax include CG macrodriver h MD_STATUS LVI_ResetModeStart void Argumeni s None Return value 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
24. El Generate File Mode Generate file Werge file Output folder C Documents and Settings Report type HTML file Register files Output files to project ve El Pin Configurator Refleyaiintia E e Mode Mot output files to project Register files The register mode of the output files is displayed Genaration F R20UT0257EJ0100 Rev 1 00 sQENESAS Page 33 of 394 Sep 01 2010 CubeSuite Ver 1 40 CHAPTER 3 FUNCTIONS Code Generator 3 5 1 Setting that determines whether or not to generate source code 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 7 Setting That Determines Whether or Not to Generate Source Code Code Generator Preview a f File w Common ik oo afk rode is tok Generate code l 2 tive Not generate code EEEE OE E E E E E E E EE EEE OE CG Ika i g Gi starts Start user code for pragma Do not edit comment generated here g G_nttab s End user code Do not edit comment generated here oystem fe External Bus Jasco aa SaaS E ACCA Port FOR INT wk Include files Serial JAS SCC SCI SCS ECE SR Ar SSSR D A xf Timer include OG macrodriver h Watch Timer include CG systemh Real Time Output A t Start user code for include Do not edit comment generated here DMA
25. Save project R20UT0257EJ0100 Rev 1 00 7tENESAS Page 12 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 select Project name Project gt gt Pin Configurator Design Tool gt gt Device Pin List in the Project Tree panel Figure 2 1 Open Device Pin List Panel Device Pin List Function 4 Lo 4 H ch o PIO ANGO Free Remarks 1 If an unsupported microcontroller is defined in the project for the Pin Configurator then Pin Configura tor Design Tool node will hide under Project name Project in the Project Tree panel 2 The Device Pin List panel consists of three tabs Selecting one of the tabs changes the order in which information on each pin of the microcontroller is displayed Pin Number tab Information on each pin of the microcontroller is displayed in the order of pin number Macro tab Information on each pin of the microcontroller is displayed in the order it was grouped into peripheral functions External Peripheral tab Information about the pins connected to external peripherals is displayed in order grouped at the external peripheral component level R20UT0257EJ0100 Rev 1 00 7tENESAS Page 13 of 394 Sep 01 2010 CubeSuite Ver 1 40 CHAPTER 2 FUNCTIONS Pin Configurator 2 2 1 Select
26. See user s manual for details on target microcontrollers Figure A 17 Example of System Glock setting Stand by On chip debug setting WatchdoeTimer Confirming reset source Wain oscillation clock I setting Frequency MHz Mam oscillation feedback resistor PLL input clock fPLLI setting Not divided Subclock 87 setting Unused ATI oscillation Frequency 32768 kHz subclock teedback resistor Internal oscillator clock R setting Gan be stopped by software Option byte Stop Frequency kHz Glock mode setting O Glock mode 1 O Clock mode 2 Glock mode 3 Main clock and GPU clock settine Wain clock fA 32 055606 mode t fhg os TMH GPU clock OFLU 92 fH s MHz Peripheral clock sF P8 32 MHz PLL lockup time setting PLL lockup time 2048 2 TATR tus Ss frequency modulation setting Modulation ool output frequency modulation ratio Ai S503 output modulation cycle 40 kHz Prescaler 3 output clock setting TERG enable 32 769 kHz Actual value 32787 Clock output function setting Unused Used Clock monitor setting Unused Used How to open On the Project Tree panel select Project name Project gt gt Code Generator Design Tool gt gt System Remark Ifthe Code Generator panel is already open pressing the button changes the content displayed accordingly R20UT0257EJ0100 Rev 1 00 tENESAS Page 77 of 394 Sep 0
27. 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 R20UT0257EJ0100 Rev 1 00 tENESAS Page 23 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 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 repre senting the used pins selected by clicking Device Top View Settings tab gt gt Color in the Property panel Figure 2 11 Change in Displayed Color Device Top View Device Top View SF Ae Ae LS R20UT0257EJ0100 Rev 1 00 7tENESAS Page 24 of 394 Sep 01 2010 CubeSuite Ver 1 40 CHAPTER 2 FUNCTIONS Pin Configurator
28. txbuf USHORT txnum UCHAR wait Remark nis the channel number Argument s pee ee eeaeee Remark Device address adr consists of a device type and slave address 7 0 B7 B6 B5 B4 B3 B2 Bi BO Aidi TT lt Always 0 Slave address Device type soo T Device address Return value MD_OK Normal completion MD_ERROR Exit with error abend R20UT0257EJ0100 Rev 1 00 tENESAS Page 226 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS lICOn_MasterReceiveStart Starts IICOn master reception Remark This API function performs byte level simple IICOn 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 IIC0n_MasterReceiveStart UCHAR adr UCHAR rxbuf USHORT rxnum UCHAR wait Remark nis the channel number Argument s o p e rearen Remark Device address adr consists of a device type and slave address 7 0 B7 B6 B5 B4 B3 B2 B1 BO pt TE TT tT gt Always 0 Slave address Device type so T Device address Return value MD_OK Normal completion MD_ERROR Exit with error abend R20UT0257EJ0100 Rev 1 00 tENESAS Page 227 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS liCOn_MasterSendEndCallback Performs processing in response to the IIC
29. 00 tENESAS Page 248 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 R20UT0257EJ0100 Rev 1 00 tENESAS Page 249 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 R20UT0257EJ0100 Rev 1 00 tENESAS Page 250 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 Argumeni s Return value None Example Below is an example of setting analog voltage to channels 0 and 1 CG_main c include CG macrodriver h void main void DAO Start Start D A conversion _Star ar conversion DA1 Start Start D A ue DAO SetValue 0x7f Set analog voltage CG_tau_user c include CG_macrodriver h UCHAR gValue 0 _ interrupt void MD INTTMOS void Interrupt processing for INTTM05 DA SetValue gValuet Set analog voltage R20UT0257EJ01
30. 1 00 tENESAS Page 201 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CSIEn Init Performs initialization necessary to control the 3 wire variable length serial I O E CSIE functions Classification CG_serial c Syntax void CSIEn_Init void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 202 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CSIEn_Userlnit Performs user defined initialization relating to the 3 wire variable length serial I O E CSIE Remark This API function is called as the CSIEn_Init callback routine Classification CG_serial_ user c Syntax void CSIEn_UserInit void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 203 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CSIEn_Start Enables 3 wire variable length serial I O E CSIE Classification CG_serial c Syntax void CSIbn Stare void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 204 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CSIEn_Stop Disables 3 wire variable length serial I O E CSIE Classification CG_serial c Syntax void CSinn stop void 7 Remark nis the channel
31. 1 00 tENESAS Page 362 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTOn_SetHigh2BitData Sets higher 2 bit data for real time output Classification CG_rto c Syntax include CG Mecrodri ver 1 void RTOn_SetHigh2BitsData UCHAR data Remark nis the channel number Argumeni s Remark The API functions treat values set in bits 4 to 5 as higher 2 bit data 7 0 B7 B6 B5 B4 B3 B2 B1 BO DE Higher 2 bit data Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 363 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTOn_ SetLow2BitData Sets lower 2 bit data for real time output Classification CG_rto c Syntax include CG macrodriver h void RTOn_SetLow2BitsData UCHAR data Remark nis the channel number Argumeni s Remark The API functions treat values set in bits 2 to 3 as lower 2 bit data 7 0 B7 B6 B5 B4 B3 B2 B1 BO D ic Lower 2 bit data Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 364 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTOn_SetHigh4BitData Sets higher 4 bit data for real time output Classification CG_rto c Syntax include CG Macrodri yer i void RTOn_SetHigh4BitsData UCHAR data Remark nis the channel number Argumeni s Remark The API functions treat values set in bits 4 to 7 as higher 4 bit data 7 0 B7 B6 B5 B4
32. 139 External Peripheral tab 69 F File Setting tab 62 Functions 11 27 Code Generator 27 Pin Configurator 11 G Generation tab 59 IICOn_GetStopConditionCallback 236 ICOn_Init 222 I1COn_MasterErrorCallback 230 l1COn_MasterReceiveEndCallback 229 l1COn_MasterReceiveStart 227 l1COn_MasterSendEndCallback 228 tENESAS Page 384 of 394 CubeSuite Ver 1 40 APPENDIX D INDEX l1COn_MasterSendStart 226 lCOn_SlaveErrorCallback 235 lICOn_SlaveReceiveEndCallback 234 l1COn_SlaveReceiveStart 232 IWCOn_SlaveSendEndCallback 233 lWCOn_SlaveSendStart 231 ICOn_Stop 224 IICOn_StopCondition 225 COn_Userlnit 223 INT 80 INT 146 INT MaskablelnterruptEnable 151 INTP_Init 147 INTPn_Disable 153 INTPn_ Enable 154 INTP_Userlnit 148 KEY Disable 155 KEY Enable 156 KEY Init 149 KEY Userlnit 150 INT MaskablelnterruptEnable 151 INTP_Init 147 INTPn_Disable 153 INTPn_ Enable 154 INTP_Userlnit 148 K KEY Disable 155 KEY Enable 156 KEY Init 149 KEY Userlnit 150 L LVI 89 LVI 376 LVI_Init 377 LVI_InterruptModeStart 379 LVI_ResetModeStart 380 LVI Start 381 LVI_ Stop 382 LVI UserInit 378 LVI Init 377 LVI_InterruptModeStart 379 LVI_ResetModeStart 380 LVI Start 381 LVI_ Stop 382 LVI _Userlnit 378 M Ma
33. 2 5 Output Report Files Output report files files containing information configured using the 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 the Pin Configurator 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 As Save IF My Documents w E pi mj Amy Music oe My Pictures My Recent Documents i sample _ se T Desktop May Documents Mp Network File name Places i Save at lype Microsoft Office Excel Bool 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 R20UT0257EJ0100 Rev 1 00 7tENESAS Page 25 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 the Pin Configurator device top view The destination folder for the device top view is specified in the Save As dialog box which opens by
34. B3 B2 B1 BO Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 365 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTOn_ SetLow4BitData Sets lower 4 bit data for real time output Classification CG_rto c Syntax include CG macrodriver h void RTOn_SetLow4BitsData UCHAR data Remark nis the channel number Argumeni s Remark The API functions treat values set in bits O to 3 as lower 4 bit data 7 0 B7 B6 B5 B4 B3 B2 B1 BO Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 366 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTOn_GetValue Reads data from real time output Classification CG_rto c Syntax include CG macrodriver h void RTOn_GetValue UCHAR value Remark nis the channel number Argumeni s Ea UCHAR value Pointer to area in which to store the value that was read Return value None Example Below is an example of reading the counter value of the real time counter CG_main c include CG macrodriver h void main void RTOO_Set2BitData 0x30 Set output data RTOO_Enable Enable real time output RTOO Disable Disable real time output CG_timer_user c include CG _macrodriver h _ interrupt void MD_INTTP4CCO void Interrupt processing for INTTP4CCO interrupt UCHAR value 0 RTOO_GetValue amp value
35. E E E E E E E E E E EE E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E EE E E E E E E E EEEE Ek ae Pragma directive gaia GG E EE E E E EOE E EE EE E EE EOE E EE E E E E E EE E E E E CCCI E E EE E E E ICEL DEE E E E E E E E E E E E w Start user code for pragma Do not edit comment generated here End user code Do not edit comment generated here ik ppo HHH Hoo Ek DEEE E EE E E E E E E E hiclude tiles DEE EE E E E E E EE E E E E E E EE GGG GOR E E E E E E E E E E E E E E E EE E E E E E E E a ISSO w include CG macrodriver h include CG systemh Start user code for include Do not edit comment generated here End user code Do not edit comment generated here inc lude CG userdefine h 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 C 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 button on the Code Generator panel is pressed For this reason the source S Generate Code
36. End user code Do not edit comment generated here LWI include CG userdefine h H H CLEEECECEEECCeE 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 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 T must be generated it is impossible to change the icon to FE Source code for the currently selected API function is gener ated Source code for the currently selected API function is not gen erated R20UT0257EJ0100 Rev 1 00 sQENESAS Page 34 of 394 Sep 01 2010 CubeSuite Ver 1 40 CHAPTER 3 FUNCTIONS Code Generator 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 8 Change File Name Code Generator Preview f File See Common oe BCS ee Eyk okooko EEEE EE EEEE agma directive rE IE EIE IET CeCe Tere cece ee Te ee ee VET TET O TET ee VET TET ee ee VET TET OE TT ce IES OE TET ES IET TET ES enn ec SOO ORK OG_inttabs Start user code for pragma Do not edit comment generated here system End user code Do not edit comment generated here External Bus Port PEE E Ek
37. 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 Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 153 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 R20UT0257EJ0100 Rev 1 00 tENESAS Page 154 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS KEY Disable Disables the acceptance of the key interrupts INTKR Classification CG_int c Syntax void KEY Disable void Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 155 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS KEY Enable Enables the acceptance of the key interrupts INTKR Classification CG_int c Syntax void KEY_Enable void Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 156 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS C 3 5 Serial Below is a list of API functions output b
38. INT _MaskablelnterruptEnable INTPn_Disable INTPn_Enable KEY Disable KEY Enable MD_INTNMI MD_INTPn MD_INTKR INTP_UserInit KEY_Userlnit CG_int_user c C UARTAn_ Init UARTAn_ Start UARTAn_Stop UARTAn_SendData UARTAn_ReceiveData UARTBn_ Init UARTBn_ Start UARTBn_ Stop UARTBn_SendData UARTBn_ReceiveData UARTCn_Init UARTCn_ Start UARTCn_Stop UARTCn_SendData UARTCn_ReceiveData CSIBn_Init CSIBn_ Start CSIBn_Stop CSIBn_SendData CSIBn_ReceiveData CSIBn_SendReceiveData CSIEn_Init CSIEn_ Start CSIEn_Stop CSIEn_SendData CSIEn_ReceiveData CSIEn_SendReceiveData R20UT0257EJ0100 Rev 1 00 Sep 01 2010 tENESAS Page 105 of 394 CubeSuite Ver 1 40 APPENDIX B OUTPUT FILES Peripheral Function Source File Name Names of API Functions Included Serial CG_serial c CSIFn_Init CSIFn_ Start CSIFn_Stop CSIFn_SendData CSIFn_ReceiveData ICOn_Init IICOn_Stop IICOn_StopCondition I1COn_MasterSendStart IICOn_MasterReceiveStart IICOn_SlaveSendStart IICOn_SlaveReceiveStart CG_serial_user c MD_INTUAnT MD_INTUAnR MD_INTUBnTIT MD_INTUBnTIF MD_INTUBnTIR MD_INTUBnTIRE MD_INTUBnTITO MD_INTUCnT MD_INTUCnR MD_INTCBnT MD_INTCBnR MD_INTCEnT MD_INTCEnTIOF MD_INTCFntT MD_INTCFnR MD_INTIICn UARTAn_UserlInit UARTAn_SendEndCallback UARTAn_ReceiveEndCallback UARTAn_ErrorCallback UARTAn_SoftOverRunCallback UARTBn_Userlnit UARTBn_SendEndCallback UARTBn_ReceiveEndCallback UARTBn_SingleErrorCallback UARTB
39. Page 333 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 macrodriver h include CG See void main void struct RTCAlarmValue alarmval RTC_AlarmEnable Start alarm interrupt function alarmval Alarmww 0x41 RTC_AlarmSet alarmval Change conditions R20UT0257EJ0100 Rev 1 00 tENESAS Page 334 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTC_AlarmGet Reads the alarm conditions weekday hour minute Classification CG_rtc c Syntax include CG Macrodriver h include CG rtco hn void RTC_AlarmGet struct RTCAlarmValue alarmval Remark See RIC AlarmSet for details about RTCAlarmValue alarm conditions Argumeni s Argument Description EA 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 CG_macrodriver h include CG rton void main void struct RTCAlarmValue alarmval RTC_AlarmEnable Start alarm interrupt function RTC_AlarmGet amp alarmval Read conditions R20UT0257EJ0100 Rev 1 00 tENESAS Page 335 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RT
40. Performs processing in response to the UARTCn reception completion interrupt INTUCoR UARTCn_ErrorCallback Performs processing in response to the UARTCn reception error interrupt INTUCnR overrun error framing error parity error UARTCn_SoftOverRunCallback Performs processing in response to detection of overrun error CSIBn_Init Performs initialization necessary to control the 3 wire variable length serial I O B CSIB functions CSIBn_Userlnit Performs user defined initialization relating to the 3 wire variable length serial I O B CSIB CSIBn_SendEndCallback Performs processing in response to the CSIBn reception completion interrupt INTCBnR or the CSIBn consecutive transmission write enable interrupt INTCBnT CSIBn_ReceiveEndCallback Performs processing in response to the CSIBn reception completion interrupt INTCBnR CSIBn_ErrorCallback Performs processing in response to the CSIBn reception error interrupt INTCBnR overrun error CSIEn_Init Performs initialization necessary to control the 3 wire variable length serial I O E CSIE functions CSIEn_UserlInit Performs user defined initialization relating to the 3 wire variable length serial I O E CSIE CSIEn_SendEndCallback Performs processing in response to the CSIEn transmission reception completion interrupt INTCEnT CSIEn_ReceiveEndCallback Performs processing in response to the CSIEn transmission reception completion interrupt INTCEnT CSIEn_ErrorCallback
41. Read output data value value RTOO_Set2BitData value Set output data R20UT0257EJ0100 Rev 1 00 tENESAS Page 367 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS C 3 12 DMA Below is a list of API functions output by Code Generator for DMA Direct Memory Access controller use Table C 13 API Functions DMA DMAn_ Disable Disables operation of channel n 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_ Software TriggerOn Uses a software trigger as a DMA transfer start tigger a software Uses a software trigger as a DMA transfer start tigger as a DMA transfer start trigger R20UT0257EJ0100 Rev 1 00 tENESAS Page 368 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 R20UT0257EJ0100 Rev 1 00 tENESAS Page 369 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 S
42. Rev 1 00 sQENESAS Page 241 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS AD_SelectADChannel Configures the analog voltage input pin for A D conversion Classification CG_ad c Syntax include CG macrodriver h include CG_ad h MD_STATUS AD_SelectADChannel enum ADChannel channel Argument 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 ADCHANNEL n Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT0257EJ0100 Rev 1 00 tENESAS Page 242 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS AD_SetPFTCondition Sets the information for operation in power fail compare mode comparison value and A D conversion end interrupt INTAD trigger Classification CG_ad c Syntax include CG macrodriver h include Caan MD_STATUS AD_SetPFTCondition UCHAR pftvalue enum ADPFTMode mode Argument s Argument Description E UCHAR pftvalue Comparison value enum ADPFTMode mode Cause of A D conversion end interrupt INTAD EACHEND Generate INTAD when A D is complete PFTHIGHER Generate INTAD if ADAOCRnH gt ADAOPFT PFTLOWER Generate INTAD if ADAOCRnH lt ADAOPFT Remark Ifthe parameter mode is set to PF THIGHER or PF TLOWER then the value set in parameter pftvalue is set in the power fail com
43. TABn_SoftwareTriggerOn 294 TABn_Start 287 TABn_Stop 288 TABn_Userlnit 286 TMMn_ChangeTimerCondition 311 TMMn_Init 307 TMMn_Start 309 TMMn_Stop 310 TMMn_Userlnit 308 TMPn_ChangeDuty 262 TMPn_ChangeTimerCondition 258 TMPn_GetFreeRunningValue 261 TMPn_GetPulseWidth 260 TMPn_Init 254 TMPn_SoftwareTriggerOn 263 TMPn_Start 256 TMPn_Stop 257 TMPn_Userlnit 255 TMQO_ChangeDuty 272 R20UT0257EJ0100 Rev 1 00 Sep 01 2010 tENESAS Page 388 of 394 CubeSuite Ver 1 40 APPENDIX D INDEX TMQO_ChangeTimerCondition 268 TMQO_GetFreeRunningValue 271 TMQO_ GetPulseWidth 270 TMQO_Init 264 TMQ0O_SoftwareTriggerOn 274 TMQO_ Start 266 TMQO_Stop 267 TMQO_Userlnit 265 TMTO_ChangeCountValue 306 TMTO_ChangeDuty 302 TMTO_ChangeTimerCondition 299 TMTO_DisableHold 305 TMTO EnableHold 304 TMTO_GetFreeRunningValue 301 TMTO_GetPulseWidth 300 TMTO_Init 295 TMTO_SoftwareTriggerOn 303 TMTO_ Start 297 TMTO_Stop 298 TMTO_UserlInit 296 TMMn_ChangeTimerCondition 311 TMMn_Init 307 TMMn_Start 309 TMMn_Stop 310 TMMn_Userlnit 308 TMPn_ChangeDuty 262 TMPn_ChangeTimerCondition 258 TMPn_GetFreeRunningValue 261 TMPn_GetPulseWidth 260 TMPn_Init 254 TMPn_SoftwareTriggerOn 263 TMPn_Start 256 TMPn_Stop 257 TMPn_Userlnit 255 TMQO_ChangeDuty 272
44. This API function is called as a callback routine of the interrupt process MD_INTUBnTIRE corresponding to a reception error interrupt INTUBAnTIRE of UARTBn FIFO mode Classification CG_serial_ user c Syntax include CG_Macrodriver h void UARTBn_FIFOErrorCallback UCHAR err typel UCHAR err type2 Remark nis the channel number Argument s UCHAR err_typel Trigger for reception error interrupt 00001000B Overrun error Trigger for reception error interrupt 000000x1B Framing error 0000001xB Parity error UCHAR err type2 Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 179 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTBn_TimeoutErrorCallback Performs processing in response to the reception timeout error interrupt INTUBnTITO Remark This API function is called as a callback routine of the interrupt process MD_INTUBnTITO corresponding to a reception timeout interrupt INTUBAnTITO of UARTBn FIFO mode Classification CG_serial_user c Syntax void UARTBn_TimeoutErrorCallback void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 180 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTBn_SoftOverRunCallback Performs processing in response to detection of overrun error Remark This API function is called as the callback routine of interrupt pr
45. Ver 1 40 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 for microcontrollers manufactured by Renesas Electronics 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 generators external bus interfaces ports etc by configuring various information using the GUI 1 2 Features The design tool Pin Configurator Code Generator has the following features Code generating function The Code Generator can output not only device driver programs in accordance with the information configured using the GUI but also a build environment such as sample programs containing main functions and link directive files Source code output by the Code Generator conforms to the MISRA C Guidelines for the Use of the C Language in Vehicle Based Software coding convention Reporting function You can output configured information using the Pin Configurator Code Generator as files in various formats for use as design documents Renam
46. View Panel Device lop View PUF PAL LAL IA FIF a EFF AT A LAF mF AT AF AE CH TEE SIS LP OORT ARQZAADAADTUUAUAALTAAUAADABAAEFAA AAD EEE R eer RrtRFRP Re PRE Re ERE EER EEE oe REE EERE ERE EECE 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 select Project name Project gt gt Pin Configurator Design Tool gt gt Device Top View 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 R20UT0257EJ0100 Rev 1 00 7tENESAS Page 71 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Description of each area 1 Toolbar This area consists of the following buttons ye Clicks this button to enable changing of the display in theDevice 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 th
47. 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 the following sections for details on this area System External Bus Port INT Serial A D D A Timer Watch Timer RTC Real Time Output DMA LVI Remark 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 the 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 R20UT0257EJ0100 Rev 1 00 tENESAS Page 76 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE System Configure the information required to control the clock generation function standby function and etc provided by the microcontroller Screen Structure may be different depending on the kinds of target microcontrollers
48. area allows you to view and change the setting for the file generation mode Generate file Report type Out put folder and Register files of the Code Generator Generate file Views or select the operation mode applied when the Generate Code button is pressed Operation mode applied when you select File menu gt gt Save Code Generator Report is fixed to Overwrite file Overwrite file If a file with the same name exists the existing file is overwritten by a new file 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 Do nothing if file exists If a file with the same name exists a new file will not be output Output folder Views or select 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 select the format of the report files a file containing information configured using the 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 f
49. ator Panel through 3 3 Enter Information 3 3 1 Input rule Following is the rules for input to the Code Generator panel 1 Character set Character sets that are allowed to input are as follows Table 3 1 List of Character Set ASO 1 byte _1 byte alphabet number symbol _1 byte alphabet number symbol symbol 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 C Notation o puting number A numeric value that starts with a number between 1 and 9 and followed es 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 R20UT0257EJ0100 Rev 1 00 tENESAS Page 29 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 thena ed icon displays next to the incorrect input and the text is displayed in red to warn that there is a problem with th
50. channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 284 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TABn Init Performs initialization necessary to control 16 bit timer event counter AB TAB functions Classification CG_timer c Syntax void TABn_Init void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 285 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TABn_Userinit Performs user defined initialization relating to the 16 bit timer event counter AB TAB Remark This API function is called as the TABn_ Init callback routine Classification CG_timer_user c Syntax void TABn UserlInit void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 286 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TABn Start Starts the count for 16 bit timer event counter AB TAB Remark The length of time between the call to this API function and the start of counting will vary depending on the function type e g interval timer external event counter or external trigger pulse output Classification CG_timer c Syntax void TAB Start void Remark nis the channel number Argumeni s None Return value None
51. click ing Generation tab gt gt Report type in the Property panel The destination folder for the report file is specified by clicking Generation tab gt gt Output folder in the Property panel Save Output Tab Name Output panel dedicated item Saves the message corresponding to the specified tab overwriting the existing file Save Output Tab Name As Output panel dedicated item Opens the Save As dialog box for naming and saving the message correspond ing to the specified tab b Edit menu Undo Property panel dedicated item Cancels the effect of an edit operation to restore the previous state Cut Property panel dedicated item Sends the character string or lines selected with range selection to the clip board and deletes them Copy Property panel Output panel dedicated item Sends the character string or lines selected with range selection to the clip board Paste 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 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 R20UT0257EJ0100 Rev 1 00 7tENESAS Page 45 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Search Replace c Help menu Open Help fo
52. description of the category or item selected in the Detail information display change area Edit menu Property panel dedicated items Undo Cancels the effect of an edit operation to restore the previous state the effect of an edit Cancels the effect of an edit operation to restore the previous state to restore the previous state mo o the character string or lines selected with range selection to the clipboard and deletes them Coy Copy Sends the character string or lines selected with range selection to the clipboard the character string or lines selected with range selection to the Sends the character string or lines selected with range selection to the clipboard Inserts the contents of the clipboard at the caret position Deletes the character string or the lines selected with the range selection Select All Selects all strings displayed in the item being edited Help menu Property panel dedicated items Open Help for Property Panel Displays the help of this panel 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 Cut Sends the character string or lines selected with range selection to the clipboard and deletes them R20UT0257EJ0100 Rev 1 00 7tENESAS Page 51 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Sends the character s
53. eee Go Tota c R E E p i Port APORT a a Bort GOBORTE 7 i ae Port PORT J 0 l Fort FORTEI 0 lili Pin Number Macro External Peripheral A 2 8 8 Device Pin List Thee L Macro Name 4 Total Port PORT pl 10 Port PORTO Port PORTI Port 6 PORTE HH Pin Number External Peripheral R20UT0257EJ0100 Rev 1 00 7tENESAS Page 15 of 394 Sep 01 2010 CubeSuite Ver 1 40 CHAPTER 2 FUNCTIONS Pin Configurator 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 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 Hew Column Remark On the device pin list adding columns to the first level of Macro tab External Peripheral tab is restricted R20UT0257EJ0100 Rev 1 00 7tENESAS Page 16 of 394 Sep 01 2010 CubeSuite Ver 1 40 CHAPTER 2 FUNCTIONS Pin Configurator
54. error UCHAR err type Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 190 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTCn_SoftOverRunCallback Performs processing in response to detection of overrun error Remark This API function is called as the callback routine of interrupt process MD_INTUCnR corresponding to the UARTCn reception error interrupt INTUCnR process performed when the amount of data received is greater than the parameter rxnum specified for UARTCn_ReceiveData Classification CG_serial_ user c Syntax include CG macrodriver h void UARTCn_SoftOverRunCallback UCHAR rx_data Remark nis the channel number Argumeni s UCHAR rx data Received data Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 191 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CSIBn Init Performs initialization necessary to control the 3 wire variable length serial I O B CSIB functions Classification CG_serial c Syntax void CSIBn_Init void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 192 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CSIBn_Userlnit Performs user defined initialization relating to the 3 wire variable length serial I O B CSIB Remark This API function is called as the CS Bn_ Init cal
55. format a b c 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 R20UT0257EJ0100 Rev 1 00 tENESAS Page 122 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 Configures the CPU s standby function Selects the oscillation stabilization time for the X1 oscillator This will become neces sary when STOP mode is released R20UT0257EJ0100 Rev 1 00 tENESAS Page 123 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CLOCK_Init Performs initialization necessary to control clock functions Classification CG_system c Syntax void CLOCK_Init void Argument s None Return value None R20UT0257EJ0100 Rev 1 00 sQENESAS Page 124 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CLOCK Userlnit Performs user defined initialization relating to the clock Remark This API function is called as the CLOCK Init callback routine Classification CG_system_user c Syn
56. in order to configure the information required to control the clock generation function standby function and etc provided by the microcontroller Changes the view in the Information setting area to External Bus in order to config ure the information required to control the external bus interface mode control func tion function for connecting to external memory areas 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 INT for con figuring the information necessary to control the external interrupt functions and the key interrupt function provided by the microcontroller Changes the view in the Information setting area to Serial in order to configure the information required to control the asynchronous serial interface A UARTA 3 wire variable length serial I O CSIB and etc provided by the microcontroller Changes the content displayed in the Information setting area to the A D for con figuring 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 for con figuring the information necessary to control the function of D A converter provided by the microcontroller
57. 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 button in the To select the item to be displayed use the Column Chooser dialog box that opens by pressing the upper left corner of the device pin list Figure 2 2 Select Item Column Chooser x Pin Number Pin Hame Function Fall H ch Define Name Description Recommend Connection For Unused Attention S E e e A A C lt C8 External Peripheral iNew Column Delete Colum Default 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 R20UT0257EJ0100 Rev 1 00 7tENESAS Page 14 of 394 Sep 01 2010 CubeSuite Ver 1 40 CHAPTER 2 FUNCTIONS Pin Configurator 2 2 2 Change display order In the 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 Vb eae Ss Macro Name 4a Used in OH A E p Port PORTS g E a o Port PORTO Part PORTI Port PORTA iiil E g E E k B Port PORTO H Port PORTI q Port PORTS HTT ame H Total a Uset Hl Tan in Di
58. location This only applies to warning messages and error messages R20UT0257EJ0100 Rev 1 00 7tENESAS Page 94 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE All Output Messages tab This tab displays operation logs for all components design tool build tool etc provided by CubeSuite Figure A 32 All Output Messages Tab The following items are explained here How to open Description of each area How to open From the View menu select Output Description of each area 1 Message area This area displays operation logs for all components design tool build tool etc provided by CubeSuite The following table displays the meaning of the color of the message text displayed in this area Table A 5 Color of Message Text Background Black White Information message Displayed with information notices Blue Standard Color Warning message Displayed with warnings about operations Red LightGray Fatal error message Displayed when there is a fatal error or when execution is not possible due to a operational mistake R20UT0257EJ0100 Rev 1 00 tENESAS Page 95 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Code Generator tab This tab displays only operation logs for the Code Generator out of those for various components design tool build tool etc provided by CubeSuite Figure A 33 Code Generator Tab F fd i
59. minute second of the real time counter RTC_ConstPeriodinterruptEnable Sets the cycle of the interrupts INTRTCO then starts the cyclic interrupt function RTC_ConstPeriodinterruptDisable Ends the cyclic interrupt function 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_RC1CK1HZ_ OutputEnable Enables output of the real time counter correction clock 1 Hz to the RC1CK1HZ pin RTC_RC1CK1HZ_OutputDisable Disables output of the real time counter correction clock 1 Hz to the RC1CK1HZ pin RTC_RC1CKO_OutputEnable Enables output of the real time counter clock 32 kHz source to the RC1CKO pin RTC_RC1CKO_OutputDisable Disables output of the real time counter clock 82 KHz source to the RC1CKO pin RTC_RC1CKDIV_OutputEnable Enables output of the real time counter clock 32 kHz cycle to the RC1CKDIV pin RTC_RC1CKDIV_OutputDisable Disables output of the real time counter clock 82 kHz cycle to the RC1CKDIV pin 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 82 kHz source to the RTCCL pin RTC_RTCCL_OutputDisable Disables o
60. nection for unused pin only Unused string 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 R20UT0257EJ0100 Rev 1 00 7tENESAS Page 22 of 394 Sep 01 2010 CubeSuite Ver 1 40 CHAPTER 2 FUNCTIONS Pin Configurator 2 3 4 Select additional infomration Select the type of information to display in the Pin area inthe 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 Seitings tab by select ing the corresponding information under Pin Name Display Figure 2 10 Select Additional Information Property af Device Top View Property El Color Power ping Red Special ping Green Unused pins Black Used ping Blue Device Light ray Highlight Red Macro highlight Yellow External peripheral highlight i Green Tool Tip Tool tip Display all Pin Name Display Detine name Display Fin function Display Not display D efine name Select to show or hide the define name Device Top Yiew Settings Remarks 1 Select one of the following two types for Define name whether to display the Define Name string of the Device Pin List in appended format Display Displays the Define Name string of the device pin list in appended format Not display Hides the Define Name string of the device pin list 2
61. object of low voltage detection is external input voltage EXLVI and external input voltage EXLVI lt detected voltage VEXLVI R20UT0257EJ0100 Rev 1 00 tENESAS Page 380 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS LVI_ Start Starts low voltage detection Classification CG _Ivi c Syntax include CG macrodriver h MD STATUS LVL Start void Argument s None Return value MD_OK Normal completion MD_ARGERROR 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 input voltage EXLVI and external input voltage EXLVI lt detected voltage VEXLVI R20UT0257EJ0100 Rev 1 00 tENESAS Page 381 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS LVI_ Stop Stops low voltage detection Classification CG _Ivi c Syntax void LVI_Stop void Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 382 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX D INDEX A A D 82 A D 237 AD_Init 238 AD_Read 244 AD_ReadByte 245 AD_SelectADChannel 242 AD_SetPFTCondition 243 AD_Start 240 AD Stop 241 AD_Userlnit 239 AD_Init 238 A
62. of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTCn_ReceiveData Starts UARTCn data reception Remarks 1 This API function performs byte level UARTCn reception the number of times specified by the parame ter rxnum and stores the data in the buffer specified by the parameter rxbuf 2 Actual UARTCn reception starts after this API function is called and UARTCn_ Start is then called Classification CG_serial c Syntax include CG macrodriver h MD_STATUS UARTCn_ReceiveData UCHAR rxbuf USHORT rxnum Remark nis the channel number Argumeni s Ce ee 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 R20UT0257EJ0100 Rev 1 00 tENESAS Page 187 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTCn_SendEndCallback Performs processing in response to the UARTCn consecutive transmission enable interrupt INTUCnT Remark This API function is called as the callback routine of interrupt process MD_INTUCnT corresponding to the UARTCn consecutive transmission enable interrupt INTUCnT performed when total number of UARTCn transmissions specified by UARTCn_SendData parameter txnum has been completed Classification CG_serial_ user c Syntax void UARTCn_SendEndCallback void Remark nis the channel number Argumeni s
63. selecting File menu gt gt Save Top View As Save As Save IF My Documents w My Recent Documents T Desktop May Documents May Computer P biy Network Places Remark Top View Figure 2 13 Output Device Top View HM Videos sample File name wt gt p E Save If a device top view has been already output that view will be overwritten by selecting File menu gt gt Save R20UT0257EJ0100 Rev 1 00 Sep 01 2010 tENESAS Page 26 of 394 CubeSuite Ver 1 40 CHAPTER 3 FUNCTIONS Code Generator CHAPTER 3 FUNCTIONS Code Generator This chapter describes the key functions provided by the design tool Code Generator along with operation proce dures 3 1 Overview The Code Generator outputs source code device driver programs based on information selected entered on the CubeSuite panels that is needed to control peripheral functions provided by the microcontroller e g clock generators external bus interfaces and ports The following sections describe the operation procedures for the Code Generator 1 2 3 Start CubeSuite Launch CubeSuite from the Start menu of Windows Remark See CubeSuite Start User s Manual for details on Start CubeSuite 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
64. 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 R20UT0257EJ0100 Rev 1 00 Sep 01 2010 tENESAS Page 41 of 394 CubeSuite Ver 1 40 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 15 Change Output Destination Browse For Folder Desktop E My Documents of My Computer E3 My Network Places 2 Unused Desktop Shortcuts Make New Folder o Cancel R20UT0257EJ0100 Rev 1 00 sQENESAS Page 42 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE APPENDIX A WINDOW REFERENCE This appendix explains in detail the functions of the windows panels and dialog boxes of the design tool A 1 Description The design tool has the following windows panels and dialog boxes Table A 1 Window Panel Dialog Box List 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
65. the pins tips for avoiding the conflict popups Figure 3 3 Icon Indicating Pin Conflict Code Generator P Reflect in Fin Generate Code faa iE tie TH r bil gh ae iy H m External Interrupt Key Interrupt NMI Setting E WOA0S004 The following conflicts have been detected You must change the setting inf that module before you can use it for other purpose NMI was used as PUZ Used as multiple interrupt IN TPT Setting INTP Valid edee Priority Used as multiple interrupt INTP Setting Used as multiple interrupt INTF3 Setting ZIINTPS Valid edee Priority Used as multiple interrupt Enables digital noise elimination Sampling frequency 62500 fX4 2 6 kHz R20UT0257EJ0100 Rev 1 00 7tENESAS Page 31 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 Code Generator Preview Q File Eh te Common e OG mairic 9 OG_systeminite J OG_macrodriverh J CG_userdetineh J OG_k dir J CG starts T cG inttabs System External Bus Port INT er lal 4 D DA Timer Watch Timer Real Time Output DMA LWI Figure 3 4 Confirm Source Code FE DEEE EE EE E
66. 00 Rev 1 00 tENESAS Page 251 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS C 3 8 Timer Below is a list of API functions output by Code Generator for timer use Table C 9 API Functions Timer TMPn_Init Performs initialization necessary to control 16 bit timer event counter P TMP func tions Reads the pulse width of 16 bit timer event counter P TMP high low level width TMPn_GetFreeRunningValue Reads the value captured by 16 bit timer event counter P TMP TMPn_ChangeDuty Changes the duty ratio of the PWM signal TMPn_SoftwareTriggerOn Generates the trigger software trigger for timer output TMQO Init Performs initialization necessary to control 16 bit timer event counter Q TMQ func tions TMQO_Userlnit Performs user defined initialization relating to the 16 bit timer event counter Q TMQ TMQ0O_ Start Starts the count for 16 bit timer event counter Q TMQ TMQ0O_ Stop Ends the count for 16 bit timer event counter Q TMQ TMQO0O_ChangeTimerCondition Changes the counter value for 16 bit timer event counter Q TMQ TMQO0_GetPulseWidth Reads the pulse width of 16 bit timer event counter Q TMQ high low level width TMQO_GetFreeRunningValue Reads the value captured by 16 bit timer event counter Q TMQ TMQO_ChangeDuty Changes the duty ratio of the PWM signal TMQ0_SoftwareTriggerOn Generates the trigger software trigger for timer output TAAn_Init Performs initialization necessary to c
67. 010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CSIEn _ErrorCallback Performs processing in response to the CSIEnNBUF overflow interrupt INTCEnTIOF Remark This API function is called as the callback routine of interrupt process MD_INTCEnTIOF corresponding to the CSIEnNBUF overflow interrupt INTCENnTIOF Classification CG_serial_user c Syntax void CSIEn_ErrorCallback void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 sQENESAS Page 211 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CSIFn_Init Performs initialization necessary to control the 3 wire variable length serial I O F CSIF functions Classification CG_serial c Syntax void CSIFn_Init void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 212 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CSIFn_Userlnit Performs user defined initialization relating to the 3 wire variable length serial I O F CSIF Remark This API function is called as the CSIFn_ Init callback routine Classification CG_serial_ user c Syntax void CSIFn_UserInit void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 213 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS
68. 1 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE External Bus Configure the information required to control the external bus interface mode control function function for connecting to external memory areas provided by the microcontroller Screen Structure may be different depending on the kinds of target microcontrollers See user s manual for details on target microcontrollers Figure A 18 Example of External Bus Operation setting Unused Used Expanded internal RAM setting Usable Memory maps setting O Memory mapli Memory map Memory map 3 Memory map 4 External memory area setting Cl space OO800000H O0F FFFFFH ahi Coe space OO400000H O07FFFFFH kathi Cid space 01 O00000H 01 FFFFFFH 16M Mode settine Multiplexed bus mode O Seperate bus mode Gol space setting Data bus width Humber of wait states Insert the address hold wait Insert the address setup wait Insert the idle state Gad space setting Data bus width 16 bits Humber of wait states Insert the address hold wart Insert the address setup wait hsert the idle state Gad space setting Data bus width Humber of wait states Insert the address hold wait Insert the address setup wait Ingert the idle state Bus control pin setting wWRO WRI Ro WATT HLOAR HLOURG o TB J gt 4 4 4 16 bits og 4 How to open On the Project Tree panel select Project name Project gt gt Code Generator Design T
69. 1 00 tENESAS Page 268 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMQO_ChanneTimerCondition amp array_reg array_num Change counter value R20UT0257EJ0100 Rev 1 00 7tENESAS Page 269 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMQO_ GetPulseWidth Reads the pulse width of 16 bit timer event counter Q TMQ high low level width Remarks 1 This API function can only be called when 16 bit timer event counter Q TMQ is being used for pulse width measurement 2 If there is an overflow 2 pulses or more during pulse width measurement then the pulse width will not be read correctly Classification CG_timer c Syntax include CG macrodriver h void TMQO_GetPulseWidth ULONG activewith ULONG inactivewidth j Argumeni s Pe eee m Pointer to an area storing the high level width that was read 0x0 to Ox1 ffff ee Pointer to an area storing the low level width that was read 0x0 to Ox1 ffff Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 270 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMQ0O_GetFreeRunningValue Reads the value captured by 16 bit timer event counter Q TMQ Remark This API function can only be called when 16 bit timer event counter Q TMQ is used as a free running timer and TQO capture compare register m TQOCCR m is selected as the capture register Classificatio
70. 10 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CSIFn_ReceiveData Starts CSIFn data reception Remarks 1 This API function performs byte level CSIFn 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 CSIFn reception CS Fn_Siart must be called before this API function is called Classification CG_serial c Syntax include CG macrodriver h MD_STATUS CSIFn_ReceiveData UCHAR rxbuf USHORT rxnum Remark nis the channel number Argumeni s Ce ee 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 R20UT0257EJ0100 Rev 1 00 tENESAS Page 217 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CSIFn_SendReceiveData Starts CSIFn data transmission reception Remarks 1 This API function repeats the byte level CSIFn transmission from the buffer specified in parameter txbuf the number of times specified in parameter txnum 2 This API function performs byte level CSIFn 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 CSIFn transmission reception CS Fn_ Start must be called before this API function is called Classification CG_serial c Syntax includ
71. 100 Rev 1 00 tENESAS Page 50 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Description of each area 1 Detail information display change area This area allows you to view the information on and change the setting for the node Pin Configurator Design Tool Device Pin List Device Top View Code Generator Design Tool or peripheral function node such as System EE oe Bus or Port selected in the Project Tree panel the peripheral function button such as or pressed in the Code Generator panel or the file selected in the Code Generator Preview sana The onto odi in this area differs depending on the node selected in the Project Tree panel the peripheral function button pressed in the Code Generator panel or the file selected in the Code Generator Preview panel The following table displays the meaning of H and amp displayed to the left of each category Indicates that the items within the category are displayed as a collapsed view Indicates that the items within the category are displayed as an expanded view Remarks 1 See the sections Pin Configurator Settings tab Pin Configurator Information tab Device Top View Settings tab Generation tab Macro Setting tab and File Setting tab for details on the content displayed in this area 2 Toswitch between and click this mark or double click the category name 2 Explanation area This area displays a brief
72. 144 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS 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 win ET O MD_TRUE MD_CLEAR Switch I O mode oe R20UT0257EJ0100 Rev 1 00 tENESAS Page 145 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS C 3 4 INT Below is a list of API functions output by Code Generator for interrupt and key interrupt use Table C 5 API Functions INT 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_ KEY_Disable Disables the acceptance of the key interrupts INTKR m Enables the acceptance of the key interrupts INTKR R20UT0257EJ0100 Rev 1 00 sQENESAS Page 146 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 Argument s None Return value None R20UT0257EJ0100 Rev 1 00 sQENESAS Page 147 of 394 Sep 01 2010 CubeSuite Ve
73. 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 af Device Top View Property El Color Power ping Special ping Unused pins Used ping Device Highlight Macro highlight External peripheral highlight El ToolTip Tool tip El Fin Name Display Define name Pin functor C Firebrick Power pins Select test calor of power pinis Device Top Yiew Settings Remark Select the colors to be displayed for the following eight types of items Table 2 2 Select Color Selects the display color for power pins pins whose use is limited to power Selects the display color for special pins pins with specified uses Selects the display color for unused pins dual use pins with no use set in the Device Pin List panel Selects the display color for used pins dual use pins with a use set in the Device Pin List panel Selects the display color of the microcontroller Highlight Selects the background color of a pin selected in the Device Pin List panel on the Pin Number tab Macro highlight Selects the background color of pins selected in the Device Pin List panel on the Macro tab R20UT0257EJ0100 Rev 1 00 tENESAS Page 20 of 394 Sep 01 2010 CubeSuite Ver 1 40 CHAPTER 2 FUNCTIONS Pin Configurator Extern
74. 20UT0257EJ0100 Rev 1 00 tENESAS Page 255 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMPn Start Starts the count for 16 bit timer event counter P TMP Remark The length of time between the call to this API function and the start of counting will vary depending on the function type e g interval timer external event counter or external trigger pulse output Classification CG_timer c Syntax void TMPn Start void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 256 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMPn_Stop Ends the count for 16 bit timer event counter P TMP Remark The length of time between the call to this API function and the end of counting will vary depending on the function type e g interval timer external event counter or external trigger pulse output Classification CG_timer c Syntax void TMPn_Stop void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 257 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMPn_ChangeTimerCondition Changes the counter value for 16 bit timer event counter P TMP Remark The value specified in parameter arrar_reg is set in TMPn capture compare register m TPnCCRm Classification CG_timer c Syntax
75. 22 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS R20UT0257EJ0100 Rev 1 00 7tENESAS Page 323 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 mMmacrodriver h include CG FLGsh MD STATUS RTC_CounterSet struct RTCCounterValue counterwriteval Argumeni s Argument Description struct RTCCounterValue Counter value counterwriteval Remark Below is an example of the structure RT CCounterValue 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 MD_OK Normal completion MD_BUSY1 Executing count process before change to setting MD_BUSY2 Stopping count process after change to setting Remark If MD_BUSY1 or MD_BUSY2 is returned it may be because the counter operation is stopped or the counter operation start wait time is too short so make the value of the RTC_WAITTIME macro defined in the header file CG_rtc h larger Example The example below shows the counter value of the real time counter being set to 2008 12 25 Thu 17 30 00 R20UT0257EJ0100 Rev 1 00
76. 57EJ0100 Rev 1 00 tENESAS Page 359 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTOn_Set4BitData Sets 4 bit data for real time output Classification CG_rto c Syntax include CG macrodriver h void RTOn_Set4BitsData UCHAR data Remark nis the channel number Argumeni s Remark The API functions treat values set in bits O to 3 as 4 bit data r 0 B7 B6 B5 B4 B3 B2 B1 BO Z 4 bit data Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 360 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTOn_Set6BitData Sets 6 bit data for real time output Classification CG_rto c Syntax include CG macrodriver h void RTOn_Set6BitsData UCHAR data Remark nis the channel number Argumeni s Remark The API functions treat values set in bits O to 5 as 6 bit data 7 0 B7 B6 B5 B4 B3 B2 B1 BO lt n Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 361 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTOn_Set8BitData Sets 8 bit data for real time output Classification CG_rto c Syntax include CG macrodriver h void RTOn_Set8BitsData UCHAR data Remark nis the channel number Argumeni s Remark The API functions treat values set in bits 0 to 7 as 8 bit data 7 0 B7 B6 B5 B4 B3 B2 Bi BO 8 bit data Return value None R20UT0257EJ0100 Rev
77. 679 Renesas Electronics Shanghai Co Ltd Unit 204 205 AZIA Center No 1233 Lujiazui Ring Rd Pudong District Shanghai 200120 China Tel 86 21 5877 1818 Fax 86 21 6887 7858 7898 Renesas Electronics Hong Kong Limited Unit 1601 1613 16 F Tower 2 Grand Century Place 193 Prince Edward Road West Mongkok Kowloon Hong Kong Tel 852 2886 9318 Fax 852 2886 9022 9044 Renesas Electronics Taiwan Co Ltd 7F No 363 Fu Shing North Road Taipei Taiwan Tel 886 2 8175 9600 Fax 886 2 8175 9670 Renesas Electronics Singapore Pte Ltd 1 harbourFront Avenue 06 10 keppel Bay Tower Singapore 098632 Tel 65 6213 0200 Fax 65 6278 8001 Renesas Electronics Malaysia Sdn Bhd Unit 906 Block B Menara Amcorp Amcorp Trade Centre No 18 JIn Persiaran Barat 46050 Petaling Jaya Selangor Darul Ehsan Malaysia Tel 60 3 7955 9390 Fax 60 3 7955 9510 Renesas Electronics Korea Co Ltd 11F Samik Lavied or Bldg 720 2 Yeoksam Dong Kangnam Ku Seoul 135 080 Korea Tel 82 2 558 3737 Fax 82 2 558 5141 http www renesas com 2010 Renesas Electronics Corporation All rights reserved Colophon 1 0 CubeSuite Ver 1 40 CENESAS Renesas Electronics Corporation R20UT0257EJ0100
78. API Functions Watch Timer WT_Init Performs initialization necessary to control watch timer functions WT_Userlnit Performs user defined initialization relating to the watch timer WT_ Start Clears the watch timer counter and resumes counting WT_Stop Ends the count for watch timer R20UT0257EJ0100 Rev 1 00 tENESAS Page 312 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS WT Init Performs initialization necessary to control watch timer functions Classification CG_wt c Syntax void WT Init void Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 313 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS WT_Userlnit Performs user defined initialization relating to the watch timer Remark This API function is called as the WT_ Init callback routine Classification CG_wt_user c Syntax void WT_UserInit void Argument s None Return value None R20UT0257EJ0100 Rev 1 00 7tENESAS Page 314 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS WT_ Start Clears the watch timer counter and resumes counting Classification CG_wt c Syntax void WI Start void Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 315 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS WT_Stop Ends the count for watch timer
79. ARTCn_Start 184 UARTCn_Stop 185 UARTCn_Userlnit 183 W Watch Timer 85 Watch Timer 312 WT_Init 313 WT_Start 315 WT_Stop 316 WT Userlnit 314 WDT2_ Restart 133 Window reference 43 WT_Init 313 WT_Start 315 WT_Stop 316 WT Userlnit 314 R20UT0257EJ0100 Rev 1 00 tENESAS Page 390 of 394 Sep 01 2010 Revision Record Description Sep 01 2010 Sep 01 2010 2010 P First Edition issued CubeSuite Ver 1 40 User s Manual V850 Design Publication Date Rev 1 00 Sep 1 2010 Published by Renesas Electronics Corporation CENESAS SALES OFFICES Renesas Electronics Corporation Refer to http www renesas com for the latest and detailed information Renesas Electronics America Inc 2880 Scott Boulevard Santa Clara CA 95050 2554 U S A Tel 1 408 588 6000 Fax 1 408 588 6130 Renesas Electronics Canada Limited 1101 Nicholson Road Newmarket Ontario L3Y 9C3 Canada Tel 1 905 898 5441 Fax 1 905 898 3220 Renesas Electronics Europe Limited Dukes Meadow Millboard Road Bourne End Buckinghamshire SL8 5FH U K Tel 44 1628 585 100 Fax 44 1628 585 900 Renesas Electronics Europe GmbH Arcadiastrasse 10 40472 Dusseldorf Germany Tel 49 211 65030 Fax 49 211 6503 1327 Renesas Electronics China Co Ltd 7th Floor Quantum Plaza No 27 ZhiChunLu Haidian District Beijing 100083 P R China Tel 86 10 8235 1155 Fax 86 10 8235 7
80. ATFAA AA EEE R err RrtRFRP Re PRE Re ERE EER EEE oe REE EERE ERE EECE 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 R20UT0257EJ0100 Rev 1 00 7tENESAS Page 18 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 El Product Informaton El Use of Pin Contigurator Panek Use pin configurator panels Mo El Package Package type 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 R20UT0257EJ0100 Rev 1 00 7tENESAS Page 19 of 394 Sep 01 2010 CubeSuite Ver 1 40 CHAPTER 2 FUNCTIONS Pin Configurator 2 3 2 Select color Select the colors used to distinguish the type of pins power pins special pins unused pins etc whose information is displayed in the Device Top View panel which is opened as described in
81. B9 B8 B7 B6 B5 B4 B3 B2 BI Results of A D conversion to be stored in buffer Return value MD_OK Normal completion MD ERROR Exit with error abend R20UT0257EJ0100 Rev 1 00 tENESAS Page 245 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS C 3 7 D A Below is a list of API functions output by Code Generator for D A converter use Table C 8 API Functions D A DAn_Init Performs initialization necessary to control D A converter functions DAn_Userlnit Performs user defined initialization relating to the D A converter DAn_ Stop Ends D A conversion DAn_SetValue Sets the analog voltage output to the ANOn pin R20UT0257EJ0100 Rev 1 00 tENESAS Page 246 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS Performs initialization necessary to control D A converter functions Classification CG_da c Syntax void DAn_Init void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 247 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS DAn_Userlnit Performs user defined initialization relating to the D A converter Remark This API function is called as the DAn_ Init callback routine Classification CG_da_user c Syntax void DAn_UserInit void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1
82. Bn_Stop 195 CSIBn_Userlnit 193 CSIEn_ErrorCallback 211 CSIEn_Init 202 CSIEn_ReceiveData 207 CSIEn_ReceiveEndCallback 210 CSIEn_SendData 206 CSIEn_SendEndCallback 209 CSIEn_SendReceiveData 208 CSIEn_Start 204 CSIEn_Stop 205 CSIEn_Userlnit 203 CSIFn_ErrorCallback 221 CSIFn_Init 212 CSIFn_ReceiveData 217 CSIFn_ReceiveEndCallback 220 CSIFn_SendData 216 CSIFn_SendEndCallback 219 CSIFn_SendReceiveData 218 CSIFn_Start 214 CSIFn_Stop 215 CSIFn_UserlInit 213 D D A 83 D A 246 DAn_ Init 247 DAn_SetValue 251 DAn_ Start 249 DAn_Stop 250 DAn_UserlInit 248 DAn Init 247 DAn_SetValue 251 DAn_Start 249 DAn_Stop 250 DAn_UserlInit 248 Device Pin List panel 63 External Peripheral tab 69 Macro tab 67 Pin Number tab 65 R20UT0257EJ0100 Rev 1 00 Sep 01 2010 APPENDIX D INDEX Device Top View panel 71 Device Top View Settings tab 56 DMA 88 DMA 368 DMAn_CheckStatus 373 DMAn_ Disable 372 DMAn_Enable 371 DMAn_Init 369 DMAn_SetData 374 DMAn_SoftwareTriggerOn 375 DMAn_UserlInit 370 DMAn_CheckStatus 373 DMAn_ Disable 372 DMAn_Enable 371 DMAn_Init 369 DMAn_SetData 374 DMAn_SoftwareTriggerOn 375 DMAn_UserlInit 370 E External Bus 78 External Bus 137 BUS Init 138 BUS Userlnit
83. CPU s standby function Classification CG_system c Syntax include CG macrodriver h include CG_system h MD STATUS CG_SelectPowerSaveMode enum PSLevel level Argumeni s enum PSLevel level Standby function type E Sx3 H ES Jx3 E ES Jx3 H PSSTOP STOP mode PSHALT HALT mode PSIDLE1 IDLE1 mode PSIDLE2 IDLE2 mode ES Jx3 ES Jx3 L PSSTOP STOP mode PSHALT HALT mode Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT0257EJ0100 Rev 1 00 tENESAS Page 129 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CG _SelectStabTime Selects the oscillation stabilization time for the X1 oscillator This will become necessary when STOP mode is released Classification CG_system c Syntax include CG macrodriver h include CG_system h MD STATUS CG SelectStabTime enum StabTime waittime Argumeni s Oscillation stabilization time type enum StabTime waittime STLEVELO STLEVEL1 STLEVEL2 STLEVEL3 STLEVEL4 STLEVELS STLEVEL6 2 10 fx 2 11 fx 2 12 fx 2 13 fx 2 14 fx 2 15 fx 2 16 fx Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT0257EJ0100 Rev 1 00 Sep 01 2010 tENESAS Page 130 of 394 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CG_SelectPIIMode Selects the operation mode of the PLL function Classif
84. C_IntervalStart Starts the interval interrupt function Remark After setting the cycle of the interrupts INTRTC2 call RTC_IntervallnterruptEnable to start the interval inter rupt function Classification CG_rtc c Syntax void RTC_IntervalStart void Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 336 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTC_IntervalStop Ends the interval interrupt function Classification CG_rtc c Syntax void RIC _Intervalstop void Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 337 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTC_IntervallnterruptEnable Sets the cycle of the interrupts INTRTC2 then starts the interval interrupt function Remark Call RIC_IntervalStart to start the interval interrupt function without setting the cycle of the interrupts INTRTC2 Classification CG_rtc c Syntax include CG_macrodriver h include CG rte n MD_STATUS RTC_IntervalInterruptEnable enum RTCINTInterval interval Argumeni s enum RTCINTInterval interval Interrupt INTRTC2 cycle INTERVALO 246 fRTC INTERVAL1 247 fRTC INTERVAL2 248 fRTC INTERVALS 249 fRTC INTERVAL4 2410 fRTC INTERVALS 2411 fRTC INTERVALE6 2412 fRTC Remark fRTC is the frequency of the subsystem clock Return value MD_OK
85. Cn_SendEndCallback 188 UARTCn_SoftOverRunCallback 191 UARTCn_ Start 184 UARTCn_Stop 185 UARTCn_Userlnit 183 System 77 System 123 CG_ChangeClockMode 127 CG_ChangeFrequency 128 CG_ReadResetSource 126 CG_SelectPlIMode 131 132 CG_SelectPowerSaveMode 129 CG_SelectStabTime 130 CLOCK Init 124 CLOCK Userlnit 125 CRC_GetResult 136 CRC_SetData 135 CRC Start 134 WDT2_ Restart 133 T TAAn_ChangeDuty 283 TAAn_ChangeTimerCondition 279 TAAn_ControlOutputToggle 280 TAAn_GetFreeRunningValue 282 TAAn_GetPulseWidth 281 TAAn_Init 275 TAAn_SoftwareTriggerOn 284 TAAn_ Start 277 TAAn_Stop 278 TAAn_Userlnit 276 TABn_ChangeDuty 293 TABn_ChangeTimerCondition 289 TABn_ControlOutputToggle 290 TABn_GetFreeRunningValue 292 TABn_GetPulseWidth 291 TABn_Init 285 TABn_SoftwareTriggerOn 294 TABn_Start 287 TABn_Stop 288 TABn_Userlnit 286 Timer 84 Timer 252 TAAn_ChangeDuty 283 TAAn_ChangeTimerCondition 279 TAAn_ControlOutputToggle 280 TAAn_GetFreeRunningValue 282 TAAn_GetPulseWidth 281 TAAn_Init 275 TAAn_SoftwareTriggerOn 284 TAAn_ Start 277 TAAn_Stop 278 TAAn_Userlnit 276 TABn_ChangeDuty 293 TABn_ChangeTimerCondition 289 TABn_ControlOutputToggle 290 TABn_GetFreeRunningValue 292 TABn_GetPulseWidth 291 TABn_Init 285
86. DIX B OUTPUT FILES APPENDIX C API FUNCTIONS APPENDIX D INDEX How to Read This Manual It is assumed that the readers of this manual have general knowledge of electricity logic circuits and microcontrollers Conventions 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 R20UTO267E v850 Debug 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 MEMO MEMO MEMO TABLE OF CONTENTS CHAPTER 1 GENERAL 10 1 1 Overview 10 1 2 Features 10 CHAPTER 2 FUNCTIONS Pin Configurator 11 2 1 Overview 11 2 2 Open Device Pin List Panel 13 2 2 1 Select item 14 2 2 2 Change display order 15 2 2 3 Add column 16 2 2 4 Delete column 17 2 3 Open Device Top View Panel 18 2 3 1 Select shape of microcontroller
87. D_Read 244 AD_ReadByte 245 AD_SelectADChannel 242 AD_SetPFTCondition 243 AD_Start 240 AD Stop 241 AD_Userlnit 239 All Output Messages tab 95 API functions 111 A D 237 D A 246 DMA 368 External Bus 137 INT 146 LVI 376 Port 140 Real Time Output 354 RTC 317 Serial 157 System 123 Timer 252 Watch Timer 312 B Browse For Folder dialog box 101 BUS Init 138 APPENDIX D INDEX BUS Userlnit 139 C CG_ChangeClockMode 127 CG_ChangeFrequency 128 CG_ReadResetSource 126 CG_SelectPlIMode 131 132 CG_SelectPowerSaveMode 129 CG_SelectStabTime 130 CLOCK Init 124 CLOCK Userlnit 125 Code Generator panel 74 A D 82 D A 83 DMA 88 External Bus 78 INT 80 LVI 89 Port 79 Real Time Output 87 RTC 86 Serial 81 System 77 Timer 84 Watch Timer 85 Code Generator Preview panel 90 Code Generator tab 96 Column Chooser dialog box 97 CRC_GetResult 136 CRC_SetData 135 CRC Start 134 CSIBn_ErrorCallback 201 CSIBn_Init 192 CSIBn_ReceiveData 197 CSIBn_ReceiveEndCallback 200 CSIBn_SendData 196 CSIBn_SendEndCallback 199 CSIBn_SendReceiveData 198 R20UT0257EJ0100 Rev 1 00 Sep 01 2010 tENESAS Page 383 of 394 CubeSuite Ver 1 40 CSIBn_Start 194 CSI
88. Design Tool selected in the Project Tree panel Figure A 8 Generation Tab Property gt Gode Generator Property El Product Information Werzion Release date El Generate File Mode Generate file Meree file Output tolder C Documents and Settings Report type HTML file Register files Output files to project El Pin Configurator Reflect Mode Mode Reflected Version The version information of the product t displayed Genaration The following items are explained here How to open Description of each area How to open On the Project Tree panel select Project name Project gt gt Code Generator Design Tool and then select Property from the View menu On the Project Tree panel select Project name Project gt gt Code Generator Design Tool and then select Property from the context menu Remark _ If this panel is already open selecting a different Code Generator Design Tool in the Project Tree panel changes the content displayed accordingly Description of each area 1 Product Information category This area displays product information Version and Release date on the Code Generator Version Displays the version of the Code Generator Release date Displays the release date of the Code Generator R20UT0257EJ0100 Rev 1 00 tENESAS Page 59 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE 2 Generate File Mode category This
89. External Parts This area is for selecting which external peripheral controller to connect the pin to Remarks 1 You cannot add information in the Macro Name Total Used Used by other function Pin Number Pin Name Description Recommend Connection For Unused and Attention col umns because they contain fixed information 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 button in the upper left corner of the device pin list R20UT0257EJ0100 Rev 1 00 tENESAS Page 68 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 Total Pin Number Pin Name 4a Function 1 v REFU Free Pin Number A M
90. From the View menu select Pin Configurator gt gt Device Pin List Description of each area 1 Device pin list area Display 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 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 VO mode of theping area allows This area allows you to select the I O mode ofthe pin 0 to select the I O mode of the pin This area allows you to select which output mode to apply when using the pin in the output mode This area allows you to assign a user defined pin name to the pin Displays the summary of function of the pin R20UT0257EJ0100 Rev 1 00 7tENESAS Page 65 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Recommend Connection For Displays instructions on how to handle the pin when it is not used Unused This column displays information only when the Free is selected in the Function column Attention Displays the precaution on using the pin External Parts This area is for selecting which external peripheral controller to connect the pin to
91. I FUNCTIONS liCOn_Userlnit Performs user defined initialization relating to the IIC bus Remark This API function is called as the COn_ Init callback routine Classification CG_serial_ user c Syntax void TicOn_UserInit void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 223 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS liCOn_Stop Ends ICOn communication Classification CG_serial c Syntax void IIC0n_ Stop void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 224 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS liCOn_StopCondition Generates a stop condition Classification CG_serial c Syntax void IIc0n_StopCondition void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 225 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS li1COn_MasterSendStart Starts IIC0n master transmission Remark This API function repeats the byte level IICOn 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 IIcC0n_MasterSendStart UCHAR adr UCHAR
92. I function can only be called when 16 bit timer event counter AB TAB is used for external trigger pulse output PWM output Classification CG_timer c Syntax include CG_macrodriver h MD_ATATUS TABn_ChangeDuty UCHAR array_duty UCHAR array_num Remark nis the channel number Argument s UCHAR array_num Register to change 1 TABnCCR1 2 TABnCCR1 TPnCCR2 3 TABnCCR1 TPnCCR2 TPnCCR3 Remark The value set to duty ratio array duty must be in base 10 notation Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT0257EJ0100 Rev 1 00 tENESAS Page 293 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TABn_SoftwareTriggerOn Generates the trigger software trigger for timer output Remark This API function can only be called when 16 bit timer event counter AB TAB is used for external trigger pulse output one shot pulse output Classification CG_timer c Syntax void TABn_SoftwareTriggerOn void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 294 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMTO_Init Performs initialization necessary to control 16 bit timer event counter T TMT functions Classification CG_timer c Syntax void TMTO_Init void Argument s None Return value None
93. IX C API FUNCTIONS CSIEn_SendEndCallback Performs processing in response to the CSIEn transmission reception completion interrupt INTCEnT Remark This API function is called as the callback routine process performed when the total number of CSIEn transmissions specified in the parameter txnum for CSIEn_SendData or CSIEn_SendReceiveData has been completed of interrupt process MD_INTCEnT corresponding to the CSIEn transmission reception completion interrupt INTCEnT Classification CG_serial_ user c Syntax void CSIEn_SendEndCallback void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 209 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CSIEn_ReceiveEndCallback Performs processing in response to the CSIEn transmission reception completion interrupt INTCEnT Remark This API function is called as the callback routine process performed when the total number of CSIEn receptions specified in the parameter rxnum for CSIEn_ReceiveData or CSIEn_SendReceiveData has been completed of interrupt process MD_INTCEnT corresponding to the CSIEn transmission reception completion interrupt INTCEnT Classification CG_serial_ user c Syntax void CSIEn ReceiveEndCallback void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 210 of 394 Sep 01 2
94. NCTIONS 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 local variables start with a p and are in all lower 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 Table C 1 API Function List System CLOCK Init Performs initialization necessary to control clock func tions CG_SelectStabTime Selects the oscillation stabilization time for the X1 oscil lator This will become necessary when STOP mode is released CG_SelectPlIlMode Selects the operation mode of the PLL function CG_SelectSSCGMode Selects the operation mode of the SSCG Spread Spectrum Clock Generator WDT2_ Restart gars the watchdog timer counter and resumes count CRC_Start Begins detection of data block errors CRC_SetData Sets data in the CRC input register CRCIN CRC_GetResult Reads the results of the calculation stored in the CRC data register CRCD External Bus BUS _Init Performs initialization necessary to cont
95. NTUBnTIR corresponding to the reception completion interrupt INTUBnTIR performed when total number of UARTBn receptions specified by UARTBn_ReceiveData parameter rxnum has been completed Classification CG_serial_ user c Syntax void UARTBn ReceiveEndCallback void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 177 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTBn_SingleErrorCallback Performs processing in response to the reception error interrupt INTUBnTIRE overrun error framing error parity error Remark This API function is called as a callback routine of the interrupt process MD_INTUBnTIRE corresponding to a reception error interrupt INTUBAnTIRE of UARTBn single mode Classification CG_serial_ user c Syntax include CG macrodriver h void UARTBn_SingleErrorCallback UCHAR err_type Remark nis the channel number Argumeni s Description Argument Trigger for reception error interrupt 00000xx1B Overrun error 00000x1xB Framing error 000001xxB Parity error UCHAR err type Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 178 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTBn_FIFOErrorCallback Performs processing in response to the reception error interrupt INTUBnTIRE overrun error framing error parity error Remark
96. Normal completion MD_ARGERROR Invalid argument specification R20UT0257EJ0100 Rev 1 00 tENESAS Page 280 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TAAn_GetPulseWidth Reads the pulse width of 16 bit timer event counter AA TAA high low level width Remarks 1 This API function can only be called when 16 bit timer event counter AA TAA is being used for pulse width measurement 2 If there is an overflow 2 pulses or more during pulse width measurement then the pulse width will not be read correctly Classification CG_timer c Syntax include CG macrodriver h void TAAn GetPulseWidth ULONG activewith ULONG inactivewidth j Remark nis the channel number Argumeni s Pe eee Pointer to an area storing the high level width that was read 0x0 to Ox1 ffff nena Pointer to an area storing the low level width that was read 0x0 to Ox1 ffff Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 281 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TAAn_GetFreeRunningValue Reads the value captured by 16 bit timer event counter AA TAA Remark This API function can only be called when 16 bit timer event counter AA TAA is used as a free running timer and TAAn capture compare register m TAAnCCR is selected as the capture register Classification CG_timer c Syntax include CG Macrodriver h include CG timer
97. Normal completion MD_ARGERROR Invalid argument specification Example Below is an example of changing the interval the restarting the interval interrupt function CG_main c include CG_macrodriver h include CG ttc void main void R20UT0257EJ0100 Rev 1 00 tENESAS Page 338 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTC_IntervalStart Start interval interrupt function RTC_IntervalStop lt End interval interrupt function RTC_IntervalInterruptEnable INTERVAL6 Start interval interrupt function R20UT0257EJ0100 Rev 1 00 tENESAS Page 339 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTC_IntervallnterruptDisable Ends the interval interrupt function Classification CG_rtc c Syntax void RTC_IntervalInterruptDisable void Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 340 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTC _RC1CK1HZ_OutputEnable Enables output of the real time counter correction clock 1 Hz to the RC1CK1HZ pin Classification CG_rtc c Syntax void RTC_RC1CK1HZ_OutputEnable void Argument s None Return value None R20UT0257EJ0100 Rev 1 00 sQENESAS Page 341 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTC_RC1CK1HZ_OutputDisable Disables output of the real time c
98. On master transfer completion interrupt INTIICn Remark This API function is called as the callback routine of interrupt process MD_INTIICn corresponding to the simple IICOn master transfer completion interrupt INTIICn performed when total number of simple IICOn master transmissions specified by COn_MasterSendStart parameter rxnum has been completed Classification CG_serial_ user c Syntax void TICOn MasterSendEndCallback void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 228 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS liCOn_MasterReceiveEndCallback Performs processing in response to the IICOn master transfer completion interrupt INTIICn Remark This API function is called as the callback routine of interrupt process MD_INTIICn corresponding to the simple IICOn master transfer completion interrupt INTIICn performed when total number of simple IICOn master transmissions specified by COn_MasterReceiveStart parameter rxnum has been completed Classification CG_serial_ user c Syntax void IICOn_ MasterReceiveEndCallback void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 229 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS liCOn_MasterErrorCallback Performs processing in response to detection of
99. Performs processing in response to the CSIEnNBUF overflow interrupt INTCEnTIOF CSIFn_Init Performs initialization necessary to control the 3 wire variable length serial I O F CSIF functions CSIFn_Userlnit Performs user defined initialization relating to the 3 wire variable length serial I O F CSIF R20UT0257EJ0100 Rev 1 00 tENESAS Page 158 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS Starts CSIF data transmission reception CSIF data Starts CSIF data transmission reception CSIFn_SendEndCallback Performs processing in response to the CSIFn transmission reception completion interrupt INTCFnT CSIFn_ReceiveEndCallback Performs processing in response to the CSIFn transmission reception completion interrupt INTCF nT CSIFn_ErrorCallback Performs processing in response to the CSIFn reception error interrupt INTCFnR overrun error Performs initialization necessary to control the IIC bus functions initialization Performs initialization necessary to control the IIC bus functions to control the IIC bus functions Starts lICOn master reception IICOn master Starts lICOn master reception IICOn_MasterSendEndCallback Performs processing in response to the IICOn master transfer completion interrupt INTIICn IICOn_MasterReceiveEndCallback Performs processing in response to the IICOn master transfer completion interrupt INTIICn IICOn_MasterErrorCallback Performs processing in response to detection o
100. R20UT0257EJ0100 Rev 1 00 tENESAS Sep 01 2010 Page 32 of 394 CubeSuite Ver 1 40 CHAPTER 3 FUNCTIONS Code Generator code displayed in the Code Generator Preview panel may not be the same as that would actually be generated 3 5 Output Source Code Output the source code device driver program by pressing the 5 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 Proj Tree Proj ao Tree T sample Project FE UPOVOFS746 Microcontroller E A Pin Configurator Design Tool a Gode Generator Design Tool a ae A CASSO Build Tool A CASSO Build Tool ce W850 Simulator Debug Tool cee W850 Simulator Debug Tool a 16 Programmer Flash Programming Tool a I6 Programmer Flash Programming Tool g i File a File a startup tl Build Tool Output Files startup H F CodeGenerator de 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 5 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 E Code Generator Property El Product Information Version Release date
101. R20UT0257EJ0100 Rev 1 00 tENESAS Page 132 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS WDT2_ Restart Clears the watchdog timer counter and resumes counting Classification CG_system c Syntax void WDT2_ Restart void Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 133 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CRC_ Start Begins detection of data block errors Classification CG_system c Syntax void CRC Start void Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 134 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CRC_SetData Sets data in the CRC input register CRCIN Classification CG_system c Syntax include CG macrodriver h void CRC_SetData UCHAR data Argumeni s Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 135 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CRC_GetResult Reads the results of the calculation stored in the CRC data register CRCD Classification CG_system c Syntax include CG macrodriver h void CRC_GetResult USHORT result Argumeni s USHORT result Pointer to area in which to store read calculation results Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 136 of 394 Sep 01 2010 Cube
102. 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 button in the upper left corner of the device pin list R20UT0257EJ0100 Rev 1 00 tENESAS Page 66 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Macro tab This tab displays information on each pin of the microcontroller in the order it was grouped into peripheral functions Figure A 13 Macro Tab Device Pin List Pin Humber 4a Pin Name Function A PSO THO AG Free P31 RDA Free man a Lnn Pin Number A iMacro External Peripheral The following items are explained here How to open Description of each area How to open On the Project Tree
103. SIBn 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 CSIBn transmission reception CS Bn_ Start must be called before this API function is called Classification CG_serial c Syntax include Ce macrodriver h MD_STATUS CSIBn_SendReceiveData UCHAR txbuf USHORT txnum UCHAR rxbuf Remark nis the channel number Argumeni s Pointer to a buffer to store the received data ES USHORT txnum Total amount of data to receive UCHAR rxbuf Pointer to a buffer storing the transmission data Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT0257EJ0100 Rev 1 00 tENESAS Page 198 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CSIBn_SendEndCallback Performs processing in response to the CSIBn reception completion interrupt INTCBnR or the CSIBn consecutive transmission write enable interrupt INTCBnT Remark This API function is called as the callback routine process performed when the total number of CSIBn transmissions specified in the parameter txnum for CSIBn_SendData or CSIBn_SendReceiveData has been completed of interrupt process MD_INTCBnR corresponding to the CSIBn reception completion inter rupt INTCBnkR and interrupt process MD_INTCBnT corresponding to the CSIBn consecutive transmission write enable interrupt INTCBnT Classification CG_
104. Start User s Manual for details on Create Open project Open Code Generator Panel Open the Code Generator panel used to configure the information necessary to control the peripheral functions clock generators ports external bus interfaces etc 4 Enter Information Allows you to configure the information necessary to control the peripheral functions in the Code Generator panel 5 Confirm Source Code Allows you to confirm the source code device driver program that reflects the information configured in the Code Generator panel 6 Output Source Code Output the source code device driver program to the specified folder 7 Output Report Files Output report files a file containing information configured using the Code Generator and a file containing informa tion regarding the source code to the specified folder 8 Save project Save a project Remark See CubeSuite Start User s Manual for details on Save project R20UT0257EJ0100 Rev 1 00 2CENESAS Page 27 of 394 Sep 01 2010 CubeSuite Ver 1 40 CHAPTER 3 FUNCTIONS Code Generator 3 2 Open Code Generator Panel Open the Code Generator panel to configure the information necessary to control the peripheral functions clock gener ators ports external bus interfaces etc To open the Code Generator panel select Project name Project gt gt Code Generator Design Tool gt gt Peripheral function node System External Bus Port etc in the Project
105. Suite Ver 1 40 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 R20UT0257EJ0100 Rev 1 00 tENESAS Page 137 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 138 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 139 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS C 3 3 Port Below is a list of API fun
106. TMQO_ChangeTimerCondition 268 TMQO_GetFreeRunningValue 271 TMQO_GetPulseWidth 270 TMQO_Init 264 TMQ0O_SoftwareTriggerOn 274 TMQO_ Start 266 TMQO_Stop 267 TMQO_Userlnit 265 TMTO_ChangeCountValue 306 TMTO_ChangeDuty 302 TMTO_ChangeTimerCondition 299 TMTO_DisableHold 305 TMTO_EnableHold 304 TMTO_GetFreeRunningValue 301 TMTO_GetPulseWidth 300 TMTO_Init 295 TMTO_SoftwareTriggerOn 303 TMTO_ Start 297 TMTO_Stop 298 TMTO_Userlnit 296 U UARTAn_ErrorCallback 168 UARTAn_Init 160 UARTAn_ReceiveData 165 UARTAn_ ReceiveEndCallback 167 UARTAn_SendData 164 UARTAn_SendEndCallback 166 UARTAn_SoftOverRunCallback 169 UARTAn_Start 162 UARTAn_Stop 163 UARTAn_Userlnit 161 UARTBn_FIFOErrorCallback 179 UARTBn_Init 170 UARTBn_ReceiveData 175 UARTBn_ ReceiveEndCallback 177 UARTBn_SendData 174 UARTBn_SendEndCallback 176 UARTBn_SingleErrorCallback 178 UARTBn_SoftOverRunCallback 181 UARTBn_Start 172 UARTBn_Stop 173 UARTBn_TimeoutErrorCallback 180 UARTBn_Userlnit 171 UARTCn_ErrorCallback 190 UARTCn_Init 182 UARTCn_ ReceiveData 187 R20UT0257EJ0100 Rev 1 00 Sep 01 2010 tENESAS Page 389 of 394 CubeSuite Ver 1 40 APPENDIX D INDEX UARTCn_ReceiveEndCallback 189 UARTCn_SendData 186 UARTCn_SendEndCallback 188 UARTCn_SoftOverRunCallback 191 U
107. Tree panel Figure 3 1 Open Code Generator Panel Code Generator Fi Reflect in Pin Generate Code o JEF S ge T bi N ae oS ee m Glock setting Stand by On chip debue setting WatchdoeTimer Power on Clear setting Main oscillation clack setting Wain oscillation clack fx C MHz Main oscillation feedback resistor subclock setting Operation Subclock fXT 32768 kk Hz suboloack feedback resistor Internal oscillator clock setting Operation Internal oscillator fR He Main clack and GPU clock setting Main clock fx 4 clock throueh mode TW fx se MHz GPU clock OPU O5 exo s UMHz TERG setting iBRG enable 32768 kHz Actual value 32 787 Clock output function setting Unused Used Clock monitor setting Unused O Used Remark If an unsupported microcontroller is defined in the project for the Code Generator then Code Generator Design Tool node will hide under Project name Project in the Project Tree panel R20UT0257EJ0100 Rev 1 00 tENESAS Page 28 of 394 Sep 01 2010 CubeSuite Ver 1 40 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
108. UT0257EJ0100 Rev 1 00 tENESAS Page 170 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTBn_Userlnit Performs user defined initialization relating to the asynchronous serial interface B UARTB Remark This API function is called as the UARTBn_ Init callback routine Classification CG_serial_ user c Syntax void UARTBn_UserInit void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 7tENESAS Page 171 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTBn Start Enables asynchronous serial interface B UARTB Classification CG_serial c Syntax void UARTBn Start void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 172 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTBn_Stop Disables asynchronous serial interface B UARTB Classification CG_serial c Syntax void VARTER Stop void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 173 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTBn_SendData Starts UARTBn data transmission Remarks 1 This API function repeats the byte level UARTBn transmission from the buffer specified in parameter txbuf the number of times specifie
109. UT0257EJ0100 Rev 1 00 Sep 01 2010 tENESAS Page 46 of 394 CubeSuite Ver 1 40 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 A Pin Configurator Design Tool a Device Pin List a Device Top View i Code Generator Design Tool we System oa External Bus we Port i INT we Ser lal me AD E DA W Timer we Watch Timer Real Time Output E DMA E Lvl A CASSO Build Tool cas VESO Simulator Debue Tool ME OB Proerammer Flash Programming Tool al File The following items are explained here How to open Description of each area Help menu Project Tree panel dedicated items Context menu How to open From the View menu select Project Tree Description of each area 1 Project tree area This area displays components of the project microcontroller design tool build tool etc in a tree structure a Pin Configurator Design Tool This node consists of the following pin nodes R20UT0257EJ0100 Rev 1 00 7tENESAS Page 47 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Device Pin List Opens the Device Pin List panel for entering information on the pins of the microcontroller Device Top View Opens the Device Top View panel that displays the information entered in the Device Pin List pa
110. Ver 1 40 APPENDIX C API FUNCTIONS TMPn_ChangeDuty Changes the duty ratio of the PWM signal Remark This API function can only be called when 16 bit timer event counter P TMP is used for external trigger pulse output PWM output Classification CG_timer c Syntax include CG_macrodriver h void TMPn_ChangeDuty UCHAR array_duty Remark nis the channel number Argument s Remark The value set to duty ratio array _duty must be in base 10 notation Return value None Example The example below shows changing the duty ratio to 25 CG_main c include CG macrodriver h void Main void flagStatus array_duty TMPO_Start Start count while flagStatus TMPO_ChangeDuty array_duty Change duty ratio R20UT0257EJ0100 Rev 1 00 tENESAS Page 262 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMPn_SoftwareTriggerOn Generates the trigger software trigger for timer output Remark This API function can only be called when 16 bit timer event counter P TMP is used for external trigger pulse output one shot pulse output Classification CG_timer c Syntax void TMPn_SoftwareTriggerOn void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 263 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMQ0O_Init Performs in
111. _ user c Syntax include CG macrodriver h void UARTAn_ErrorCallback UCHAR err_type Remark nis the channel number Argumeni s Description Argument Trigger for UARTAn reception error interrupt 00000xx1B Overrun error 00000x1xB Framing error 000001xxB Parity error UCHAR err type Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 168 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTAn_SoftOverRunCallback Performs processing in response to detection of overrun error Remark This API function is called as the callback routine of interrupt process MD_INTUAnR corresponding to the UARTAn reception error interrupt INTUAnR process performed when the amount of data received is greater than the parameter rxnum specified for UARTAn_ReceiveData Classification CG_serial_ user c Syntax include CG macrodriver h void UARTAn SoftOverRunCallback UCHAR rx data Remark nis the channel number Argumeni s UCHAR rx data Received data Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 169 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTBn Init Performs initialization necessary to control the asynchronous serial interface B UARTB functions Classification CG_serial c Syntax void UARIBN Init void Remark nis the channel number Argument s None Return value None R20
112. _macrodriver h void main void int flagsStatus I array_duty 25 array_num 1 TMQ0_Start Start count while flagStatus R20UT0257EJ0100 Rev 1 00 tENESAS Page 272 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMQO_ChangeDuty amp array_duty array_num Change duty ratio R20UT0257EJ0100 Rev 1 00 sQENESAS Page 273 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMQO_SoftwareTriggerOn Generates the trigger software trigger for timer output Remark This API function can only be called when 16 bit timer event counter Q TMQ is used for external trigger pulse output one shot pulse output Classification CG_timer c Syntax void TMQO_SoftwareTriggerOn void Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 274 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TAAn Init Performs initialization necessary to control 16 bit timer event counter AA TAA functions Classification CG_timer c Syntax void TAAn Init void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 275 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TAAn_Userinit Performs user defined initialization relating to the 16 bit timer event counter AA TAA Remark This API function
113. able enum MaskableSource name BOOL enableflag ES Jx3 ES Jx3 L include CG macrodriver h include CG_int h void INT_MaskableInterruptEnable enum MaskableSource name BOOL enableflag Argument s enum MaskableSource name Maskable interrupt type INT_xxXx 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 E Sx3 H ES Jx3 E ES Jx3 H MD_OK Normal completion MD_ARGERROR Invalid argument specification ES Jx3 ES Jx3 L None Example 1 Below is an example of disabling acceptance of the maskable interrupt INTPO R20UT0257EJ0100 Rev 1 00 tENESAS Page 151 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CG_main c include CG macrodriver h include CG int n 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 Co macrodri ver i include CG ant void main void INT_MaskableInterruptEnable INT_INTPO MD_TRUE Enable acceptance of maskable interrupt INTPO R20UT0257EJ0100 Rev 1 00 tENESAS Page 152 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API
114. acro 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 From the View menu select Pin Configurator gt gt Device Pin List Description of each area 1 Device pin list area Display 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 Column Heading s External Peripheral co e 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 R20UT0257EJ0100 Rev 1 00 tENESAS Page 69 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE b Second layer Displays the pin number of the pin Function This area allows you to select which function to use when the pin has more than one functions 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 This area allows you to assign a user defined pin name to the
115. ained 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 4 Generator panel Generate Gode button is pressed in the Code R20UT0257EJ0100 Rev 1 00 Sep 01 2010 tENESAS Page 90 of 394 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Remarks 1 You can change the source code to be displayed by 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 Table A 2 Setting That Determines Whether or Not to Generate the Source Code 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 acs must be generated it is impossible to change t
116. al peripheral highlight Selects the background color of pins selected in the Device Pin List panel on the External Peripheral tab R20UT0257EJ0100 Rev 1 00 7tENESAS Page 21 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 af Device Top View Property El Color Power ping Red Special ping Green Unused ping Black Used ping Blue Device LightGray Highlight Red Macro highlight Fellow External peripheral highlight i Green El Tool Tip Display all El PinName Display HEJME Define name Description recommended connection for unused pin only Pin function Attention only Not display Tooltip Select contents displayed in the toal tip Device Top Yiew Settings Remark Popup information is selected from the following four types Table 2 3 Select Popup Information 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
117. anges the counter value for 16 bit timer event counter AA TAA Remark The value specified in parameter arrar_reg is set in TAAn capture compare register m TAAnCCRm Classification CG_timer c Syntax include CG macrodriver h MD_STATUS TAAn ChangeTimerCondition USHORT array_reg UCHAR array_num Remark nis the channel number Argumeni s o me o O OO DCEO Pointer oan area storing the count value 0x0 to Oxf UCHAR array_num Register to change 1 TAAnCCRO 2 TAAnCCRO TAAnCCR1 Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT0257EJ0100 Rev 1 00 tENESAS Page 279 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TAAn_ControlOutputToggle Changes the toggle control of 16 bit timer event counter AA TAA Remark This API function can only be called when 16 bit timer event counter AA TAA is used for interval timer free running timer Classification CG_timer c Syntax include CG Macrodriver h include CG timer h MD_STATUS TAAn ControlOutputToggle enum TMOut toggle enum TMChannel channel Remark nis the channel number Argument s enum TMOutput toggle Toggle control STANDARD Normal toggle operation INACTIVE Reset request ACTIVE Set request FREEZE Keep request enum TMChannel channel pin to change TMCHANNELO TOAAn0 pin TMCHANNEL1 TOAAn1 pin Return value MD_OK
118. as Electronics does not warrant that such information is error free Renesas Electronics assumes no liability whatsoever for any damages incurred by you resulting from errors in or omissions from the information included herein Renesas Electronics products are classified according to the following three quality grades Standard High Quality and Specific The recommended applications for each Renesas Electronics product depends on the product s quality grade as indicated below You must check the quality grade of each Renesas Electronics product before using it in a particular application You may not use any Renesas Electronics product for any application categorized as Specific without the prior written consent of Renesas Electronics Further you may not use any Renesas Electronics product for any application for which it is not intended without the prior written consent of Renesas Electronics Renesas Electronics shall not be in any way liable for any damages or losses incurred by you or third parties arising from the use of any Renesas Electronics product for an application categorized as Specific or for which the product is not intended where you have failed to obtain the prior written consent of Renesas Electronics The quality grade of each Renesas Electronics product is Standard unless otherwise expressly specified in a Renesas Electronics data sheets or data books etc Standard Computers office equip
119. ayed to the left of the tab name R20UT0257EJ0100 Rev 1 00 tENESAS Page 93 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE 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 Sends the character string or lines selected with range selection to the clipboard Select All Selects all the messages displayed on the Message area Search Opens the Search and Replace dialog box for searching strings with the Quick Search tab selected Replace Opens the Search and Replace dialog box for replacing strings with the Whole Replace tab selected Help menu Output panel dedicated items Open Help for Output Panel Displays the help of this panel Context menu The following context menu items are displayed by right clicking the mouse Sends the character string or lines selected with range selection to the clipboard Select All Selects all the messages displayed on the Message area 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
120. clude CG macrodriver h include CG_system h MD_STATUS CG_ChangeClockMode enum ClockMode mode Argumeni s enum ClockMode mode CPU clock type MAINOSCCLK Main clock oscillator fXX SUBCLK Subclock oscillator fXT Return value MD_OK Normal completion MD_ERROR 1 Exit with error abend Cannot change from the subclock oscillator fXT to the main clock oscillator fXX MD_ERROR2 Exit with error abend Cannot change from the main clock oscillator fXX to the subclock oscillator fXT MD_ARGERROR Invalid argument specification R20UT0257EJ0100 Rev 1 00 tENESAS Page 127 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CG_ChangeFrequency Changes the CPU clock division ratio Classification CG_system c Syntax include CG macrodriver h include CG_system h MD_STATUS CG_ChangeFregquency enum CPUCLlock clock Argumeni s enum CPUClock clock Division ratio type SYSTEMCLOCK xx SYSONEHALF fxx 2 SYSONEFOURTH fxx 4 SYSONEEIGHTH fxx 8 SYSONESIXTEENTH fxx 16 SYSONETHIRTYSECOND fxx 32 Remark fxx signifies the frequency of the main clock oscillator Return value MD_OK Normal completion MD_ERROR Exit with error abend MD_ARGERROR Invalid argument specification R20UT0257EJ0100 Rev 1 00 tENESAS Page 128 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CG_SelectPowerSaveMode Configures the
121. cro Setting tab 61 Macro tab 67 Main window 44 N New Column dialog box 100 O Output panel 93 All Output Messages tab 95 Code Generator tab 96 P Pin Configurator Information tab 55 Pin Configurator Settings tab 53 Pin Number tab 65 Port 79 Port 140 PORT ChangePmninput 143 PORT _ChangePmnOutput 144 PORT Init 141 PORT Userlnit 142 PORT ChangePmninput 143 PORT _ChangePmnOutput 144 PORT _Init 141 PORT Userlnit 142 Project Tree panel 47 Property panel 50 Device Top View Settings tab 56 File Setting tab 62 Generation tab 59 Macro Setting tab 61 Pin Configurator Information tab 55 Pin Configurator Settings tab 53 R20UT0257EJ0100 Rev 1 00 Sep 01 2010 tENESAS Page 385 of 394 CubeSuite Ver 1 40 APPENDIX D INDEX R Real Time Output 87 Real Time Output 354 RTOn_Disable 358 RTOn_Enable 357 RTOn_GetValue 367 RTOn_Init 355 RTOn_Set2BitData RTOn_Set4BitData RTOn_Set6BitData 361 RTOn_Set8BitData 362 RTOn_SetHigh2BitData RTOn_SetHigh4BitData RTOn_SetLow2BitData RTOn_SetLow4BitData RTOn_Userlnit 356 359 360 363 365 364 366 RTC 86 RTC 317 RTC_AlarmDisable 331 RTC_AlarmEnable 330 RTC_AlarmGet 335 RTC_AlarmSet 332 353 RTC_ConstPeriodInterruptDisable RTC _Chang
122. ctions output by Code Generator for port use Table C 4 API Functions Port 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 R20UT0257EJ0100 Rev 1 00 7tENESAS Page 140 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS PORT Init Performs initialization necessary to control port functions Classification CG_port c Syntax void PORT_Init void Argument s None Return value None R20UT0257EJ0100 Rev 1 00 sQENESAS Page 141 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 R20UT0257EJ0100 Rev 1 00 7tENESAS Page 142 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS PORT_ChangePmninput Switches the pin s I O mode from output mode to input mode Classification CG_port c Syntax void PORT_ChangePmnInput void Remark mn is the port number Argument s None Return value None E
123. cts 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 Selects the background color of a pin selected in the Device Pin List panel on the Pin Number tab Macro highlight Selects the background color of pins selected in the Device Pin List panel on the Macro tab External peripheral highlight Selects the background color of pins selected in the Device Pin List panel on the External Peripheral tab Remark To change the setting of the color use the following color palette which opens by making a selection from the dropdown list in this area Figure A 7 Color Palette Custom Web System mi TEETE E EEEE E LLALL LLL BEEBE EEE EERE EERE 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 Display all Displays the Description Recommend Connection For Unused and Attention strings for the device pin list Description recommended Displays the Descripti
124. cture RTCAlarmValue alarm conditions struct RTCAlarmValue UCHAR Alarmwm Minute UCHAR Alarmwh Hour UCHAR Alarmww Weekday Alarmwm Minute Below are shown the meanings of each bit of the structure member Alarmwm BCD code minute digit 1 BCD code minute digit 10 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 R20UT0257EJ0100 Rev 1 00 tENESAS Page 332 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 TWIT Le 1 Sunday Ls 1 Tuesday 1 Wednesday 1 Thursday 1 Friday 1 Saturday 0 Fixed Return value None Example 1 The example below shows the alarm conditions being set to Monday Tuesday Wednesday at 17 30 CG_main c include CG macrodriver h include CEG roo 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 R20UT0257EJ0100 Rev 1 00 tENESAS
125. d in parameter txnum 2 When performing a UARTBn transmission single mode UARTBn_ Start must be called before this API function is called 3 When performing a UARTBn transmission FIFO mode UARTBn_ Start must be called after this API function is called Classification CG_serial c Syntax include CG macrodriver h MD STATUS UARTBn_SendData UCHAR txbuf USHORT txnum Remark nis the channel number Argumeni s o Awe te ee Pointer oa buffer storing the vansmission data USHORT txnum Total amount of data to send Return value MD MDK Normal completion Normal completion Cea _ARGERROR Invalid argument specification txnumis not a multiple of transmit FIFO as trigger MD_DATAEXISTS Exit with error abend Hold a next transmission data in the UBnTX register R20UT0257EJ0100 Rev 1 00 sQENESAS Page 174 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTBn_ReceiveData Starts UARTBn data reception Remarks 1 This API function performs byte level UARTBn reception the number of times specified by the parame ter rxnum and stores the data in the buffer specified by the parameter rxbuf 2 Actual UARTBn reception starts after this API function is called and UARTBn_ Start is then called Classification CG_serial c Syntax include CG macrodriver h MD_STATUS UARTBn_ReceiveData UCHAR rxbuf USHORT rxnum Remark nis the channel number Argumeni s
126. e R20UT0257EJ0100 Rev 1 00 tENESAS Page 298 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMTO_ChangeTimerCondition Changes the counter value for 16 bit timer event counter T TMT Remark The value specified in parameter arrar_reg is set in TMTO capture compare register m TTOCCR m Classification CG_timer c Syntax include CG macrodriver h MD_STATUS TMTO_ChangeTimerCondition USHORT array_reg UCHAR array_num Argumeni s USHORT array rege Pointer to an area storing the count value 0x0 to Oxffff UCHAR array_num Register to change 1 TTOCCRO 2 TTOCCRO TTOCCR1 Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT0257EJ0100 Rev 1 00 tENESAS Page 299 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMTO_GetPulseWidth Reads the pulse width of 16 bit timer event counter T TMT high low level width Remarks 1 This API function can only be called when 16 bit timer event counter T TMT is being used for pulse width measurement 2 If there is an overflow 2 pulses or more during pulse width measurement then the pulse width will not be read correctly Classification CG_timer c Syntax include CG macrodriver h void TMTO_GetPulseWidth ULONG activewith ULONG inactivewidth j Argumeni s Pe eee m Pointer to an area storing the high level width that wa
127. e Ce mMacrodriver h MD_STATUS CSIFn_SendReceiveData UCHAR txbuf USHORT txnum UCHAR rxbuf Remark nis the channel number Argumeni s Pointer to a buffer to store the received data ES USHORT txnum Total amount of data to receive UCHAR rxbuf Pointer to a buffer storing the transmission data Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT0257EJ0100 Rev 1 00 tENESAS Page 218 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CSIFn_SendEndCallback Performs processing in response to the CSIFn transmission reception completion interrupt INTCFnT Remark This API function is called as the callback routine process performed when the total number of CSIFn transmissions specified in the parameter txnum for CSIFn_SendData or CSIFn_SendReceiveData has been completed of interrupt process MD_INTCFnT corresponding to the CSIFn transmission reception completion interrupt INTCFnT Classification CG_serial_ user c Syntax void CSIFn_SendEndCallback void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 219 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CSIFn_ReceiveEndCallback Performs processing in response to the CSIFn transmission reception completion interrupt INTCFnT Remark This API function is called as the callback routine proce
128. e 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 Kd lt I 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 the Pin Configurator device top view overwriting the existing file Save Top View As Opens the Save As dialog box for naming and saving a report file a file containing infor mation configured using the 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 con
129. e start menu select All Programs gt gt NEC Electronics CubeSuite gt gt CubeSuite Description of each area 1 Menu bar This area consists of the following menu items R20UT0257EJ0100 Rev 1 00 tENESAS Page 44 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE a File menu Save Pin List Device Pin List panel dedicated item Saves a report file a file containing information configured using the Pin Con figurator 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 the Pin Configurator device pin list Save Top View Device Top View panel dedicated item Saves a report file a file containing information configured using the Pin Con figurator 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 the Pin Configurator device top view Save Code Generator Report Code Generator panel Code Generator Preview panel dedicated item Outputs report files a file containing information configured using the Code Generator and a file containing information regarding the source code The output format for the report file either HTML or CSV is selected by
130. e AD_ Init callback routine Classification CG_ad_user c Syntax void AD UseriInit void gt Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 239 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS Starts A D conversion Remark A D conversion is performed repeatedly between the call to this API function and a call to AD_ Stop Classification CG_ad c Syntax void AD_Start void Argument s None Return value None Example The example below shows A D conversion of analog voltage CG_main c include CG_macrodriver h BOOL gFlag A D conversion complete flag void main void USHORT buffer 0 wait 100 Initialize A D conversion complete flag Start A D conversion gFlag Wait for INTAD AD Read amp buffer Read results of A D conversion AD Stop End A D conversion CG_ad_user c include CG_macrodriver h 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 R20UT0257EJ0100 Rev 1 00 tENESAS Page 240 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS AD_ Stop Ends A D conversion Classification CG_ad c Syntax void AD_Stop void Argument s None Return value None R20UT0257EJ0100
131. e Changes the initial counter value for 16 bit timer event counter T TMT TMMn_ Init Performs initialization necessary to control 16 bit interval timer M TMM functions TMMn_UserlInit Performs user defined initialization relating to the 16 bit interval timer M TMM TMMn_Start Starts the count for 16 bit interval timer M TMM TMMn_Stop Ends the count for 16 bit interval timer M TMM R20UT0257EJ0100 Rev 1 00 7tENESAS Page 117 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMMn_ChangeTimerCondition Changes the counter value for 16 bit interval timer M TMM Watch Timer WT_ Init WT_UserlInit Performs initialization necessary to control watch timer functions Performs user defined initialization relating to the watch timer WT_ Start Clears the watch timer counter and resumes counting WT_Stop Ends the count for watch timer RTC RTC_Init RTC_Userlnit RTC_CounterEnable RTC_CounterDisable RTC_SetHourSystem RTC_CounterSet RTC_CounterGet RTC_ConstPeriodinterruptEnable Performs initialization necessary to control real time counter functions Performs user defined initialization relating to the real time counter Starts the count of the real time counter year month weekday day hour minute second Ends the count of the real time counter year month weekday day hour minute second Sets the clock type 12 hour or 24 hour clock of the real tim
132. e counter Sets the counter value year month weekday day hour minute second of the real time counter Reads the counter value year month weekday day hour minute second of the real time counter Sets the cycle of the interrupts INTRTCO then starts the cyclic interrupt function Sets the alarm conditions weekday hour minute Reads the alarm conditions weekday hour minute RTC_IntervallnterruptEnable Sets the cycle of the interrupts INTRTC2 then starts the interval interrupt function RTC_IntervallnterruptDisable Ends the interval interrupt function RTC_RC1CK1HZ_OutputEnable RTC_RC1CK1HZ_OutputDisable RTC _RC1CKO_OutputEnable Enables output of the real time counter correction clock 1 Hz to the RC1CK1HZ pin Disables output of the real time counter correction clock 1 Hz to the RC1CK1HZ pin Enables output of the real time counter clock 32 kHz source to the RC1CKO pin RTC _RC1CKO_OutputDisable Disables output of the real time counter clock 32 kHz source to the RC1CKO pin R20UT0257EJ0100 Rev 1 00 Sep 01 2010 tENESAS Page 118 of 394 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTC_RC1CKDIV_OutputEnable Enables output of the real time counter clock 32 kHz cycle to the RC1CKDIV pin RTC_RC1CKDIV_OutputDisable Disables output of the real time counter clock 32 kHz cycle to the RC1CKDIV pin RTC_RTC1HZ_ OutputEnable Enables output of the real time counte
133. e input Remark If the mouse cursor is moved over the 7 icon information regarding the string that should be entered tips for correcting the entry popups Figure 3 2 Icon Indicating Incorrect Entry Code Generator Ay Reflect in Pin Generate Code Glock setting Stand by On chip debug setting Watchdog Timer Power on Clear setting Main oscillation clack setting Main oscillation clock fh MHz c Main oscillation feedback resistor Information of valid Input value range subclock setting Operation Subclock fXT 32768 kHz subolock feedback resistor Internal oscillator clock setting Operation Internal oscillator fR kHz Main clack and GPU clock settine Main clock THH 4 clock throueh mode fx fx se MHz GPU clock OPLU 05 Gee we UMHz TERG settine BRG enable 32768 kHz Actual value 32 787 Clock output function setting Unused Used Clock monitor setting Unused Used R20UT0257EJ0100 Rev 1 00 tENESAS Page 30 of 394 Sep 01 2010 CubeSuite Ver 1 40 CHAPTER 3 FUNCTIONS Code Generator 3 3 3 Icon indicating pin conflict If a conflict occurs between the pins while setting various peripheral functions in the Code Generator panel the J icon is displayed at the location where the conflict occurs to warn the user of a conflict between the pins Remark Ifthe mouse cursor is moved over the T icon information regarding the conflict between
134. eCorrectionValue 329 RTC_ConstPeriodInterruptEnable 328 RTC _CounterDisable 321 RTC _CounterEnable 320 RTC _CounterGet 326 RTC _CounterSet 324 RTC_Init 318 340 338 RTC_IntervallnterruptDisable RTC_IntervallnterruptEnable RTC_IntervalStart 336 RTC_IntervalStop 337 RTC _RC1CK1HZ_ OutputDisable RTC _RC1CK1HZ_ OutputEnable RTC_RCiCKDIV_OutputDisable RTC_RCiCKDIV_OutputEnable RTC _RC1CKO_OutputDisable RTC _RC1CKO_OutputEnable RTC_RTC1HZ_OutputDisable 342 341 346 345 344 343 348 RTC_RTC1HZ_OutputEnable RTC _RTCCL_OutputDisable RTC _RTCCL_OutputEnable RTC _RICDIV_OutputDisable RTC_RTCDIV_OutputEnable 322 RTC _SetHourSystem RTC_Userlnit 319 RTC_AlarmDisable 331 RTC_AlarmEnable 330 RTC_AlarmGet 335 RTC_AlarmSet 332 RTC_ChangeCorrectionValue RTC_ConstPeriodInterruptDisable RTC_ConstPeriodIinterruptEnable RTC_CounterDisable 321 RTC _CounterEnable 320 RTC _CounterGet 326 RTC _CounterSet 324 RTC_Init 318 RTC_IntervallnterruptDisable RTC_IntervallnterruptEnable RTC_IntervalStart 336 RTC_IntervalStop 337 RTC _RC1CK1HZ_ OutputDisable RTC _RC1CK1HZ_ OutputEnable RTC _RCiCKDIV_OutputDisable RTC_RCi1CKDIV_OutputEnable RTC _RC1CKO_OutputDisable RTC _RC1iCKO_OutputEnable RTC_RTC1HZ_OutputDisable RTC_RTC1HZ_OutputEnable
135. eader 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 macrodriver h include CG ree sh void Main void struct RTCCounterValue counterreadval RTC CounterEnable Start count RTC_CounterGet amp counterreadval Read count value R20UT0257EJ0100 Rev 1 00 tENESAS Page 326 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS R20UT0257EJ0100 Rev 1 00 7tENESAS Page 327 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTC_ConstPeriodIinterruptEnable Sets the cycle of the interrupts INTRTCO then starts the cyclic interrupt function Classification CG_rtc c Syntax include CG Macrodriver h include CG FLech MD STATUS RTC_ConstPeriodInterruptEnable enum RTCINTPeriod period Argumeni s enum RTCINTPeriod period Interrupt INTRTCO cycle HALFSEC 0 5 seconds ONESEC 1 second ONEMIN 1 minute ONEHOUR 1 hour ONEDAY 1 day ONEMONTH 1 month Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification Example Below is an example of setting the cycle of the interrupts INTRTCO then starting the cyclic interrupt function CG_main c include CG_macrodriver h include CG rtc ia void main void RTC_ConstPeriodInterruptDisable End of cyclic interrupt function RTC_ConstPeriodInte
136. edit comment generated here and End user code Do not edit comment generated here will be merged Do nothin if file exists If a file with the same name exists a new file will not be output R20UT0257EJ0100 Rev 1 00 tENESAS Page 37 of 394 Sep 01 2010 CubeSuite Ver 1 40 CHAPTER 3 FUNCTIONS Code Generator 3 5 5 Change output destination folder The Code Generator is used to change the output destination folder for the source code by selecting Generation tab gt gt Output folder in the Property panel To change the output destination use the Browse For Folder dialog box which opens by pressing the button in the Output folder Figure 3 11 Change Output Destination Folder Browse For Folder Desktop E My Documents of My Computer E3 My Network Places 2 Unused Desktop Shortcuts Make New Folder o Cancel R20UT0257EJ0100 Rev 1 00 sQENESAS Page 38 of 394 Sep 01 2010 CubeSuite Ver 1 40 CHAPTER 3 FUNCTIONS Code Generator 3 6 Output Report Files Output report files a file containing information configured using the 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 Rema
137. el 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 R20UT0257EJ0100 Rev 1 00 7tENESAS Page 61 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 Code Generator Property El File Information 1 Default name Yes File name CO mainc Default Default operation File Setting The following items are explained here How to open Description of each area How to open On the Code Generator Preview panel select a file and then select Property from the View menu On the Code Generator Preview panel select a file and then select Property from the context menu Remark _ If this panel is already open selecting a different file in the Code Generator Preview panel changes the con tent displayed accordingly Description of each area 1 File Information category This area allows you to view the information Default File name on and change the setting for the file selected in the Code Generator Preview panel Default name Views or select the setting that determines whether the name of the file selected in the Code Generator Previe
138. el number Argument s o oe o o ee ee Pointer oa buffer storing the wansmission data USHORT txnum Total amount of data to send Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT0257EJ0100 Rev 1 00 tENESAS Page 196 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CSIBn_ReceiveData Starts CSIBn data reception Remarks 1 This API function performs byte level CSIBn 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 CSIBn reception CS IBn_ Start must be called before this API function is called Classification CG_serial c Syntax include CG macrodriver h MD_STATUS CSIBn_ReceiveData UCHAR rxbuf USHORT rxnum Remark nis the channel number Argumeni s Ce ee 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 R20UT0257EJ0100 Rev 1 00 tENESAS Page 197 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CSIBn_SendReceiveData Starts CSIBn data transmission reception Remarks 1 This API function repeats the byte level CSIBn transmission from the buffer specified in parameter txbuf the number of times specified in parameter txnum 2 This API function performs byte level C
139. endEndCallback 219 CSIFn_SendReceiveData 218 CSIFn_Start 214 CSIFn_Stop 215 CSIFn_Userlnit 213 IICOn_GetStopConditionCallback 236 ICOn_Init 222 I1COn_MasterErrorCallback 230 l1COn_MasterReceiveEndCallback 229 I COn_MasterReceiveStart 227 lWCOn_MasterSendEndCallback 228 l1COn_MasterSendStart 226 lWCOn_SlaveErrorCallback 235 lICOn_SlaveReceiveEndCallback 234 l1COn_SlaveReceiveStart 232 IWCOn_SlaveSendEndCallback 233 lWCOn_SlaveSendStart 231 IICOn_ Stop 224 IICOn_StopCondition 225 lCOn_Userlnit 223 UARTAn_ErrorCallback 168 UARTAn_Init 160 UARTAn_ReceiveData 165 UARTAn_ ReceiveEndCallback 167 UARTAn_SendData 164 UARTAn_SendEndCallback 166 UARTAn_SoftOverRunCallback 169 UARTAn_Start 162 UARTAn_Stop 163 UARTAn_Userlnit 161 UARTBn_FIFOErrorCallback 179 UARTBn_Init 170 UARTBn_ReceiveData 175 UARTBn_ReceiveEndCallback 177 UARTBn_SendData 174 UARTBn_SendEndCallback 176 UARTBn_SingleErrorCallback 178 UARTBn_SoftOverRunCallback 181 UARTBn_Start 172 UARTBn_Stop 173 UARTBn_TimeoutErrorCallback 180 UARTBn_Userlnit 171 UARTCn_ErrorCallback 190 R20UT0257EJ0100 Rev 1 00 Sep 01 2010 tENESAS Page 387 of 394 CubeSuite Ver 1 40 APPENDIX D INDEX UARTCn_Init 182 UARTCn_ReceiveData 187 UARTCn_ReceiveEndCallback 189 UARTCn_SendData 186 UART
140. ent then the pulse width will not be read correctly Classification CG_timer c Syntax include CG macrodriver h void TMPn_GetPulseWidth ULONG activewith ULONG inactivewidth j Remark nis the channel number Argumeni s Pe eee Pointer to an area storing the high level width that was read 0x0 to Ox1 ffff nena Pointer to an area storing the low level width that was read 0x0 to Ox1 ffff Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 260 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMPn_GetFreeRunningValue Reads the value captured by 16 bit timer event counter P TMP Remark This API function can only be called when 16 bit timer event counter P TMP is used as a free running timer and TMPn capture compare register m TPnCCR m is selected as the capture register Classification CG_timer c Syntax include CG Macrodriver h include CG timer h MD_STATUS TMPn_GetFreeRunningValue ULONG count enum TMChannel channel Remark nis the channel number Argument s Co onone scours Pointer to area in which to store the width that was read enum TMChannel channel Channel to read TMCHANNELO Channel 0 TPnCCRO TMCHANNEL1 Channel 1 TPnCCR1 Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT0257EJ0100 Rev 1 00 tENESAS Page 261 of 394 Sep 01 2010 CubeSuite
141. er AB TAB TABn_ControlOutputToggle Changes the toggle control of 16 bit timer event counter AB TAB TABn_GetPulseWidth Reads the pulse width of 16 bit timer event counter AB TAB high low level width TABn_GetFreeRunningValue Reads the value captured by 16 bit timer event counter AB TAB TABn_ChangeDuty Changes the duty ratio of the PWM signal TABn_SoftwareTriggerOn Generates the trigger software trigger for timer output TMTO_Init Performs initialization necessary to control 16 bit timer event counter T TMT functions TMTO_Userlnit Performs user defined initialization relating to the 16 bit timer event counter T TMT TMTO_ Start Starts the count for 16 bit timer event counter T TMT TMTO_ Stop Ends the count for 16 bit timer event counter T TMT TMTO_ChangeTimerCondition Changes the counter value for 16 bit timer event counter T TMT TMTO_GetPulseWidth Reads the pulse width of 16 bit timer event counter T TMT high low level width TMTO_GetFreeRunningValue Reads the value captured by 16 bit timer event counter T TMT TMTO_ChangeDuty Changes the duty ratio of the PWM signal TMTO_SoftwareTriggerOn Generates the trigger software trigger for timer output TMTO_EnableHold Changes the encoder counter control of 16 bit timer event counter T TMT to holding count value TMTO_DisableHold Changes the encoder counter control of 16 bit timer event counter T TMT to normal operation TMTO_ChangeCountValu
142. er clock 32 kHz cycle to the RC1CKDIV pin Classification CG_rtc c Syntax void RTC_RC1CKDIV_OutputDisable void Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 346 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 347 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTC_RTC1HZ_OutputDisable Disables output of the real time counter correction clock 1 Hz to the RTC1HZ pin Classification CG_rtc c Syntax void RIC RTICIAZ OutputDisable void Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 348 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTC_RTCCL_OutputEnable Enables output of the real time counter clock 82 kHz source to the RTCCL pin Classification CG_rtc c Syntax void RTC_RTCCL_OutputEnable void Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 349 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTC_RTCCL_OutputDisable Disables output of the real time counter clock 32
143. erforms processing in response to detection of stop condition Remark This API function is called as the callback routine process carried out when a stop condition is detected of interrupt process MD_INTIICn corresponding to the IICOn transfer completion interrupt INTIICn Classification CG_serial_user c Syntax void TICOn_GetStopConditionCallback void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 236 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS C 3 6 A D Below is a list of API functions output by Code Generator for D A converter use Table C 7 API Functions A D Sets the information for operation in power fail compare mode comparison value and A D conversion end interrupt INTAD trigger Reads the results of A D conversion 8 bits most significant 8 bits of 10 bit resolution R20UT0257EJ0100 Rev 1 00 tENESAS Page 237 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS Performs initialization necessary to control A D converter functions Classification CG_ad c Syntax void AD_Init void Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 238 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS Performs user defined initialization relating to the A D converter Remark This API function is called as th
144. error in IICOn master communication Remark This API function is called as the callback routine process carried out when an IICOn master communica tion error is detected of interrupt process MD_INTIICn corresponding to the IICOn master transfer complete interrupt INTIICn Classification CG_serial_ user c Syntax include CG macrodriver h void TICOn_MasterErrorCallback MD_STATUS flag Remark nis the channel number Argumeni s MD_STATUS flag Cause of IICOn master communication error MD_SPT Stop condition detected MD_NACK Acknowledge detected Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 230 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS liCOn_SlaveSendStart Starts 1ICOn slave transmission Remark This API function repeats the byte level IICOn 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 1ic0On SlaveSendStart UCHAR txbuf USHORT txnum Remark nis the channel number Argument s 1 UCHAR exbut Pointer to a buffer storing the transmission data EE USHORT txnum Total amount of data to send Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 231 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS liCOn_SlaveReceiveStart Starts IICOn slave reception
145. errupt functions and the key interrupt function provided by the microcontroller Screen Structure may be different depending on the kinds of target microcontrollers See user s manual for details on target microcontrollers Figure A 20 Example of INT _ External Interrupt Key Interrupt NMI setting HMI Valid edge Falling edge _INTPO setting IM TPO Valid edge Falling edge Used as multiple interrupt Priority INTP1 setting INTP Valid edge Falling edge Used as multiple interrupt Priority IN TP setting INTP2 Use POS Valid edge Falling edge Used as multiple interrupt Priority INTPS setting IN TPS Valid edge Falling edge Used as multiple interrupt Priority Enables digital noise elimination Sampling frequency 62500 APA 6 kHz z gt m How to open On the Project Tree panel select Project name Project gt gt Code Generator Design Tool gt gt INT Remark Ifthe Code Generator panel is already open pressing the button changes the content displayed accordingly R20UT0257EJ0100 Rev 1 00 tENESAS Page 80 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Serial Configure the information required to control the asynchronous serial interface A UARTA 3 wire variable length serial I O CSIB and etc provided by the microcontroller Screen Structure may be different depending on the kinds of target microcontrollers See user
146. f error in II COn master communication IICOn_SlaveSendStart Starts IICOn slave transmission l1COn_SlaveReceiveStart Starts IICOn slave reception ICOn_SlaveSendEndCallback iil processing in response to the IICOn slave transfer completion interrupt INTI IICOn_SlaveReceiveEndCallback processing in response to the IICOn slave transfer completion interrupt INTI IICOn_SlaveErrorCallback Performs processing in response to detection of error in IICOn slave communication Performs processing in response to detection of error in IICOn slave communication in response to detection of error in IICOn slave communication IICOn_GetStopConditionCallback Performs processing in response to detection of stop condition R20UT0257EJ0100 Rev 1 00 tENESAS Page 159 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTAn Init Performs initialization necessary to control the asynchronous serial interface A UARTA functions Classification CG_serial c Syntax void UARTAn_Init void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 160 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTAn_Userlnit Performs user defined initialization relating to the asynchronous serial interface A UARTA Remark This API function is called as the UARTAn_ Init callback routine Classification CG_serial_ user c Syn
147. fied in the File name and Save as type to the folder specified in the Save in Cancel Cancel Ignores the setting and closes this dialog box Ignores the setting and closes this dialog box setting and closes this dialog box R20UT0257EJ0100 Rev 1 00 tENESAS Page 103 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 systeminit c Call initial function of peripheral function Call CG_ReadResetSource Defines common macros used by all source files B 2 Output File Below are the files peripheral function output by Code Generator Table B 2 File List Peripheral Function Peripheral Function Source File Name Names of API Functions Included System CG_system c CLOCK_Init CG_ChangeClockMode CG_ChangeFrequency CG_SelectPowerSaveMode CG_SelectStab Time CG_SelectPlIMode CG_SelectSSCGMode WDT2_ Restart CRC_ Start CRC_SetData CRC_GetResult CG_system_user c MD_INTWDT2 CLOCK Userlnit CG_ReadResetSource C R20UT0257EJ0100 Rev 1 00 tENESAS Page 104 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX B OUTPUT FILES Peripheral Function Source File Name Names of API Functions Included PORT_Init PORT_ChangePmnInput PORT _ChangePmnOutput CG_port_user c PORT _Userlnit INTP_Init KEY Init
148. guring the information necessary to control the func tions of timer array unit provided by the microcontroller Watch Timer Opens the Watch Timer for configuring the information necessary to control the functions of watch timer provided by the microcontroller RTC Opens the RIC for configuring the information necessary to control the func tions of real time counter provided by the microcontroller Real Time Output Opens the Real Time Output for configuring the information necessary to con trol the real time output functions provided by the microcontroller DMA Opens the DMA for configuring the information necessary to control the func tions of DMA Direct Memory Access controller provided by the microcontrol ler 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 pane has been carried out R20UT0257EJ0100 Rev 1 00 7tENESAS Page 48 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Operation in the corresponding Code Generator panel has not been carried out wet wi The problem occurs on the setting became the manipulation to the other peripheral function node influences Help menu Project Tree panel dedicated item
149. h MD_STATUS TAAn GetFreeRunningValue ULONG count enum TMChannel channel Remark nis the channel number Argumeni s Co onone scours Pointer to area in which to store the width that was read enum TMChannel channel Channel to read TMCHANNELO Channel 0 TAAnCCRO TMCHANNEL1 Channel 1 TAAnCCR1 Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT0257EJ0100 Rev 1 00 tENESAS Page 282 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TAAn_ChangeDuty Changes the duty ratio of the PWM signal Remark This API function can only be called when 16 bit timer event counter AA TAA is used for external trigger pulse output PWM output Classification CG_timer c Syntax include CG_macrodriver h void TAAn_ChangeDuty UCHAR array_duty Remark nis the channel number Argument s Remark The value set to duty ratio array _duty must be in base 10 notation Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 283 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TAAn_SoftwareTriggerOn Generates the trigger software trigger for timer output Remark This API function can only be called when 16 bit timer event counter AA TAA is used for external trigger pulse output one shot pulse output Classification CG_timer c Syntax void TAAn SoftwareTriggerOn void Remark nis the
150. he icon to 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 C Remarks 1 You cannot edit 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 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 the Code Generator and a file containing information regarding the source code R20UT0257EJ0100 Rev 1 00 7tENESAS Page 91 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Remarks 1 The output format for the report file either HTML o
151. he 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 AS Save As dialog box box This dialog box allows you to name and save a file Such as a report file R20UT0257EJ0100 Rev 1 00 sQENESAS Page 43 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 sample CubeSuite Project Tree File Edit View Project Build Debug Flash Tool Window Help Gy Start ada ka aa My du Aa a ff Gah OE Oy ACOE Mi Ge Ce ENE m x E Property sample Property a Gode Generator Design Tool A CASSO Build Tool cos W850 Simulator Debug Tool File name GF GB Programmer Flash Programming Tool This ts the name of the tile to which the a 7 Information of this main project is to be ie File saved q Project Output EOF All Output Messages FS fi ET ra rq rit til fic 2 Disconnected The following items are explained here How to open Description of each area How to open From th
152. i The following items are explained here How to open Description of each area How to open From the View menu select Output Description of each area 1 Message area This area displays only operation logs for the Code Generator out of those for various components design tool build tool etc provided by CubeSuite The following table displays the meaning of the color of the message text displayed in this area Table A 6 Color of Message Text Background Black White Information message Displayed with information notices Blue Standard Color Warning message Displayed with warnings about operations Red LightGray Fatal error message Displayed when there is a fatal error or when execution is not possible due to a operational mistake R20UT0257EJ0100 Rev 1 00 tENESAS Page 96 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 34 Column Chooser Dialog Box Column Chooser Ed of Fin Humber Fin Hame Function LO H ch Define Name Description Recommend Connection For Unused Atenton L E E A A Cs Es External Feripheral Function buttons d Column Delete Colum Default The following items are explained here
153. ication CG_system c Syntax include CG macrodriver h include CG_system h MD_STATUS CG_SelectPllMode enum PllMode pllmode Argumeni s enum PllMode pllmode Operation mode type E Sx3 H ES Jx3 ES Jx3 L SYSPLLOFF Clock through mode SYS4PLL x4 When PLL function is used SYS8PLL x8 When PLL function is used ES Jx3 E ES Jx3 H SYSPLLOFF PLL stopped SYSPLLON PLL operating Return value MD_OK Normal completion MD_ERROR Exit with error abend ES Jx3 ES Jx3 E ES Jx3 H ES Jx3 L MD_ERROR 1 Exit with error abend E Sx3 H Cannot change the operation mode MD_ERROR2 Exit with error abend E Sx3 H Cannot change to the x4 MD_ERROR3 Exit with error abend E Sx3 H Cannot change to the x8 MD_ARGERROR Invalid argument specification R20UT0257EJ0100 Rev 1 00 tENESAS Page 131 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CG_SelectSSCGMode Selects the operation mode of the SSCG Spread Spectrum Clock Generator Classification CG_system c Syntax include CG macrodriver h include CG_system h MD_STATUS CG_SelectSSCGMode enum SSCGMode sscgmode Argumeni s enum SSCGMode sscgmode Operation mode type SYSSSCGON SSCG operation enabled SYSSSCGOFF SSCG operation stopped Return value MD_OK Normal completion MD ERROR Exit with error abend MD_ARGERROR Invalid argument specification
154. igure the information required to control the 16 bit timer event counter P TMP 16 bit timer event counter Q TMQ and 16 bit interval timer M TMM functions provided by the microcontroller Screen Structure may be different depending on the kinds of target microcontrollers See user s manual for details on target microcontrollers Figure A 24 Example of Timer TMPO TMP1 TMP2 TMP lt gt EOT Functions Unused O Interval timer External event counter External trigger output One shot output Pulse width measurement PWM output Free runnine mode How to open On the Project Tree panel select Project name Project gt gt Code Generator Design Tool gt gt Timer Remark Ifthe Code Generator panel is already open pressing the button changes the content displayed accordingly R20UT0257EJ0100 Rev 1 00 7tENESAS Page 84 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Watch Timer This panel allows you to configure the information necessary to control the function of watch timer provided by the microcontroller Screen Structure may be different depending on the kinds of target microcontrollers See user s manual for details on target microcontrollers Figure A 25 Example of Watch Timer Operation setting Unused Used Watch timer clock setting fi Subelock fT O Watch count clock BRG Watch
155. iles Selects whether source code generated by pressing the Generate Code button should be added to the project Output files to project Adds output source code to the project The source code will be added to the Project Tree panel under the File Code Generator node Not output files to project Does not add output source code to the project Remark To change the output destination use the Browse For Folder dialog box which opens by pressing the button in this area 3 Pin Configurator Reflect Mode category Configure the information linking mode between the Code Generator and Pin Configurator Selects whether to reflect the settings made in the Code Generator panel in the Device Pin List panel when the button is pressed Reflected Reflects Code Generator panel settings in the Device Pin List panel Not reflected Does not reflect Code Generator panel settings in the Device Pin List panel Remark If Not reflected is selected then the H Reflect in Pin button will be grayed out deselected R20UT0257EJ0100 Rev 1 00 tENESAS Page 60 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 such as System External Bus or Port selected in the Project Tree panel or the peripheral function button Such JE i pres
156. include CG macrodriver hi MD_STATUS TMPn_ ChangeTimerCondition USHORT array_reg UCHAR array_num Remark nis the channel number Argumeni s o me O OO DCEO Pointer oan area storing the count value xt Oxf UCHAR array_num Register to change 1 TPnCCRO 2 TPnCCRO TPnCCRI1 Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification 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 void Main void 4 int flag_finish USHORT array_reg TMP_TPOCCRO_VALUE gt gt 1 TMP TPOCCRO VALUE Current interval time UCHAR array_num 1 TMPO_ Start Start count while flag_finish Check for time up R20UT0257EJ0100 Rev 1 00 tENESAS Page 258 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMPO_ChanneTimerCondition amp array_reg array_num Change counter value R20UT0257EJ0100 Rev 1 00 7tENESAS Page 259 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMPn_GetPulseWidth Reads the pulse width of 16 bit timer event counter P TMP high low level width Remarks 1 This API function can only be called when 16 bit timer event counter P TMP is being used for pulse width measurement 2 If there is an overflow 2 pulses or more during pulse width measurem
157. ing OMA transfer end interrupt INTO MAD Used as multiple interrupt Priority Lowest et How to open On the Project Tree panel select Project name Project gt gt Code Generator Design Tool gt gt DMA Remark Ifthe Code Generator panel is already open pressing the oe button changes the content displayed accordingly R20UT0257EJ0100 Rev 1 00 tENESAS Page 88 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE LVI This panel allows you to configure the information necessary to control the functions of low voltage detector provided by the microcontroller Screen Structure may be different depending on the kinds of target microcontrollers See user s manual for details on target microcontrollers Figure A 29 Example of LVI Low voltage detector operation setting O Unused Used Voltage detection setting Detection level 105 TYP J ya Operation mode setting Generate interrupt signal INTL YD Used ae multiple interrupte Priority Generate internal reset signal LWIRES How to open On the Project Tree panel select Project name Project gt gt Code Generator Design Tool gt gt LVI Remark Ifthe Code Generator panel is already open pressing the button changes the content displayed accordingly R20UT0257EJ0100 Rev 1 00 tENESAS Page 89 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Code Generator Pre
158. ing function The user can change default names assigned to the files output by the Code Generator and the API functions con tained in the source code R20UT0257EJ0100 Rev 1 00 7tENESAS Page 10 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 the Pin Configurator 1 Start CubeSuite Launch CubeSuite from the Start menu of Windows Remark See CubeSuite Start User s Manual 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 Start User s Manual for details on Create Open project 3 Open Device Pin List Panel Open the Device Pin List panel where you enter information on the pins of the microcontroller a Select item Allows you to select items displayed in the device pin list b Change display order Allows you to change the order in which items are displayed in the device pin list c Add column Allows you to add col
159. initialization relating to the real time output Remark This API function is called as the RIOn_ Init callback routine Classification CG_rto_user c Syntax void RTOn_UserInit void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 356 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTOn_ Enable Enables validates real time output Classification CG_rto c Syntax void RTOn_Enable void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 357 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTOn_Disable Disables invalidates real time output Classification CG_rto c Syntax void RTOn_CounterDisable void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 358 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTOn_Set2BitData Sets 2 bit data for real time output Classification CG_rto c Syntax include CG macrodriver h void RTOn_Set2BitsData UCHAR data Remark nis the channel number Argumeni s Remark The API functions treat values set in bits 4 to 5 as 2 bit data 7 0 B7 B6 B5 B4 B3 B2 B1 BO PTE TTT TT DA 2 bit data Return value None R20UT02
160. interface C UARTC Classification CG_serial c Syntax void UARTCn Start void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 184 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTCn_Stop Disables asynchronous serial interface C UARTC Classification CG_serial c Syntax void UARTCn_Stop void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 185 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTCn_SendData Starts UARTCn data transmission Remarks 1 This API function repeats the byte level UARTCn transmission from the buffer specified in parameter txbuf the number of times specified in parameter txnum 2 When performing a UARTCn transmission UARTCn_Start must be called before this API function is called Classification CG_serial c Syntax include CG macrodriver h MD_STATUS UARTCn SendData UCHAR txbuf USHORT txnum Remark nis the channel number Argumeni s pI UCHAR exbut Pointer to a buffer storing the transmission data Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification MD_DATAEXISTS Exit with error abend Hold a next transmission data in the UCnTX register R20UT0257EJ0100 Rev 1 00 tENESAS Page 186
161. interrupt INTIICn Remark This API function is called as the callback routine of interrupt process MD_INTIICn corresponding to the simple IICOn slave transfer completion interrupt INTIICn performed when total number of simple IICOn slave transmissions specified by I COn_SlaveReceiveSiart parameter rxnum has been completed Classification CG_serial_ user c Syntax void IICOn_SlaveReceiveEndCallback void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 234 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS liCOn_SlaveErrorCallback Performs processing in response to detection of error in IICOn slave communication Remark This API function is called as the callback routine process carried out when an IICOn slave communication error is detected of interrupt process MD_INTIICn corresponding to the IICOn slave transfer complete interrupt INTIICn Classification CG_serial_ user c Syntax include CG macrodriver h void TICOn_SlaveErrorCallback MD_STATUS flag Remark nis the channel number Argumeni s MD_STATUS flag Cause of IICOn master communication error MD_ ERROR Address mismatch deteced MD _NACK Acknowledge detected Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 235 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS liCOn_GetStopConditionCallback P
162. ions Changes the counter value for 16 bit timer event counter T TMT Reads the pulse width of 16 bit timer event counter T TMT high low level width Reads the value captured by 16 bit timer event counter T TMT TMTO_EnableHold Changes the encoder counter control of 16 bit timer event counter T TMT to holding count value TMTO_DisableHold Changes the encoder counter control of 16 bit timer event counter T TMT to normal operation Performs initialization necessary to control 16 bit interval timer M TMM functions Performs user defined initialization relating to the 16 bit interval timer M TMM R20UT0257EJ0100 Rev 1 00 tENESAS Page 253 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMPn_Init Performs initialization necessary to control 16 bit timer event counter P TMP functions Classification CG_timer c Syntax void TMPn_Init void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 254 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMPn_Userlnit Performs user defined initialization relating to the 16 bit timer event counter P TMP Remark This API function is called as the TMPn_ Init callback routine Classification CG_timer_user c Syntax void TMPn_UserInit void Remark nis the channel number Argumeni s None Return value None R
163. is called as the TAAn_ Init callback routine Classification CG_timer_user c Syntax void TAAn UserInit void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 276 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TAAn Start Starts the count for 16 bit timer event counter AA TAA Remark The length of time between the call to this API function and the start of counting will vary depending on the function type e g interval timer external event counter or external trigger pulse output Classification CG_timer c Syntax void TAAn Start void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 277 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TAAn_Stop Ends the count for 16 bit timer event counter AA TAA Remark The length of time between the call to this API function and the end of counting will vary depending on the function type e g interval timer external event counter or external trigger pulse output Classification CG_timer c Syntax void TAAn_Stop void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 278 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TAAn_ChangeTimerCondition Ch
164. ising How to open On the Project Tree panel select Project name Project gt gt Code Generator Design Tool gt gt Real Time Out put Remark Ifthe Code Generator panel is already open pressing the button changes the content displayed accordingly R20UT0257EJ0100 Rev 1 00 tENESAS Page 87 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE DMA This panel allows you to configure the information necessary to control the functions of DMA Direct Memory Access controller provided by the microcontroller Screen Structure may be different depending on the kinds of target microcontrollers See user s manual for details on target microcontrollers Figure A 28 Example of DMA OMAD Mai DMA DMAg DMA operation setting gt Unused Used Transter data size setting B bits 16 bits Transter source setting External memory or on chip peripheral LO Internal RAM or expanded internal RAM Transter destination setting External memory or on chip peripheral LO Internal RAM or expanded internal RAM External memory information External memory area 0 has been enabled External memory 0 Ox00400000 0 007F FFFF External memory 1 000800000 0 006F FFFF External memory 2 Ox00CO0000 0x00FFFFFF External memory 3 0x01 0000007001 FFFFFF Transfer address and count setting Source address Destination address Count i DMA start source setting Trigger Interrupt sett
165. ite Ver 1 40 APPENDIX C API FUNCTIONS TABn_ControlOutputToggle Changes the toggle control of 16 bit timer event counter AB TAB Remark This API function can only be called when 16 bit timer event counter AB TAB is used for interval timer free running timer Classification CG_timer c Syntax include CG Macrodriver h include CG timer h MD_STATUS TABn_ControlOutputToggle enum TMOut toggle enum TMChannel channel Remark nis the channel number Argument s enum TMOutput toggle Toggle control STANDARD Normal toggle operation INACTIVE Reset request ACTIVE Set request FREEZE Keep request enum TMChannel channel pin to change TMCHANNELO TOABn0 pin TMCHANNEL1 TOABn1 pin Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT0257EJ0100 Rev 1 00 tENESAS Page 290 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TABn_GetPulseWidth Reads the pulse width of 16 bit timer event counter AB TAB high low level width Remarks 1 This API function can only be called when 16 bit timer event counter AB TAB is being used for pulse width measurement 2 If there is an overflow 2 pulses or more during pulse width measurement then the pulse width will not be read correctly Classification CG_timer c Syntax include CG macrodriver h void TABn GetPulseWidth ULONG activewith ULONG inactivewidth j
166. itialization necessary to control 16 bit timer event counter Q TMQ functions Classification CG_timer c Syntax void TMQO_ Init void Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 264 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMQO_Userlnit Performs user defined initialization relating to the 16 bit timer event counter Q TMQ Remark This API function is called as the TMQO Init callback routine Classification CG_timer_user c Syntax void TMQO_UserInit void Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 265 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMQO_ Start Starts the count for 16 bit timer event counter Q TMQ Remark The length of time between the call to this API function and the start of counting will vary depending on the function type e g interval timer external event counter or external trigger pulse output Classification CG_timer c Syntax void TMOO Start void Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 266 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMQO_Stop Ends the count for 16 bit timer event counter Q TMQ Remark The length of time between the call to this API function and the start of counting will vary depending on the func
167. its are 00 Ea 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 R20UT0257EJ0100 Rev 1 00 tENESAS Page 353 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS C 3 11 Real Time Output Below is a list of API functions output by Code Generator as the real time output function Table C 12 API Functions Real Time Output RTOn_Init Performs initialization necessary to control real time output functions RTOn_UserlInit Performs user defined initialization relating to the real time output RTOn_Enable Enables validates real time output RTOn_Disable Disables invalidates real time output RTOn_Set2BitData Sets 2 bit data for real time output RTOn_Set4BitData Sets 4 bit data for real time output R20UT0257EJ0100 Rev 1 00 tENESAS Page 354 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTOn Init Performs initialization necessary to control real time output functions Classification CG _rto c Syntax void RTOn_Init void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 355 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTOn_Userlnit Performs user defined
168. ject Tree panel Figure A 6 Device Top View Settings Tab Property af Device Top Yiew Property El Color Power ping Red Special pins Green Unused pins Black Used pins Blue Device Lightlaray Highlight Red Macro highlight elow External peripheral highlight M Green Tool Tip Tool tip Display all Pin Name Display Define name Display Pin functor Dsiplay all Power pins Select text color of power pins i 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 is already open selecting a different Device Top View in the Project Tree panel changes the content displayed accordingly Description of each area 1 Color category Select the display colors to differentiate the pin groups power pins special pins unused pins etc in the device top view Selects the display color for power pins pins whose use is limited to power R20UT0257EJ0100 Rev 1 00 tENESAS Page 56 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Special pins Sele
169. k Ek k alii ii iia rR A RCAC RCRA ACCA ACCC CRC RC RC RC RC Ek INT bisector ak serial vet Include files r D Earars sstart estarta Eart an Eas E a Eae E e E e E a E lair i rr ror rr ROR ROR AO Fo DA EAEE EEEE E EE E EEE Timer EZ Watch Timer include CGG_macrodriver h Real Time Output include CG systemh DMA Start user code for include Do not edit comment generated here LI fk End user code Do not edit comment generated here include GG userdetine h Remark To restore the default file name defined by the Code Generator select Default from the context menu R20UT0257EJ0100 Rev 1 00 7tENESAS Page 35 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 Code Generator Preview f File hee Common i CG manc a g OG systeminitc H CG userdefi f OG Ik dir CG starts T OG_inttabs System External Bus Port INT Ser lal Ar DA Timer Watch Timer Real Time Qutput DMA LWI Figure 3 9 Change API Function Name ve SK directive a Oe e E e e E Defau It OE Start user code for pragma Do not edit comment generated here End user code Do not edit comment generated here Poee ee manana het Include files
170. kHz source to the RTCCL pin Classification CG_rtc c Syntax void RIC RICCh OutputDisable void Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 350 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTC_RTCDIV_OutputEnable Enables output of the real time counter clock 82 kHz cycle to the RTCDIV pin Classification CG_rtc c Syntax void RTC_RTCCLDIV_OutputEnable void Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 351 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTC_RTCDIV_OutputDisable Disables output of the real time counter clock 32 kHz cycle to the RTCDIV pin Classification CG_rtc c Syntax void RIC RICDIV OutputDisable void Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 352 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTC_ChangeCorrectionValue Changes the timing and correction value for correcting clock errors Classification CG_rtc c Syntax include CG mMmacrodriver h include CG FLeesh MD STATUS RTC_ChangeCorrectionValue enum RTCCorectionTiming timing UCHAR corectval Argumeni s enum RTCCorectionTiming timing When clock errors are corrected EVERY20S When the seconds digits are 00 20 or 40 EVERY60S When the seconds dig
171. lback routine Classification CG_serial_ user c Syntax void CSIBn_UserInit void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 193 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CSIBn_Start Enables 3 wire variable length serial I O B CSIB Classification CG_serial c Syntax void CSIBn_Start void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 194 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CSIBn_Stop Disables 3 wire variable length serial I O B CSIB Classification CG_serial c Syntax void CSiBr stop void 7 Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 195 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CSIBn_SendData Starts CSIBn data transmission Remarks 1 This API function repeats the byte level CSIBn transmission from the buffer specified in parameter txbuf the number of times specified in parameter txnum 2 When performing a CSIBn transmission CS Bn_ Start must be called before this API function is called Classification CG_serial c Syntax include CG macrodriver h MD STATUS CSIBn_SendData UCHAR txbur USHORT txnum Remark nis the chann
172. le etc are output Function buttons Make New Folder Creates a New Folder below the folder selected in the Folder location Specifies the folder selected in the Folder location as the destination for the files Ignores the setting and closes this dialog box R20UT0257EJ0100 Rev 1 00 tENESAS Page 101 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 42 Save As Dialog Box Save As My Recent Documents My Documents a My Computer Newark iene ff O 4 plies 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 gt 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 list of files matching the conditions selected in Save in and Save as type R20UT0257EJ0100 Rev 1 00 tENESAS Page 102 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 EME emf EMF format Function buttons Save Outputs a file having the name speci
173. les the acceptance of the key interrupts INTKR Serial UARTAn_Init UARTAn_UserlInit Performs initialization necessary to control the asyn chronous serial interface A UARTA functions Performs user defined initialization relating to the asyn chronous serial interface A UARTA UARTAn_SendEndCallback UARTAn_ReceiveEndCallback UARTAn_ ErrorCallback UARTAn_SoftOverRunCallback UARTBn_Init UARTBn_Userlnit Performs processing in response to the UARTAn con secutive transmission enable interrupt INTUAnT Performs processing in response to the UARTAn recep tion completion interrupt INTUAnR Performs processing in response to the UARTAn recep tion error interrupt INTUAnR overrun error framing error parity error Performs processing in response to detection of overrun error Performs initialization necessary to control the asyn chronous serial interface B UARTB functions Performs user defined initialization relating to the asyn chronous serial interface B UARTB R20UT0257EJ0100 Rev 1 00 Sep 01 2010 tENESAS Page 112 of 394 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTBn_SendEndCallback Performs processing consequent to the transmission enable interrupt INTUBnTIT and the FIFO transmission completion interrupt INTUBnTIF UARTBn_ReceiveEndCallback Performs processing in response to the reception com pletion interrupt INTUBnTIR UARTBn_SingleErrorCallback Performs
174. ller 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 the 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 the 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 R20UT0257EJ0100 Rev 1 00 7tENESAS Page 64 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 OE e Pin Number A Pin Name H Function 4 LO AVREFO 1 Ais PIO ANG 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
175. mation on the Device Pin List selected in the Project Tree panel Figure A 5 Pin Configurator Information Tab Property Device Pin List Property El Product Informabon Version Fin configurator version information q Pin Configurator Information F 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 Pin Configurator Release date Displays the release date of Pin Configurator R20UT0257EJ0100 Rev 1 00 tENESAS Page 55 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Device Top View Settings tab This tab allows you to view the information Color Tool Tip and Product Information on and change the setting for the Device Top View selected in the Pro
176. ment communications equipment test and measurement equipment audio and visual equipment home electronic appliances machine tools personal electronic equipment and industrial robots High Quality Transportation equipment automobiles trains ships etc traffic control systems anti disaster systems anti crime systems safety equipment and medical equipment not specifically designed for life support Specific Aircraft aerospace equipment submersible repeaters nuclear reactor control systems medical equipment or systems for life support e g artificial life support devices or systems surgical implantations or healthcare intervention e g excision etc and any other applications or purposes that pose a direct threat to human life You should use the Renesas Electronics products described in this document within the range specified by Renesas Electronics especially with respect to the maximum rating operating supply voltage range movement power voltage range heat radiation characteristics installation and other product characteristics Renesas Electronics shall have no liability for malfunctions or damages arising out of the use of Renesas Electronics products beyond such specified ranges Although Renesas Electronics endeavors to improve the quality and reliability of its products semiconductor products have specific characteristics such as the occurrence of failure at a certain rate and malfunctions under certai
177. 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 Device Top View panel View panel This panel displays the information entered in the Device Pin List panel This panel displays the information entered in the Device Pin List panel displays the information entered in the Device Pin List panel Code Generator panel This panel allows you to configure the information necessary to control the peripheral functions provided by the microcontroller Code Generator Preview panel This panel allows you to confirm or configure on a per API function basis the setting that determines whether or not the source code device driver program is generated when the Generate Code button is pressed in the Code Generator panel It also allows you to confirm the source code that reflects the information configured in the Code Generator panel Output panel This panel displays operation logs for various components design tool build tool etc provided by CubeSuite Column Chooser dialog box This dialog box allows you to choose whether or not to display t
178. n CG_timer c Syntax include CG Macrodriver h include CG timer h MD_STATUS TMQO_GetFreeRunningValue ULONG count enum TMChannel channel Argumeni s 0 urong count 0 Pointer to area in which to store the width that was read enum TMChannel channel Channel to read TMCHANNELO Channel 0 TQOCCRO TMCHANNEL1 Channel 1 TQOCCR1 TMCHANNEL2 Channel 2 TQOCCR2 TMCHANNEL3 Channel 3 TQOCCR3 Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT0257EJ0100 Rev 1 00 tENESAS Page 271 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMQO_ChangeDuty Changes the duty ratio of the PWM signal Remark This API function can only be called when 16 bit timer event counter Q TMQ is used for external trigger pulse output PWM output Classification CG_timer c Syntax include CG_macrodriver h MD_STATUS TMQO_ChangeDuty UCHAR array_duty UCHAR array_num j Argument s C 2 Pointer to an area storing the duty ratio 0 to 100 in percent UCHAR array_num Register to change 1 TQOCCR1 2 TQOCCR1 TQOCCR2 3 TQOCCR1 TQOCCR2 TQOCCR3 Remark The value set to duty ratio array_duty must be in base 10 notation Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification Example The example below shows changing the duty ratio to 25 CG_main c include CG
179. n CG_dma c Syntax include CG macrodriver h MD_STATUS DMAn_ CheckStatus void Remark nis the channel number Argumeni s None Return value MD_UNDEREXEC Transfer ongoing MD_COMPLETED Transfer complete R20UT0257EJ0100 Rev 1 00 tENESAS Page 373 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 Remark Calling this API function while a transfer is ongoing will end the transfer Classification CG_dma c Syntax include CG macrodriver h MD_STATUS DMAn SetData UINT srcaddr UINT dstaddr UINT count Remark nis the channel number Argumeni s ees Riese Cr ome ee i Pt ene sinc Nira me Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT0257EJ0100 Rev 1 00 tENESAS Page 374 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS DMAn_SoftwareTriggerOn Uses a software trigger as a DMA transfer start trigger Remark After this API function is called DMA transfer will begin if the start DMA transfer software trigger flag STGn is set to 1 or the interrupt e g INTPn or INTAD occurs Classification CG_dma c Syntax void DMAn_SoftwareTriggerOn void Remark nis the channel number Argumeni s None Return value None
180. n enable interrupt INTUAnT performed when total number of UARTAn transmissions specified by UARTAn_SendDaita parameter txnum has been completed Classification CG_serial_ user c Syntax void UARTAn_SendEndCallback void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 166 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTAn_ReceiveEndCallback Performs processing in response to the UARTAn reception completion interrupt INTUAnR Remark This API function is called as the callback routine of interrupt process MD_INTUAnR corresponding to the UARTAn reception completion interrupt INTUAnR performed when total number of UARTAn receptions specified by UARTAn_ReceiveData parameter rxnum has been completed Classification CG_serial_ user c Syntax void UARTAn_ ReceiveEndCallback void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 167 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTAn_ErrorCallback Performs processing in response to the UARTAn reception error interrupt INTUAnR overrun error framing error parity error Remark This API function is called as the callback routine of interrupt process MD_INTUAnR corresponding to the UARTAn reception error interrupt INTUAnR Classification CG_serial
181. n use conditions Further Renesas Electronics products are not subject to radiation resistance design Please be sure to implement safety measures to guard them against the possibility of physical injury and injury or damage caused by fire in the event of the failure of a Renesas Electronics product such as safety design for hardware and software including but not limited to redundancy fire control and malfunction prevention appropriate treatment for aging degradation or any other appropriate measures Because the evaluation of microcomputer software alone is very difficult please evaluate the safety of the final products or system manufactured by you Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental compatibility of each Renesas Electronics product Please use Renesas Electronics products in compliance with all applicable laws and regulations that regulate the inclusion or use of controlled substances including without limitation the EU RoHS Directive Renesas Electronics assumes no liability for damages or losses occurring as a result of your noncompliance with applicable laws and regulations This document may not be reproduced or duplicated in any form in whole or in part without prior written consent of Renesas Electronics Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this document or Renesas Electronics
182. n_FIFOErrorCallback UARTBn_TimeoutErrorCallback UARTBn_SoftOverRunCallback UARTCn_UserlInit UARTCn_SendEndCallback UARTCn_ReceiveEndCallback UARTCn_ErrorCallback UARTCn_SoftOverRunCallback CSIBn_Userlnit CSIBn_SendEndCallback R20UT0257EJ0100 Rev 1 00 tENESAS Page 106 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX B OUTPUT FILES Peripheral Function Source File Name Names of API Functions Included Serial CG_serial_user c CSIBn_ReceiveEndCallback CSIBn_ErrorCallback CSIEn_Userlnit CSIEn_SendEndCallback CSIEn_ReceiveEndCallback CSIEn_ErrorCallback CSIFn_Userlnit CSIFn_SendEndCallback CSIFn_ReceiveEndCallback CSIFn_ErrorCallback I1COn_UserlInit IICOn_MasterSendEndCallback IICOn_MasterReceiveEndCallback IICOn_MasterErrorCallback IICOn_SlaveSendEndCallback IICOn_SlaveReceiveEndCallback IICOn_SlaveErrorCallback IICOn_GetStopConditionCallback asi fe a A D CG_ad c AD_Init AD_ Start AD_ Stop AD_SelectADChannel AD_SetPFTCondition AD_Read AD_ReadByte CG_ad_user c MD_INTAD AD_UserInit D A CG_da c DAn_Init DAn_ Start DAn_ Stop DAn_SetValue Timer CG_timer c TMPn_Init TMPn_Start TMPn_Stop TMPn_ChangeTimerCondition TMPn_GetPulseWidth TMPn_GetFreeRunningValue TMPn_ChangeDuty TMPn_SoftwareTriggerOn TMQO_Init TMQ0O_ Start R20UT0257EJ0100 Rev 1 00 tENESAS Page 107 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX B OUTPUT FILES Peripheral Function Source File Name Names of API Functions I
183. ncluded Timer CG_timer c TMQO_ Stop TMQO_ChangeTimerCondition TMQO_GetPulseWidth TMQ0_GetFreeRunningValue TMQO0_ChangeDuty TMQ0_SoftwareTriggerOn TAAn_Init TAAn_ Start TAAn_Stop TAAn_Change TimerCondition TAAn_ControlOutputToggle TAAn_GetPulseWidth TAAn_GetFreeRunningValue TAAn_ChangeDuty TAAn_SoftwareTriggerOn TABn_ Init TABn_ Start TABn_Stop TABn_Change TimerCondition TABn_ControlOutputToggle TABn_GetPulseWidth TABn_GetFreeRunningValue TABn_ChangeDuty TABn_ Software TriggerOn TMTO_Init TMTO_ Start TMTO_ Stop TMTO_ChangeTimerCondition TMTO_GetPulseWidth TMTO_GetFreeRunningValue TMTO_ChangeDuty TMTO_SoftwareTriggerOn TMTO_EnableHold TMTO_DisableHold TMTO_ChangeCountValue TMMn_ Init TMMnh_ Start TMMn_ Stop TMMn_ChangeTimerCondition CG_timer_user c MD_INTTPnOV MD_INTTPnCCm MD_INTTQO0OV MD_INTTQ0CCm MD_INTTTAAnOV MD_INTTAAnCCm MD_INTTTABnOV MD_INTTABnCCm R20UT0257EJ0100 Rev 1 00 tENESAS Page 108 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX B OUTPUT FILES Peripheral Function Source File Name Names of API Functions Included Timer CG_timer_user c MD_INTTTOEC MD_INTTTOOV MD_INTTTOCCm MD_INTTMnEQO TMPn_UserInit TMQ0O_UserlInit TAAn_Userlnit TABn_UserInit TMTO_Userlnit TMMn_UserInit C Watch Timer CG_wt c WT_Init WT_ Start WT_Stop CG_wt_user c MD_INTWT MD_INTWTI WT_UserlInit come RTC CG_rtc c RTC_Init RTC_CounterEnable RTC_CounterDisable RTC_SetHourSystem RTC_CounterSe
184. ndCallback Performs processing consequent to the transmission enable interrupt INTUBnTIT and the FIFO transmission completion interrupt INTUBnTIF UARTBn_ReceiveEndCallback Performs processing in response to the reception completion interrupt INTUBnTIR UARTBn_SingleErrorCallback Performs processing in response to the reception error interrupt INTUBnTIRE overrun error framing error parity error UARTBn_FIFOErrorCalloack Performs processing in response to the reception error interrupt INTUBnTIRE overrun error framing error parity error UARTBn_TimeoutErrorCallback Performs processing in response to the reception timeout error interrupt INTUBnTITO UARTBn_SoftOverRunCallback Performs processing in response to detection of overrun error UARTCn_Init Performs initialization necessary to control the asynchronous serial interface C UARTC functions UARTCn_UserlInit Performs user defined initialization relating to the asynchronous serial interface C UARTC UARTCn_Start Enables asynchronous serial interface C UARTC UARTCn_Stop Disables asynchronous serial interface C UARTC R20UT0257EJ0100 Rev 1 00 m l ENESAS Page 157 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTCn_SendData Starts UARTCn data transmission UARTCn_ReceiveData Starts UARTCn data reception UARTCn_SendEndCallback Performs processing in response to the UARTCn consecutive transmission enable interrupt INTUCnT UARTCn_ReceiveEndCallback
185. nel 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 functions of power on clear circuit 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 Opens the Port for configuring the information necessary to control the port functions provided by the microcontroller Opens the INT for configuring the information necessary to control the inter rupt functions and the key interrupt function provided by the microcontroller Serial Opens the Serial for configuring the information necessary to control the func tions of serial array unit and functions of serial interface provided by the micro controller A D Opens the A D for configuring the information necessary to control the func tion of A D converter provided by the microcontroller D A Opens the D A for configuring the information necessary to control the func tion of D A converter provided by the microcontroller Timer Opens the Timer for confi
186. nformation 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 H 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 R20UT0257EJ0100 Rev 1 00 7tENESAS Page 63 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE 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 if the Device Top View panel 2 Device pin list area Display the device pin list for entering information on the pins of the microcontroller 3 Tab selection area Selecting the tab changes the order in which information on each pin of the microcontroller is displayed This panel has the following tabs Pin Number tab This tab displays information on each pin of the microcontro
187. ntax void TMMn_UserInit void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 308 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMMn Start Starts the count for 16 bit interval timer M TMM Classification CG_timer c Syntax void TMM Start void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 309 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMMn_Stop Ends the count for 16 bit interval timer M TMM Classification CG_timer c Syntax void TMMn Stop void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 310 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMMn_ChangeTimerCondition Changes the counter value for 16 bit interval timer M TMM Remark The value specified in parameter regvalue is set to TMMn control register 0 TMnCMPO0 Classification CG_timer c Syntax Remark nis the channel number Argumeni s Return value None R20UT0257EJ0100 Rev 1 00 7tENESAS Page 311 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS C 3 9 Watch Timer Below is a list of API functions output by Code Generator for watch timer use Table C 10
188. nter to a buffer storing the transmission data Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification MD_DATAEXISTS Exit with error abend Hold a next transmission data in the UAnTX register R20UT0257EJ0100 Rev 1 00 tENESAS Page 164 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTAn_ReceiveData Starts UARTAn data reception Remarks 1 This API function performs byte level UARTAn reception the number of times specified by the parame ter rxnum and stores the data in the buffer specified by the parameter rxbuf 2 Actual UARTAn reception starts after this API function is called and UARTAn_ Start is then called Classification CG_serial c Syntax include CG macrodriver h MD_STATUS UARTAn_ReceiveData UCHAR rxbuf USHORT rxnum Remark nis the channel number Argumeni s Ce ee 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 R20UT0257EJ0100 Rev 1 00 tENESAS Page 165 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTAn_SendEndCallback Performs processing in response to the UARTAn consecutive transmission enable interrupt INTUAnT Remark This API function is called as the callback routine of interrupt process MD_INTUAnT corresponding to the UARTAn consecutive transmissio
189. number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 205 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CSIEn SendData Starts CSIEn data transmission Remarks 1 This API function repeats the byte level CSIEn transmission from the buffer specified in parameter txbuf the number of times specified in parameter txnum 2 When performing a CSIEn transmission CS IEn_ Start must be called before this API function is called Classification CG_serial c Syntax include CG macrodriver h MD STATUS CSIEn_ sendData UCHAR txbur USHORT txnum Remark nis the channel number Argument s o oe o o ee ee Pointer oa buffer storing the wansmission data USHORT txnum Total amount of data to send Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT0257EJ0100 Rev 1 00 tENESAS Page 206 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CSIEn_ ReceiveData Starts CSIEn data reception Remarks 1 This API function performs byte level CSIEn 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 CSIEn reception CSIEn_ Start must be called before this API function is called Classification CG_serial c Syntax include CG macrodriver h MD_STATUS CSIEn_ReceiveData UCHAR rxb
190. ocess MD_INTUBnTIRE corresponding to the reception error interrupt INTUBnTIRE process performed when the amount of data received is greater than the parameter rxnum specified for UARTBn_ReceiveDaita Classification CG_serial_ user c Syntax include CG macrodriver h void UARTBn_SoftOverRunCallback UCHAR rx_data Remark nis the channel number Argumeni s UCHAR rx data Received data Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 181 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTCn Init Performs initialization necessary to control the asynchronous serial interface C UARTC functions Classification CG_serial c Syntax void UARTCn_Init void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 182 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTCn_Userlnit Performs user defined initialization relating to the asynchronous serial interface C UARTC Remark This API function is called as the UARTCn_ Init callback routine Classification CG_serial_ user c Syntax void UARTCn_UserInit void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 183 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTCn_Start Enables asynchronous serial
191. ol the 3 wire variable length serial I O B CSIB functions CSIBn_Userlnit Performs user defined initialization relating to the 3 wire variable length serial I O B CSIB CSIBn_ Start Enables 3 wire variable length serial I O B CSIB CSIBn_Stop Disables 3 wire variable length serial I O B CSIB CSIBn_SendData Starts CSIB data transmission R20UT0257EJ0100 Rev 1 00 7tENESAS Page 113 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS Serial CSIBn_ReceiveData Starts CSIB data reception CSIBn_SendReceiveData Starts CSIB data transmission reception CSIBn_SendEndCallback Performs processing in response to the CSIBn reception completion interrupt INTCBnR or the CSIBn consecutive transmission write enable interrupt INTCBnT CSIBn_ReceiveEndCallback Performs processing in response to the CSIBn reception completion interrupt INTCBnR CSIBn_ErrorCallback Performs processing in response to the CSIBn reception error interrupt INTCBnR overrun error CSIEn_Init Performs initialization necessary to control the 3 wire variable length serial I O E CSIE functions CSIEn_Userlnit Performs user defined initialization relating to the 3 wire variable length serial I O E CSIE CSIEn_SendEndCallback Performs processing in response to the CSIEn transmission reception completion interrupt INTCEnT CSIEn_ReceiveEndCallback Performs processing in response to the CSIEn transmission reception completion inter
192. on and Recommend connection for unused pin Connection For Unused string 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 R20UT0257EJ0100 Rev 1 00 tENESAS Page 57 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE 3 Pin Name Display category Select whether to display additional information about the pin in the device top view Define name Selects whether to display the Define Name string of the device pin list appended to the pin in the device top view Display Displays the Define Name string of the device pin list in appended format Not display Hides the Define Name string of the device pin list Pin function Selects whether to also display unselected functions in the device top view when a function has been selected from the device pin list s Function feature Display all Displays functions selected via the device pin list s Function feature in parentheses Selected function only Only display functions selected via the device pin list s Function feature in the device top view R20UT0257EJ0100 Rev 1 00 tENESAS Page 58 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Generation tab This tab allows you to view the information Product Information Generate File Mode on and change the setting for the Code Generator
193. on necessary to control 16 bit timer event counter P TMP functions TMPn_User Init Performs user defined initialization relating to the 16 bit timer event counter P TMP TMPn_Start Starts the count for 16 bit timer event counter P TMP TMPn_Stop Ends the count for 16 bit timer event counter P TMP TMPn_ChangeTimerCondition Changes the counter value for 16 bit timer event counter P TMP TMPn_GetPulseWidth Reads the pulse width of 16 bit timer event counter P TMP high low level width TMPn_GetFreeRunningValue Reads the value captured by 16 bit timer event counter P TMP TMPn_ChangeDuty Changes the duty ratio of the PWM signal TMPn_SoftwareTriggerOn Generates the trigger software trigger for timer output TMQ0O_Init Performs initialization necessary to control 16 bit timer event counter Q TMQ functions TMQO_Userlnit Performs user defined initialization relating to the 16 bit timer event counter Q TMQ TMQ0O_ Start Starts the count for 16 bit timer event counter Q TMQ TMQO_ Stop Ends the count for 16 bit timer event counter Q TMQ TMQO_ChangeTimerCondition Changes the counter value for 16 bit timer event counter Q TMQ TMQO0O_GetPulseWidth Reads the pulse width of 16 bit timer event counter Q TMQ high low level width TMQO_GetFreeRunningValue Reads the value captured by 16 bit timer event counter Q TMQ TMQO_ChangeDuty Changes the duty ratio of the PWM signal TMQ0_ Software TriggerOn Generates the t
194. ontrol 16 bit timer event counter AA TAA func tions TAAn_Userlnit Performs user defined initialization relating to the 16 bit timer event counter AA TAA TAAn_ Start Starts the count for 16 bit timer event counter AA TAA TAAn_Stop Ends the count for 16 bit timer event counter AA TAA TAAn_ChangeTimerCondition Changes the counter value for 16 bit timer event counter AA TAA TAAn_ControlOutputToggle Changes the toggle control of 16 bit timer event counter AA TAA TAAn_GetPulseWidth Reads the pulse width of 16 bit timer event counter AA TAA high low level width TAAn_GetFreeRunningValue Reads the value captured by 16 bit timer event counter AA TAA TAAn_ChangeDuty Changes the duty ratio of the PWM signal TAAn_SoftwareTriggerOn Generates the trigger software trigger for timer output Performs initialization necessary to control 16 bit timer event counter AB TAB func tions Performs user defined initialization relating to the 16 bit timer event counter AB TAB Starts the count for 16 bit timer event counter AB TAB R20UT0257EJ0100 Rev 1 00 tENESAS Page 252 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS Reads the pulse width of 16 bit timer event counter AB TAB high low level width C eatin tape eetinaront TABn_ Software TriggerOn Generates the trigger software trigger for timer output TMTO_Init Performs initialization necessary to control 16 bit timer event counter T TMT func t
195. ool gt gt External Bus accordingly R20UT0257EJ0100 Rev 1 00 tENESAS Page 78 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Port This panel allows you to configure the information necessary to control port functions provided by the microcontroller Screen Structure may be different depending on the kinds of target microcontrollers See user s manual for details on target microcontrollers Figure A 19 Example of Port Port Porti Porta Port4 Port Port Port Port Port PortGD PortOM lt gt POQ O Unused h Out H ch Change FO by software el Unused h Out ch Change VO by software O Unused h Out H ch Change FO by software POs Unused Ih Out H ch Change VO by software PL Unused Th Gut H ch Change VO by software POS Unused h Out H ch i Change VO by software POG O Unused h Out H ch Change VO by software How to open On the Project Tree panel select Project name Project gt gt Code Generator Design Tool gt gt Port Remark Ifthe Code Generator panel is already open pressing the button changes the content displayed accordingly R20UT0257EJ0100 Rev 1 00 tENESAS Page 79 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE INT This panel allows you to configure the information necessary to control the external int
196. ounter correction clock 1 Hz to the RC1CK1HZ pin Classification CG_rtc c Syntax void RTC_RC1CK1HZ_OutputDisable void Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 342 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTC _RC1CKO_OutputEnable Enables output of the real time counter clock 82 kHz source to the RC1CKO pin Classification CG_rtc c Syntax void RTC_RC1CKO_OutputEnable void Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 343 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTC_RC1CKO_OutputDisable Disables output of the real time counter clock 32 kHz source to the RC1CKO pin Classification CG_rtc c Syntax void RTC RCICKO OutputDisable void Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 7tENESAS Page 344 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTC _RC1CKDIV_OutputEnable Enables output of the real time counter clock 82 kHz cycle to the RC1CKDIV pin Classification CG_rtc c Syntax void RTC_RC1CKDIV_OutputEnable void Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 345 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTC_RC1CKDIV_OutputDisable Disables output of the real time count
197. panel select Project name Project gt gt Pin Configurator Design Tool gt gt Device Pin List 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 Used in Other Macro Displays the total number of pins for which the purpose has been set by other peripheral functions R20UT0257EJ0100 Rev 1 00 tENESAS Page 67 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE b Second layer Displays the pin number of the pin Function This area allows you to select which function to use when the pin has more than one functions 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 This area allows you to assign a user defined pin name to the pin Displays the summary of function of the pin Recommend Connection For Displays instructions on how to handle the pin when it is not used Unused This column displays information only when the Free is selected in the Func tion column Attention Displays the precaution on using the pin
198. pare threshold value register ADAOPFT and used for comparison with the A D con version result registernH ADAOCRnh Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT0257EJ0100 Rev 1 00 tENESAS Page 243 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS AD_ Read Reads the results of A D conversion 10 bits Classification CG_ad c Syntax include CG macrodriver h MD STATUS AD_ Read USHORT buffer Argumeni s em an Pointer to area in which to store read results of A D conversion 10 bits Remark Below is an example of the results of A D conversion to be stored in buffer 15 8 7 0 B10 B9 B8 B7 B6 B5 B4 B3 B2 Bi Results of A D conversion to be stored in buffer Return value MD_OK Normal completion MD ERROR Exit with error abend R20UT0257EJ0100 Rev 1 00 7tENESAS Page 244 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 MD STATUS AD_ReadByte UCHAR buffer Argumeni 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 15 8 7 0 B10
199. pin Displays the summary of function of the pin Recommend Connection For Displays instructions on how to handle the pin when it is not used Unused This column displays information only when the Free is selected in the Func tion column Attention 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 button in the upper left corner of the device pin list R20UT0257EJ0100 Rev 1 00 tENESAS Page 70 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Device Top View panel This panel displays the information entered in the Device Pin List panel Figure A 15 Device Top
200. processing in response to the reception error interrupt INTUBnTIRE overrun error framing error par ity error UARTBn_FIFOErrorCalloack Performs processing in response to the reception error interrupt INTUBnTIRE overrun error framing error par ity error UARTBn_TimeoutErrorCallback Performs processing in response to the reception time out error interrupt INTUBnTITO UARTBn_SoftOverRunCallback Performs processing in response to detection of over run error UARTCn_Init Performs initialization necessary to control the asyn chronous serial interface A UARTA functions UARTCn_Userlnit Performs user defined initialization relating to the asyn chronous serial interface A UARTA UARTCn_Start Enables asynchronous serial interface A UARTA UARTCn_Stop Disables asynchronous serial interface A UARTA UARTCn_SendData Starts UARTAn data transmission UARTCn_ReceiveData Starts UARTAn data reception UARTCn_SendEndCallback Performs processing in response to the UARTAn con secutive transmission enable interrupt INTUAnT UARTCn_ReceiveEndCallback Performs processing in response to the UARTAn recep tion completion interrupt INTUAnR UARTCn_ErrorCallback Performs processing in response to the UARTAn recep tion error interrupt INTUAnR overrun error framing error parity error UARTCn_SoftOverRunCallback Performs processing in response to detection of overrun error CSIBn_Init Performs initialization necessary to contr
201. products or if you have any other inquiries Note 1 Renesas Electronics as used in this document means Renesas Electronics Corporation and also includes its majority owned subsidiaries Note 2 Renesas Electronics product s means any product developed or manufactured by or for Renesas Electronics How to Use This Manual This manual describes the role of the CubeSuite integrated development environment for developing applications and systems for V850 microcontrollers and provides an outline of its features CubeSuite is an integrated development environment IDE for V850 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 This manual is intended for users who wish to understand the functions of the CubeSuite and design software and hardware application systems Purpose 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 Organization 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 APPEN
202. r 1 40 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 Argument s None Return value None R20UT0257EJ0100 Rev 1 00 7tENESAS Page 148 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 Argument s None Return value None R20UT0257EJ0100 Rev 1 00 sQENESAS Page 149 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS KEY Userlnit Performs user defined initialization relating to the key interrupt INTKR functions Remark This API function is called as the KEY_ Init callback routine Classification CG_int_user c Syntax void KEY Userinit void Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 150 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS INT_MaskablelnterruptEnable Disables enables the acceptance of the maskable interrupts Classification CG_int c Syntax E Sx3 H ES Jx3 E ES Jx3 H include CG macrodriver h include CG_int h MD_STATUS INT_MaskableInterruptEn
203. r 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 Preview panel dedicated items Displays the help of this panel Open Help for Code Generator Preview Panel Context menu The following context menu items are displayed by right clicking the mouse Generate code Not generate code Rename Makes a setting 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 to Makes a setting so that the source code of the currently selected API function is not gen erated when the 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 cur
204. r Project Tree Panel Open Help for Property Panel Open Help for Device Pin List Panel Open Help for Device Top View Panel Open Help for Code Generator Panel Open Help for Code Generator Preview Panel Open Help for Output Panel 2 Panel display area 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 Output panel dedicated item Opens the Search and Replace dialog box for replacing strings with the Whole Replace tab selected Project Tree panel dedicated item Displays the help of Project Tree panel Property panel dedicated item Displays the help of Property panel Device Pin List panel dedicated item Displays the help of Device Pin List panel Device Top View panel dedicated item Displays the help of Device Top View panel Code Generator panel dedicated item Displays the help of Code Generator panel Code Generator Preview panel dedicated item Displays the help of Code Generator Preview panel Output panel dedicated item Displays the help of Output panel 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 R20
205. r 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 Disables output of the real time counter clock 32 kHz cycle to the RTCDIV pin RTC_ChangeCorrectionValue Changes the timing and correction value for correcting clock errors Real Time Output RTOn_Init Performs initialization necessary to control real time output functions RTOn_UserInit Performs user defined initialization relating to the real time output Enables validates real time output Disables invalidates real time output DMAn_Init Performs initialization necessary to control DMA con troller functions DMAn_UserlInit Performs user defined initialization relating to the DMA controller DMAn_Enable Enables operation of channel n DMAn_ Disable Disables operation of channel n DMAn_CheckStatus Reads the transfer status transfer complete transfer ongoing R20UT0257EJ0100 Rev 1 00 7tENESAS Page 119 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS DMA DMAn_SetData Sets the RAM address of the transfer so
206. rates an interrupt request INTA0 when 4040CRnH lt 40 40PFT Compare threshold PFT value C Interrupt setting Use 4 0 interrupt KINTAD Used as multiple interrupt Priority Lowest et How to open On the Project Tree panel select Project name Project gt gt Code Generator Design Tool gt gt A D Remark Ifthe Code Generator panel is already open pressing the button changes the content displayed accordingly R20UT0257EJ0100 Rev 1 00 tENESAS Page 82 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE D A This panel allows you to configure the information necessary to control the function of D A converter provided by the microcontroller Screen Structure may be different depending on the kinds of target microcontrollers See user s manual for details on target microcontrollers Figure A 23 Example of D A DAO pat D A convertor operation setting O Unused Used Operation mode setting Normal mode Real time output mode Conversion value setting Conversion value o How to open On the Project Tree panel select Project name Project gt gt Code Generator Design Tool gt gt D A Remark Ifthe Code Generator panel is already open pressing the button changes the content displayed accordingly R20UT0257EJ0100 Rev 1 00 tENESAS Page 83 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Timer Conf
207. reby under any patents copyrights or other intellectual property rights of Renesas Electronics or others You should not alter modify copy or otherwise misappropriate any Renesas Electronics product whether in whole or in part Descriptions of circuits software and other related information in this document are provided only to illustrate the operation of semiconductor products and application examples You are fully responsible for the incorporation of these circuits software and information in the design of your equipment Renesas Electronics assumes no responsibility for any losses incurred by you or third parties arising from the use of these circuits software or information When exporting the products or technology described in this document you should comply with the applicable export control laws and regulations and follow the procedures required by such laws and regulations You should not use Renesas Electronics products or the technology described in this document for any purpose relating to military applications or use by the military including but not limited to the development of weapons of mass destruction Renesas Electronics products and technology may not be used for or incorporated into any products or systems whose manufacture use or sale is prohibited under any applicable domestic or foreign laws or regulations Renesas Electronics has used reasonable care in preparing the information included in this document but Renes
208. rently selected file R20UT0257EJ0100 Rev 1 00 Sep 01 2010 tENESAS Page 92 of 394 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Output panel This panel displays operation logs for various components design tool build tool etc provided by CubeSuite Figure A 31 Output Panel Output 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 Help menu Output panel dedicated items Context menu How to open From the View menu select Output Description of each area 1 Message area This area displays operation logs for various components design tool build tool etc provided by CubeSuite The following table displays the meaning of the color of the message text displayed in this area Table A 4 Color of Message Text Background Block White Information message Displayed with information notices Blue Standard color Warning message Displayed with warnings about operations Red LightGray Fatal error message Displayed when there is a fatal error or when execution is not possible due to a operational mistake Remark See the sections All Output Messages tab and Code Generator tab for details on the content dis played in this area 2 Tab selection area Select the source of message Remark When the new message is output mark is displ
209. rigger software trigger for timer output TAAn_Init Performs initialization necessary to control 16 bit timer event counter AA TAA functions TAAn_Userlnit Performs user defined initialization relating to the 16 bit timer event counter AA TAA TAAn_ Start Starts the count for 16 bit timer event counter AA TAA TAAn_Stop Ends the count for 16 bit timer event counter AA TAA TAAn_ChangeTimerCondition Changes the counter value for 16 bit timer event counter AA TAA TAAn_ControlOutputToggle Changes the toggle control of 16 bit timer event counter AA TAA TAAn_GetPulseWidth Reads the pulse width of 16 bit timer event counter AA TAA high low level width TAAn_GetFreeRunningValue Reads the value captured by 16 bit timer event counter AA TAA TAAn_ChangeDuty Changes the duty ratio of the PWM signal R20UT0257EJ0100 Rev 1 00 7tENESAS Page 116 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS Timer TAAn_SoftwareTriggerOn Generates the trigger software trigger for timer output TABn_Init Performs initialization necessary to control 16 bit timer event counter AB TAB functions TABn_Userlnit Performs user defined initialization relating to the 16 bit timer event counter AB TAB TABn_ Start Starts the count for 16 bit timer event counter AB TAB TABn_Stop Ends the count for 16 bit timer event counter AB TAB TABn_ChangeTimerCondition Changes the counter value for 16 bit timer event count
210. ription of each area 1 Name This area allows you to enter column headings of the columns added to the device pin list 2 Type Select the input format of the column to add to the device pin list 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 Only real numbers can be entered in the column Only dates in YYYYMMDD format can be entered in the column Function buttons Button Function OK 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 R20UT0257EJ0100 Rev 1 00 tENESAS Page 100 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 41 Browse For Folder Dialog Box Browse For Folder Desktop 4 i My Documents 1 E3 H My Computer E3 My Network Places 9 Unused Desktop Shortcuts Function buttons i i The following items are explained here How to open Description of each area Function buttons How to open In the Generation tab of the Property panel click the button in Output folder Description of each area 1 Folder location Select the folder to which the files source code report fi
211. rks 1 You can only use macro or function as a name of the report file Table 3 6 Output Report Files macro A file that contains the information configured using the 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 12 Output Example of Report File macro gt Macro list Windows Internet Explorer Sel E C carpi maaa html v X File Edit View Favorites Tools Help w abr Macro list MCU name O50ER 9 Chip name uPDfOF S746 nl la Main oscillation clock fx 10H p me z feedback f or Subclock setting Used f Subclock fT 32 768 kHz Subclockfeedback resistor used Internal oscillator clock setting Used a Internal oscillator fR 22 220 KHZ ee Clock outputfunction setting Unused R20UT0257EJ0100 Rev 1 00 sQENESAS Page 39 of 394 Sep 01 2010 CubeSuite Ver 1 40 CHAPTER 3 FUNCTIONS Code Generator Figure 3 13 Output Example of Report File function E Function list Windows Internet Explorer i m wiew Favorites Tools h E Macro list E Cr sample Function html or i lela e f Function list MCU name Y850ESJJ3 Chip name uPD OFS 746 Ps Module Common System File cG_main c CG systeminitc CG macrodriver h CG _userdefine h CG_I k dir Gs starts CG inttab s
212. rol 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 exter nal bus interface R20UT0257EJ0100 Rev 1 00 7tENESAS Page 111 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS Port PORT Init Performs initialization necessary to control port func tions PORT_Userlnit Performs user defined initialization relating to the port PORT_ChangePmnInput PORT _ChangePmnOutput INT INTP_Init INTP_Userlnit KEY_Init KEY Userlnit INT_MaskablelnterruptEnable INTPn_Disable INTPn_Enable Switches the pin s I O mode from output mode to input mode Switches the pin s I O mode from input mode to output mode Performs initialization necessary to control the external interrupt INTPn functions Performs user defined initialization relating to the exter nal interrupt INTPn functions Performs initialization necessary to control the key interrupt INTKR functions Performs user defined initialization relating to the key interrupt INTKR functions Disables enables the acceptance of the maskable inter rupts Disables the acceptance of the maskable interrupts INTPn external interrupt requests Enables the acceptance of the maskable interrupts INTPn external interrupt requests KEY_ Disable Disables the acceptance of the key interrupts INTKR KEY Enable Enab
213. rray_duty Argument s Remark The value set to duty ratio array _duty must be in base 10 notation Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT0257EJ0100 Rev 1 00 tENESAS Page 302 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMTO_SoftwareTriggerOn Generates the trigger software trigger for timer output Remark This API function can only be called when 16 bit timer event counter T TMT is used for external trigger pulse output one shot pulse output Classification CG_timer c Syntax void TMTO_SoftwareTriggerOn void Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 303 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMTO_EnableHold Changes the encoder counter control of 16 bit timer event counter T TMT to holding count value Remark This API function can only be called when 16 bit timer event counter T TMT is used for encoder count Classification CG_timer c Syntax void TMTO_EnableHold void Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 304 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMTO_DisableHold Changes the encoder counter control of 16 bit timer event counter T TMT to normal operation Remark This API function can only be called when 16 bit timer even
214. rruptEnable HALFSEC Start of cyclic interrupt function R20UT0257EJ0100 Rev 1 00 tENESAS Page 328 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTC_ConstPeriodIinterruptDisable Ends the cyclic interrupt function Classification CG_rtc c Syntax void RTC_ConstPeriodInterruptDisable void Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 329 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTC_AlarmEnable Starts the alarm interrupt function Classification CG_rtc c Syntax void RTC_AlarmEnable void Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 330 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTC_AlarmDisable Ends the alarm interrupt function Classification CG_rtc c Syntax void RTC_AlarmDisable void Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 331 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTC_AlarmSet Sets the alarm conditions weekday hour minute Classification CG_rtc c Syntax include CG Macrodriver h include CG rtco n void RTC_AlarmSet struct RTCAlarmValue alarmval Argumeni s struct RTCAlarmValue alarmval Alarm conditions weekday hour minute Remark Below is shown the stru
215. rupt INTCEnT CSIEn_ErrorCallback Performs processing in response to the CSIENBUF overflow interrupt INTCEnTIOF CSIFn_Init Performs initialization necessary to control the 3 wire variable length serial I O F CSIF functions CSIFn_Userlnit Performs user defined initialization relating to the 3 wire variable length serial I O F CSIF CSIFn_SendEndCallback Performs processing in response to the CSIFn transmission reception completion interrupt INTCFnT CSIFn_ReceiveEndCallback Performs processing in response to the CSIFn transmission reception completion interrupt INTCFnT CSIFn_ErrorCallback Performs processing in response to the CSIFn reception error interrupt INTCFnR overrun error HCOn_Init Performs initialization necessary to control the IIC bus functions R20UT0257EJ0100 Rev 1 00 7tENESAS Page 114 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS Serial IICOn_UserlInit Performs user defined initialization relating to the IIC bus I1COn_MasterSendEndCallback Performs processing in response to the IICn master transfer completion interrupt INTIICn IICOn_MasterReceiveEndCallback Performs processing in response to the IICn master transfer completion interrupt INTIICn IICOn_MasterErrorCallback Performs processing in response to detection of error in IlCn master communication IICOn_SlaveSendStart Starts IICOn slave transmission l1COn_SlaveReceiveStart Starts IICOn slave reception I1COn_Sla
216. s Open Help for Project Tree Panel Displays the help of this panel Context menu The following context menu items are displayed by right clicking the mouse Return to Reset Value Restores the information for the selected peripheral function node to its default state Property Opens the Property pane containing the information for the selected node Pin Configurator Design Tool or Code Generator Design Tool R20UT0257EJ0100 Rev 1 00 7tENESAS Page 49 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Property panel This panel allows you to view the information on and change the seiting 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 A Fin Configurator Property El Product Informaton El Use of Pin Configurator Panek Use pin configurator panels No El Package Package type GC Version Fin configurator version information Pin Configurator Settings The following items are explained here How to open Description of each area Edit menu Property panel dedicated items Help 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
217. s manual for details on target microcontrollers Figure A 21 Example of Serial UARTAQ WARTAT UARTAZ lt i5 aa Transfer mode Unused Transmission mode Reception mode Tranemission reception mode How to open On the Project Tree panel select Project name Project gt gt Code Generator Design Tool gt gt Serial Remark Ifthe Code Generator panel is already open pressing the button changes the content displayed accordingly R20UT0257EJ0100 Rev 1 00 7tENESAS Page 81 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE A D This panel allows you to configure the information necessary to control the function of A D converter provided by the microcontroller Screen Structure may be different depending on the kinds of target microcontrollers See user s manual for details on target microcontrollers Figure A 22 Example of A D 4 0 convertor operation setting O Unused Used Trigger mode setting Software trigger mode External trigger mode Timer trigger mode Operation mode setting Continuous select mode gt Continuous scan mode O One shot select mode O One shot scan mode 4 0 channells AND set Conversion time setting O Normal mode High speed mode Conversion time us Power tail function setting Power fail compare disable Generates an interrupt request INTA0 when 4040CRnH SO40PFT Gene
218. s read 0x0 to Ox1 ffff ee Pointer to an area storing the low level width that was read 0x0 to Ox1 ffff Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 300 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMTO_GetFreeRunningValue Reads the value captured by 16 bit timer event counter T TMT Remark This API function can only be called when 16 bit timer event counter T TMT is used as a free running timer and TMTO capture compare register m TTOCCRm is selected as the capture register Classification CG_timer c Syntax include CG Macrodriver h include CG timer h MD_STATUS TMTO_GetFreeRunningValue ULONG count enum TMChannel channel Argumeni s 0 urong count 0 Pointer to area in which to store the width that was read enum TMChannel channel Channel to read TMCHANNELO Channel 0 TPnCCRO TMCHANNEL1 Channel 1 TPnCCR1 Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT0257EJ0100 Rev 1 00 tENESAS Page 301 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMTO_ChangeDuty Changes the duty ratio of the PWM signal Remark This API function can only be called when 16 bit timer event counter T TMT is used for external trigger pulse output PWM output Classification CG_timer c Syntax include CG_macrodriver h MD_STATUS TMTO_ChangeDuty UCHAR a
219. sed in the Code Generator panel Figure A 9 Macro Setting Tab Property i system Property O Macro Information Macro name Macro name Macro name of selected macro Macro Setting The following items are explained here How to open Description of each area How to open On the Project Tree panel select Project name Project gt gt Code Generator Design Tool gt gt Peripheral func tion node System External Bus 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 External Bus Port etc and then select Property from the context menu Remarks 1 _ If this panel is already open selecting a different peripheral function node such as System External Bus or Port 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 such as 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 such as System External Bus or Port selected in the Project Tree panel or the peripheral function button pressed in the Code Generator pan
220. serial_ user c Syntax void CSIBn S endEndCallback void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 199 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CSIBn_ReceiveEndCallback Performs processing in response to the CSIBn reception completion interrupt INTCBnR Remark This API function is called as the callback routine process performed when the total number of CSIBn receptions specified in the parameter rxnum for CS IBn_ReceiveData or CSIBn_SendReceiveData has been completed of interrupt process MD_INTCBnR corresponding to the CSIBn reception completion inter rupt INTCBnR Classification CG_serial_ user c Syntax void CSIBn ReceiveEndCallback void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 200 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CSIBn_ErrorCallback Performs processing in response to the CSIBn reception error interrupt INTCBnR overrun error Remark This API function is called as the callback routine of interrupt process MD_INTCBnR corresponding to the CSIBn reception error interrupt INTCBnR Classification CG_serial_user c Syntax void CSIBn_ErrorCallback void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev
221. ss performed when the total number of CSIFn receptions specified in the parameter rxnum for CS IFn_ReceiveData or CSIFn_SendReceiveData has been completed of interrupt process MD_INTCFnT corresponding to the CSIFn transmission reception comple tion interrupt INTCFnT Classification CG_serial_ user c Syntax void CSIFn_ReceiveEndCallback void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 220 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CSIFn_ErrorCallback Performs processing in response to the CSIFn reception error interrupt INTCFnR overrun error Remark This API function is called as the callback routine of interrupt process MD_INTCFnR corresponding to the CSIFn reception error interrupt INTCFnR Classification CG_serial_user c Syntax void CSIFn_ErrorCallback void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 221 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS HCOn Init Performs initialization necessary to control the IIC bus functions Classification CG_serial c Syntax void IICO0n_Init void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 222 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C AP
222. t RTC_CounterGet RTC_ConstPeriodinterruptEnable RTC_ConstPeriodInterruptDisable RTC_AlarmEnable RTC_AlarmDisable RTC_AlarmSet RTC_AlarmGet RTC_IntervalStart RTC_IntervalStop RTC_IntervallnterruptEnable RTC_IntervallnterruptDisable RTC _RC1CK1HZ_ OutputEnable RTC_RC1CK1HZ_OutputDisable RTC _RC1CKO_OutputEnable RTC _RC1CKO_OutputDisable RTC _RC1CKDIV_OutputEnable RTC_RC1CKDIV_OutputDisable RTC_RTC1HZ_OutputEnable RTC_RTC1HZ_OutputDisable RTC_RTCCL_OutputEnable RTC_RICCL_OutputDisable RTC_RTCDIV_OutputEnable RTC _RTCDIV_OutputDisable R20UT0257EJ0100 Rev 1 00 tENESAS Page 109 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX B OUTPUT FILES Peripheral Function Source File Name Names of API Functions Included CG_rtc_user c MD_INTRTCn RTC_Userlnit ew ooo p Real Time Output CG_rto c RTOn_Init RTOn_Enable RTOn_ Disable RTOn_Set2BitData RTOn_Set4BitData RTOn_Set6BitData RTOn_Set8BitData RTOn_SetHigh2BitData RTOn_SetLow2BitData RTOn_SetHigh4BitData RTOn_SetLow4BitData RTOn_GetValue CG_dma c DMAn_Init DMAn_ Enable DMAn_ Disable DMAn_CheckStatus DMAn_SetData DMAn_ Software TriggerOn CG_dma_user c MD_INTDMAn DMAn_Userlnit LVI CG_lvi c LVI_Init LVI_InterruptModeStart LVI_ResetModeStart LVI_Start LVI_Stop CG_lvi_user c MD_INTLVI LVI_Userlnit R20UT0257EJ0100 Rev 1 00 7tENESAS Page 110 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS APPENDIX C API FU
223. t counter T TMT is used for encoder count Classification CG_timer c Syntax void TMTO DisableHold void Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 305 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMTO_ChangeCountValue Changes the initial counter value for 16 bit timer event counter T TMT Remarks 1 The value specified in parameter regvalue is set in TMTO counter write register TTOTCW 2 This API function can only be called when 16 bit timer event counter T TMT is used for encoder count Classification CG_timer c Syntax include CG_macrodriver h void TMTO_ChangeCountValue USHORT regvalue Argument s Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 306 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMMn_Init Performs initialization necessary to control 16 bit interval timer M TMM functions Classification CG_timer c Syntax void TMMn_Init void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 307 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMMn_Userlnit Performs user defined initialization relating to the 16 bit interval timer M TMM Remark This API function is called as the MMn_ Init callback routine Classification CG_timer_user c Sy
224. tax void UARTAn_UserInit void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 161 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTAn Start Enables asynchronous serial interface A UARTA Classification CG_serial c Syntax void UARTAn Start void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 162 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTAn_Stop Disables asynchronous serial interface A UARTA Classification CG_serial c Syntax void VARTAn Stop void Remark nis the channel number Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 163 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS UARTAn_SendData Starts UARTAn data transmission Remarks 1 This API function repeats the byte level UARTAn transmission from the buffer specified in parameter txbuf the number of times specified in parameter txnum 2 When performing a UARTAn transmission UARTAn_ Start must be called before this API function is called Classification CG_serial c Syntax include CG macrodriver h MD_STATUS UARTAn_SendData UCHAR txbuf USHORT txnum Remark nis the channel number Argumeni s pI UCHAR exbut Poi
225. tax void CLOCK_UserInit void Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 125 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CG _ReadResetSource Performs processing in response to a reset signal Classification CG_system_user c Syntax void CG_ReadResetSource void Argument 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 Perform process according to reset signal trigger CG_system_user c include CG_macrodriver h void CG_ReadResetSource void UCHAR resetflag RESF Reset control flag register Obtain RESF contents if resetflag amp 0x1 Trigger identification Check LVIRF flag Process performed when low voltage detector detects low voltage else if resetflag amp 0x2 Trigger identification Check CLMRF flag Process performed when clock monitor oscillation stopped resetflag amp 0x10 Trigger identification Check WDT2RF flag Process performed when watchdog timer 2 overflows R20UT0257EJ0100 Rev 1 00 tENESAS Page 126 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CG_ChangeClockMode Changes the CPU clock Classification CG_system c Syntax in
226. text menu displays R20UT0257EJ0100 Rev 1 00 tENESAS Page 72 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 clicked Delete External Peripheral Removes the external peripheral controller R20UT0257EJ0100 Rev 1 00 tENESAS Page 73 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 1 F Reflect in Pin SS Generate Code 7 jet sip a T bi m amp Se Glock setting stand by On chip debug setting Watchdog Timer Power on Clear setting Main oscillation clack setting Wain oscillation clack fx e MHz Main oscillation feedback resistor subclock setting Operation Subclock fXT 32768 kk Hz subolock feedback resistor Internal oecillator clock setting Operation Internal oscillator fR He 2 Main clock and GPU clock setting Main clock fx 4 clock throueh mode TA fx ae MHz GPU clock GPL D5 KKI w MHz TERG setting fBRG enable 32768 kHe Actual value 32 787
227. timer setting Time O500 P1449 te Actual value 500 Enable watch timer interrupt INTWT Used as multiple interrupt Priority Lowest et Interval timer setting Time 488 24 0 tue Actual value488 Enable interval timer interrupt INTWTT Used as multiple interrupt Priority Lowest a How to open On the Project Tree panel select Project name Project gt gt Code Generator Design Tool gt gt Watch Timer Remark Ifthe Code Generator panel is already open pressing the button changes the content displayed accordingly R20UT0257EJ0100 Rev 1 00 tENESAS Page 85 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE RTC This panel allows you to configure the information necessary to control the function of real time counter provided by the microcontroller Screen Structure may be different depending on the kinds of target microcontrollers See user s manual for details on target microcontrollers Figure A 26 Example of RTC Real time counter operation setting Unused Used Operating clock setting TRATO Subelock fT O Watch count clock BRG Real time counter setting Hour system selection Set real time counter initial value 00 01 01 00 00 00 Saturday at Enable output of R 1GK1HZ pin 1 Hz Qlarm detection function setting Use alarm detection function oet alarm initial value Week day Sunday Monday Tuesday Wednesday Thursday w Frida
228. tion type e g interval timer external event counter or external trigger pulse output Classification CG_timer c Syntax void TMOU Stop void Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 267 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS TMQO_ChangeTimerCondition Changes the counter value for 16 bit timer event counter Q TMQ Remark The value specified in parameter arrar_reg is set to TMQO capture compare register m TQ0CCRm Classification CG_timer c Syntax include CG_macrodriver h MD_STATUS TMQO_ChangeTimerCondition USHORT array_reg UCHAR array_num Argumeni s eT amen Cn ee Pointer to an area storing the count value 0x0 to Oxffff UCHAR array_num Register to change 1 TQOCCRO 2 TQOCCRO TQOCCR1 3 TQOCCRO TQOCCR1 TQOCCR2 4 TQOCCRO TQOCCR1 TQOCCR2 TQOCCR3 Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification 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 void Main void 4 int flag_finish USHORT array_reg TMQ_TQOCCRO_VALUE gt gt 1 TMQ TQOCCRO_VALUE Current interval time UCHAR array_num 1 TMQO Start Start count while flag_finish Check for time up R20UT0257EJ0100 Rev
229. tring or lines selected with range selection to the clipboard Inserts the contents of the clipboard at the caret position 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 R20UT0257EJ0100 Rev 1 00 tENESAS Page 52 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Pin Configurator Settings tab This tab displays information Product Information Use of Pin Configurator and Package on the Pin Configurator Design Tool selected in the Project Tree panel Figure A 4 Pin Configurator Settings Tab Property A Fin Configurator Property El Product Information El Use of Pin Configurator Panek Use pin configurator panels No El Package Package type GC Version Pin configurator version information Pin Configurator Settings Fi 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 Proper
230. ty 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 the Pin Configurator Version Displays the version of the Pin Configurator Release date Displays the release date of the Pin Configurator 2 Use of Pin Configurator Panels category Select whether to show the Device Pin List panel and Device Top View panel R20UT0257EJ0100 Rev 1 00 tENESAS Page 53 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Selects whether to display the Device Pin List panel and Device Top View panel in Use pin configurator panels the Main window the next time this project is opened Displays the Device Pin List panel and Device Top View panel Hides the Device Pin List panel and Device Top View panel 3 Package category Change the shape package type and settings of the microcontroller to display as the device top view in the Device Top View panel Package type Selects the shape of the microcontroller displayed in the device top view R20UT0257EJ0100 Rev 1 00 7tENESAS Page 54 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Pin Configurator Information tab This tab displays information Product infor
231. uf USHORT rxnum Remark nis the channel number Argumeni s Ce ee 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 R20UT0257EJ0100 Rev 1 00 tENESAS Page 207 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS CSIEn_ SendReceiveData Starts CSIEn data transmission reception Remarks 1 This API function repeats the byte level CSIEn transmission from the buffer specified in parameter txbuf the number of times specified in parameter txnum 2 This API function performs byte level CSIEn 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 CSIEn transmission reception CS En_ Start must be called before this API function is called Classification CG_serial c Syntax include Ce macrodriver h MD_STATUS CSIEn_SendReceiveData UCHAR txbuf USHORT txnum UCHAR rxbuf Remark nis the channel number Argumeni s Pointer to a buffer to store the received data ES USHORT txnum Total amount of data to receive UCHAR rxbuf Pointer to a buffer storing the transmission data Return value MD_OK Normal completion MD_ARGERROR Invalid argument specification R20UT0257EJ0100 Rev 1 00 tENESAS Page 208 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPEND
232. umns 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 R20UT0257EJ0100 Rev 1 00 7tENESAS Page 11 of 394 Sep 01 2010 CubeSuite Ver 1 40 CHAPTER 2 FUNCTIONS Pin Configurator 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 infomration Select the type of information to display in the Pin area of the Device Top View panel 5 Enter Information Allows you to enter information on the pins of the microcontroller in the Device Pin List panel 6 Output Report Files Output report files files containing configured information using the 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 7 Save project Save a project Remark See CubeSuite Start User s Manual for details on
233. urce destina tion and the number of times the data has been trans ferred LVI DMAn_ Software TriggerOn Uses a software trigger as a DMA transfer start trigger LVI_ Init Performs initialization necessary to control low voltage detector functions LVI Userlnit Performs user defined initialization relating to the low voltage detector LVI_InterruptWModeStart Starts low voltage detection when in interrupt genera tion mode LVI_ResetModeStart Starts low voltage detection when in internal reset mode LVI Start Starts low voltage detection LVI Stop Stops low voltage detection R20UT0257EJ0100 Rev 1 00 tENESAS Page 120 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 5 Argument s 6 Return value 7 Example 1 Name Indicates the name of the API function 2 Outline Outlines the functions of the API function 3 Classification Indicates the name of the C source file to which the API function is output 4 Syntax Indicates the format to be used when describing an API function to be called in C language R20UT0257EJ0100 Rev 1 00 7tENESAS Page 121 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS 5 Argument s API function arguments are explained in the following
234. utput of the real time counter clock 32 kHz source to the RTCCL pin RTC_RITCDIV_OutputEnable Enables output of the real time counter clock 32 kHz cycle to the RTCDIV pin RTC_RITCDIV_OutputDisable Disables output of the real time counter clock 82 kHz cycle to the RTCDIV pin RTC_ChangeCorrectionValue Changes the timing and correction value for correcting clock errors R20UT0257EJ0100 Rev 1 00 tENESAS Page 317 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 R20UT0257EJ0100 Rev 1 00 tENESAS Page 318 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTC_Userlnit Performs user defined initialization relating to the real time counter Remark This API function is called as the RI C_ Init callback routine Classification CG_rtc_user c Syntax void RTC Userinity void Argument s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 319 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS RTC_CounterEnable Starts the count of the real time counter year month weekday day hour minute second Classification CG_rtc c Syntax void RTC_CounterEnable void Argumeni s None Return value None
235. veSendEndCallback Performs processing in response to the IICn slave transfer completion interrupt INTIICn IICOn_SlaveReceiveEndCallback Performs processing in response to the IICn slave transfer completion interrupt INTIICn IICOn_SlaveErrorCallback Performs processing in response to detection of error in IICn slave communication II1COn_GetStopConditionCallback Performs processing in response to detection of stop condition A D AD_Init Performs initialization necessary to control A D con verter functions AD_Userlnit Performs user defined initialization relating to the A D converter AD_Stop Ends A D conversion AD_SelectADChannel Configures the analog voltage input pin for A D conver sion AD_SetPFTCondition Sets the information for operation in power fail compare mode comparison value and A D conversion end inter rupt INTAD trigger AD_Read Reads the results of A D conversion 10 bits AD_ReadByte Reads the results of A D conversion 8 bits most signif icant 8 bits of 10 bit resolution D A DAn_Init Performs initialization necessary to control D A con verter functions DAn_Userlnit Performs user defined initialization relating to the D A converter DAn_ Stop Ends D A conversion DAn_SetValue Sets the analog voltage output to the ANOn pin R20UT0257EJ0100 Rev 1 00 7tENESAS Page 115 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS Timer TMPn_Init Performs initializati
236. view panel This panel allows you to confirm or configure on a per API function basis the setting that determines whether or not the source code device driver program is generated when the Generate Code button is pressed in the Code Genera tor panel It also allows you to confirm the source code that reflects the information configured in the Code Generator panel Code Generator Preview a File See Common i ERE 9 OG_systeminitec Figure A 30 Code Generator Preview Panel Pe TTT TT CTT C CTC T TT CTL C TCC TTT LTT TTT CC TT TTT Te Copyrighti NEG Electronics Corporation 2008 All rights reserved by NEG Electronics Corporation OG _macrodriverh This program should be used on your own responsibility Gak dir f CG starts F cG inttabs system External Bus Port INT Ser lal rD D A Timer Watch Timer Real Time Output DMA g F CG userdefineh g E na cs GEH E EH EF mM NEC Electronics Corporation assumes no responsibility for any losses incurred by customers or third parties arising from the use of this file 4 M This device driver was created by CubeSuite code part for VE5UES Jes ye S2 Bit Sinele Chip Microcontrollers CA mainc This tile implements main function APTlib GubeSuite code part for VESOESJIx3 EOSOf 22 Aug 2008 Device uPDVOFS 46 Compiler CADO Creation date 2008 09 01 goiogoigioigoiaigaiaagiadaoioiainigiooiabaoigigioigi k al The following items are expl
237. w panel is a default name or not The file name is a default name Changing this area from No to Yes changes the name of the file to its default name The file name is not a default name Displays or change the name of the file selected on the Code Generator Preview panel File name R20UT0257EJ0100 Rev 1 00 tENESAS Page 62 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Device Pin List panel This panel allows you to enter information on each pin of the microcontroller Figure A 11 Device Pin List Panel Device Pin List e Pin Number Pin Name Function VO a N ch Detir A ARE FO AM PIO ANOO Pin Number Macro External Peripheral POPC iia F 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 select Project name Project gt gt Pin Configurator Design Tool gt gt Device Pin List From the View menu select Pin Configurator gt gt Device Pin List Description of each area 1 Toolbar This area consists of the following buttons Displays the information in the Device pin list area in an expanded view Displays the information in the Device pin list area in a folded view only Clicks this button to automatically process the configuration i
238. xample Below is an example of switching the POO pin s I O mode from output mode to input mode CG_main c void main void PORT_ChangePOOInput Switch I O mode R20UT0257EJ0100 Rev 1 00 7tENESAS Page 143 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS PORT_ChangePmnOutput Switches the pin s I O mode from input mode to output mode Classification CG_port c Syntax The format for specifying this API function differs according to whether the target pin conducts N ch open drain output N ch open drain output none include CG_macrodriver h void PORT_ChangePmnOutput BOOL initialvalue N ch open drain output yes include CG_macrodriver h void PORT_ChangePmnOutput BOOL enablench BOOL initialvalue Remark nm is the port number Argumeni s BOOL enablench Output mode type MD_TRUE N ch open drain output Vpop withstand voltage mode MD_FALSE Normal output mode BOOL initialvalue Initial output value MD_SET Output HIGH level 1 MD_CLEAR Output LOW level 0 Return value None Example 1 Below is shown an example where pin POO N ch open drain output none is changed as follows I O mode type Output mode Initial output value Output HIGH level 1 CG_main c include CG_macrodriver h void main void PORT_ChangeP000Output MD_SET Switch I O mode R20UT0257EJ0100 Rev 1 00 stENESAS Page
239. y Code Generator for serial use Table C 6 API Functions Serial UARTAn_ Init Performs initialization necessary to control the asynchronous serial interface A UARTA functions UARTAn_UserlInit Performs user defined initialization relating to the asynchronous serial interface A UARTA UARTAn_ Start Enables asynchronous serial interface A UARTA UARTAn_Stop Disables asynchronous Serial interface A UARTA UARTAn_SendData Starts UARTAn data transmission UARTAn_ReceiveData Starts UARTAn data reception UARTAn_SendEndCallback Performs processing in response to the UARTAn consecutive transmission enable interrupt INTUAnT UARTAn_ReceiveEndCallback Performs processing in response to the UARTAn reception completion interrupt INTU AnR UARTAn_ErrorCallback Performs processing in response to the UARTAn reception error interrupt INTUAnR overrun error framing error parity error UARTAn_SoftOverRunCallback Performs processing in response to detection of overrun error UARTBn_lnit Performs initialization necessary to control the asynchronous serial interface B UARTB functions UARTBn_Userlnit Performs user defined initialization relating to the asynchronous serial interface B UARTB UARTBn_Start Enables asynchronous serial interface B UARTB UARTBn_Stop Disables asynchronous serial interface B UARTB UARTBn_SendData Starts UARTBn data transmission UARTBn_ReceiveData Starts UARTBn data reception UARTBn_SendE
240. y Saturday Howe Minute O0 00 Counter correction function setting Use correction tunction us RCIGKDIV RGIGCEO output setting No output Enable output of RCICKDIV pin Enable output of RCICKO pin 32 kHe Interrupt setting Use periodic interrupt INTRTCO Used as multiple interrupt Priority Lowest et Use alarm interrupt NTRTC1 Used as multiple interrupt Prior ity Use interval interrupt INTRTG 1953125 2 BART times Used as multiple interrupt Priority Lowest wt How to open On the Project Tree panel select Project name Project gt gt Code Generator Design Tool gt gt RTC Remark Ifthe Code Generator panel is already open pressing the accordingly button changes the content displayed R20UT0257EJ0100 Rev 1 00 tENESAS Page 86 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX A WINDOW REFERENCE Real Time Output This panel allows you to configure the information necessary to control real time output functions provided by the microcontroller Screen Structure may be different depending on the kinds of target microcontrollers See user s manual for details on target microcontrollers Figure A 27 Example of Real Time Output ETOO RTO Real time output operation setting Unused 4 bits x 1 channel INTTPACCO is not used O 2 bits x 1 channel O 4 2 bits 2 channel 6 bits 1 channel Trigger edge setting Falling O R
241. yntax void DMAn UserInit void Remark nis the channel number Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 370 of 394 Sep 01 2010 CubeSuite Ver 1 40 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 Argumeni s None Return value None R20UT0257EJ0100 Rev 1 00 tENESAS Page 371 of 394 Sep 01 2010 CubeSuite Ver 1 40 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_CheckStatus Classification CG_dma c Syntax void DMAn Disable void Remark nis the channel number Argumeni 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 DMA0_CheckStatus Check transfer status DMAO0_Disable Change to operation disabled status R20UT0257EJ0100 Rev 1 00 tENESAS Page 372 of 394 Sep 01 2010 CubeSuite Ver 1 40 APPENDIX C API FUNCTIONS DMAn_CheckStatus Reads the transfer status transfer complete transfer ongoing Classificatio

Download Pdf Manuals

image

Related Search

Related Contents

Elation Professional DJ Equipment DMX Programmer User's Manual  hershey`s dual single-serve ice cream machine  Samsung Galaxy Tab pro (12.2, LTE) Manual de utilizare    Téléphone portable M160 Mode d`emploi  ZyXEL P-793H 601156 User's Manual  Product User Manual  CubeSuite+ V1.03.00 Integrated Development Environment User`s  8e6 Technologies Threat Analysis Reporter TAR User's Manual  MediaBlender Guía de Usuario  

Copyright © All rights reserved.
Failed to retrieve file