Résumé du contenu de la page N° 1
REJ10J1502-0101
Renesas Embedded
Application Programming Interface
Reference manual
Rev.1.01
Feb 16, 2007 www.renesas.com
Résumé du contenu de la page N° 2
REVISION HISTORY Summary Rev. Date 1.00 06.04.07 1.01 ・ Additions and corrections made for support of libraries for the H8/36094, H8/36077, 07.02.16 H8/36109, and R8C/24 and 25 ・ Unnecessary periods in Chapter 1, “Instruction,” deleted ・ Port P73 of H8 deleted ・ Channels A–D written in CreateInputCapture corrected to input captures A–D ・ Error in writing “seroal” corrected to “serial” ・ Erroneous description of RAPI_70_STATES corrected ・ Error in writing of timer channel names corre
Résumé du contenu de la page N° 3
・ Description of third argument in __CreateInputCapture corrected ・ Wording “specified” unified to “specified” ・ RAPI_BOTH deleted from the description of timer B1 count edges of H8/300H in __CreateEventCounter ・ RAPI_FTIOA and RAPI_FTIOB added to __CreatePulsePeriodMeasurementMode and __CreatePulseWidthMeasurementMode ・ All occurrences of the word “Tiny” deleted ・ Description of second argument added to __GetPulsePeriodMeasurementMode, __GetPulseWidthMeasurementMode, and __GetEvent
Résumé du contenu de la page N° 4
・ RAPI_AN30, RAPI_AN31, RAPI_AN32, and RAPI_P9_GROUP added to the item for data1 of M16C in __CreateADC ・ RAPI_AN30, RAPI_AN31, RAPI_AN32, and RAPI_P9_GROUP added to the item for data1 of M16C in __EnableADC ・ Error in writing of H8/300H interrupt set values in __CreateOutputCompare corrected ・ Error in writing of timer RD and timer RD symbol name corrected ・ Description of gate function of M16C in __CreateEventCounter deleted ・ Description of H8/300H noise rejection function in __Bas
Résumé du contenu de la page N° 5
Table of Contents Table of Contents ................................................................5 1. Introduction................................................................... 8 2. Driver ....................................................................... 9 2.1 Overview.................................................................. 9 2.2 Driver Features............................................................ 10 2.3 Serial Interface Driver..............................
Résumé du contenu de la page N° 6
__CreateTimer ........................................................... 54 __EnableTimer ........................................................... 60 __DestroyTimer .......................................................... 62 __CreateEventCounter ..................................................... 64 __EnableEventCounter..................................................... 69 __DestroyEventCounter .................................................... 71 __GetEventCounter.............
Résumé du contenu de la page N° 7
__GetADC ............................................................. 197 __GetADCAll........................................................... 198 __GetADCStatus......................................................... 199 __ClearADCStatus ....................................................... 200 Rev.1.01 2007.02.16 7 RJJ10J1643-0101
Résumé du contenu de la page N° 8
1. Introduction The Renesas Embedded Application Programming Interface (API) is a unified API for the microcomputers made by Renesas Technology Corporation. Rev.1.01 2007.02.16 8 RJJ10J1643-0101
Résumé du contenu de la page N° 9
2. Driver 2.1 Overview The library described herein provides a peripheral facility control program (peripheral driver) for microcomputers. Use of the Renesas API permits the peripheral driver to be built into a user program. Configuration of Renesas APIs is shown below. File name Description rapi_xxx_yyy.lib This is the Renesas API library file. To use (xxx = family name, yyy = series name) Renesas APIs, specify this file as input file for the linker. rapi_ad_xxx_yyy.h This is the he
Résumé du contenu de la page N° 10
2.2 Driver Features The library described herein has the following features available as a peripheral driver. (1) Serial I/O control feature It comprises a serial interface driver, which sets or clears the conditions of serial communication, as well as controls and manages the transmission/reception of communication data. (2) Timer control feature It comprises a timer driver, which sets or clears the operating conditions of timers, as well as controls the timer operation. (3) I/O
Résumé du contenu de la page N° 11
2.3 Serial Interface Driver The serial interface driver sets serial communication, clears settings, transmit/receives data, and controls the status of serial communication. There are two kinds of serial interface driver: a single-data transmission/reception API and a multi-data transmission/reception API. Rev.1.01 2007.02.16 11 RJJ10J1643-0101
Résumé du contenu de la page N° 12
2.4 Timer Driver The timer driver sets the timer, clears timer settings, controls timer operation, and acquires a counter value with respect to the following modes: • Timer mode • Event counter mode • Pulse width modulation mode (PWM mode) • Pulse period measurement mode • Pulse width measurement mode • Input capture mode • Output compare mode 2.4.1 Timer Mode In this mode, the timer counts the internally generated count source. When an underflow or an overflow interrupt occurs,
Résumé du contenu de la page N° 13
2.4.7 Output Compare Mode In this mode, the timer generates an interrupt request when the timer counter and a comparison value match. When a compare match interrupt or an underflow or an overflow interrupt occurs, it calls a preset callback function. Rev.1.01 2007.02.16 13 RJJ10J1643-0101
Résumé du contenu de la page N° 14
2.5 I/O Port Driver The I/O port driver sets the I/O port for input or output, writes data to the I/O port, and reads data from the I/O port. Rev.1.01 2007.02.16 14 RJJ10J1643-0101
Résumé du contenu de la page N° 15
2.6 External Interrupt Driver The external interrupt driver sets external interrupts, controls external interrupts, acquires the status of external interrupt flags, and clears external interrupt flags. Rev.1.01 2007.02.16 15 RJJ10J1643-0101
Résumé du contenu de la page N° 16
2.7 A/D Converter Driver The A/D converter driver sets the A/D converter, controls the A/D converter, clears settings of the A/D converter, acquires the A/D converter value, acquires the status of the A/D converter, and clears the status of the A/D converter. [A/D converter driver usage example (single-shot mode)] Here, a program example is shown for the A/D converter operating in single-shot mode under the conditions given below. CPU : R8C Operating clock : fAD divided by 2 Reso
Résumé du contenu de la page N° 17
Program example #include "rapi_ad_r8c_13.h" void main( void ) { unsigned int status, data; /* Set up A/D converter as one short mode */ __CreateADC( RAPI_ONE_SHOT|RAPI_AN0|RAPI_FAD2| RAPI_WITH_SAMPLE_HOLD| RAPI_AD_OFF|RAPI_10BIT, 1, 0, 0 ); while( 1 ){ /* Disable A/D converter */ __EnableADC( RAPI_AN0| RAPI_AD_ON, 1 ); /* Check a flag bit of A/D converter interrupt */ do{ __GetADCStatus(
Résumé du contenu de la page N° 18
3. Standard Types This section describes the standard types defined in the library. For details about the set values, refer to the description of each API. Standard type Description Boolean The Boolean type represents the enum-type data that indicates whether successful (RAPI_TRUE (= 1)) or failed (RAPI_FALSE (= 0)). VoidFuncNotify The VoidFuncNotify type represents the type of the notification function to be registered. Rev.1.01 2007.02.16 18 RJJ10J1643-0101
Résumé du contenu de la page N° 19
4. Library Reference 4.1 API List by Peripheral Facility The table below lists the Renesas Embedded APIs classified by peripheral facility. NO Facility API API operation classification Opens serial port Single-data 1 __BasicOpenSerialDriver serial I/O Closes serial port 2 __BasicCloseSerialDriver Sets serial communication 3 __BasicSetSerialFormat Receives 1 data 4 __BasicStartSerialReceiving Transmits 1 data 5 __BasicStartSerialSending Reads receive status 6 __BasicReceivingSt
Résumé du contenu de la page N° 20
Sets pulse width measurement 35 __CreatePulseWidthMeasurementMode mode Controls operation of pulse width 36 __EnablePulseWidthMeasurementMode measurement mode Clears setting of pulse width 37 Timer __DestroyPulseWidthMeasurementMode measurement mode Acquires measured value of pulse 38 __GetPulseWidthMeasurementMode width measurement mode Sets input capture mode 39 __CreateInputCapture Controls operation of input capture 40 __EnableInputCapture mode Clears setting of input capture