Application Leading Tool User`s Manual: RX API Reference

Application Leading Tool User`s Manual: RX API Reference
User’s Manual
Application Leading Tool
User's Manual: RX API Reference
Target Device
RX Family
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).
www.renesas.com
Rev.1.00 Aug 2014
Notice
1.
Descriptions of circuits, software and other related information in this document are provided only to illustrate the operation of
semiconductor products and application examples. You are fully responsible for the incorporation of these circuits, software,
and information in the design of your equipment. Renesas Electronics assumes no responsibility for any losses incurred by you
or third parties arising from the use of these circuits, software, or information.
2.
Renesas Electronics has used reasonable care in preparing the information included in this document, but Renesas Electronics
does not warrant that such information is error free. Renesas Electronics assumes no liability whatsoever for any damages
incurred by you resulting from errors in or omissions from the information included herein.
3.
Renesas Electronics does not assume any liability for infringement of patents, copyrights, or other intellectual property rights of
third parties by or arising from the use of Renesas Electronics products or technical information described in this document. No
license, express, implied or otherwise, is granted hereby under any patents, copyrights or other intellectual property rights of
Renesas Electronics or others.
4.
You should not alter, modify, copy, or otherwise misappropriate any Renesas Electronics product, whether in whole or in part.
Renesas Electronics assumes no responsibility for any losses incurred by you or third parties arising from such alteration,
modification, copy or otherwise misappropriation of Renesas Electronics product.
5.
Renesas Electronics products are classified according to the following two quality grades: “Standard” and “High Quality”. The
recommended applications for each Renesas Electronics product depends on the product’s quality grade, as indicated below.
“Standard”:
Computers; office equipment; communications equipment; test and measurement equipment; audio and visual
equipment; home electronic appliances; machine tools; personal electronic equipment; and industrial robots etc.
“High Quality”: Transportation equipment (automobiles, trains, ships, etc.); traffic control systems; anti-disaster systems; anticrime systems; and safety equipment etc.
Renesas Electronics products are neither intended nor authorized for use in products or systems that may pose a direct threat to
human life or bodily injury (artificial life support devices or systems, surgical implantations etc.), or may cause serious property
damages (nuclear reactor control systems, military equipment etc.). You must check the quality grade of each Renesas
Electronics product before using it in a particular application. You may not use any Renesas Electronics product for any
application for which it is not intended. Renesas Electronics shall not be in any way liable for any damages or losses incurred
by you or third parties arising from the use of any Renesas Electronics product for which the product is not intended by Renesas
Electronics.
6.
You should use the Renesas Electronics products described in this document within the range specified by Renesas Electronics,
especially with respect to the maximum rating, operating supply voltage range, movement power voltage range, heat radiation
characteristics, installation and other product characteristics. Renesas Electronics shall have no liability for malfunctions or
damages arising out of the use of Renesas Electronics products beyond such specified ranges.
7.
Although Renesas Electronics endeavors to improve the quality and reliability of its products, semiconductor products have
specific characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use conditions. Further,
Renesas Electronics products are not subject to radiation resistance design. Please be sure to implement safety measures to
guard them against the possibility of physical injury, and injury or damage caused by fire in the event of the failure of a Renesas
Electronics product, such as safety design for hardware and software including but not limited to redundancy, fire control and
malfunction prevention, appropriate treatment for aging degradation or any other appropriate measures. Because the evaluation
of microcomputer software alone is very difficult, please evaluate the safety of the final products or systems manufactured by
you.
8.
Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental compatibility
of each Renesas Electronics product. Please use Renesas Electronics products in compliance with all applicable laws and
regulations that regulate the inclusion or use of controlled substances, including without limitation, the EU RoHS Directive.
Renesas Electronics assumes no liability for damages or losses occurring as a result of your noncompliance with applicable laws
and regulations.
9.
Renesas Electronics products and technology may not be used for or incorporated into any products or systems whose
manufacture, use, or sale is prohibited under any applicable domestic or foreign laws or regulations. You should not use
Renesas Electronics products or technology described in this document for any purpose relating to military applications or use
by the military, including but not limited to the development of weapons of mass destruction. When exporting the Renesas
Electronics products or technology described in this document, you should comply with the applicable export control laws and
regulations and follow the procedures required by such laws and regulations.
10. It is the responsibility of the buyer or distributor of Renesas Electronics products, who distributes, disposes of, or otherwise
places the product with a third party, to notify such third party in advance of the contents and conditions set forth in this
document, Renesas Electronics assumes no responsibility for any losses incurred by you or third parties as a result of
unauthorized use of Renesas Electronics products.
11. This document may not be reproduced or duplicated in any form, in whole or in part, without prior written consent of Renesas
Electronics.
12. Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this document
or Renesas Electronics products, or if you have any other inquiries.
(Note 1) “Renesas Electronics” as used in this document means Renesas Electronics Corporation and also includes its majorityowned subsidiaries.
(Note 2) “Renesas Electronics product(s)” means any product developed or manufactured by or for Renesas Electronics.
(2012.4)
How to Use This Manual
Readers
The target readers of this manual are the application system engineers who use the Code
Generator and need to understand its function.
Purpose
The purpose of this manual is to explain the user for understanding and using the Code
Generator functions.
Organization
This manual can be broadly divided into the following units.
1.GENERAL
2.OUTPUT FILES
3.API FUNCTIONS
How to Read This Manual It is assumed that the readers of this manual have general knowledge of electricity, logic
circuits, and microcontrollers.
Conventions
Related Documents
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 ... 0xXXXX
The related documents indicated in this publication may include preliminary versions.
However, preliminary versions are not marked as such.
TABLE OF CONTENTS
1.
GENERAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.1
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2
Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.
OUTPUT FILES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1
3.
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
API FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.1
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.2
Function Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.2.1
Common . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.2.2
Clock generation circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.2.3
Voltage detection circuit (LVDA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.2.4
Clock frequency accuracy measurement circuit (CAC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
3.2.5
Low power consumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
3.2.6
Interrupt controller (ICU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
3.2.7
Buses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
3.2.8
DMA Controller(DMAC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
3.2.9
Data transfer controller (DTC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
3.2.10
Event link controller (ELC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
3.2.11
I/O ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
3.2.12
Multi-function timer pulse unit 2 (MTU2). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
3.2.13
Multi-function timer pulse unit 3 (MTU3). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
3.2.14
Port output enable 2 (POE2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
3.2.15
Port output enable 3 (POE3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
3.2.16
General PWM timer (GPT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
3.2.17
16-bit timer pulse unit (TPU). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
3.2.18
8-bit timer (TMR). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
3.2.19
Programmable pulse generator (PPG) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
3.2.20
Compare match timer (CMT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
3.2.21
Compare match timer W (CMTW) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
3.2.22
Realtime clock (RTC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
3.2.23
Watchdog timer (WDT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
3.2.24
Independent watchdog timer (IWDT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
3.2.25
Serial communications interface (SCI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
3.2.26
FIFO embedded serial communications interface (SCIFA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
3.2.27
I2C bus interface (RIIC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
3.2.28
Serial peripheral interface (RSPI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
3.2.29
CRC calculator (CRC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
3.2.30
12-bit A/D converter (S12AD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
3.2.31
D/A converter (DA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
3.2.32
12-bit converter (R12DA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
3.2.33
Comparator B (CMPB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
3.2.34
Data operation circuit (DOC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
Revision Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
Application Leading Tool
1. GENERAL
1. GENERAL
The Application Leading Tool(Code Generator) is a software tool that automatically generates device drivers.
This chapter gives an overview of the design tool (Code Generator).
1.1 Overview
The Code Generator, enables you to output the source code (device driver programs, C source files and header files)
necessary to control the peripheral functions (clock generation circuit, voltage detection circuit, etc.) provided by the
device by configuring various information using the GUI.
1.2 Features
The 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.
- Reporting function
You can output configured information using the Code Generator as files in various formats for use as design
documents.
- Renaming function
The user can change default names assigned to the files output by the Code Generator and the API functions contained in the source code.
- User code protective function
The user can add user's original source code to each API function.When user generated the device driver programs
again by the Code Generator, user's source code within this comment is protected.
[Comment for user source code descriptions]
/* Start user code. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 6 of 340
Application Leading Tool
2. OUTPUT FILES
2. OUTPUT FILES
This appendix describes the files output by the Code Generator.
2.1 Description
Below is a list of output file files by the Code Generator.
Table 2.1
Output File List
Peripheral Function
Common CCRX
Common EWRX
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
File Name
API Function Name
r_cg_dbsct.c
-
r_cg_hardware_setup.
c
HardwareSetup
R_Systeminit
r_cg_intprg.c
r_undefined_exception
r_nmi_exception
r_brk_exception
r_reserved_exception
r_cg_main.c
main
R_MAIN_UserInit
r_cg_resetprg.c
PowerON_Reset
r_cg_sbrk.c
-
r_cg_vecttbl.c
-
r_cg_macrodriver.h
-
r_cg_sbrk.h
-
r_cg_stacksct.h
-
r_cg_userdefine.h
-
r_cg_vect.h
-
r_cg_main.c
main
R_MAIN_UserInit
r_cg_intprg.c
r_brk_exception
r_icu_group_n_interrupt
_NMI_hander
r_cg_systeminit.c
R_Systeminit
_low_level_init
r_cg_macrodriver.h
-
r_cg_userdefine.h
-
Page 7 of 340
Application Leading Tool
Peripheral Function
Common GNURX for e2studio
Clock generation circuit
Voltage detection circuit (LVDA)
Clock frequency accuracy measurement circuit (CAC)
Low power consumption
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
2. OUTPUT FILES
File Name
API Function Name
r_cg_main.c
main
R_MAIN_UserInit
r_cg_vector_table.c
r_undefined_exception
r_reserved_exception
r_nmi_exception
r_brk_exception
r_icu_group_n_interrupt
r_cg_resetprogram.as
m
-
r_cg_interrupt_handler
s.h
-
r_cg_hardware_setup.
c
HardwareSetup
R_Systeminit
r_cg_macrodriver.h
-
r_cg_userdefine.h
-
r_cg_cgc.c
R_CGC_Create
R_CGC_Set_ClockMode
r_cg_cgc_user.c
R_CGC_Create_UserInit
r_cgc_oscillation_stop_interrupt
r_cgc_oscillation_stop_nmi_interrupt
r_cg_cgc.h
-
r_cg_lvd.c
R_LVDn_Create
R_LVDn_Start
R_LVDn_Stop
r_cg_lvd_user.c
R_LVDn_Create_UserInit
r_lvd_lvdn_interrupt
r_cg_lvd.h
-
r_cg_cac.c
R_CAC_Create
R_CAC_Start
R_CAC_Stop
r_cg_cac_user.c
R_CAC_Create_UserInit
r_cac_mendf_interrupt
r_cac_ferrf_interrupt
r_cac_ovrf_interrupt
r_cg_cac.h
-
r_cg_lpc.c
R_LPC_Create
R_LPC_AllModuleClockStop
R_LPC_ChangeSleepModeRetrunClock
R_LPC_Sleep
R_LPC_DeepSleep
R_LPC_DeepSoftwareStandby
R_LPC_SoftwareStandby
R_LPC_ChangeOperationPowerControl
r_cg_lpc_user.c
R_LPC_Create_UserInit
r_cg_lpc.h
-
Page 8 of 340
Application Leading Tool
Peripheral Function
Interrupt controller (ICU)
Buses
DMA Controller(DMAC)
Data transfer controller (DTC)
Event link controller (ELC)
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
2. OUTPUT FILES
File Name
API Function Name
r_cg_icu.c
R_ICU_Create
R_ICU_IRQn_Start
R_ICU_IRQn_Stop
R_ICU_Software_Start
R_ICU_Software2_Start
R_ICU_Software_Stop
R_ICU_Software2_Stop
R_ICU_SoftwareInterrupt_Generate
R_ICU_SoftwareInterrupt2_Generate
r_cg_icu_user.c
R_ICU_Create_UserInit
r_icu_irqn_interrupt
r_icu_software_interrupt
r_icu_software2_interrupt
r_icu_nmi_interrupt
r_cg_icu.h
-
r_cg_bsc.c
R_BSC_Create
R_BSC_Error_Monitoring_Start
R_BSC_Error_Monitoring_Stop
R_BSC_InitializeSDRAM
r_cg_bsc_user.c
R_BSC_Create_UserInit
r_bsc_buserr_interrupt
r_cg_bsc.h
-
r_cg_dmac.c
R_DMAC_Create
R_DMACn_Start
R_DMACn_Stop
R_DMACn_Set_SoftwareTrigger
R_DMACn_Clear_SoftwareTrigger
r_cg_dmac_user.c
r_dmac_dmacni_interrupt
r_dmacn_callback_transfer_end
r_dmacn_callback_transfer_escape_end
R_DMAC_Create_UserInit
r_cg_dmac.h
-
r_cg_dtc.c
R_DTC_Create
R_DTCm_Start
R_DTCm_Stop
r_cg_dtc_user.c
R_DTC_Create_UserInit
r_cg_dtc.h
-
r_cg_elc.c
R_ELC_Create
R_ELC_Start
R_ELC_Stop
R_ELC_GenerateSoftwareEvent
R_ELC_Set_PortBuffern
R_ELC_Get_PortBuffern
r_cg_elc_user.c
R_ELC_Create_UserInit
r_elc_elsrni_interrupt
r_cg_elc.h
-
Page 9 of 340
Application Leading Tool
Peripheral Function
I/O ports
Multi-function timer pulse unit 2 (MTU2)
Multi-function timer pulse unit 3 (MTU3)
Port output enable 2 (POE2)
Port output enable 3 (POE3)
General PWM timer (GPT)
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
2. OUTPUT FILES
File Name
API Function Name
r_cg_port.c
R_PORT_Create
r_cg_port_user.c
R_PORT_Create_UserInit
r_cg_port.h
-
r_cg_mtu2.c
R_MTU2_Create
R_MTU2_Cn_Start
R_MTU2_Cn_Stop
r_cg_mtu2_user.c
R_MTU2_Create_UserInit
r_mtu2_tgimn_interrupt
r_mtu2_tcivn_interrupt
r_mtu2_tciun_interrupt
r_cg_mtu2.h
-
r_cg_mtu3.c
R_MTU3_Create
R_MTU3_Cn_Start
R_MTU3_Cn_Stop
r_cg_mtu3_user.c
R_MTU3_Create_UserInit
r_mtu3_tgimn_interrupt
r_mtu3_tcivn_interrupt
r_mtu3_tciun_interrupt
r_cg_mtu3.h
-
r_cg_poe2.c
R_POE2_Create
R_POE2_Start
R_POE2_Stop
r_cg_poe2_user.c
R_POE2_Create_UserInit
r_poe2_oein_interrupt
r_cg_poe2.h
-
r_cg_poe3.c
R_POE3_Create
R_POE3_Start
R_POE3_Stop
r_cg_poe3_user.c
R_POE3_Create_UserInit
r_poe3_oein_interrupt
r_cg_poe3.h
-
r_cg_gpt.c
R_GPT_Create
R_GPTn_Start
R_GPTn_Stop
R_GPTn_HardwareStart
R_GPTn_HardwareStop
r_cg_gpt_user.c
R_GPT_Create_UserInit
r_gpt_gtcimn_interrupt
r_gpt_gtcivn_interrupt
r_gpt_gtciun_interrupt
r_gpt_gdten_interrupt
r_gpt_etgip_interrupt
r_gpt_etgin_interrupt
r_cg_gpt.h
-
Page 10 of 340
Application Leading Tool
Peripheral Function
16-bit timer pulse unit (TPU)
8-bit timer (TMR)
Programmable pulse generator (PPG)
Compare match timer (CMT)
Compare match timer W (CMTW)
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
2. OUTPUT FILES
File Name
API Function Name
r_cg_tpu.c
R_TPU_Create
R_TPUn_Start
R_TPUn_Stop
r_cg_tpu_user.c
R_TPU_Create_UserInit
r_tpu_tginm_interrupt
r_tpu_tcinv_interrupt
r_tpu_tcinu_interrupt
r_cg_tpu.h
-
r_cg_tmr.c
R_TMR_Create
R_TMRn_Start
R_TMRn_Stop
r_cg_tmr_user.c
R_TMR_Create_UserInit
r_tmr_cmimn_interrupt
r_tmr_ovin_interrupt
r_cg_tmr.h
-
r_cg_ppg.c
R_PPG_Create
r_cg_ppg_user.c
R_PPG_Create_UserInit
r_cg_ppg.h
-
r_cg_cmt.c
R_CMTn_Create
R_CMTn_Start
R_CMTn_Stop
r_cg_cmt_user.c
R_CMTn_Create_UserInit
r_cmt_cmin_interrupt
r_cg_cmt.h
-
r_cg_cmtw.c
R_CMTWn_Create
R_CMTWn_Start
R_CMTWn_Stop
r_cg_cmtw_user.c
R_CMTWn_Create_UserInit
r_cmtw_cmwin_interrupt
r_cmtw_icmin_interrupt
r_cmtw_ocmin_interrupt
r_cg_cmtw.h
-
Page 11 of 340
Application Leading Tool
Peripheral Function
Realtime clock (RTC)
Watchdog timer (WDT)
Independent watchdog timer (IWDT)
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
2. OUTPUT FILES
File Name
API Function Name
r_cg_rtc.c
R_RTC_Create
R_RTC_Set_CalendarAlarm
R_RTC_Set_BinaryAlarm
R_RTC_Set_ConstPeriodInterruptOn
R_RTC_Set_ConstPeriodInterruptOff
R_RTC_Set_CarryInterruptOn
R_RTC_Set_CarryInterruptOff
R_RTC_Set_RTCOUTOn
R_RTC_Set_RTCOUTOff
R_RTC_Start
R_RTC_Stop
R_RTC_Restart
R_RTC_Set_CalendarCounterValue
R_RTC_Get_CalendarCounterValue
R_RTC_Set_BinaryCounterValue
R_RTC_Get_BinaryCounterValue
R_RTC_Get_CalendarTimeCaptureValue
n
R_RTC_Get_BinaryTimeCaptureValuen
r_cg_rtc_user.c
R_RTC_Create_UserInit
r_rtc_alm_interrupt
r_rtc_prd_interrupt
r_rtc_cup_interrupt
r_cg_rtc.h
-
r_cg_wdt.c
R_WDT_Create
R_WDT_Restart
r_cg_wdt_user.c
R_WDT_Create_UserInit
r_wdt_wuni_interrupt
r_cg_wdt.h
-
r_cg_iwdt.c
R_IWDT_Create
R_IWDT_Restart
r_cg_iwdt_user.c
R_IWDT_Create_UserInit
r_iwdt_nmi_interrupt
r_iwdt_iwuni_interrupt
r_cg_iwdt.h
-
Page 12 of 340
Application Leading Tool
Peripheral Function
Serial communications interface (SCI)
FIFO embedded serial communications interface (SCIFA)
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
2. OUTPUT FILES
File Name
API Function Name
r_cg_sci.c
R_SCIn_Create
R_SCIn_Start
R_SCIn_Stop
R_SCIn_Serial_Send
R_SCIn_Serial_Receive
R_SCIn_Serial_Multiprocessor_Send
R_SCIn_Serial_Multiprocessor_Receive
R_SCIn_Serial_Send_Receive
R_SCIn_SmartCard_Send
R_SCIn_SmartCard_Receive
R_SCIn_IIC_Master_Send
R_SCIn_IIC_Master_Receive
R_SCIn_SPI_Master_Send
R_SCIn_SPI_Master_Send_Receive
R_SCIn_SPI_Slave_Send
R_SCIn_SPI_Slave_Send_Receive
R_SCIn_IIC_StartCondition
R_SCIn_IIC_StopCondition
r_cg_sci_user.c
R_SCIn_Create_UserInit
r_scin_transmitend_interrupt
r_scin_transmit_interrupt
r_scin_receiveend_interrupt
r_scin_receiveerror_interrupt
r_scin_callback_transmitend
r_scin_callback_receiveend
r_scin_callback_receiveerror
r_cg_sci.h
-
r_cg_scifa.c
R_SCIFAn_Create
R_SCIFAn_Start
R_SCIFAn_Stop
R_SCIFAn_Serial_Send
R_SCIFAn_Serial_Receive
R_SCIFAn_Serial_Send_Receive
r_cg_scifa_user.c
R_SCIFAn_Create_UserInit
r_scifan_teif_interrupt
r_scifan_txif_interrupt
r_scifan_rxif_interrupt
r_scifan_erif_interrupt
r_scifan_brif_interrupt
r_scifan_drif_interrupt
r_scifan_callback_transmitend
r_scifan_callback_receiveend
r_scifan_callback_error
r_cg_scifa.h
-
Page 13 of 340
Application Leading Tool
Peripheral Function
I2C bus interface (RIIC)
Serial peripheral interface (RSPI)
CRC calculator (CRC)
12-bit A/D converter (S12AD)
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
2. OUTPUT FILES
File Name
API Function Name
r_cg_riic.c
R_RIICn_Create
R_RIICn_Start
R_RIICn_Stop
R_RIICn_Master_Send
R_RIICn_Master_Receive
R_RIICn_Slave_Send
R_RIICn_Slave_Receive
R_RIICn_StartCondition
R_RIICn_StopCondition
r_cg_riic_user.c
R_RIICn_Create_UserInit
r_riicn_error_interrupt
r_riicn_receive_interrupt
r_riicn_transmit_interrupt
r_riicn_transmitend_interrupt
r_riicn_callback_receiveerror
r_riicn_callback_transmitend
r_riicn_callback_receiveend
r_cg_riic.h
-
r_cg_rspi.c
R_RSPIn_Create
R_RSPIn_Start
R_RSPIn_Stop
R_RSPIn_Send
R_RSPIn_Send_Receive
r_cg_rspi_user.c
R_RSPIn_Create_UserInit
r_rspin_receive_interrupt
r_rspin_transmit_interrupt
r_rspin_error_interrupt
r_rspin_idle_interrupt
r_rspin_callback_receiveend
r_rspin_callback_error
r_rspin_callback_transmitend
r_cg_rspi.h
-
r_cg_crc.c
R_CRC_SetCRC8
R_CRC_SetCRC16
R_CRC_SetCCITT
R_CRC_Input_Data
R_CRC_Get_Result
r_cg_crc.h
-
r_cg_s12ad.c
R_S12ADn_Create
R_S12ADn_Start
R_S12ADn_Stop
R_S12ADn_Get_ValueResult
R_S12ADn_Set_CompareValue
r_cg_s12ad_user.c
R_S12ADn_Create_UserInit
r_s12adn_interrupt
r_s12adn_groupb_interrupt
r_s12adn_compare_interrupt
r_cg_s12ad.h
-
Page 14 of 340
Application Leading Tool
Peripheral Function
D/A converter (DA)
12-bit converter (R12DA)
Comparator B (CMPB)
Data operation circuit (DOC)
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
2. OUTPUT FILES
File Name
API Function Name
r_cg_da.c
R_DA_Create
R_DAm_Start
R_DAm_Stop
R_DAm_Set_ConversionValue
r_cg_da_user.c
R_DA_Create_UserInit
r_cg_da.h
-
r_cg_r12da.c
R_R12DA_Create
R_R12DAn_Start
R_R12DAn_Stop
R_R12DAn_Set_ConversionValue
R_R12DA_sync_Start
R_R12DA_sync_Stop
r_cg_r12da_user.c
R_DA_Create_UserInit
r_cg_r12da.h
-
r_cg_cmpb.c
R_CMPB_Create
R_CMPBn_Start
R_CMPBn_Stop
r_cg_cmpb_user.c
R_CMPB_Create_UserInit
r_cmpb_cmpbn_interrupt
r_cg_cmpb.h
-
r_cg_doc.c
R_DOC_Create
R_DOC_SetMode
R_DOC_WriteData
R_DOC_GetResult
R_DOC_ClearFlag
r_cg_doc_user.c
R_DOC_Create_UserInit
r_doc_dopcf_interrupt
r_cg_doc.h
-
Page 15 of 340
Application Leading Tool
3. API FUNCTIONS
3. API FUNCTIONS
This appendix describes the API functions output by the Code Generator.
3.1 Overview
Below are the naming conventions for API functions output by the Code Generator.
- Macro names are in ALL CAPS.
The number in front of the macro name is a hexadecimal value; this is the same value as the macro value.
- Local variable names are in all lower case.
- Global variable names start with a "g" and use Camel Case.
- Names of pointers to global variables start with a "gp" and use Camel Case.
- Names of elements in enum statements are in ALL CAPS.
3.2 Function Reference
This section describes the API functions output by the Code Generator, using the following notation format.
Figure 3.1
Notation Format of API Functions
(1)
.........
(2)
...........................
[Syntax]
(3)
...
.........
[Argument(s)]
(4)
I/O
...
Argument
...
.........
Description
...........................
[Return value]
(5)
Macro
Description
...........................
.........
(1)
Name
Indicates the name of the API function.
(2)
Outline
Outlines the functions of the API function.
(3)
[Syntax]
Indicates the format to be used when describing an API function to be called in C language.
(4)
[Argument(s)]
API function arguments are explained in the following format.
I/O
Argument
Description
(a)
(b)
(c)
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 16 of 340
Application Leading Tool
(a)
I/O
Argument classification
I
... Input argument
O
... Output argument
(b)
Argument
Argument data type
(c)
Description
Description of argument
(5)
3. API FUNCTIONS
[Return value]
API function return value is explained in the following format.
Macro
Description
(a)
(b)
(a)
Macro
Macro of return value
(b)
Description
Description of return value
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 17 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.1 Common
Below is a list of API functions output by the Code Generator for common use.
Performs processing in response to the exception (other than undefined instruction exception, reset, non-maskable
interrupt and unconditional trap).
Table 3.1
API Functions: [Common]
API Function Name
Function
r_undefined_exception
Performs processing in response to the undefined instruction exception.
PowerON_Reset
Performs processing in response to the reset.
r_nmi_exception
Performs processing in response to the non-maskable interrupt.
r_brk_exception
Performs processing in response to the unconditional trap.
r_reserved_exception
Performs processing in response to the exception (other than undefined
instruction exception, reset, non-maskable interrupt and unconditional
trap).
HardwareSetup
Performs initialization necessary to control the various hardwares.
R_Systeminit
Performs initialization necessary to control the various peripheral
functions.
main
This is a main function.
R_MAIN_UserInit
Performs user-defined initialization.
r_icu_group_n_interrupt
Performs processing in response to the group interrupt.
_NMI_handler
Performs processing in response to the non-maskable interrupt.
_low_level_init
Performs initialization necessary to control the various hardwares.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 18 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_undefined_exception
Performs processing in response to the undefined instruction exception.
Remark
This API function is called to run interrupt processing in response to an undefined instruction exception
occurred when detecting the undefined instruction (unimplemented instruction) execution.
[Syntax]
void
r_undefined_exception ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 19 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
PowerON_Reset
Performs processing in response to the reset.
Remark
This API function is called to run interrupt processing for an internal reset by the power-on reset circuit.
[Syntax]
void
PowerON_Reset ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 20 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_nmi_exception
Performs processing in response to the non-maskable interrupt.
Remark
This API function is called to run interrupt processing for the non-maskable interrupt.
[Syntax]
void
r_nmi_exception ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 21 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_brk_exception
Performs processing in response to the unconditional trap.
Remark
This API function is called to run interrupt processing for an unconditional trap.
[Syntax]
void
r_brk_exception ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 22 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_reserved_exception
Performs processing in response to the exception (other than undefined instruction exception, reset, non-maskable
interrupt and unconditional trap).
Remark
This API function is called to run interrupt processing for the exceptions other than undefined instruction
exception, reset, non-maskable interrupt, and unconditional trap.
[Syntax]
void
r_reserved_exception ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 23 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
HardwareSetup
Performs initialization necessary to control the various hardwares.
Remark
This API function is called as the PowerON_Reset callback routine.
[Syntax]
void
HardwareSetup ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 24 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_Systeminit
Performs initialization necessary to control the various peripheral functions.
Remark
This API function is called as the HardwareSetup callback routine.
[Syntax]
void
R_Systeminit ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 25 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
main
This is a main function.
Remark
This API function is called as the PowerON_Reset callback routine.
[Syntax]
void
main ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 26 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_MAIN_UserInit
Performs user-defined initialization.
Remark
This API function is called as the main callback routine.
[Syntax]
void
R_MAIN_UserInit ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 27 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_icu_group_n_interrupt
Performs processing in response to the group interrupts.
[Syntax]
void
Remark
r_icu_group_n_interrupt ( void );
n is the group interrupt number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 28 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
_NMI_handler
Performs processing in response to the non-maskable interrupt.
Remark
This API function is called to run interrupt processing for the non-maskable interrupt.
[Syntax]
void
_NMI_handler ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 29 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
_low_level_init
Performs initialization necessary to control the various hardwares.
[Syntax]
void
_low_level_init ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 30 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.2 Clock generation circuit
Below is a list of API functions output by the Code Generator for clock generation circuit use.
Table 3.2
API Functions: [Clock Generation Circuit]
API Function Name
Function
R_CGC_Create
Performs initialization required to control the clock generation circuit.
R_CGC_Create_UserInit
Performs user-defined initialization relating to the clock generation
circuit.
r_cgc_oscillation_stop_interrupt
Performs processing in response to the osillation stop detection interrupt.
r_cgc_oscillation_stop_nmi_interrupt
Performs processing in response to the oscillation stop detection NMI.
R_CGC_Set_ClockMode
Sets the clock source.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 31 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_CGC_Create
Performs initialization required to control the clock generation circuit.
[Syntax]
void
R_CGC_Create ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 32 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_CGC_Create_UserInit
Performs user-defined initialization relating to the clock generation circuit.
Remark
This API function is called as the R_CGC_Create callback routine.
[Syntax]
void
R_CGC_Create_UserInit ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 33 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_cgc_oscillation_stop_interrupt
Performs processing in response to the oscillation stop detection interrupt.
Remark
This API function is called to run interrupt processing for the oscillation stop detection interrupt, which is
generated when the clock generation circuit detects oscillation by the main clock having stopped.
[Syntax]
static
void
r_cgc_oscillation_stop_interrupt ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 34 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_cgc_oscillation_stop_nmi_interrupt
Performs processing in response to the oscillation stop detection NMI.
[Syntax]
static
void
r_cgc_oscillation_stop_nmi_interrupt ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 35 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_CGC_Set_ClockMode
Sets the clock source.
[Syntax]
#include
#include
MD_STATUS
"r_cg_macrodriver.h"
"r_cg_cgc.h"
R_CGC_Set_ClockMode ( clock_mode_t mode );
[Argument(s)]
I/O
I
Argument
clock_mode_t
mode;
Description
Clock source type
MAINCLK:
Main clock oscillator
SUBCLK:
Sub-clock oscillator
PLLCLK:
PLL circuit
HOCO:
High-speed on-chip oscillator
LOCO:
Low-speed on-chip oscillator
[Return value]
Macro
Description
MD_OK
Normal completion
MD_ERROR1
Exit with error (abend)
MD_ARGERROR
Invalid argument mode specification
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 36 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.3 Voltage detection circuit (LVDA)
Below is a list of API functions output by the Code Generator for voltage detection circuit use.
Table 3.3
API Functions: [Voltage Detection Circuit]
API Function Name
Function
R_LVDn_Create
Performs initialization necessary to control the voltage detection circuit.
R_LVDn_Create_UserInit
Performs user-defined initialization relating to the voltage detection
circuit.
r_lvd_lvdn_interrupt
Performs processing in response to the voltage monitoring n interrupt.
R_LVDn_Start
Starts voltage monitoring (when in interrupt mode, and interrupt & reset
mode).
R_LVDn_Stop
Ends voltage monitoring (when in interrupt mode, and interrupt & reset
mode).
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 37 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_LVDn_Create
Performs initialization necessary to control the voltage detection circuit.
[Syntax]
void
Remark
R_LVDn_Create ( void );
n is the circuit number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 38 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_LVDn_Create_UserInit
Performs user-defined initialization relating to the voltage detection circuit.
Remark
This API function is called as the R_LVDn_Create callback routine.
[Syntax]
void
Remark
R_LVDn_Create_UserInit ( void );
n is the circuit number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 39 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_lvd_lvdn_interrupt
Performs processing in response to the voltage monitoring n interrupt.
Remark
This API function is called to run interrupt processing for the voltage monitoring n interrupt, which is generated when the voltage detection circuit detects the voltage being dropped.
[Syntax]
static
Remark
void
r_lvd_lvdn_interrupt ( void );
n is the circuit number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 40 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_LVDn_Start
Starts voltage monitoring (when in interrupt mode, and interrupt & reset mode).
[Syntax]
void
Remark
R_LVDn_Start ( void );
n is the circuit number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 41 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_LVDn_Stop
Ends voltage monitoring (when in interrupt mode, and interrupt & reset mode).
[Syntax]
void
R_LVDn_Stop ( void );
Remark
n is the circuit number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 42 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.4 Clock frequency accuracy measurement circuit (CAC)
Below is a list of API functions output by the Code Generator for clock frequency accuracy measurement circuit use.
Table 3.4
API Functions: [Clock Frequency Accuracy Measurement Circuit]
API Function Name
Function
R_CAC_Create
Performs initialization necessary to control the clock frequency accuracy
measurement circuit.
R_CAC_Create_UserInit
Performs user-defined initialization relating to the clock frequency
accuracy measurement circuit.
r_cac_mendf_interrupt
Performs processing in response to the measurement end interrupt.
r_cac_ferrf_interrupt
Performs processing in response to the frequency error interrupt.
r_cac_ovrf_interrupt
Performs processing in response to the overflow interrupt.
R_CAC_Start
Starts measurement of the accuracy of the clock frequency.
R_CAC_Stop
Ends measurement of the accuracy of the clock frequency.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 43 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_CAC_Create
Performs initialization necessary to control the clock frequency accuracy measurement circuit.
[Syntax]
void
R_CAC_Create ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 44 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_CAC_Create_UserInit
Performs user-defined initialization relating to the clock frequency accuracy measurement circuit.
Remark
This API function is called as the R_CAC_Create callback routine.
[Syntax]
void
R_CAC_Create_UserInit ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 45 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_cac_mendf_interrupt
Performs processing in response to the measurement end interrupt.
Remark
This API function is called to run interrupt processing for the measurement end interrupt, which is generated when the clock frequency accuracy measurement circuit detects the valid edge of the reference signal.
[Syntax]
static
void
r_cac_mendf_interrupt ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 46 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_cac_ferrf_interrupt
Performs processing in response to the frequency error interrupt.
Remark
This API function is called to run interrupt processing for the frequency error interrupt, which is generated
when the clock frequency is not in the allowed range (from the minimum to the maximum value).
[Syntax]
static
void
r_cac_ferrf_interrupt ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 47 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_cac_ovrf_interrupt
Performs processing in response to the overflow interrupt.
Remark
This API function is called to run interrupt processing for the overflow interrupt, which is generated when
the counter overflows.
[Syntax]
static
void
r_cac_ovrf_interrupt ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 48 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_CAC_Start
Starts measurement of the accuracy of the clock frequency.
[Syntax]
void
R_CAC_Start ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 49 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_CAC_Stop
Ends measurement of the accuracy of the clock frequency.
[Syntax]
void
R_CAC_Stop ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 50 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.5 Low power consumption
Below is a list of API functions output by the Code Generator for low power consumption use.
Table 3.5
API Functions: [Low Power Consumption]
API Function Name
Function
R_LPC_Create
Performs initialization required to control the low power consumption.
R_LPC_Create_UserInit
Performs user-defined initialization relating to the low power
consumption.
R_LPC_AllModuleClockStop
Stops the clock for all modules.
R_LPC_ChangeSleepModeRetrunClock
Sets the clock source that is selected following release from sleep mode.
R_LPC_Sleep
Transits the low power consumption mode of the MCU to the sleep
mode.
R_LPC_DeepSleep
Transits the low power consumption mode of the MCU to the deep sleep
mode.
R_LPC_DeepSoftwareStandby
Transits the low power consumption mode of the MCU to the deep software standby mode.
R_LPC_SoftwareStandby
Transits the low power consumption mode of the MCU to the software
standby mode.
R_LPC_ChangeOperationPowerControl
Changes the operating power control mode of the MCU.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 51 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_LPC_Create
Performs initialization required to control the low power consumption.
[Syntax]
void
R_LPC_Create ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 52 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_LPC_Create_UserInit
Performs user-defined initialization relating to the low power consumption.
Remark
This API function is called as the R_LPC_Create callback routine.
[Syntax]
void
R_LPC_Create_UserInit ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 53 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_LPC_AllModuleClockStop
Stops the clock for all modules.
[Syntax]
#include
MD_STATUS
"r_cg_macrodriver.h"
R_LPC_AllModuleClockStop ( void );
[Argument(s)]
None.
[Return value]
Macro
Description
MD_OK
Normal completion
MD_ERROR1
Exit with error (abend)
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 54 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_LPC_ChangeSleepModeRetrunClock
Sets the clock source that is selected following release from sleep mode.
[Syntax]
#include
#include
MD_STATUS
"r_cg_macrodriver.h"
"r_cg_lpc.h"
R_LPC_ChangeSleepModeReturnClock ( return_clock_t clock );
[Argument(s)]
I/O
I
Argument
return_clock_t
clock;
Description
Clock source type
RETURN_LOCO:
RETURN_HOCO:
RETURN_MAIN_CLOCK:
RETURN_DISABLE:
does not proceed.
Low-speed on-chip oscillator
High-speed on-chip oscillator
Main clock oscillator
Switching of the clock source
[Return value]
Macro
Description
MD_OK
Normal completion
MD_ERROR1
Change to the low-speed operating mode ended abnormally.
MD_ARGERROR
Invalid argument clock specification
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 55 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_LPC_Sleep
Transits the low power consumption mode of the MCU to the sleep mode.
[Syntax]
#include
MD_STATUS
"r_cg_macrodriver.h"
R_LPC_Sleep ( void );
[Argument(s)]
None.
[Return value]
Macro
Description
MD_OK
Normal completion
MD_ERROR1
Exit with error (abend)
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 56 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_LPC_DeepSleep
Transits the low power consumption mode of the MCU to the deep sleep mode.
[Syntax]
#include
MD_STATUS
"r_cg_macrodriver.h"
R_LPC_DeepSleep ( void );
[Argument(s)]
None.
[Return value]
Macro
Description
MD_OK
Normal completion
MD_ERROR1
Exit with error (abend)
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 57 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_LPC_DeepSoftwareStandby
Transits the low power consumption mode of the MCU to the deep software standby mode.
[Syntax]
MD_STATUS
R_LPC_DeepSoftwareStandby ( void );
[Argument(s)]
None.
[Return value]
Macro
Description
MD_OK
Normal completion
MD_ERROR1
Exit with error (abend)
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 58 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_LPC_SoftwareStandby
Transits the low power consumption mode of the MCU to the software standby mode.
[Syntax]
#include
MD_STATUS
"r_cg_macrodriver.h"
R_LPC_SoftwareStandby ( void );
[Argument(s)]
None.
[Return value]
Macro
Description
MD_OK
Normal completion
MD_ERROR1
Exit with error (abend)
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 59 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_LPC_ChangeOperationPowerControl
Changes the operating power control mode of the MCU.
[Syntax]
#include
#include
MD_STATUS
"r_cg_macrodriver.h"
"r_cg_lpc.h"
R_LPC_ChangeOperationPowerControl ( operaring_mode_t mode );
[Argument(s)]
I/O
I
Argument
operating_mode_t
mode;
Description
Operating power control mode type
HIGH_SPEED:
High-speed operating mode
MIDDLE_SPEED:
Middle-speed operating mode
LOW_SPEED:
Low-speed operating mode
[Return value]
Macro
Description
MD_OK
Normal completion
MD_ERROR1
Change to the low-speed operating mode ended abnormally.
MD_ERROR2
Change to the middle-speed operating mode is ended abnormally.
MD_ARGERROR
Invalid argument mode specification
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 60 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.6 Interrupt controller (ICU)
Below is a list of API functions output by the Code Generator for interrupt controller use.
Table 3.6
API Functions: [Interrupt Controller]
API Function Name
Function
R_ICU_Create
Performs initialization necessary to control the interrupt controller.
R_ICU_Create_UserInit
Performs user-defined initialization relating to the interrupt controller.
r_icu_irqn_interrupt
Performs processing in response to the external pin interrupts.
r_icu_software_interrupt
Performs processing in response to the software interrupt.
r_icu_software2_interrupt
Performs processing in response to the software interrupt2.
r_icu_nmi_interrupt
Performs processing in response to the NMI pin interrupt.
R_ICU_IRQn_Start
Allows detection of the external pin interrupt.
R_ICU_IRQn_Stop
Prohibits detection of the external pin interrupt.
R_ICU_Software_Start
Allows detection of the software interrupt.
R_ICU_Software2_Start
Allows detection of the software interrupt2.
R_ICU_Software_Stop
Prohibits detection of the software interrupt.
R_ICU_Software2_Stop
Prohibits detection of the software interrupt2.
R_ICU_SoftwareInterrupt_Generate
Generates the software interrupt.
R_ICU_SoftwareInterrupt2_Generate
Generates the software interrupt2.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 61 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_ICU_Create
Performs initialization necessary to control the interrupt controller.
[Syntax]
void
R_ICU_Create ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 62 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_ICU_Create_UserInit
Performs user-defined initialization relating to the interrupt controller.
Remark
This API function is called as the R_ICU_Create callback routine.
[Syntax]
void
R_ICU_Create_UserInit ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 63 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_icu_irqn_interrupt
Performs processing in response to the external pin interrupts.
Remark
This API function is called to run interrupt processing for the external pin interrupts.
[Syntax]
static
Remark
void
r_icu_irqn_interrupt ( void );
n is the source number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 64 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_icu_software_interrupt
Performs processing in response to the software interrupt.
Remark
This API function is called to run the interrupt processing for the software interrupt, which is generated in
response to calling of R_ICU_SoftwareInterrupt_Generate.
[Syntax]
static
void
r_icu_software_interrupt ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 65 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_icu_software2_interrupt
Performs processing in response to the software interrupt2.
Remark
This API function is called to run the interrupt processing for the software interrupt, which is generated in
response to calling of R_ICU_SoftwareInterrupt2_Generate.
[Syntax]
static
void
r_icu_software2_interrupt ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 66 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_icu_nmi_interrupt
Performs processing in response to the NMI pin interrupt.
Remark
This API function is called to run interrupt processing for the NMI pin interrupt.
[Syntax]
static
void
r_icu_nmi_interrupt ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 67 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_ICU_IRQn_Start
Allows detection of the external pin interrupt.
[Syntax]
void
Remark
R_ICU_IRQn_Start ( void );
n is the source number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 68 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_ICU_IRQn_Stop
Prohibits detection of the external pin interrupt.
[Syntax]
void
Remark
R_ICU_IRQn_Stop ( void );
n is the source number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 69 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_ICU_Software_Start
Allows detection of the software interrupt.
[Syntax]
void
R_ICU_Software_Start ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 70 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_ICU_Software2_Start
Allows detection of the software interrupt 2.
[Syntax]
void
R_ICU_Software2_Start ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 71 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_ICU_Software_Stop
Prohibits detection of the software interrupt.
[Syntax]
void
R_ICU_Software_Stop ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 72 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_ICU_Software2_Stop
Prohibits detection of the software interrupt 2.
[Syntax]
void
R_ICU_Software2_Stop ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 73 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_ICU_SoftwareInterrupt_Generate
Generates the software interrupt.
Remark
r_icu_software_interrupt is called in response to calling od this API function.
[Syntax]
void
R_ICU_SoftwareInterrupt_Generate ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 74 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_ICU_SoftwareInterrupt2_Generate
Generates the software interrupt 2.
Remark
r_icu_software2_interrupt is called in response to calling od this API function.
[Syntax]
void
R_ICU_SoftwareInterrupt2_Generate ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 75 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.7 Buses
Below is a list of API functions output by the Code Generator for buses use.
Table 3.7
API Functions: [Buses]
API Function Name
Function
R_BSC_Create
Performs initialization necessary to control the buses.
R_BSC_Create_UserInit
Performs user-defined initialization relating to the buses.
r_bsc_buserr_interrupt
Performs processing in response to the bus error (illegal address
access).
R_BSC_Error_Monitoring_Start
Allows the detection of bus errors (illegal address access).
R_BSC_Error_Monitoring_Stop
Prohibits the detection of bus errors (illegal address access).
R_BSC_InitializeSDRAM
Performs initialization of SDRAM controller.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 76 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_BSC_Create
Performs initialization necessary to control the buses.
[Syntax]
void
R_BSC_Create ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 77 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_BSC_Create_UserInit
Performs user-defined initialization relating to the buses.
Remark
This API function is called as the R_BSC_Create callback routine.
[Syntax]
void
R_BSC_Create_UserInit ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 78 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_bsc_buserr_interrupt
Performs processing in response to the bus error (illegal address access).
Remarks 1.
This API function is called to run interrupt processing for a bus error (illegal address access), which is
generated through access by the processing program to a location within an illegal address range.
Remarks 2.
The bus master that caused the bus error can be confirmed by reading the MST bit of bus error status
register 1 (BERSR1) from within this API function.
Remarks 3.
The illegal address (high-order 13 bits) that caused the bus error can be confirmed by reading the ADDR
bit of bus error status register 2 (BERSR2) from within this API function.
[Syntax]
static
void
r_bsc_buserr_interrupt ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 79 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_BSC_Error_Monitoring_Start
Allows the detection of bus errors (illegal address access).
[Syntax]
void
R_BSC_Error_Monitoring_Start ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 80 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_BSC_Error_Monitoring_Stop
Prohibits the detection of bus errors (illegal address access).
[Syntax]
void
R_BSC_Error_Monitoring_Stop ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 81 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_BSC_InitializeSDRAM
Performs initialization of SDRAM controller.
[Syntax]
void
R_BSC_InitializeSDRAM ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 82 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.8 DMA Controller(DMAC)
Below is a list of API functions output by the Code Generator for DMA controller use.
Table 3.8
API Functions: [DMA Controller]
API Function Name
Function
R_DMAC_Create
Performs initialization necessary to control the DMA controller.
R_DMAC_Create_UserInit
Performs user-defined initialization relating to the DMA controller.
r_dmac_dmacni_interrupt
Performs processing in response to the transfer end interrupt.
r_dmacn_callback_transfer_end
Performs processing in response to the transfer end interrupt.
r_dmacn_callback_transfer_escap
e_end
Performs processing in response to the escape transfer end interrupt.
R_DMACn_Start
Allows starting of the DMAC controller.
R_DMACn_Stop
Prohibits starting of the DMAC controller.
R_DMACn_Set_SoftwareTrigger
Sets the software request of DMA transfer by software.
R_DMACn_Clear_SoftwareTrigger
Clears the software request of DMA transfer by software.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 83 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_DMAC_Create
Performs initialization necessary to control the DMA controller.
[Syntax]
void
R_DMAC_Create ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 84 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_DMAC_Create_UserInit
Performs user-defined initialization relating to the DMA controller.
Remark
This API function is called as the R_DMAC_Create callback routine.
[Syntax]
void
R_DMAC_Create_UserInit ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 85 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_dmac_dmacni_interrupt
Performs processing in response to the transfer end interrupt.
[Syntax]
static
Remark
void
r_dmac_dmacni_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 86 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_dmacn_callback_transfer_end
Performs processing in response to the transfer end interrupt.
Remark
This API function is called as thecall r_dmac_dmacni_interrupt back routine.
[Syntax]
static
Remark
void
r_dmacn_callback_transfer_end ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 87 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_dmacn_callback_transfer_escape_end
Performs processing in response to the escape transfer end interrupt.
Remark
This API function is called as the r_dmac_dmacni_interrupt callback routine, which is generated by
escape transfer end.
[Syntax]
static
Remark
void
r_dmacn_callback_transfer_escape_end ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 88 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_DMACn_Start
Allows starting of the DMAC controller.
[Syntax]
void
Remark
R_DMACn_Start ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 89 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_DMACn_Stop
Prohibits starting of the DMAC controller.
[Syntax]
void
R_DMACn_Stop ( void );
Remark
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 90 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_DMACn_Set_SoftwareTrigger
Sets the software request of DMA transfer by software.
[Syntax]
void
Remark
R_DMACn_Set_SoftwareTrigger ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 91 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_DMACn_Clear_SoftwareTrigger
Clears the software request of DMA transfer by software.
[Syntax]
void
Remark
R_DMACn_Clear_SoftwareTrigger ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 92 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.9 Data transfer controller (DTC)
Below is a list of API functions output by the Code Generator for data transfer controller use.
Table 3.9
API Functions: [Data Transfer Controller]
API Function Name
Function
R_DTC_Create
Performs initialization necessary to control the data transfer controller.
R_DTC_Create_UserInit
Performs user-defined initialization relating to the data transfer
controller.
R_DTCm_Start
Allows starting of the data transfer controller.
R_DTCm_Stop
Prohibits starting of the data transfer controller.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 93 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_DTC_Create
Performs initialization necessary to control the data transfer controller.
[Syntax]
void
R_DTC_Create ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 94 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_DTC_Create_UserInit
Performs user-defined initialization relating to the data transfer controller.
Remark
This API function is called as the R_DTC_Create callback routine.
[Syntax]
void
R_DTC_Create_UserInit ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 95 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_DTCm_Start
Allows starting the data transfer controller.
Remark
In this API function, starting the data transfer controller is allowed by operating the DTCE bit of the DTC
activation enable register n (DTCERn) supporting the transfer data number m.
[Syntax]
void
Remark
R_DTCm_Start ( void );
m is the transfer data number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 96 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_DTCm_Stop
Prohibits starting of the data transfer controller.
Remark
In this API function, starting the data transfer controller is prohibited by operating the DTCE bit of the
DTC activation enable register n (DTCERn) supporting the transfer data number m.
[Syntax]
void
Remark
R_DTCm_Stop ( void );
m is the transfer data number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 97 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.10 Event link controller (ELC)
Below is a list of API functions output by the Code Generator for event link controller use.
Table 3.10
API Functions: [Event Link Controller]
API Function Name
Function
R_ELC_Create
Performs initialization necessary to control the event link controller.
R_ELC_Create_UserInit
Performs user-defined initialization relating to the event link controller.
r_elc_elsrni_interrupt
Performs processing in response to the event link interrupt.
R_ELC_Start
Starts interlinked operation of peripheral functions.
R_ELC_Stop
Ends interlinked operation of peripheral functions.
R_ELC_GenerateSoftwareEvent
Generates the software event.
R_ELC_Set_PortBuffern
Sets the value of a port buffer.
R_ELC_Get_PortBuffern
Gets the value of a port buffer.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 98 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_ELC_Create
Performs initialization necessary to control the event link controller.
[Syntax]
void
R_ELC_Create ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 99 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_ELC_Create_UserInit
Performs user-defined initialization relating to the event link controller.
Remark
This API function is called as the R_ELC_Create callback routine.
[Syntax]
void
R_ELC_Create_UserInit ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 100 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_elc_elsrni_interrupt
Performs processing in response to the event link interrupt.
Remark
This API function is called to run interrupt processing for the event signal defined in event link setting register.
[Syntax]
static
Remark
void
r_elc_elsrni_interrupt ( void );
n is the source number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 101 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_ELC_Start
Starts interlinked operation of peripheral functions.
[Syntax]
void
R_ELC_Start ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 102 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_ELC_Stop
Ends interlinked operation of peripheral functions.
[Syntax]
void
R_ELC_Stop ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 103 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_ELC_GenerateSoftwareEvent
Generates the software event.
[Syntax]
void
R_ELC_GenerateSoftwareEvent ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 104 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_ELC_Set_PortBuffern
Sets the value of a port buffer.
[Syntax]
void
Remark
R_ELC_Set_PortBuffern ( uint8_t value );
n is the source number.
[Argument(s)]
I/O
I
Argument
uint8_t value;
Description
The value set in the port buffer.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 105 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_ELC_Get_PortBuffern
Gets the value of a port buffer.
[Syntax]
void
Remark
R_ELC_Get_PortBuffern ( uint8_t * const value );
n is the source number.
[Argument(s)]
I/O
O
Argument
uint8_t * const value;
Description
Pointer to the location where the obtained value is to be stored.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 106 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.11 I/O ports
Below is a list of API functions output by the Code Generator for I/O ports use.
Table 3.11
API Functions: [I/O Ports]
API Function Name
Function
R_PORT_Create
Performs initialization necessary to control the I/O ports.
R_PORT_Create_UserInit
Performs user-defined initialization relating to the I/O ports.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 107 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_PORT_Create
Performs initialization necessary to control the I/O ports.
[Syntax]
void
R_PORT_Create ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 108 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_PORT_Create_UserInit
Performs user-defined initialization relating to the I/O ports.
Remark
This API function is called as the R_PORT_Create callback routine.
[Syntax]
void
R_PORT_Create_UserInit ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 109 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.12 Multi-function timer pulse unit 2 (MTU2)
Below is a list of API functions output by the Code Generator for multi-function timer pulse unit 2 use.
Table 3.12
API Functions: [Multi-Function Timer Pulse Unit 2]
API Function Name
Function
R_MTU2_Create
Performs initialization necessary to control the multi-function timer pulse unit 2.
R_MTU2_Create_UserInit
Performs user-defined initialization relating to the multi-function timer pulse unit
2.
r_mtu2_tgimn_interrupt
Performs processing in response to the input capture/compare match interrupt.
r_mtu2_tcivn_interrupt
Performs processing in response to the overflow interrupt.
r_mtu2_tciun_interrupt
Performs processing in response to the underflow interrupt.
R_MTU2_Cn_Start
Starts counting by a 16-bit timer.
R_MTU2_Cn_Stop
Ends counting by a 16-bit timer.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 110 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_MTU2_Create
Performs initialization necessary to control the multi-function timer pulse unit 2.
[Syntax]
void
R_MTU2_Create ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 111 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_MTU2_Create_UserInit
Performs user-defined initialization relating to the multi-function timer pulse unit 2.
Remark
This API function is called as the R_MTU2_Create callback routine.
[Syntax]
void
R_MTU2_Create_UserInit ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 112 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_mtu2_tgimn_interrupt
Performs processing in response to the input capture/compare match interrupt.
Remark
This API function is called to run interrupt processing for the input capture interrupt generated because
multi-function timer pulse unit 2 detected the effective edge of the input signal or for the compare match
interrupt generated because the current counter value (value of the timer counter, TCNT) matched the
defined counter value (value of the timer general register, TGR).
[Syntax]
static
Remark
void
r_mtu2_tgimn_interrupt ( void );
m is the timer general register number, and n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 113 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_mtu2_tcivn_interrupt
Performs processing in response to the overflow interrupt.
Remark
This API function is called to run interrupt processing for the overflow interrupt, which is generated in
response to an overflow of the timer counter (TCNT).
[Syntax]
static
Remark
void
r_mtu2_tcivn_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 114 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_mtu2_tciun_interrupt
Performs processing in response to the underflow interrupt.
Remark
This API function is called to run interrupt processing for the underflow interrupt, which is generated in
response to an underflow of the timer counter (TCNT).
[Syntax]
static
Remark
void
r_mtu2_tciun_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 115 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_MTU2_Cn_Start
Starts counting by the 16-bit timer.
[Syntax]
void
Remark
R_MTU2_Cn_Start ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 116 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_MTU2_Cn_Stop
Ends counting by the 16-bit timer.
[Syntax]
void
Remark
R_MTU2_Cn_Stop ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 117 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.13 Multi-function timer pulse unit 3 (MTU3)
Below is a list of API functions output by the Code Generator for multi-function timer pulse unit 3 use.
Table 3.13
API Functions: [Multi-Function Timer Pulse Unit 3]
API Function Name
Function
R_MTU3_Create
Performs initialization necessary to control the multi-function timer pulse unit 3.
R_MTU3_Create_UserInit
Performs user-defined initialization relating to the multi-function timer pulse unit
3.
r_mtu3_tgimn_interrupt
Performs processing in response to the input capture/compare match interrupt.
r_mtu3_tcivn_interrupt
Performs processing in response to the overflow interrupt.
r_mtu3_tciun_interrupt
Performs processing in response to the underflow interrupt.
R_MTU3_Cn_Start
Starts counting by a 16-bit timer.
R_MTU3_Cn_Stop
Ends counting by a 16-bit timer.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 118 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_MTU3_Create
Performs initialization necessary to control the multi-function timer pulse unit 3.
[Syntax]
void
R_MTU3_Create ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 119 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_MTU3_Create_UserInit
Performs user-defined initialization relating to the multi-function timer pulse unit 3.
Remark
This API function is called as the R_MTU3_Create callback routine.
[Syntax]
void
R_MTU3_Create_UserInit ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 120 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_mtu3_tgimn_interrupt
Performs processing in response to the input capture/compare match interrupt.
Remark
This API function is called to run interrupt processing for the input capture interrupt generated because
multi-function timer pulse unit 3 detected the effective edge of the input signal or for the compare match
interrupt generated because the current counter value (value of the timer counter, TCNT) matched the
defined counter value (value of the timer general register, TGR).
[Syntax]
static
Remark
void
r_mtu3_tgimn_interrupt ( void );
m is the timer general register number, and n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 121 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_mtu3_tcivn_interrupt
Performs processing in response to the overflow interrupt.
Remark
This API function is called to run interrupt processing for the overflow interrupt, which is generated in
response to an overflow of the timer counter (TCNT).
[Syntax]
static
Remark
void
r_mtu3_tcivn_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 122 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_mtu3_tciun_interrupt
Performs processing in response to the underflow interrupt.
Remark
This API function is called to run interrupt processing for the underflow interrupt, which is generated in
response to an underflow of the timer counter (TCNT).
[Syntax]
static
Remark
void
r_mtu3_tciun_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 123 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_MTU3_Cn_Start
Starts counting by the 16-bit timer.
[Syntax]
void
Remark
R_MTU3_Cn_Start ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 124 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_MTU3_Cn_Stop
Ends counting by the 16-bit timer.
[Syntax]
void
Remark
R_MTU3_Cn_Stop ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 125 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.14 Port output enable 2 (POE2)
Below is a list of API functions output by the Code Generator for port output enable 2 use.
Table 3.14
API Functions: [Port Output Enable 2]
API Function Name
Function
R_POE2_Create
Performs initialization necessary to control the port output enable 2.
R_POE2_Create_UserInit
Performs user-defined initialization relating to the port output enable 2.
r_poe2_oein_interrupt
Performs processing in response to the output enable interrupt n (OEIn).
R_POE2_Start
Places the MTU's complementary PWM output pins in the high-impedance
state.
R_POE2_Stop
Releases the R_POE2_Stop MTU's complementary PWM output pins from the
high-impedance state.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 126 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_POE2_Create
Performs initialization necessary to control the port output enable 2.
[Syntax]
void
R_POE2_Create ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 127 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_POE2_Create_UserInit
Performs user-defined initialization relating to the port output enable 2.
Remark
This API function is called as the R_POE2_Create callback routine.
[Syntax]
void
R_POE2_Create_UserInit ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 128 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_poe2_oein_interrupt
Performs processing in response to the output enable interrupt n (OEIn).
Remark
This API function is called to run interrupt processing for the output enable interrupt n (OEIn), which is
generated when a pin (any of POE0#, POE1#, POE2#, POE3#, and POE8#) becomes high-impedance
or the output short flag 1 is set.
[Syntax]
static
Remark
void
r_poe2_oein_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 129 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_POE2_Start
Places the MTU's complementary PWM output pins in the high-impedance state.
[Syntax]
void
R_POE2_Start ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 130 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_POE2_Stop
Releases the MTU's complementary PWM output pins from the high-impedance state.
[Syntax]
void
R_POE2_Stop ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 131 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.15 Port output enable 3 (POE3)
Below is a list of API functions output by the Code Generator for port output enable 3 use.
Table 3.15
API Functions: [Port Output Enable 3]
API Function Name
Function
R_POE3_Create
Performs initialization necessary to control the port output enable 3.
R_POE3_Create_UserInit
Performs user-defined initialization relating to the port output enable 3.
r_poe3_oein_interrupt
Performs processing in response to the output enable interrupt n (OEIn).
R_POE3_Start
Places the MTU's complementary PWM output pins in the high-impedance
state.
R_POE3_Stop
Releases the R_POE3_Stop MTU's complementary PWM output pins from the
high-impedance state.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 132 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_POE3_Create
Performs initialization necessary to control the port output enable 3.
[Syntax]
void
R_POE3_Create ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 133 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_POE3_Create_UserInit
Performs user-defined initialization relating to the port output enable 3.
Remark
This API function is called as the R_POE3_Create callback routine.
[Syntax]
void
R_POE3_Create_UserInit ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 134 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_poe3_oein_interrupt
Performs processing in response to the output enable interrupt.
Remark
This API function is called to run interrupt processing for the output enable interrupt, which is generated
when a related pin becomes high-impedance or the output short flag 1 is set.
[Syntax]
static
Remark
void
r_poe3_oein_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 135 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_POE3_Start
Places the related pins in the high-impedance state.
[Syntax]
void
R_POE3_Start ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 136 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_POE3_Stop
Replaces the related output pins from the high-impedance state.
[Syntax]
void
R_POE3_Stop ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 137 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.16 General PWM timer (GPT)
Below is a list of API functions output by the Code Generator for general PWM timer use.
Table 3.16
API Functions: [General PWM timer]
API Function Name
Function
R_GPT_Create
Performs initialization necessary to control the general PWM timer.
R_GPT_Create_UserInit
Performs user-defined initialization relating to the general PWM timer.
r_gpt_gtcimn_interrupt
Performs processing in response to the input capture/compare match interrupt.
r_gpt_gtcivn_interrupt
Performs processing in response to the overflow interrupt.
r_gpt_gtciun_interrupt
Performs processing in response to the underflow interrupt.
r_gpt_gdten_interrupt
Performs processing in response to the dead time error interrupt.
r_gpt_etgip_interrupt
Performs processing in response to the external trigger rising interrupt.
r_gpt_etgin_interrupt
Performs processing in response to the external trigger falling interrupt.
R_GPTn_Start
Starts counting by a 16-bit timer.
R_GPTn_Stop
Ends counting by a 16-bit timer.
R_GPTn_HardwareStart
Allows GPT interrupts.
R_GPTn_HardwareStop
Prohibits GPT interrupts.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 138 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_GPT_Create
Performs initialization necessary to control the general PWM timer.
[Syntax]
void
R_GPT_Create ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 139 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_GPT_Create_UserInit
Performs user-defined initialization relating to the general PWM timer.
Remark
This API function is called as the R_GPT_Create callback routine.
[Syntax]
void
R_GPT_Create_UserInit ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 140 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_gpt_gtcimn_interrupt
Performs processing in response to the input capture/compare match interrupt.
[Syntax]
static
Remark
void
r_gpt_gtcimn_interrupt ( void );
m is the timer general register number, n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 141 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_gpt_gtcivn_interrupt
Performs processing in response to the overflow interrupt.
[Syntax]
static
Remark
void
r_gpt_gtcivn_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 142 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_gpt_gtciun_interrupt
Performs processing in response to the underflow interrupt.
[Syntax]
static
Remark
void
r_gpt_gtciun_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 143 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_gpt_gdten_interrupt
Performs processing in response to the dead time error interrupt.
[Syntax]
static
Remark
void
r_gpt_gdten_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 144 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_gpt_etgip_interrupt
Performs processing in response to the external trigger rising interrupt.
[Syntax]
static
void
r_gpt_eigip_interrupt ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 145 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_gpt_etgin_interrupt
Performs processing in response to the external trigger falling interrupt.
[Syntax]
static
void
r_gpt_etgin_interrupt ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 146 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_GPTn_Start
Starts counting by a 16-bit timer.
[Syntax]
void
R_GPTn_Start ( void );
Remark
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 147 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_GPTn_Stop
Ends counting by a 16-bit timer.
[Syntax]
void
R_GPTn_Stop ( void );
Remark
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 148 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_GPTn_HardwareStart
Allows detection of GPT interrupts.
Remark
This API function enables GPT interrupts when starting timer count by the hardware trigger.
[Syntax]
void
Remark
R_GPTn_HardwareStart ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 149 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_GPTn_HardwareStop
Prohibits detection of GPT interrupts.
Remark
This API function disables GPT interrupts when starting timer count by the hardware trigger.
[Syntax]
void
Remark
R_GPTn_HardwareStop ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 150 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.17 16-bit timer pulse unit (TPU)
Below is a list of API functions output by the Code Generator for 16-bit timer pulse unit use.
Table 3.17
API Functions: [16-bit timer pulse unit]
API Function Name
Function
R_TPU_Create
Performs initialization necessary to control the 16-bit timer pulse unit.
R_TPU_Create_UserInit
Performs user-defined initialization relating to the 16-bit timer pulse unit.
r_tpu_tginm_interrupt
Performs processing in response to the input capture/compare match interrupt.
r_tpu_tcinv_interrupt
Performs processing in response to the overflow interrupt.
r_tpu_tcinu_interrupt
Performs processing in response to the underflow interrupt.
R_TPUn_Start
Starts counting by a 16-bit timer.
R_TPUn_Stop
Ends counting by a 16-bit timer.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 151 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_TPU_Create
Performs initialization necessary to control the 16-bit timer pulse unit.
[Syntax]
void
R_TPU_Create ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 152 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_TPU_Create_UserInit
Performs user-defined initialization relating to the 16-bit timer pulse unit.
Remark
This API function is called as the R_TPU_Create callback routine.
[Syntax]
void
R_TPU_Create_UserInit ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 153 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_tpu_tginm_interrupt
Performs processing in response to the input capture/compare match interrupt.
[Syntax]
static
Remark
void
r_tpu_tginm_interrupt ( void );
m is the timer general register number, n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 154 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_tpu_tcinv_interrupt
Performs processing in response to the overflow interrupt.
[Syntax]
static
Remark
void
r_tpu_tcinv_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 155 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_tpu_tcinu_interrupt
Performs processing in response to the underflow interrupt.
[Syntax]
static
Remark
void
r_tpu_tcinu_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 156 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_TPUn_Start
Starts counting by a 16-bit timer.
[Syntax]
void
R_TPUn_Start ( void );
Remark
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 157 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_TPUn_Stop
Ends counting by a 16-bit timer.
[Syntax]
void
R_TPUn_Stop ( void );
Remark
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 158 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.18 8-bit timer (TMR)
Below is a list of API functions output by the Code Generator for 8-bit timer use.
Table 3.18
API Functions: [8-bit timer]
API Function Name
Function
R_TMR_Create
Performs initialization necessary to control the 8-bit timer pulse unit.
R_TMR_Create_UserInit
Performs user-defined initialization relating to the 8-bit timer pulse unit.
r_tmr_cmimn_interrupt
Performs processing in response to the compare match interrupt.
r_tmr_ovin_interrupt
Performs processing in response to the overflow interrupt.
R_TMRn_Start
Starts counting by an 8-bit timer.
R_TMRn_Stop
Ends counting by an 8-bit timer.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 159 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_TMR_Create
Performs initialization necessary to control the 8-bit timer.
[Syntax]
void
R_TMR_Create ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 160 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_TMR_Create_UserInit
Performs user-defined initialization relating to the 8-bit timer.
Remark
This API function is called as the R_TMR_Create callback routine.
[Syntax]
void
R_TMR_Create_UserInit ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 161 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_tmr_cmimn_interrupt
Performs processing in response to the compare match interrupt.
[Syntax]
static
Remark
void
r_tmr_cmimn_interrupt ( void );
m is the timer general register number, n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 162 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_tmr_ovin_interrupt
Performs processing in response to the overflow interrupt.
[Syntax]
static
Remark
void
r_tmr_ovin_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 163 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_TMRn_Start
Starts counting by an 8-bit timer.
[Syntax]
void
R_TMRn_Start ( void );
Remark
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 164 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_TMRn_Stop
Ends counting by an 8-bit timer.
[Syntax]
void
R_TMRn_Stop ( void );
Remark
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 165 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.19 Programmable pulse generator (PPG)
Below is a list of API functions output by the Code Generator for programmable pulse generator use.
Table 3.19
API Functions: [Programmable Pulse Generator ]
API Function Name
Function
R_PPG_Create
Performs initialization necessary to control the programmable pulse generator .
R_PPG_Create_UserInit
Performs user-defined initialization relating to the programmable pulse
generator .
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 166 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_PPG_Create
Performs initialization necessary to control the programmable pulse generator .
[Syntax]
void
R_PPG_Create ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 167 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_PPG_Create_UserInit
Performs user-defined initialization relating to the programmable pulse generator .
Remark
This API function is called as the R_PPG_Create callback routine.
[Syntax]
void
R_PPG_Create_UserInit ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 168 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.20 Compare match timer (CMT)
Below is a list of API functions output by the Code Generator for compare match timer use.
Table 3.20
API Functions: [Compare Match Timer]
API Function Name
Function
R_CMTn_Create
Performs initialization necessary to control the compare match timer.
R_CMTn_Create_UserInit
Performs user-defined initialization relating to the compare match timer.
r_cmt_cmin_interrupt
Performs processing in response to the compare match interrupt (CMIn).
R_CMTn_Start
Starts counting by a 16-bit timer.
R_CMTn_Stop
Ends counting by a 16-bit timer.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 169 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_CMTn_Create
Performs initialization necessary to control the compare match timer.
[Syntax]
void
Remark
R_CMTn_Create ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 170 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_CMTn_Create_UserInit
Performs user-defined initialization relating to the compare match timer.
Remark
This API function is called as the R_CMTn_Create callback routine.
[Syntax]
void
Remark
R_CMTn_Create_UserInit ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 171 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_cmt_cmin_interrupt
Performs processing in response to the compare match interrupt (CMIn).
Remark
This API function is called to run interrupt processing for the compare match interrupt (CMIn), which is
generated because the current counter value (value of the compare match timer counter, CMCR)
matched the defined counter value (value of the compare match timer constant register, CMCOR).
[Syntax]
static
Remark
void
r_cmt_cmin_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 172 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_CMTn_Start
Starts counting by a 16-bit timer.
[Syntax]
void
R_CMTn_Start ( void );
Remark
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 173 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_CMTn_Stop
Ends counting by a 16-bit timer.
[Syntax]
void
R_CMTn_Stop ( void );
Remark
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 174 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.21 Compare match timer W (CMTW)
Below is a list of API functions output by the Code Generator for compare match timer W use.
Table 3.21
API Functions: [Compare Match Timer W]
API Function Name
Function
R_CMTWn_Create
Performs initialization necessary to control the compare match timer W.
R_CMTWn_Create_UserInit
Performs user-defined initialization relating to the compare match timer W.
r_cmtw_cmwin_interrupt
Performs processing in response to the compare match interrupt.
r_cmtw_icmin_interrupt
Performs processing in response to the input capture interrupt.
r_cmtw_ocmin_interrupt
Performs processing in response to the output compare interrupt.
R_CMTWn_Start
Starts counting by a 16-bit timer.
R_CMTWn_Stop
Ends counting by a 16-bit timer.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 175 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_CMTWn_Create
Performs initialization necessary to control the compare match timer W.
[Syntax]
void
Remark
R_CMTPn_Create ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 176 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_CMTWn_Create_UserInit
Performs user-defined initialization relating to the compare match timer W.
Remark
This API function is called as the R_CMTWn_Create callback routine.
[Syntax]
void
Remark
R_CMTWn_Create_UserInit ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 177 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_cmtw_cmwin_interrupt
Performs processing in response to the compare match interrupt.
[Syntax]
static
Remark
void
r_cmtw_cmwin_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 178 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_cmtw_icmin_interrupt
Performs processing in response to the input capture interrupt.
[Syntax]
static
Remark
void
r_cmtw_icmin_interrupt ( void );
m is the timer general register number, n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 179 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_cmtw_ocmin_interrupt
Performs processing in response to the output compare interrupt.
[Syntax]
static
Remark
void
r_cmtw_ocmin_interrupt ( void );
m is the timer general register number, n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 180 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_CMTWn_Start
Starts counting by a 16-bit timer.
[Syntax]
void
Remark
R_CMTWn_Start ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 181 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_CMTWn_Stop
Ends counting by a 16-bit timer.
[Syntax]
void
R_CMTWn_Stop ( void );
Remark
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 182 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.22 Realtime clock (RTC)
Below is a list of API functions output by the Code Generator for realtime clock use.
Table 3.22
API Functions: [Realtime Clock]
API Function Name
Function
R_RTC_Create
Performs initialization necessary to control the realtime clock.
R_RTC_Create_UserInit
Performs user-defined initialization relating to the realtime clock.
r_rtc_alm_interrupt
Performs processing in response to the alarm interrupt (ALM).
r_rtc_prd_interrupt
Performs processing in response to the periodic interrupt (PRD).
r_rtc_cup_interrupt
Performs processing in response to the carry interrupt (CUP).
R_RTC_Set_CalendarAlarm
Sets the condition for the alarm interrupt (ALM) and allows detection of ALM
(calendar count mode).
R_RTC_Set_BinaryAlarm
Sets the condition for the alarm interrupt (ALM) and allows detection of ALM
(binary count mode).
R_RTC_Set_ConstPeriodInterrupt
On
Sets the period of the periodic interrupt (PRD) and allows detection of PRD.
R_RTC_Set_ConstPeriodInterrupt
Off
Prohibits detection of the periodic interrupt (PRD).
R_RTC_Set_CarryInterruptOn
Allows detection of the carry interrupt (CUP).
R_RTC_Set_CarryInterruptOff
Prohibits detection of the carry interrupt (CUP).
R_RTC_Set_RTCOUTOn
Set the RTCOUT output period and starts RTCOUT output.
R_RTC_Set_RTCOUTOff
Ends the RTCOUT output.
R_RTC_Start
Starts counting.
R_RTC_Stop
Ends counting.
R_RTC_Restart
Initializes the counter then starts counting.
R_RTC_Set_CalendarCounterVal
ue
Sets the values of the calendar and time counters.
R_RTC_Get_CalendarCounterVal
ue
Gets the values of the calendar and time counters.
R_RTC_Set_BinaryCounterValue
Sets the value of the binary counter.
R_RTC_Get_BinaryCounterValue
Gets the value of the binary counter.
R_RTC_Get_CalendarTimeCaptur
eValuen
Gets the captured calendar time value.
R_RTC_Get_BinaryTimeCaptureV
aluen
Gets the captured binary time value.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 183 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RTC_Create
Performs initialization necessary to control the realtime clock.
[Syntax]
void
R_RTC_Create ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 184 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RTC_Create_UserInit
Performs user-defined initialization relating to the realtime clock.
Remark
This API function is called as the R_RTC_Create callback routine.
[Syntax]
void
R_RTC_Create_UserInit ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 185 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_rtc_alm_interrupt
Performs processing in response to the alarm interrupt (ALM).
Remark
This API function is called to run interrupt processing for the alarm interrupt (ALM), which is generated
when the condition specified by R_RTC_Set_CalendarAlarm is satisfied.
[Syntax]
static
void
r_rtc_alm_interrupt ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 186 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_rtc_prd_interrupt
Performs processing in response to the periodic interrupt (PRD).
Remark
This API function is called to run interrupt processing for the periodic interrupt (PRD), which is generated
when the period specified by R_RTC_Set_ConstPeriodInterruptOn elapses.
[Syntax]
static
void
r_rtc_prd_interrupt ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 187 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_rtc_cup_interrupt
Performs processing in response to the carry interrupt (CUP).
Remark
This API function is called to run interrupt processing for the carry interrupt (CUP), which is generated on
carries from the seconds counter (RSECCNT) or binary counter 0 (BCNT0) or when the 64-Hz counter
(R64CNT) is read at the same time as a carry from the 64-Hz counter (R64CNT).
[Syntax]
static
void
r_rtc_cup_interrupt ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 188 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RTC_Set_CalendarAlarm
Sets the condition for the alarm interrupt (ALM) and allows detection of ALM (calendar count mode).
[Syntax]
#include
"r_cg_rtc.h"
void
R_RTC_Set_CalendarAlarm ( rtc_calendar_alarm_enable_t alarm_enable,
rtc_calendar_alarm_value_t alarm_val );
[Argument(s)]
I/O
Argument
Description
I
rtc_calendar_alarm_enable_t
alarm_enable;
Comparison flags (year, month, date, day-of-the-week, hour, minute, and second).
0x0:
Comparison proceeds
0x80:
Comparison does not proceed
I
rtc_calendar_alarm_value_t
alarm_val;
Calendar and time values (year, month, date, day-of-week, time,
minute, and second)
Remarks 1.
The configuration of the comparison flag structure rtc_calendar_alarm_enable_t is shown below.
typedef struct {
uint8_t sec_enb;
/* Second */
uint8_t min_enb;
/* Minute */
uint8_t hr_enb;
/* Time */
uint8_t day_enb;
/* Date */
uint8_t wk_enb;
/* Day-of-week */
uint8_t mon_enb;
/* Month */
uint8_t yr_enb;
/* Year */
} rtc_calendar_alarm_enable_t;
Remarks 2.
The configuration of the calendar and time values rtc_calendar_alarm_value_t is shown below.
typedef struct {
uint8_t rsecar;
/* second */
uint8_t rminar;
/* Minute */
uint8_t rhrar;
/* Time */
uint8_t rdayar;
/* Date */
uint8_t rwkar;
/* Day-of-week (0: Sunday, 6: Saturday) */
uint8_t rmonar;
/* Month */
uint16_t ryrar;
/* Year */
} rtc_calendar_alarm_value_t;
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 189 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RTC_Set_BinaryAlarm
Sets the condition for the alarm interrupt (ALM) and allows detection of ALM (binary count mode).
[Syntax]
#include
"r_cg_macrodriver.h"
void
R_RTC_Set_BinaryAlarm ( uint32_t alarm_enable, uint32_t alarm_val );
[Argument(s)]
I/O
Argument
Description
I
uint32_t
alarm_enable;
Comparison flag
0x0:
Comparison does not proceed
0x1:
Comparison proceeds
I
uint32_t
alarm_val;
The value of the binary counter
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 190 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RTC_Set_ConstPeriodInterruptOn
Sets the period of the periodic interrupt (PRD) and allows detection of the PRD.
[Syntax]
#include
"r_cg_rtc.h"
void
R_RTC_Set_ConstPeriodInterruptOn ( rtc_int_period_t period );
[Argument(s)]
I/O
I
Argument
rtc_int_period_t
period;
Description
Period of the periodic interrupt (PRD).
PES_2_SEC:
2 seconds
PES_1_SEC:
1 second
PES_1_2_SEC:
1/2 second
PES_1_4_SEC:
1/4 second
PES_1_8_SEC:
1/8 second
PES_1_16_SEC:
1/16 second
PES_1_32_SEC:
1/32 second
PES_1_64_SEC:
1/64 second
PES_1_128_SEC:
1/128 second
PES_1_256_SEC:
1/256 second
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 191 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RTC_Set_ConstPeriodInterruptOff
Prohibits detection of the periodic interrupt (PRD).
[Syntax]
void
R_RTC_Set_ConstPeriodInterruptOff ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 192 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RTC_Set_CarryInterruptOn
Allows detection of the carry interrupt (CUP).
[Syntax]
void
R_RTC_Set_CarryInterruptOn ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 193 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RTC_Set_CarryInterruptOff
Prohibits detection of the carry interrupt (CUP).
[Syntax]
void
R_RTC_Set_CarryInterruptOff ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 194 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RTC_Set_RTCOUTOn
Sets the RTCOUT output period and starts RTCOUT output.
[Syntax]
#include
"r_cg_rtc.h"
void
R_RTC_Set_RTCOUTOn ( rtc_rtcout_period_t rtcout_freq );
[Argument(s)]
I/O
I
Argument
rtc_rtcout_period_t
rtcout_freq;
Description
RTCOUT output period
RTCOUT_1HZ:
1Hz
RTCOUT_64HZ:
64Hz
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 195 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RTC_Set_RTCOUTOff
Ends RTCOUT output.
[Syntax]
void
R_RTC_Set_RTCOUTOff ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 196 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RTC_Start
Starts counting.
[Syntax]
void
R_RTC_Start ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 197 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RTC_Stop
Ends counting.
[Syntax]
void
R_RTC_Stop ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 198 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RTC_Restart
Initializes the counter then starts counting.
Remarks 1.
When the realtime clock is operating in the calendar counting mode, this API function initializes the counters to the values specified by the argument counter_write_val.
Remarks 2.
When the realtime clock is operating in the binary counting mode, this API function ignores the value
specified by the argument counter_write_val and clears the counter to zero.
[Syntax]
#include
"r_cg_rtc.h"
void
R_RTC_Restart ( rtc_calendarcounter_value_t counter_write_val );
[Argument(s)]
I/O
I
Remark
Argument
rtc_calendarcounter_value_t
counter_write_val;
Description
Initial value (year, month, date, day-of-week, time, minute, and
second)
The configuration of the initial value rtc_calendarcounter_value_t is shown below.
typedef struct {
uint8_t rseccnt;
/* second */
uint8_t rmincnt;
/* Minute */
uint8_t rhrcnt;
/* Time */
uint8_t rdaycnt;
/* Date */
uint8_t rwkcnt;
/* Day-of-week (0: Sunday, 6: Saturday) */
uint8_t rmoncnt;
/* Month */
uint16_t ryrcnt;
/* Year */
} rtc_calendarcounter_value_t;
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 199 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RTC_Set_CalendarCounterValue
Sets the calendar and time values.
[Syntax]
#include
"r_cg_rtc.h"
void
R_RTC_Set_CalendarCounterValue ( rtc_calendarcounter_value_t counter_write_val
);
[Argument(s)]
I/O
I
Remark
Argument
rtc_calendarcounter_value_t
counter_write_val;
Description
Calendar and time values (year, month, date, day-of-week, time,
minute, and second)
The configuration of the calendar and time values rtc_calendarcounter_value_t is shown below.
typedef struct {
uint8_t rseccnt;
/* second */
uint8_t rmincnt;
/* Minute */
uint8_t rhrcnt;
/* Time */
uint8_t rdaycnt;
/* Date */
uint8_t rwkcnt;
/* Day-of-week (0: Sunday, 6: Saturday) */
uint8_t rmoncnt;
/* Month */
uint16_t ryrcnt;
/* Year */
} rtc_calendarcounter_value_t;
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 200 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RTC_Get_CalendarCounterValue
Gets the calendar and time values.
[Syntax]
#include
"r_cg_rtc.h"
void
R_RTC_Get_CalendarCounterValue ( rtc_calendarcounter_value_t * const
counter_read_val );
[Argument(s)]
I/O
O
Remark
Argument
rtc_calendarcounter_value_t
* const counter_read_val;
Description
Pointer to the area where the obtained calendar and time values
(year, month, date, day-of-week, time, minute, and second) are to
be stored
The configuration of the calendar and time values rtc_calendarcounter_value_t is shown below.
typedef struct {
uint8_t rseccnt;
/* second */
uint8_t rmincnt;
/* Minute */
uint8_t rhrcnt;
/* Time */
uint8_t rdaycnt;
/* Date */
uint8_t rwkcnt;
/* Day-of-week (0: Sunday, 6: Saturday) */
uint8_t rmoncnt;
/* Month */
uint16_t ryrcnt;
/* Year */
} rtc_calendarcounter_value_t;
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 201 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RTC_Set_BinaryCounterValue
Sets the value of the binary counter.
[Syntax]
#include
"r_cg_macrodriver.h"
void
R_RTC_Set_BinaryCounterValue ( uint32_t counter_write_val );
[Argument(s)]
I/O
I
Argument
uint32_t
counter_write_val;
Description
The value of the binary counter
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 202 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RTC_Get_BinaryCounterValue
Gets the value of the binary count.
[Syntax]
#include
"r_cg_macrodriver.h"
void
R_RTC_Get_BinaryCounterValue ( uint32_t * const counter_read_val );
[Argument(s)]
I/O
Argument
O
uint32_t * const
counter_read_val;
Description
Pointer to an area where the obtained value of the binary counter
is to be stored
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 203 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RTC_Get_CalendarTimeCaptureValuen
Gets the captured calendar time value.
[Syntax]
void
R_RTC_Get_CalendarTimeCaptureValuen ( rtc_calendarcounter_value_t
counter_read_val );
Remark
* const
n is the channel number.
[Argument(s)]
I/O
O
Remark
Argument
rtc_calendarcounter_value_t
* const counter_read_val;
Description
Pointer to the area where the obtained calendar and time values.
The configuration of the calendar and time values rtc_calendarcounter_value_t is shown below.
typedef struct {
uint8_t rseccnt;
/* Second */
uint8_t rmincnt;
/* Minute */
uint8_t rhrcnt;
/* Time */
uint8_t rdaycnt;
/* Date */
uint8_t rwkcnt;
/* Day-of-week (0: Sunday, 6: Saturday) */
uint8_t rmoncnt;
/* Month */
uint16_t ryrcnt;
/* Year */
} rtc_calendarcounter_value_t;
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 204 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RTC_Get_BinaryTimeCaptureValuen
Gets the value of the binary count.
[Syntax]
void
Remark
R_RTC_Get_BinaryTimeCaptureValuen ( uint32_t
* const
counter_read_val
);
n is the channel number.
[Argument(s)]
I/O
O
Argument
uint32_t
* const counter_read_val;
Description
The value of the binary counter.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 205 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.23 Watchdog timer (WDT)
Below is a list of API functions output by the Code Generator for watchdog timer use.
Table 3.23
API Functions: [Watchdog Timer]
API Function Name
Function
R_WDT_Create
Performs initialization necessary to control the watchdog timer.
R_WDT_Create_UserInit
Performs user-defined initialization relating to the watchdog timer.
r_wdt_wuni_interrupt
Performs processing in response to the non-maskable/maskable interrupt.
R_WDT_Restart
Clears the watchdog timer counter and resumes counting.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 206 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_WDT_Create
Performs initialization necessary to control the watchdog timer.
[Syntax]
void
R_WDT_Create ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 207 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_WDT_Create_UserInit
Performs user-defined initialization relating to the watchdog timer.
Remark
This API function is called as the R_WDT_Create callback routine.
[Syntax]
void
R_WDT_Create_UserInit ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 208 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_wdt_wuni_interrupt
Performs processing in response to the non-maskable/maskable interrupt.
Remark
This API function is called to run interrupt processing for the non-maskable / maskable interrupt , which is
generated when the down-counter underflows or refreshing proceeds.
[Syntax]
static
void
r_wdt_wuni_interrupt ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 209 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_WDT_Restart
Clears the watchdog timer counter and resumes counting.
[Syntax]
void
R_WDT_Restart ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 210 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.24 Independent watchdog timer (IWDT)
Below is a list of API functions output by the Code Generator for independent watchdog timer use.
Table 3.24
API Functions: [Independent Watchdog Timer]
API Function Name
Function
R_IWDT_Create
Performs initialization necessary to control the independent watchdog
timer.
R_IWDT_Create_UserInit
Performs user-defined initialization relating to the independent watchdog
timer.
r_iwdt_nmi_interrupt
Performs processing in response to the non-maskable interrupt (WUNI).
r_iwdt_iwuni_interrupt
Performs processing in response to the non-maskable/maskable
interrupt.
R_IWDT_Restart
Clears the independent watchdog timer counter and resumes counting.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 211 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_IWDT_Create
Performs initialization necessary to control the independent watchdog timer.
[Syntax]
void
R_IWDT_Create ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 212 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_IWDT_Create_UserInit
Performs user-defined initialization relating to the independent watchdog timer.
Remark
This API function is called as the R_IWDT_Create callback routine.
[Syntax]
void
R_IWDT_Create_UserInit ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 213 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_iwdt_nmi_interrupt
Performs processing in response to the non-maskable interrupt (WUNI).
Remark
This API function is called to run interrupt processing for the non-maskable interrupt (WUNI), which is
generated when the down-counter underflows or refreshing proceeds outside the period where it is permitted.
[Syntax]
static
void
r_iwdt_nmi_interrupt ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 214 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_iwdt_iwuni_interrupt
Performs processing in response to the non-maskable/maskable interrupt.
Remark
This API function is called to run interrupt processing for the non-maskable / maskable interrupt , which is
generated when the down-counter underflows or refreshing proceeds.
[Syntax]
static
void
r_iwdt_iwuni_interrupt ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 215 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_IWDT_Restart
Clears the independent watchdog timer counter and resumes counting.
[Syntax]
void
R_IWDT_Restart ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 216 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.25 Serial communications interface (SCI)
Below is a list of API functions output by the Code Generator for serial communications interface use.
Table 3.25
API Functions: [Serial Communications Interface]
API Function Name
Function
R_SCIn_Create
Performs initialization necessary to control the serial communications
interface.
R_SCIn_Create_UserInit
Performs user-defined initialization related to the serial communications
interface.
r_scin_transmitend_interrupt
Performs processing in response to the transmit-end interrupts.
r_scin_transmit_interrupt
Performs processing in response to the transmit-data-empty interrupts.
r_scin_receiveend_interrupt
Performs processing in response to the receive-data-full interrupts.
r_scin_receiveerror_interrupt
Performs processing in response to the receive error interrupts.
R_SCIn_Start
Starts SCI communication.
R_SCIn_Stop
Ends SCI communication.
R_SCIn_Serial_Send
Starts SCI transmission (synchronous mode).
R_SCIn_Serial_Receive
Starts SCI reception (synchronous mode).
R_SCIn_Serial_Multiprocessor_Send
Starts SCI transmission (multi-processor communications function).
R_SCIn_Serial_Multiprocessor_Receive
Starts SCI reception (multi-processor communications function).
R_SCIn_Serial_Send_Receive
Starts SCI transmission/reception (clock synchronous mode).
R_SCIn_SmartCard_Send
Starts SCI transmission (smart card interface mode).
R_SCIn_SmartCard_Receive
Starts SCI reception (smart card interface mode).
R_SCIn_IIC_Master_Send
Starts SCI master transmission (simple I2C mode).
R_SCIn_IIC_Master_Receive
Starts SCI master reception (simple I2C mode).
R_SCIn_SPI_Master_Send
Starts SCI master transmission (simple SPI mode).
R_SCIn_SPI_Master_Send_Receive
Starts SCI master transmission/reception (simple SPI mode).
R_SCIn_SPI_Slave_Send
Starts SCI slave transmission (simple SPI mode).
R_SCIn_SPI_Slave_Send_Receive
Starts SCI slave transmission/reception (simple SPI mode).
R_SCIn_IIC_StartCondition
Sends the start bit.
R_SCIn_IIC_StopCondition
Sends the stop bit.
r_scin_callback_transmitend
Performs processing in response to the transmit-end interrupts.
r_scin_callback_receiveend
Performs processing in response to the receive-data-full interrupts.
r_scin_callback_receiveerror
Performs processing in response to the receive error interrupts.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 217 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_SCIn_Create
Performs initialization necessary to control the serial communication interface.
[Syntax]
void
Remark
R_SCIn_Create ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 218 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_SCIn_Create_UserInit
Performs user-defined initialization related to the serial communications interface.
Remark
This API function is called as the R_SCIn_Create callback routine.
[Syntax]
void
Remark
R_SCIn_Create_UserInit ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 219 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_scin_transmitend_interrupt
Performs processing in response to the transmit-end interrupts.
Remark
This API function is called to run interrupt processing for the transmit-end interrupts.
[Syntax]
static
Remark
void
r_scin_transmitend_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 220 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_scin_transmit_interrupt
Performs processing in response to the transmit-data-empty interrupts.
Remark
This API function is called to run interrupt processing for the transmit-data-empty interrupts.
[Syntax]
static
Remark
void
r_scin_transmit_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 221 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_scin_receiveend_interrupt
Performs processing in response to the receive-data-full interrupts.
Remark
This function is called to run interrupt processing for the receive-data-full interrupts.
[Syntax]
static
Remark
void
r_scin_receiveend_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 222 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_scin_receiveerror_interrupt
Performs processing in response to the receive error interrupts.
Remark
This API function is called to run interrupt processing for the receive error interrupts.
[Syntax]
static
Remark
void
r_scin_receiveerror_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 223 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_SCIn_Start
Starts SCI communication.
[Syntax]
void
R_SCIn_Start ( void );
Remark
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 224 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_SCIn_Stop
Ends SCI communication.
[Syntax]
void
R_SCIn_Stop ( void );
Remark
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 225 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_SCIn_Serial_Send
Starts SCI transmission (asynchronous mode).
Remarks 1.
This API function repeats the byte-level SCI transmission from the buffer specified in argument tx_buf the
number of times specified in argument tx_num.
Remarks 2.
When performing a SCI transmission, R_SCIn_Start must be called before this API function is called.
[Syntax]
#include
MD_STATUS
Remark
"r_cg_macrodriver.h"
R_SCIn_Serial_Send ( uint8_t * const tx_buf, uint16_t tx_num );
n is the channel number.
[Argument(s)]
I/O
Argument
Description
I
uint8_t * const tx_buf;
Pointer to a buffer storing the transmission data
I
uint16_t
Total amount of data to send
tx_num;
[Return value]
Macro
Description
MD_OK
Normal completion
MD_ARGERROR
Invalid argument tx_num specification
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 226 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_SCIn_Serial_Receive
Starts SCI reception (asynchronous mode).
Remarks 1.
This API function repeats SCI reception in byte units the number of times specified by the argument
rx_num and then stores the received data in the buffer at the location specified by the argument rx_buf.
Remarks 2.
When performing a SCI reception, R_SCIn_Start must be called before this API function is called.
[Syntax]
#include
MD_STATUS
Remark
"r_cg_macrodriver.h"
R_SCIn_Serial_Receive ( uint8_t * const rx_buf, uint16_t rx_num );
n is the channel number.
[Argument(s)]
I/O
Argument
Description
O
uint8_t * const rx_buf;
Pointer to a buffer to store the reception data
I
uint16_t
Total amount of data to receive
rx_num;
[Return value]
Macro
Description
MD_OK
Normal completion
MD_ARGERROR
Invalid argument rx_num specification
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 227 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_SCIn_Serial_Multiprocessor_Send
Starts SCI transmission (multi-processor communications function).
Remarks 1.
This API function repeats the byte-level SCI transmission from the buffer specified in argument tx_buf the
number of times specified in argument tx_num.
Remarks 2.
When performing a SCI transmission, R_SCIn_Start must be called before this API function is called.
[Syntax]
#include
"r_cg_macrodriver.h"
MD_STATUS
R_SCIn_Serial_Multiprocessor_Send ( uint8_t * id_buf, uint16_t id_num,
uint8_t * const tx_buf, uint16_t tx_num );
Remark
n is the channel number.
[Argument(s)]
I/O
Argument
Description
I
uint8_t *
id_buf;
Pointer to a buffer storing the transmission ID
I
uint16_t
id_num;
Total amount of ID to send
I
uint8_t * const tx_buf;
Pointer to a buffer storing the transmission data
I
uint16_t
Total amount of data to send
tx_num;
[Return value]
Macro
Description
MD_OK
Normal completion
MD_ARGERROR
Invalid argument tx_num specification
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 228 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_SCIn_Serial_Multiprocessor_Receive
Starts SCI reception (multi-processor communications function).
Remarks 1.
This API function repeats SCI reception in byte units the number of times specified by the argument
rx_num and then stores the received data in the buffer at the location specified by the argument rx_buf.
Remarks 2.
When performing a SCI reception, R_SCIn_Start must be called before this API function is called.
[Syntax]
#include
MD_STATUS
rx_num );
Remark
"r_cg_macrodriver.h"
R_SCIn_Serial_Multiprocessor_Receive ( uint8_t * const rx_buf, uint16_t
n is the channel number.
[Argument(s)]
I/O
Argument
Description
O
uint8_t * const rx_buf;
Pointer to a buffer to store the reception data
I
uint16_t
Total amount of data to receive
rx_num;
[Return value]
Macro
Description
MD_OK
Normal completion
MD_ARGERROR
Invalid argument rx_num specification
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 229 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_SCIn_Serial_Send_Receive
Starts SCI transmission/reception (clock synchronous mode).
Remarks 1.
This API function repeats SCI transmission in byte units the number of times specified by the argument
tx_num from the buffer at the location specified by the argument tx_buf.
Remarks 2.
This API function repeats SCI reception processing in byte units the number of times specified by the
argument rx_num and then stores the received data in the buffer at the location specified by the argument rx_buf.
Remarks 3.
When performing a SCI transmission/reception, R_SCIn_Start must be called before this API function is
called.
[Syntax]
#include
"r_cg_macrodriver.h"
MD_STATUS
R_SCIn_Serial_Send_Receive ( uint8_t * const tx_buf, uint16_t tx_num,
uint8_t * const rx_buf, uint16_t rx_num );
Remark
n is the channel number.
[Argument(s)]
I/O
Argument
Description
I
uint8_t * const tx_buf;
Pointer to a buffer storing the transmission data
I
uint16_t
Total amount of data to send
O
uint8_t * const rx_buf;
Pointer to a buffer to store the reception data
I
uint16_t
Total amount of data to receive
tx_num;
rx_num;
[Return value]
Macro
Description
MD_OK
Normal completion
MD_ARGERROR
Invalid argument tx_num specification
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 230 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_SCIn_SmartCard_Send
Starts SCI transmission (smart card interface mode).
Remarks 1.
This API function repeats the byte-level SCI transmission from the buffer specified in argument tx_buf the
number of times specified in argument tx_num.
Remarks 2.
When performing a SCI transmission, R_SCIn_Start must be called before this API function is called.
[Syntax]
#include
MD_STATUS
Remark
"r_cg_macrodriver.h"
R_SCIn_SmartCard_Send ( uint8_t * const tx_buf, uint16_t tx_num );
n is the channel number.
[Argument(s)]
I/O
Argument
Description
I
uint8_t * const tx_buf;
Pointer to a buffer storing the transmission data
I
uint16_t
Total amount of data to send
tx_num;
[Return value]
Macro
Description
MD_OK
Normal completion
MD_ARGERROR
Invalid argument tx_num specification
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 231 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_SCIn_SmartCard_Receive
Starts SCI reception (smart card interface mode).
Remarks 1.
This API function repeats SCI reception in byte units the number of times specified by the argument
rx_num and then stores the received data in the buffer at the location specified by the argument rx_buf.
Remarks 2.
When performing a SCI reception, R_SCIn_Start must be called before this API function is called.
[Syntax]
#include
MD_STATUS
Remark
"r_cg_macrodriver.h"
R_SCIn_SmartCard_Receive ( uint8_t * const rx_buf, uint16_t rx_num );
n is the channel number.
[Argument(s)]
I/O
Argument
Description
O
uint8_t * const rx_buf;
Pointer to a buffer to store the reception data
I
uint16_t
Total amount of data to receive
rx_num;
[Return value]
Macro
Description
MD_OK
Normal completion
MD_ARGERROR
Invalid argument rx_num specification
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 232 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_SCIn_IIC_Master_Send
Starts SCI master transmission (simple I2C mode).
Remarks 1.
This API function handles SCI master transmission to the slave device at the address specified by the
argument adr and the R/W#bit. SCI master transmission in byte units is repeated the number of times
specified by the argument tx_num from the buffer at the location specified by the argument tx_buf.
Remarks 2.
This API function internally calls R_SCIn_IIC_StartCondition to handle processing to start SCI master
transmission.
Remarks 3.
When performing a SCI master transmission, R_SCIn_Start must be called before this API function is
called.
[Syntax]
#include
"r_cg_macrodriver.h"
void
R_SCIn_IIC_Master_Send ( uint8_t adr, uint8_t * const tx_buf, uint16_t tx_num
);
Remark
n is the channel number.
[Argument(s)]
I/O
Argument
Description
I
uint8_t
I
uint8_t * const tx_buf;
Pointer to a buffer storing the transmission data
I
uint16_t
Total amount of data to send
adr;
tx_num;
Slave address
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 233 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_SCIn_IIC_Master_Receive
Starts SCI master reception (simple I2C mode).
Remarks 1.
This API function handles SCI master transmission to the slave device at the address specified by the
argument adr. SCI master reception in byte units is repeated the number of times specified by the argument rx_num and the received data are stored in the buffer at the location specified by the argument
rx_buf.
Remarks 2.
This API function internally calls R_SCIn_IIC_StartCondition to handle processing to start SCI master
reception.
Remarks 3.
When performing a SCI master reception, R_SCIn_Start must be called before this API function is called.
[Syntax]
#include
"r_cg_macrodriver.h"
void
R_SCIn_IIC_Master_Receive ( uint8_t adr, uint8_t * const rx_buf, uint16_t
rx_num );
Remark
n is the channel number.
[Argument(s)]
I/O
Argument
Description
I
uint8_t
O
uint8_t * const rx_buf;
Pointer to a buffer to store the reception data
I
uint16_t
Total amount of data to receive
adr;
rx_num;
Slave address
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 234 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_SCIn_SPI_Master_Send
Starts SCI master transmission (simple SPI mode).
Remarks 1.
This API function repeats the byte-level SCI master transmission from the buffer specified in argument
tx_buf the number of times specified in argument tx_num.
Remarks 2.
When performing a SCI master transmission, R_SCIn_Start must be called before this API function is
called.
[Syntax]
#include
MD_STATUS
Remark
"r_cg_macrodriver.h"
R_SCIn_SPI_Master_Send ( uint8_t * const tx_buf, uint16_t tx_num );
n is the channel number.
[Argument(s)]
I/O
Argument
Description
I
uint8_t * const tx_buf;
Pointer to a buffer storing the transmission data
I
uint16_t
Total amount of data to send
tx_num;
[Return value]
Macro
Description
MD_OK
Normal completion
MD_ARGERROR
Invalid argument tx_num specification
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 235 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_SCIn_SPI_Master_Send_Receive
Starts SCI master transmission/reception (simple SPI mode).
Remarks 1.
This API function repeats SCI master transmission in byte units the number of times specified by the
argument tx_num from the buffer at the location specified by the argument tx_buf.
Remarks 2.
This API function repeats SCI master reception in byte units the number of times specified by the argument rx_num and the received data are stored in the buffer at the location specified by the argument
rx_buf.
Remarks 3.
When performing a SCI master transmission/reception, R_SCIn_Start must be called before this API
function is called.
[Syntax]
#include
"r_cg_macrodriver.h"
MD_STATUS
R_SCIn_SPI_Master_Send_Receive ( uint8_t * const tx_buf, uint16_t tx_num,
uint8_t * const rx_buf, uint16_t rx_num );
Remark
n is the channel number.
[Argument(s)]
I/O
Argument
Description
I
uint8_t * const tx_buf;
Pointer to a buffer storing the transmission data
I
uint16_t
Total amount of data to send
O
uint8_t * const rx_buf;
Pointer to a buffer to store the reception data
I
uint16_t
Total amount of data to receive
tx_num;
rx_num;
[Return value]
Macro
Description
MD_OK
Normal completion
MD_ARGERROR
Invalid argument tx_num specification
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 236 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_SCIn_SPI_Slave_Send
Starts SCI slave transmission (simple SPI mode).
Remarks 1.
This API function repeats the byte-level SCI slave transmission from the buffer specified in argument
tx_buf the number of times specified in argument tx_num.
Remarks 2.
When performing a SCI slave transmission, R_SCIn_Start must be called before this API function is
called.
[Syntax]
#include
MD_STATUS
Remark
"r_cg_macrodriver.h"
R_SCIn_SPI_Slave_Send ( uint8_t * const tx_buf, uint16_t tx_num );
n is the channel number.
[Argument(s)]
I/O
Argument
Description
I
uint8_t * const tx_buf;
Pointer to a buffer storing the transmission data
I
uint16_t
Total amount of data to send
tx_num;
[Return value]
Macro
Description
MD_OK
Normal completion
MD_ARGERROR
Invalid argument tx_num specification
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 237 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_SCIn_SPI_Slave_Send_Receive
Starts SCI slave transmission/reception (simple SPI mode).
Remarks 1.
This API function repeats SCI slave transmission in byte units the number of times specified by the argument tx_num from the buffer at the location specified by the argument tx_buf.
Remarks 2.
This API function repeats SCI slave reception in byte units the number of times specified by the argument
rx_num and the received data are stored in the buffer at the location specified by the argument rx_buf.
Remarks 3.
When performing a SCI slave transmission/reception, R_SCIn_Start must be called before this API function is called.
[Syntax]
#include
"r_cg_macrodriver.h"
MD_STATUS
R_SCIn_SPI_Slave_Send_Receive ( uint8_t * const tx_buf, uint16_t tx_num,
uint8_t * const rx_buf, uint16_t rx_num );
Remark
n is the channel number.
[Argument(s)]
I/O
Argument
Description
I
uint8_t * const tx_buf;
Pointer to a buffer storing the transmission data
I
uint16_t
Total amount of data to send
O
uint8_t * const rx_buf;
Pointer to a buffer to store the reception data
I
uint16_t
Total amount of data to receive
tx_num;
rx_num;
[Return value]
Macro
Description
MD_OK
Normal completion
MD_ARGERROR
Invalid argument tx_num specification
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 238 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_SCIn_IIC_StartCondition
Sends the start bit.
Remark
This API function is called as the internal function of R_SCIn_IIC_Master_Send and
R_SCIn_IIC_Master_Receive.
[Syntax]
void
Remark
R_SCIn_IIC_StartCondition ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 239 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_SCIn_IIC_StopCondition
Sends the stop bit.
[Syntax]
void
Remark
R_SCIn_IIC_StopCondition ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 240 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_scin_callback_transmitend
Performs processing in response to the transmit-end interrupts.
Remark
This API function is called as the r_scin_transmitend_interrupt callback routine.
[Syntax]
static
Remark
void
r_scin_callback_transmitend ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 241 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_scin_callback_receiveend
Performs processing in response to the receive-data-full interrupts.
Remark
This API function is called as the r_scin_receiveend_interrupt callback routine.
[Syntax]
static
Remark
void
r_scin_callback_receiveend ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 242 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_scin_callback_receiveerror
Performs processing in response to the receive error interrupts.
Remark
This API function is called as the r_scin_receiveerror_interrupt callback routine.
[Syntax]
static
Remark
void
r_scin_callback_receiveerror ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 243 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.26 FIFO embedded serial communications interface (SCIFA)
Below is a list of API functions output by the Code Generator for FIFO embedded serial communications interface use.
Table 3.26
API Functions: [FIFO Embedded Serial Communications Interface]
API Function Name
Function
R_SCIFAn_Create
Performs initialization necessary to control the FIFO embedded serial
communications interface.
R_SCIFAn_Create_UserInit
Performs user-defined initialization relating to the FIFO embedded serial
communications interface.
r_scifan_teif_interrupt
Performs processing in response to the transmit-end interrupts.
r_scifan_txif_interrupt
Performs processing in response to the transmit FIFO data empty
interrupts.
r_scifan_rxif_interrupt
Performs processing in response to the receive FIFO data full interrupts.
r_scifan_erif_interrupt
Performs processing in response to the framing error or parity error
interrupts.
r_scifan_brif_interrupt
Performs processing in response to the break or overrun interrupts.
r_scifan_drif_interrupt
Performs processing in response to the receive data ready interrupts.
r_scifan_callback_transmitend
Performs processing in response to the transmit-end interrupts.
r_scifan_callback_receiveend
Performs processing in response to the receive FIFO data full interrupts.
r_scifan_callback_error
Performs processing in response to the error interrupts.
R_SCIFAn_Start
Starts FIFO embedded SCI communication.
R_SCIFAn_Stop
Ends FIFO embedded SCI communication.
R_SCIFAn_Serial_Send
EStarts FIFO embedded SCI transmission (asynchronous mode).
R_SCIFAn_Serial_Receive
Starts FIFO embedded SCI reception (asynchronous mode).
R_SCIFAn_Serial_Send_Receive
Starts FIFO embedded SCI transmission/reception (clock synchronous
mode).
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 244 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_SCIFAn_Create
Performs initialization necessary to control the FIFO embedded serial communications interface.
[Syntax]
void
Remark
R_SCIFAn_Create ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 245 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_SCIFAn_Create_UserInit
Performs user-defined initialization related to the FIFO embedded serial communications interface.
Remark
This API function is called as the R_SCIFAn_Create callback routine.
[Syntax]
void
Remark
R_SCIFAn_Create_UserInit ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 246 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_scifan_teif_interrupt
Performs processing in response to the transmit-end interrupts.
Remark
This API function is called to run the interrupt processing for the transmit-end interrupt.
[Syntax]
static
Remark
void
r_scifan_teif_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 247 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_scifan_txif_interrupt
Performs processing in response to the transmit FIFO data empty interrupts.
Remark
This API function is called to run the interrupt processing for the transmit FIFO data empty interrupt.
[Syntax]
static
Remark
void
r_scifan_txif_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 248 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_scifan_rxif_interrupt
Performs processing in response to the receive FIFO data full interrupts.
Remark
This API function is called to run the interrupt processing for the receive FIFO data full interrupt.
[Syntax]
static
Remark
void
r_scifan_rxif_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 249 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_scifan_erif_interrupt
Performs processing in response to the framing error or parity error interrupts.
Remark
This API function is called to run the interrupt processing for the framing error or parity error interrupt.
[Syntax]
static
Remark
void
r_scifan_erif_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 250 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_scifan_brif_interrupt
Performs processing in response to the break or overrun interrupts.
Remark
This API function is called to run the interrupt processing for the break or overrun interrupt.
[Syntax]
static
Remark
void
r_scifan_brif_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 251 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_scifan_drif_interrupt
Performs processing in response to the receive data ready interrupts.
Remark
This API function is called to run the interrupt processing for the receive data ready interrupt.
[Syntax]
static
Remark
void
r_scifan_drif_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 252 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_scifan_callback_transmitend
Performs processing in response to the transmit-end interrupts.
Remark
This API function is called as the r_scifan_teif_interrupt callback routine.
[Syntax]
static
Remark
void
r_scifan_callback_transmitend ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 253 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_scifan_callback_receiveend
Performs processing in response to the transmit-end interrupts.
Remark
This API function is called as the r_scifan_txif_interrupt callback routine.
[Syntax]
static
Remark
void
r_scifan_callback_receiveend ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 254 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_scifan_callback_error
Performs processing in response to the error interrupts.
Remark
This API function is called as the r_scifan_erif_interrupt or r_scifan_brif_interrupt callback routine.
[Syntax]
static
Remark
void
r_scifan_callback_error ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 255 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_SCIFAn_Start
Starts FIFO embedded SCI communication.
[Syntax]
void
Remark
R_SCIFAn_Start ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 256 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_SCIFAn_Stop
Ends FIFO embedded SCI communication.
[Syntax]
void
Remark
R_SCIFAn_Stop ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 257 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_SCIFAn_Serial_Send
Starts FIFO embedded SCI transmission (asynchronous mode).
Remarks 1.
This API function repeats the byte-level SCI transmission from the buffer specified in argument tx_buf the
number of times specified in argument tx_num.
Remarks 2.
When performing a SCI transmission, R_SCIFAn_Start must be called before this API function is called.
[Syntax]
MD_STATUS
Remark
R_SCIFAn_Serial_Send ( uint8_t * const tx_buf, uint16_t tx_num );
n is the channel number.
[Argument(s)]
I/O
Argument
Description
I
uint8_t * const tx_buf;
Pointer to a buffer storing the transmission data
I
uint16_t
Total amount of data to send
tx_num;
[Return value]
Macro
Description
MD_OK
Normal completion
MD_ARGERROR
Invalid argument
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 258 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_SCIFAn_Serial_Receive
Starts FIFO embedded SCI reception (asynchronous mode).
Remarks 1.
This API function repeats the byte-level SCI reception from the buffer specified in argument rx_buf the
number of times specified in argument rx_num.
Remarks 2.
When performing a SCI reception, R_SCIFAn_Start must be called before this API function is called.
[Syntax]
MD_STATUS
Remark
R_SCIFAn_Serial_Receive ( uint8_t * const rx_buf, uint16_t rx_num );
n is the channel number.
[Argument(s)]
I/O
Argument
Description
O
uint8_t * const rx_buf;
Pointer to a buffer to store the reception data
I
uint16_t
Total amount of data to receive
rx_num;
[Return value]
Macro
Description
MD_OK
Normal completion
MD_ARGERROR
Invalid argument
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 259 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_SCIFAn_Serial_Send_Receive
Starts FIFO embedded SCI transmission/reception (clock synchronous mode).
Remarks 1.
This API function repeats the byte-level SCI transmission from the buffer specified in argument tx_buf the
number of times specified in argument tx_num.
Remarks 2.
This API function repeats the byte-level SCI reception from the buffer specified in argument rx_buf the
number of times specified in argument rx_num.
Remarks 3.
When performing a SCI transmission/reception, R_SCIFAn_Start must be called before this API function
is called.
[Syntax]
MD_STATUS
R_SCIn_Serial_Send_Receive ( uint8_t * const tx_buf, uint16_t tx_num,
uint8_t * const rx_buf, uint16_t rx_num );
Remark
n is the channel number.
[Argument(s)]
I/O
Argument
Description
I
uint8_t * const tx_buf;
Pointer to a buffer storing the transmission data
I
uint16_t
Total amount of data to send
O
uint8_t * const rx_buf;
Pointer to a buffer to store the reception data
I
uint16_t
Total amount of data to receive
tx_num;
rx_num;
[Return value]
Macro
Description
MD_OK
Normal completion
MD_ARGERROR
Invalid argument
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 260 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.27 I2C bus interface (RIIC)
Below is a list of API functions output by the Code Generator for I2C bus interface use.
Table 3.27
API Functions: [I2C Bus Interface]
API Function Name
Function
R_RIICn_Create
Performs initialization necessary to control the I2C bus interface.
R_RIICn_Create_UserInit
Performs user-defined initialization relating to the I2C bus interface.
r_riicn_error_interrupt
Performs processing in response to the transfer error/event generation
interrupts (EEI).
r_riicn_receive_interrupt
Performs processing in response to the receive data full interrupts (RXI).
r_riicn_transmit_interrupt
Performs processing in response to the transmit data empty interrupts
(TXI).
r_riicn_transmitend_interrupt
Performs processing in response to the transmit end interrupts (TEI).
R_RIICn_Start
Starts RIIC communication.
R_RIICn_Stop
Ends RIIC communication.
R_RIICn_Master_Send
Starts RIIC master transmission.
R_RIICn_Master_Receive
Starts RIIC master reception.
R_RIICn_Slave_Send
Starts RIIC slave transmission.
R_RIICn_Slave_Receive
Starts RIIC slave reception.
R_RIICn_StartCondition
Issues the start condition and causes a transfer error and an event generation interrupt (EEI).
R_RIICn_StopCondition
Issues the stop condition and causes a transfer error and an event generation interrupt (EEI).
r_riicn_callback_receiveerror
Of the internal processing for transfer error/event generation interrupts
(EEI), this function handles processing specialized in the arbitration-lost
detection, NACK detection, and timeout detection.
r_riicn_callback_transmitend
Of the internal processing for transfer error/event generation interrupts
(EEI), this function handles processing specialized in the start condition
detection in response to calling of R_RIICn_Master_Send.
r_riicn_callback_receiveend
Of the interrupt processing for transfer error/event generation interrupts
(EEI), processing specialized in the start condition detection in response
to calling of R_RIICn_Master_Receive is performed.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 261 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RIICn_Create
Performs initialization necessary to control the I2C bus interface.
[Syntax]
void
Remark
R_RIICn_Create ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 262 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RIICn_Create_UserInit
Performs user-defined initialization relating to the I2C bus interface.
Remark
This API function is called as the R_RIICn_Create callback routine.
[Syntax]
void
Remark
R_RIICn_Create_UserInit ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 263 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_riicn_error_interrupt
Performs processing in response to the transfer error/event generation interrupts (EEI).
Remark
This API function is called to run interrupt processing for the transfer error/event generation interrupts
(EEI), which are generated when the I2C bus interface detects the transfer error/event generation (arbitration-lost, NACK, timeout, start condition, and stop condition).
[Syntax]
static
Remark
void
r_riicn_error_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 264 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_riicn_receive_interrupt
Performs processing in response to the receive data full interrupts (RXI).
Remark
This API function is called to run interrupt processing for the receive data full interrupts (RXI).
[Syntax]
static
Remark
void
r_riicn_receive_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 265 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_riicn_transmit_interrupt
Performs processing in response to the transmit data empty interrupts (TXI).
Remark
This function is called to run interrupt processing for the transmit data empty interrupts (TXI).
[Syntax]
static
Remark
void
r_riicn_transmit_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 266 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_riicn_transmitend_interrupt
Performs processing in response to the transmit end interrupts (TEI).
Remark
This API function is called to run interrupt processing for the transmit end interrupts (TEI).
[Syntax]
static
Remark
void
r_riicn_transmitend_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 267 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RIICn_Start
Starts RIIC communication.
[Syntax]
void
Remark
R_RIICn_Start ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 268 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RIICn_Stop
Ends RIIC communication.
[Syntax]
void
R_RIICn_Stop ( void );
Remark
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 269 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RIICn_Master_Send
Starts RIIC master transmission.
Remarks 1.
This API function handles RIIC master transmission to the slave device at the address specified by the
argument adr and the R/W#bit. RIIC master transmission in byte units is repeated the number of times
specified by the argument tx_num from the buffer at the location specified by the argument tx_buf.
Remarks 2.
This API function internally calls R_RIICn_StartCondition to handle processing to start RIIC master transmission.
Remarks 3.
When performing a RIIC master transmission, R_RIICn_Start must be called before this API function is
called.
[Syntax]
#include
MD_STATUS
);
Remark
"r_cg_macrodriver.h"
R_RIICn_Master_Send ( uint8_t adr, uint8_t * const tx_buf, uint16_t tx_num
n is the channel number.
[Argument(s)]
I/O
Argument
Description
I
uint8_t
I
uint8_t * const tx_buf;
Pointer to a buffer storing the transmission data
I
uint16_t
Total amount of data to send
adr;
tx_num;
Slave address
[Return value]
Macro
Description
MD_OK
Normal completion
MD_ERROR1
Bus busy
MD_ERROR2
Invalid argument adr specification
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 270 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RIICn_Master_Receive
Starts RIIC master reception.
Remarks 1.
This API function handles RIIC master transmission to the slave device at the slave address specified by
the argument adr. RIIC master reception in byte units is repeated the number of times specified by the
argument rx_num and the received data are stored in the buffer at the location specified by the argument
rx_buf.
Remarks 2.
This API function internally calls R_RIICn_StartCondition to handle processing to start RIIC master
reception.
Remarks 3.
When performing a RIIC master reception, R_RIICn_Start must be called before this API function is
called.
[Syntax]
#include
MD_STATUS
rx_num );
Remark
"r_cg_macrodriver.h"
R_RIICn_Master_Receive ( uint8_t adr, uint8_t * const rx_buf, uint16_t
n is the channel number.
[Argument(s)]
I/O
Argument
Description
I
uint8_t
O
uint8_t * const rx_buf;
Pointer to a buffer to store the reception data
I
uint16_t
Total amount of data to receive
adr;
rx_num;
Slave address
[Return value]
Macro
Description
MD_OK
Normal completion
MD_ERROR1
Bus busy
MD_ERROR2
Invalid argument adr specification
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 271 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RIICn_Slave_Send
Starts RIIC slave transmission.
Remarks 1.
This API function repeats the byte-level RIIC slave transmission from the buffer specified in argument
tx_buf the number of times specified in argument tx_num.
Remarks 2.
When performing a RIIC slave transmission, R_RIICn_Start must be called before this API function is
called.
[Syntax]
#include
"r_cg_macrodriver.h"
void
R_RIICn_Slave_Send ( uint8_t * const tx_buf, uint16_t tx_num );
Remark
n is the channel number.
[Argument(s)]
I/O
Argument
Description
I
uint8_t * const tx_buf;
Pointer to a buffer storing the transmission data
I
uint16_t
Total amount of data to send
tx_num;
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 272 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RIICn_Slave_Receive
Starts RIIC slave reception.
Remarks 1.
This API function performs byte-level RIIC slave reception the number of times specified by the argument
rx_num, and stores the data in the buffer specified by the argument rx_buf.
Remarks 2.
When performing a RIIC slave reception, R_RIICn_Start must be called before this API function is called.
[Syntax]
#include
"r_cg_macrodriver.h"
void
R_RIICn_Slave_Receive ( uint8_t * const rx_buf, uint16_t rx_num );
Remark
n is the channel number.
[Argument(s)]
I/O
Argument
Description
O
uint8_t * const rx_buf;
Pointer to a buffer to store the reception data
I
uint16_t
Total amount of data to receive
rx_num;
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 273 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RIICn_StartCondition
Issues the start condition and causes a transfer error and an event generation interrupt (EEI).
Remarks 1.
This API function is called as the internal function of R_RIICn_Master_Send and
R_RIICn_Master_Receive.
Remarks 2.
r_riicn_error_interrupt is called in response to calling of this API function.
[Syntax]
void
Remark
R_RIICn_StartCondition ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 274 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RIICn_StopCondition
Issues the stop condition and causes a transfer error and an event generation interrupt (EEI).
Remark
r_riicn_error_interrupt is called in response to calling of this API function.
[Syntax]
void
Remark
R_RIICn_StopCondition ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 275 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_riicn_callback_receiveerror
Of the internal processing for transfer errors and event generation interrupts (EEI), this function handles processing
specialized in the arbitration-lost detection, NACK detection, and timeout detection.
Remark
This API function is called as the r_riicn_error_interrupt callback routine.
[Syntax]
#include
"r_cg_macrodriver.h"
static void
r_riicn_callback_receiveerror ( MD_STATUS status );
Remark
n is the channel number.
[Argument(s)]
I/O
I
Argument
MD_STATUS status;
Description
Source of the transfer errors and event generation interrupts
MD_ERROR1:
Arbitration-lost detection
MD_ERROR2:
Timeout detection
MD_ERROR3:
NACK detection
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 276 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_riicn_callback_transmitend
Of the internal processing for transfer errors and event generation interrupts (EEI), this function handles processing
specialized in the start condition detection in response to calling of R_RIICn_Master_Send.
Remark
This API function is called as the r_riicn_error_interrupt callback routine.
[Syntax]
static
Remark
void
r_riicn_callback_transmitend ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 277 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_riicn_callback_receiveend
Of the internal processing for transfer errors and event generation interrupts (EEI), this function handles processing
specialized in the start condition detection in response to calling of R_RIICn_Master_Receive.
Remark
This API function is called as the r_riicn_error_interrupt callback routine.
[Syntax]
static
Remark
void
r_riicn_callback_receiveend ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 278 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.28 Serial peripheral interface (RSPI)
Below is a list of API functions output by the Code Generator for serial peripheral interface use.
Table 3.28
API Functions: [Serial Peripheral Interface]
API Function Name
Function
R_RSPIn_Create
Performs initialization necessary to control the serial peripheral
interface.
R_RSPIn_Create_UserInit
Performs user-defined initialization relating to the serial peripheral
interface.
r_rspin_receive_interrupt
Performs processing in response to the receive buffer full interrupts.
r_rspin_transmit_interrupt
Performs processing in response to the transmit buffer error interrupts.
r_rspin_error_interrupt
Performs processing in response to the RSPI error interrupts.
r_rspin_idle_interrupt
Performs processing in response to the RSPI idle interrupts.
R_RSPIn_Start
Starts RSPI communication.
R_RSPIn_Stop
Ends RSPI communication.
R_RSPIn_Send
Starts RSPI transmission.
R_RSPIn_Send_Receive
Starts RSPI transmission/reception.
r_rspin_callback_receiveend
Performs processing in response to the receive buffer full interrupts.
r_rspin_callback_error
Performs processing in response to the RSPI error interrupts.
r_rspin_callback_transmitend
Performs processing in response to the RSPI idle interrupts.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 279 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RSPIn_Create
Performs initialization necessary to control the serial peripheral interface.
[Syntax]
void
Remark
R_RSPIn_Create ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 280 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RSPIn_Create_UserInit
Performs user-defined initialization relating to the serial peripheral interface.
Remark
This API function is called as the R_RSPIn_Create callback routine.
[Syntax]
void
Remark
R_RSPIn_Create_UserInit ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 281 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_rspin_receive_interrupt
Performs processing in response to the receive buffer full interrupts.
Remark
This API function is called to run interrupt processing for the receive buffer full interrupt.
[Syntax]
static
Remark
void
r_rspin_receive_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 282 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_rspin_transmit_interrupt
Performs processing in response to the transmit buffer empty interrupts.
Remark
This API function is called to run interrupt processing for the transmit buffer empty interrupts.
[Syntax]
static
Remark
void
r_rspin_transmit_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 283 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_rspin_error_interrupt
Performs processing in response to the RSPI error interrupts.
Remark
This API function is called to run interrupt processing for the RSPI error interrupts.
[Syntax]
static
Remark
void
r_rspin_error_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 284 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_rspin_idle_interrupt
Performs processing in response to the RSPI idle interrupts.
Remark
This API function is called to run interrupt processing for the RSPI idle interrupts.
[Syntax]
static
Remark
void
r_rspin_idle_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 285 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RSPIn_Start
Starts RSPI communication.
[Syntax]
void
Remark
R_RSPIn_Start ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 286 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RSPIn_Stop
Ends RSPI communication.
[Syntax]
void
R_RSPIn_Stop ( void );
Remark
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 287 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RSPIn_Send
Starts RSPI transmission.
Remarks 1.
This API function repeats the byte-level RSPI transmission from the buffer specified in argument tx_buf
the number of times specified in argument tx_num.
Remarks 2.
When performing a RSPI transmission, R_RSPIn_Start must be called before this API function is called.
[Syntax]
#include
MD_STATUS
Remark
"r_cg_macrodriver.h"
R_RSPIn_Send ( uint8_t * const tx_buf, uint16_t tx_num );
n is the channel number.
[Argument(s)]
I/O
Argument
Description
I
uint8_t * const tx_buf;
Pointer to a buffer storing the transmission data
I
uint16_t
Total amount of data to send
tx_num;
[Return value]
Macro
Description
MD_OK
Normal completion
MD_ARGERROR
Invalid argument tx_num specification
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 288 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_RSPIn_Send_Receive
Starts RSPI transmission/reception.
Remarks 1.
This API function repeats RSPI transmission in byte units the number of times specified by the argument
tx_num from the buffer at the location specified by the argument tx_buf.
Remarks 2.
This API function repeats RSPI reception processing in byte units the number of times specified by the
argument tx_num and then stores the received data in the buffer at the location specified by the argument rx_buf.
Remarks 3.
When performing a RSPI transmission/reception, R_RSPIn_Start must be called before this API function
is called.
[Syntax]
#include
"r_cg_macrodriver.h"
MD_STATUS
R_RSPIn_Send_Receive ( uint8_t * const tx_buf, uint16_t tx_num, uint8_t *
const rx_buf );
Remark
n is the channel number.
[Argument(s)]
I/O
Argument
Description
I
uint8_t * const tx_buf;
Pointer to a buffer storing the transmission data
I
uint16_t
Total amount of data to send/receive
O
uint8_t * const rx_buf;
tx_num;
Pointer to a buffer to store the reception data
[Return value]
Macro
Description
MD_OK
Normal completion
MD_ARGERROR
Invalid argument tx_num specification
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 289 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_rspin_callback_receiveend
Performs processing in response to the receive buffer full interrupts.
Remark
This API function is called as the r_rspin_receive_interrupt callback routine.
[Syntax]
static
Remark
void
r_rspin_callback_receiveend ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 290 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_rspin_callback_error
Performs processing in response to the RSPI error interrupts.
Remark
This API function is called as the r_rspin_error_interrupt callback routine.
[Syntax]
static
Remark
void
r_rspin_callback_error ( uint8_t err_type );
n is the channel number.
[Argument(s)]
I/O
O
Argument
uint8_t err_type;
Description
Source of the RSPI error interrupt (x is undefined)
xxxx00x1B:
Overrun error detection
xxxx01x0B:
Mode fault error detection
xxxx10x0B:
Parity error detection
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 291 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_rspin_callback_transmitend
Performs processing in response to the RSPI idle interrupts.
Remark
This API function is called as the r_rspin_idle_interrupt callback routine.
[Syntax]
static
Remark
void
r_rspin_callback_transmitend ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 292 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.29 CRC calculator (CRC)
Below is a list of API functions output by the Code Generator for CRC calculator use.
Table 3.29
API Functions: [CRC calculator]
API Function Name
Function
R_CRC_SetCRC8
Initializes the CRC calculator for 8-bit CRC calculation (CRC generating polynomial: X8 + X2 + X + 1).
R_CRC_SetCRC16
Initializes the CRC calculator for 16-bit CRC calculation (CRC generating polynomial: X16 + X15 + X2 + 1).
R_CRC_SetCCITT
Initializes the CRC calculator for 16-bit CRC calculation (CRC generating polynomial: X16 + X12 + X5 + 1).
R_CRC_Input_Data
Sets the initial value of the data from which the CRC is to be calculated.
R_CRC_Get_Result
Gets the result of operation.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 293 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_CRC_SetCRC8
Initializes the CRC calculator for 8-bit CRC calculation (CRC generating polynomial: X8 + X2 + X + 1).
[Syntax]
#include
"r_cg_crc.h"
void
R_CRC_SetCRC8 ( crc_bitorder order );
[Argument(s)]
I/O
I
Argument
crc_bitorder
order;
Description
CRC calculation switching type
CRC_LSB:
LSB-first
CRC_MSB:
MSB-first
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 294 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_CRC_SetCRC16
Initializes the CRC calculator for 16-bit CRC calculation (CRC generating polynomial: X16 + X15 + X2 + 1).
[Syntax]
#include
"r_cg_crc.h"
void
R_CRC_SetCRC16 ( crc_bitorder order );
[Argument(s)]
I/O
I
Argument
crc_bitorder
order;
Description
CRC calculation switching type
CRC_LSB:
LSB-first
CRC_MSB:
MSB-first
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 295 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_CRC_SetCCITT
Initializes the CRC calculator for the 16-bit CRC calculation (CRC generating polynomial: X16 + X12 + X5 + 1).
[Syntax]
#include
"r_cg_crc.h"
void
R_CRC_SetCCITT ( crc_bitorder order );
[Argument(s)]
I/O
I
Argument
crc_bitorder
order;
Description
CRC calculation switching type
CRC_LSB:
LSB-first
CRC_MSB:
MSB-first
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 296 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_CRC_Input_Data
Sets the initial value of the data from which the CRC is to be calculated.
[Syntax]
#include
"r_cg_macrodriver.h"
void
R_CRC_Input_Data ( uint8_t data );
[Argument(s)]
I/O
I
Argument
uint8_t data;
Description
The initial value of the data from which the CRC is to be calculated
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 297 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_CRC_Get_Result
Gets the result of operation.
[Syntax]
#include
"r_cg_macrodriver"
void
R_CRC_Get_Result ( uint8_t * const result );
[Argument(s)]
I/O
O
Argument
uint8_t * const result;
Description
Pointer to the location where the result of operation is stored
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 298 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.30 12-bit A/D converter (S12AD)
Below is a list of API functions output by the Code Generator for 12-bit A/D converter use.
Table 3.30
API Functions: [12-Bit A/D Converter]
API Function Name
Function
R_S12ADn_Create
Performs initialization necessary to control the 12-bit A/D converter.
R_S12ADn_Create_UserInit
Performs user-defined initialization relating to the 12-bit A/D converter.
r_s12adn_interrupt
Performs processing in response to the A/D scan end interrupt.
r_s12adn_groupb_interrupt
Performs processing in response to the group B scan end interrupt.
R_S12ADn_Start
Starts A/D conversion.
R_S12ADn_Stop
Ends A/D conversion.
R_S12ADn_Get_ValueResult
Gets the result of conversion.
R_S12ADn_Set_CompareValue
Sets compare level.
r_s12adn_compare_interrupt
Performs processing in response to the compare interrupt.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 299 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_S12ADn_Create
Performs initialization necessary to control the 12-bit A/D converter.
[Syntax]
void
Remark
R_S12ADn_Create ( void );
n is the unit number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 300 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_S12ADn_Create_UserInit
Performs user-defined initialization relating to the 12-bit A/D converter.
Remark
This API function is called as the R_S12ADn_Create callback routine.
[Syntax]
void
Remark
R_S12ADn_Create_UserInit ( void );
n is the unit number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 301 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_s12adn_interrupt
Performs processing in response to the A/D scan end interrupt.
Remark
This API function is called to run interrupt processing for the A/D scan end interrupt, which is generated
on completion of scanning of the analog inputs.
[Syntax]
static
Remark
void
r_s12adn_interrupt ( void );
n is the unit number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 302 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_s12adn_groupb_interrupt
Performs processing in response to the group B scan end interrupt.
Remark
This function is called to run interrupt processing for the group B scan end interrupt, which is generated
when scanning of the analog inputs allocated to group B is completed.
[Syntax]
static
Remark
void
r_s12adn_groupb_interrupt ( void );
n is the unit number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 303 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_S12ADn_Start
Starts A/D conversion.
[Syntax]
void
Remark
R_S12ADn_Start ( void );
n is the unit number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 304 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_S12ADn_Stop
Ends A/D conversion.
[Syntax]
void
Remark
R_S12ADn_Stop ( void );
n is the unit number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 305 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_S12ADn_Get_ValueResult
Gets the result of conversion.
[Syntax]
#include
"r_cg_macrodriver.h"
#include
"r_cg_s12ad.h"
void
R_S12ADn_Get_ValueResult ( ad_channel_t channel, uint16_t * const buffer );
Remark
n is the unit number.
[Argument(s)]
I/O
I
O
Argument
ad_channel_t
uint16_t
channel;
* const buffer;
Description
Channel number
ADCHANNEL0:
ADCHANNEL1:
ADCHANNEL2:
ADCHANNEL3:
ADCHANNEL4:
ADCHANNEL6:
ADCHANNEL8:
ADCHANNEL9:
ADCHANNEL10:
ADCHANNEL11:
ADCHANNEL12:
ADCHANNEL13:
ADCHANNEL14:
ADCHANNEL15:
ADTEMPSENSOR:
ture sensor output)
ADINTERREFVOLT:
erence voltage)
Input channel AN000
Input channel AN001
Input channel AN002
Input channel AN003
Input channel AN004
Input channel AN006
Input channel AN008
Input channel AN009
Input channel AN010
Input channel AN011
Input channel AN012
Input channel AN013
Input channel AN014
Input channel AN015
Extended analog input (temperaExtended analog input (internal ref-
Pointer to the area where the results of conversion are stored
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 306 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_S12ADn_Set_CompareValue
Sets compare level.
[Syntax]
void
R_S12ADn_Set_CompareValue ( ad_channel_t
reg_value1 );
Remark
reg_value0,
rad_channel_t
n is the unit number.
[Argument(s)]
I/O
Argument
Description
I
ad_chanel_t
reg_value0
Register value set to the compare revel register 0
I
ad_chanel_t
reg_value1
Register value set to the compare revel register 1
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 307 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_s12adn_compare_interrupt
Performs processing in response to the compare interrupt.
Remark
This API function is called to run the interrupt processing for the compare interrupt.
[Syntax]
void
Remark
r_s12adn_compare_interrupt ( void );
n is the unit number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 308 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.31 D/A converter (DA)
Below is a list of API functions output by the Code Generator for D/A converter use.
Table 3.31
API Functions: [D/A Converter]
API Function Name
Function
R_DA_Create
Performs initialization necessary to control the D/A converter.
R_DA_Create_UserInit
Performs user-defined initialization relating to the D/A converter.
R_DAm_Start
Starts D/A conversion.
R_DAm_Stop
Ends D/A conversion.
R_DAm_Set_ConversionValue
Sets the data for D/A conversion.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 309 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_DA_Create
Performs initialization necessary to control the D/A converter.
[Syntax]
void
R_DA_Create ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 310 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_DA_Create_UserInit
Performs user-defined initialization relating to the D/A converter.
Remark
This API function is called as the R_DA_Create callback routine.
[Syntax]
void
R_DA_Create_UserInit ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 311 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_DAm_Start
Starts D/A conversion.
[Syntax]
void
Remark
R_DAm_Start ( void );
m is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 312 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_DAm_Stop
Ends D/A conversion.
[Syntax]
void
Remark
R_DAm_Stop ( void );
m is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 313 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_DAm_Set_ConversionValue
Sets the data for D/A conversion.
[Syntax]
#include
"r_cg_macrodriver.h"
void
R_DAm_Set_ConversionValue ( uint16_t reg_value );
Remark
m is the channel number.
[Argument(s)]
I/O
I
Argument
uint16_t
reg_value;
Description
Data for D/A conversion
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 314 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.32 12-bit converter (R12DA)
Below is a list of API functions output by the Code Generator for 12-bit D/A converter use.
Table 3.32
API Functions: [12-Bit D/A Converter]
API Function Name
Function
R_R12DA_Create
Performs initialization necessary to control the 12-bit D/A converter.
R_DA_Create_UserInit
Performs user-defined initialization relating to the 12-bit D/A converter.
R_R12DAn_Start
Starts D/A conversion.
R_R12DAn_Stop
Ends D/A conversion.
R_R12DAn_Start
Starts synchronous D/A conversion.
R_R12DAn_Stop
Ends synchronous D/A conversion.
R_R12DAn_Set_ConversionValue
Sets the data for D/A conversion.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 315 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_R12DA_Create
Performs initialization necessary to control the 12-bit D/A converter.
[Syntax]
void
R_R12DA_Create ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 316 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_DA_Create_UserInit
Performs user-defined initialization relating to the 12-bit D/A converter.
Remark
This API function is called as the R_R12DA_Create callback routine.
[Syntax]
void
R_R12DA_Create_UserInit ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 317 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_R12DAn_Start
Starts 12-bit D/A conversion.
[Syntax]
void
Remark
R_R12DAn_Start ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 318 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_R12DAn_Stop
Ends 12-bit D/A conversion.
[Syntax]
void
Remark
R_R12DAn_Stop ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 319 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_R12DA_sync_Start
Starts synchronous 12-bit D/A conversion.
[Syntax]
void
R_R12DA_sync_Start ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 320 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_R12DA_sync_Stop
Ends synchronous 12-bit D/A conversion.
[Syntax]
void
R_R12DA_sync_Stop ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 321 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_R12DAn_Set_ConversionValue
Sets the data for 12-bit D/A conversion.
[Syntax]
void
Remark
R_R12DAn_Set_ConversionValue ( uint16_t reg_value );
n is the channel number.
[Argument(s)]
I/O
I
Argument
uint16_t
reg_value;
Description
Data for 12-bit D/A conversion
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 322 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.33 Comparator B (CMPB)
Below is a list of API functions output by the Code Generator for Comparator B use.
Table 3.33
API Functions: [Comparator B]
API Function Name
Function
R_CMPB_Create
Performs initialization necessary to control the Comparator B.
R_CMPB_Create_UserInit
Performs user-defined initialization relating to the Comparator B.
r_cmpb_cmpbn_interrupt
Performs processing in response to the comparator B interrupt.
R_CMPBn_Start
Starts comparison for analog input voltage.
R_CMPBn_Stop
Ends comparison for analog input voltage.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 323 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_CMPB_Create
Performs initialization necessary to control the Comparator B.
[Syntax]
void
R_CMPB_Create ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 324 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_CMPB_Create_UserInit
Performs user-defined initialization relating to the Comparator B.
Remark
This API function is called as the R_CMPB_Create callback routine.
[Syntax]
void
R_CMPB_Create_UserInit ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 325 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_cmpb_cmpbn_interrupt
Performs processing in response to the comparator B interrupt.
Remark
This API function is called to run interrupt processing for the comparator Bn interrupt, which is generated
when the comparison result changes at this time.
[Syntax]
void
Remark
r_cmpb_cmpbn_interrupt ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 326 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_CMPBn_Start
Starts comparison for analog input voltage.
[Syntax]
void
Remark
R_CMPBn_Start ( void );
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 327 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_CMPBn_Stop
Ends comparison for analog input voltage.
[Syntax]
void
R_CMPBn_Stop ( void );
Remark
n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 328 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
3.2.34 Data operation circuit (DOC)
Below is a list of API functions output by the Code Generator for data operation circuit.
Table 3.34
API Functions: [Data Operation Circuit]
API Function Name
Function
R_DOC_Create
Performs initialization necessary to control the data operation circuit.
R_DOC_Create_UserInit
Performs user-defined initialization relating to the data operation circuit.
r_doc_dopcf_interrupt
Performs processing in response to the data operation circuit interrupt.
R_DOC_SetMode
Sets the operating mode and the initial value of the reference value for use by
the data operation circuit.
R_DOC_WriteData
Sets the input value (value for comparison with, addition to, or subtraction from
the reference value) for use by the data operation circuit.
R_DOC_GetResult
Gets the result of operation.
R_DOC_ClearFlag
Clears the data operation circuit flag.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 329 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_DOC_Create
Performs initialization necessary to control the data operation circuit.
[Syntax]
void
R_DOC_Create ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 330 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_DOC_Create_UserInit
Performs user-defined initialization relating to the data operation circuit.
Remark
This API function is called as the R_DOC_Create callback routine.
[Syntax]
void
R_DOC_Create_UserInit ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 331 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
r_doc_dopcf_interrupt
Performs processing in response to the data operation circuit interrupt.
Remark
This API function is called to run interrupt processing for the data operation circuit interrupt, which is generated when the result of data comparison satisfies the condition for detection, the result of addition is
greater than 0xFFFF, or the result of subtraction is less than 0x00.
[Syntax]
static
void
r_doc_dopcf_interrupt ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 332 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_DOC_SetMode
Sets the operating mode and the initial value of the reference value for use by the data operation circuit.
Remarks 1.
When COMPARE_MISMATCH or COMPARE_MATCH (data comparison mode) is specified as the mode
of operation, the 16-bit reference value is stored in the DOC data setting register (DODSR).
Remarks 2.
When ADDITION (data addition mode) or SUBTRACTION (data subtraction mode) is specified for the
mode (operation mode), the 16-bit value is stored in the DOC data setting register (DODSR) as the initial
value.
[Syntax]
#include
"r_cg_macrodriver.h"
#include
"r_cg_doc.h"
void
R_DOC_SetMode ( doc_mode_t mode, uint16_t value );
[Argument(s)]
I/O
Argument
Description
I
doc_mode_t
mode;
Operating modes (including the condition for detection)
COMPARE_MISMATCH:
Data comparison mode
(mismatch)
COMPARE_MATCH:
Data comparison mode
(match)
ADDITION:
Data addition mode
SUBTRACTION:
Data subtraction mode
I
uint16_t
value;
Initial value of the reference value for use by the DOC
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 333 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_DOC_WriteData
Sets the value for comparison with, addition to, or subtraction from the reference value.
[Syntax]
#include
"r_cg_macrodriver.h"
void
R_DOC_WriteData ( uint16_t data );
[Argument(s)]
I/O
I
Argument
uint16_t
data;
Description
Input data for use in operation
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 334 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_DOC_GetResult
Gets the result of operation.
[Syntax]
#include
"r_cg_macrodriver"
void
R_DOC_GetResult ( uint16_t * const data );
[Argument(s)]
I/O
O
Argument
uint16_t
* const data;
Description
Pointer to the location where the result of operation is to be
stored
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 335 of 340
Application Leading Tool
第 3 章 API FUNCTIONS
R_DOC_ClearFlag
Clears the data operation circuit flag.
[Syntax]
void
R_DOC_ClearFlag ( void );
[Argument(s)]
None.
[Return value]
None.
R20UT3126EJ0100 Rev.1.00
Aug 01, 2014
Page 336 of 340
Revision Record
Rev.
Date
Description
Page
1.00
Aug 01, 2014
-
Summary
First Edition issued
Application Leading Tool User's Manual:
RX Design
Publication Date:
Rev.1.00
Aug 01, 2014
Published by:
Renesas Electronics Corporation
http://www.renesas.com
SALES OFFICES
Refer to "http://www.renesas.com/" for the latest and detailed information.
Renesas Electronics America Inc.
2801 Scott Boulevard Santa Clara, CA 95050-2549, 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 Düsseldorf, Germany
Tel: +49-211-6503-0, Fax: +49-211-6503-1327
Renesas Electronics (China) Co., Ltd.
Room 1709, Quantum Plaza, No.27 ZhiChunLu Haidian District, Beijing 100191, P.R.China
Tel: +86-10-8235-1155, Fax: +86-10-8235-7679
Renesas Electronics (Shanghai) Co., Ltd.
Unit 301, Tower A, Central Towers, 555 Langao Road, Putuo District, Shanghai, P. R. China 200333
Tel: +86-21-2226-0888, Fax: +86-21-2226-0999
Renesas Electronics Hong Kong Limited
Unit 1601-1613, 16/F., Tower 2, Grand Century Place, 193 Prince Edward Road West, Mongkok, Kowloon, Hong Kong
Tel: +852-2265-6688, Fax: +852 2886-9022/9044
Renesas Electronics Taiwan Co., Ltd.
13F, No. 363, Fu Shing North Road, Taipei 10543, Taiwan
Tel: +886-2-8175-9600, Fax: +886 2-8175-9670
Renesas Electronics Singapore Pte. Ltd.
80 Bendemeer Road, Unit #06-02 Hyflux Innovation Centre, Singapore 339949
Tel: +65-6213-0200, Fax: +65-6213-0300
Renesas Electronics Malaysia Sdn.Bhd.
Unit 906, Block B, Menara Amcorp, Amcorp Trade Centre, No. 18, Jln Persiaran Barat, 46050 Petaling Jaya, Selangor Darul Ehsan, Malaysia
Tel: +60-3-7955-9390, Fax: +60-3-7955-9510
Renesas Electronics Korea Co., Ltd.
12F., 234 Teheran-ro, Gangnam-Ku, Seoul, 135-920, Korea
Tel: +82-2-558-3737, Fax: +82-2-558-5141
© 2014 Renesas Electronics Corporation and Renesas Solutions Corp. All rights reserved.
Colophon 3.0
Application Leading Tool
R20UT3126EJ0100
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement