Home

Renesas Embedded Application Programming Interface User`s

image

Contents

1. RAPI_TIMER_INT_LV_0 Interrupt priority level 0 RAPI_TIMER_INT_LV_1 Interrupt priority level 1 RAPI_TIMER_INT_LV_2 Interrupt priority level 2 RAPI_TIMER_INT_LV_3 Interrupt priority level 3 RAPI_TIMER_INT_LV_4 Interrupt priority level 4 RAPI_TIMER_INT_LV_5 Interrupt priority level 5 RAPI_TIMER_INT_LV_6 Interrupt priority level 6 RAPI_TIMER_INT_LV_7 Interrupt priority level 7 RAPI_TIMER_INT_LV_8 Interrupt priority level 8 RAPI_TIMER_INT_LV_9 Interrupt priority level 9 RAPI_TIMER_INT_LV_10 Interrupt priority level 10 RAPI_TIMER_INT_LV_11 Interrupt priority level 11 RAPI_TIMER_INT_LV_12 Interrupt priority level 12 RAPI_TIMER_INT_LV_13 Interrupt priority level 13 RAPI_TIMER_INT_LV_14 Interrupt priority level 14 RAPI_TIMER_INT_LV_15 Interrupt priority level 15 RAPI_TIMER_SYNC Synchronizes operation for channels 0 to 4 RAPI_TIMER_NO_SYNC Does not synchronize operation for channels 0 to 4 2tENESAS fae 4 Description 3 6 Library Reference 4 2 2 Timer MTU2 __GetPulseWidthMeasurementMode e Selectable parameters when RAPI_MTU2_0 is specified Count source Specify one from RAPI_MP_1 RAPI_MP_4 RAPI_MP_16 RAPI_MP_64 RAPI_EXTER_TCLKA_0 RAPI_EXTER_TCLKB_0 RAPI_EXTER_TCLKC_0 RAPI_EXTER_TCLKD_0 The default value is RAPI_MP_1 Count edge Specify one from RAPI_RISING_EDGE RAPI_FALLING_EDGE RAPI_BOTH_EDGE The default value is RA
2. e Selectable parameters when RAPI_MTU2_1 or RAPI_MTU2_2 is specified Timer general register Specify one from RAPI_TGRA RAPI_TGRB Count output Specify one from RAPI_OUTPUT_RETAIN RAPILOUTPUT_0_0 RAPI_OUTPUT_0_1 RAPILOUTPUT_0_TOG RAPI_OUTPUT_1_0 RAPLOUTPUT_1_1 RAPIOUTPUT_1_TOG The default value is RAPIOUTPUT_RETAIN Interrupt enable Specify one from RAPI_COMPARE_MATCH_ENA RAPI_COMPARE_MATCH_DIS The default value is RAPLCOMPARE_MATCH_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPITIMER_INT_LV_1 RAPI_TIMER_INT_LV_ 2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPLTIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPIL_TIMER_INT_LV_0 data2 For data2 set the 16 bit counter value for duty register or cycle register Note The duty register value is smaller than the cycle register value TGRA and TGRB are pair in PWM mode 1 so are TGRC and TGRD In PWM mode 2 one is cycle register others are duty registers func For func specify a pointer to callback function If this pointer is not specified set RAPI_NULL If retaining the callback function that is already specified set RAPI_HOLD Then only value
3. data2 For data2 specify a 16 bit value for output counter func For func specify a pointer to callback function If this pointer is not specified set RAPI_NULL If retaining the callback function that is already specified set RAPI_HOLD Then only value in data2 is changed Rev 1 01 Aug 27 2008 AS 4 92 REJ10J1906 0101 RENES Library Reference 4 4 2 2 Timer MIU SetOutputPin Return value If the specification of channel is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Category Timer MTU2 output compare mode Reference __EnableOutputCompare DestroyOutputCompare Remark If an undefined value is specified in the first argument operation of the API cannot be guaranteed Program example include rapi_timer_sh_7125 h Declaration of callback function void TimerIntBFunc void void TimerIntAFunc void void func void Setting up TGRB and TGRA of MTU2 channel 1 to duty register and cycle register respectively ___SetPWMPin RAPI_MTU2_1 RAPI_TGRB RAPI_OUTPUT_0_0 RAPI_COMPARE MATCH ENA RAPI_TIMER_INT_LV_3 50000 TimerIntBFunc ___SetPWMPin RAPI_MTU2_1 RAPI_TGRA RAPI_OUTPUT_0_1 RAPI_COMPARE_ MATCH ENA RAPI IMER_IN V_3 30000 TimerIntAFunc Rev 1 01 Aug 27 2008 AS 4 93 REJ10J1906 0101 RENES 4 Library Reference 4 2 2 Timer MT
4. data Setup data RevDtBuf Pointer to buffer storing the received data byteNum Number of bytes received RevNum Pointer to address storing the number of actual received data Starts SCI reception and acquires received data with the specified number of bytes data For data set one of the following parameters as a channel RAPI_COM1 SCI channel 0 RAPI_COM2 SCI channel 1 RAPI_COM3 SCI channel 2 If start up for SCI reception is successful RAPI_TRUE is returned otherwise DAP FAL GE is returned SCI __CreateSCl __StopSClIReceiving __GetSClIStatus e When executing this API function wait for at least a 1 bit period after __CreateSClI is called e H an undefined value is specified in the first argument operation of the API cannot be guaranteed The following values are stored in the reception buffer e High order 8 bits The value read from the serial status register SCSSR e Low order 8 bits The value read from the receive data register SCRDR Note When the receive error occurs read operation is not executed include rapi_sif_sh_7125 h unsigned char ReceiveBuf 10 unsigned short ReceiveNum void func void Aquisition of 5 byte data by SCI reception for channel 0 StartSCIReceiving RAPI_COM1 ReceiveBuf 5 amp ReceiveNum Rev 1 01 Aug 27 2008 7tENESAS 4 8 REJ10J1906 0101 4 Library Reference 4 2 1 Serial Communication Interface SC
5. Rev 1 01 Aug 27 2008 7rtENESAS 4 71 REJ10J1906 0101 4 Library Reference 4 2 2 Timer MTU2 __ EnablePulseWidthMeasurementMode 19 EnablePulseWidthMeasurementMode Synopsis Description Return value Category Reference Remark Program example Rev 1 01 Aug 27 2008 REJ10J1906 0101 lt Operation control for pulse width measurement mode gt Boolean EnablePulseWidthMeasurementMode unsigned long data data Setup data Controls start stop operation of the specified timer in pulse width measurement mode data For data set the following parameters To set multiple parameters at the same time use the symbol to separate each specified parameter Then several timers can be enabled or disabled at the same time RAPI_MTU2_0 MTU2 channel 0 RAPI_MTU2_1 MTU2 channel 1 RAPI_MTU2_2 MTU2 channel 2 RAPI_MTU2_3 MTU2 channel 3 RAPI_MTU2_4 MTU2 channel 4 RAPI_MTU2_5U MTU2 channel 5U RAPI_MTU2_5V MTU2 channel 5V RAPI_MTU2_5W MTU2 channel 5W RAPI_TIMER_ON Starts the timer in pulse width measurement mode RAPI_TIMER_OFF Stops the timer in pulse width measurement mode If the specification of timer is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Timer MTU2 pulse width measurement mode __EnablelnputCapture If an undefined value is specified in the
6. RAPI_MTU2_0 MTU2 channel 0 RAPI_MTU2_1 MTU2 channel 1 RAPI_MTU2_ 2 MTU2 channel 2 RAPI_MTU2_3 MTU2 channel 3 RAPI_MTU2_4 MTU2 channel 4 RAPI_MTU20 A MTU2 channels 0 to 4 RAPI_MTU2_5U MTU2 channel 5U RAPI_MTU2_5V MTU2 channel 5V RAPI_MTU2_5W MTU2 channel 5W RAPI_MTU2_5 MTU2 channels 5U 5V and 5W RAPI_MTU2_ALL All MTU2 channels If the specification of timer is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Timer MTU2 pulse period measurement mode __DestroylnputCapture If an undefined value is specified in the argument operation of the API cannot be guaranteed include rapi_timer_sh_7125 h void func void Clearing setting of MTU2 channel 4 in pulse period measurement mode __DestroyPulsePeriodMeasurementMode RAPI_MTU2_4 RENESAS ol 4 Library Reference 4 2 2 Timer MTU2 __ GetPulsePeriodMeasurementMode 16 GetPulsePeriodMeasurementMode Synopsis lt Acquisition of measured value in pulse period measurement mode gt Boolean __GetPulsePeriodMeasurementMode unsigned long data1 unsigned short data2 Description data1 Setup data 1 data2 Pointer to the buffer storing the counter value data1 For datai set the following parameters To set multiple parameters use the symbol to separate each specified parameter Then several pins can be selected at the same time Acquires the co
7. e When RAPI_PERIODIC is selected the following parameters can be set Count clearing source Specify one from RAPI_ TCNT_CLEAR_TGRA RAPI_ TCNT_CLEAR_TGRB The default value is RAPI_TCNT_CLEAR_DIS Count output Specify one from RAPI_OUTPUT_RETAIN RAPIL_OUTPUT_0_0 RAPLOUTPUT_0_1 RAPIL_OUTPUT_0_TOG RAPI_LOUTPUT_1_0 RAPIL_OUTPUT_1_1 RAPIOUTPUT_1_TOG The default value is RAP _OUTPUT_RETAIN A D converter start Specify one from RAPI_AD_START_REQ request RAPI_NO_AD_START_REQ The default value is RAPLNO_AD_START_REQ Interrupt enable Specify one from RAPI_COMPARE_MATCH_ENA RAPI_COMPARE_MATCH_DIS The default value is RAPLCOMPARE_MATCH_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPLTIMER_INT_LV_1 RAPI_TIMER_INT_LV_ 2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPIL_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPILTIMER_INT_LV_0 Rev 1 01 Aug 27 2008 AS 4 22 REJ10J1906 0101 RENES Library Reference 4 4 2 2 Timer MTU2 _ CreateTimer Description 6 7 e Selectable parameters when RAPI_MTU2_3 or RAPI_MTU2_4 is specified Count source Specify one from RAPI_MP1 RAPI_MP4 RAPI_MP16 RAPI_MP64 RAPI_MP256_ 34
8. Interrupt enable Specify one from RAPI_COMPARE_MATCH_ENA RAPI_COMPARE_MATCH_DIS The default value is RAPILCOMPARE_MATCH_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_TIMER_INT_LV_ 2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPILTIMER_INT_LV_0 Rev 1 01 Aug 27 2008 AS 4 20 REJ10J1906 0101 RENES Library Reference 4 4 2 2 Timer MTU2 _ CreateTimer Description 4 7 e Selectable parameters when RAPI_MTU2_1 is specified Count source Specify one from RAPI_MP1 RAPI_MP4 RAPI_MP16 RAPI_MP64 RAPI_MP256_1 The default value is RAPI_MP1 Operation method Specify one from RAP EREE RUNNING RAPI_ PERIODIC The default value is RAPI_FREE_RUNNING Count edge Specify one from RAPI_RISING_EDGE RAPI_FALLING_EDGE RAPI_BOTH_EDGE The default value is RAPI_RISING_EDGE Note When RAPI_MP1 is specified for the count source count edge is fixed to the default value e When RAD FREE RUNNING e selected the following parameters can be set Interrupt enable Specify one from RAPIOVERFLOW_ENA RAPI_OVERFLOW_DIS The default value is RAPIOVERFLOW_DIS
9. Program example lt Clearing of setting for event counter mode gt Boolean DestroyEventCounter unsigned long data data Setup data Clears setting of the specified timer in the event counter mode data For data set the following parameters To set multiple parameters use the symbol to separate each specified parameter Then several settings of timers can be cleared at the same time RAPI_MTU2_0 MTU2 channel 0 RAPI_MTU2_1 MTU2 channel 1 RAPI_MTU2_ 2 MTU2 channel 2 RAPI_MTU2_3 MTU2 channel 3 RAPI_MTU2_4 MTU2 channel 4 RAPI_MTU20_ A MTU2 channels 0 to 4 If the specification of timer is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Timer MTU2 event counter mode __DestroyTimer If an undefined value is specified in the argument operation of the API cannot be guaranteed include rapi_timer_sh_7125 h void func void Clearing settings of MTU2 channels 1 and 2 in event counter mode _ DestroyEventCounter RAPI_MTU2_1 RAPI_MTU2_2 Rev 1 01 Aug 27 2008 7rtENESAS 4 36 REJ10J1906 0101 4 Library Reference 4 2 2 Timer MTU2 __GetTimerCounter 7 __GetTimerCounter Synopsis Description REJ10J1906 0101 lt Acquisition of counter value in timer mode or event counter mode gt Boolean GetTimerCounter unsigned long data1 unsigned short data2 data
10. 4 ine oo an A m ol stENESAS eve 4 Description 2 3 Rev 1 01 Aug 27 2008 REJ10J1906 0101 Library Reference 4 2 2 Timer MTU2 __SetlnputCapturePin Selectable parameters when RAPI_MTU2_0 RAPI_MTU2_3 or RAPI_MTU2_4 is specified Capture channel Capture edge Interrupt enable Interrupt priority level Specify one from RAPI_TIOCA RAPI_TIOCB RAPI_TIOCC RAPI_TIOCD Specify one from RAPI_RISING_CAP_0 RAPI_FALLING_CAP_0 RAPI_BOTH_CAP_0O RAPI_TGRCO_CAP RAPI_TGRAO_CAP Specify one from RAPI_CAPTURE_ENA RAPI_CAPTURE_DIS The default value is RAPI_CAPTURE_DIS Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_TIMER_INT_LV_2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPI_TIMER_INT_LV_0 Selectable parameters when RAPI_MTU2_1 or RAPI_MTU2_2 is specified Capture channel Capture edge Interrupt enable Interrupt priority level 7rtENESAS Specify one from RAPI_TIOCA RAPI_TIOCB Specify one from RAPI_RISING_CAP_0 RAPI_FALLING_CAP_0 RAPI_LBOTH_CAP_0 RAPI_TGRCO_CAP RAPI_TGRAO_CAP
11. lt Operation control for event counter mode gt Boolean EnableEventCounier unsigned long data data Setup data Controls start stop operation of the specified timer in the event counter mode data For data set the following parameters To set multiple parameters use the symbol to separate each specified parameter Then several timers can be enabled or disabled at the same time RAPI_MTU2_0 MTU2 channel 0 RAPI_MTU2_1 MTU2 channel 1 RAPI_MTU2_ 2 MTU2 channel 2 RAPI_MTU2_3 MTU2 channel 3 RAPI_MTU2_4 MTU2 channel 4 RAPI_MTU20_ A MTU2 channels 0 to 4 RAPI_TIMER_ON Starts the timer in event counter mode RAPI_TIMER_OFF Stops the timer in event counter mode If the specification of timer is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Timer MTU2 event counter mode __EnableTimer If an undefined value is specified in the argument operation of the API cannot be guaranteed include rapi_timer_sh_7125 h void func void Start up timer for MTU2 channels 0 and 1 in event counter mode EnableEventCounter RAPI_MTU2_0 RAPI_MTU2_1 RAPI_TIMER_ON Rev 1 01 Aug 27 2008 7tENESAS 4 35 REJ10J1906 0101 4 Library Reference 4 2 2 Timer MTU2 __DestroyEventCounter 6 _ DestroyEventCounter Synopsis Description Return value Category Reference Remark
12. Specify one from RAPI_CAPTURE_ENA RAPI_CAPTURE_DIS The default value is RAPICAPTURE_DIS Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_TIMER_INT_LV_2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPI_TIMER_INT_LV_0 4 83 4 Description 3 3 Return value Category Reference Remark Program example Library Reference 4 2 2 Timer MTU2 __SetlnputCapturePin e Selectable parameters when RAPI_MTU2_5 is specified Capture channel Specify one from RAPI_MTU2_5U RAPI_MTU2_5V RAPI_MTU2_5W Capture edge Specify one from RAPI_RISING_CAP_5 RAPI_FALLING_CAP_5 RAPL_BOTH_CAP_5 RAPI_TCNT1_CAP Interrupt enable Specify one from RAPI_CAPTURE_ENA RAPI_CAPTURE_DIS The default value is RAPI_CAPTURE_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_O RAPITIMER_INT_LV_1 RAPI_TIMER_INT_LV_2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI
13. Synopsis Description Return value Category Reference Remark Program example lt Clearing of A D converter status gt Boolean ClearADCFlag unsigned long data data Setup data Clears the status flag of the specified A D converter data For data set the following parameters To clear multiple status flags of A D modules at the same time use the symbol to separate each specified parameter RAPI_AD_0 A D module 0 RAPI_AD_1 A D module 1 e A D end flag ADF is the status flag which indicate the end of A D conversion and is corresponding to the bit 15 of the A D control status register ADCSR e Configuration of ADCSR ARF ADIE o o TAGE 0 CONADF STC CKSLIFO ADMIT OT ADCS A D end flag If A D converter status flag is successfully cleared RAPI_TRUE is returned if failed RAPI_FALSE is returned A D converter __GetADCFlag If an undefined value is specified in the first argument operation of the API cannot be guaranteed include rapi_ad_sh_7125 h void func void Clearing status flag of A D converter __ClearADCStatus RAPI_AD_1 Rev 1 01 Aug 27 2008 7tENESAS 4 121 REJ10J1906 0101 Library Reference of Library 4 4 2 5 A D Converter ClearADCFlag Rev 1 01 Aug 27 2008 4 122 REJ10J1906 0101 RENESAS 5 5 Usage Example Usage Example 5 1 Serial Communication Inter
14. Boolean GetADCFlag unsigned long data unsigned char status data Setup data status Pointer to the buffer in which the register content indicating A D converter status is stored Description Acquires the status flag of the specified A D converter data For data set the following parameters To acquire multiple status flags of A D modules at the same time use the symbol to separate each specified parameter RAPI_AD_0 A D module 0 RAPI_AD_1 A D module 1 e A D end flag ADF is the status flag which indicate the end of A D conversion and is corresponding to the bit 15 of the A D control status register ADCSR e Configuration of ADCSR ADF ADE oo TAGE 0 CONADF STC CRSUVO ADM ADCS CHO A D end flag Return value If A D converter status flag is successfully acquired RAPI_TRUE is returned if failed RAPI_FALSE is returned Category A D converter Reference __ClearADCFlag Remark If an undefined value is specified in the first argument operation of the API cannot be guaranteed Program example include rapi_ad_sh_7125 h void func void unsigned char status Acquisition of status flag of A D converter for module 0 __GetADCStatus RAPI_AD_0O RAPI_AD_ 1 amp status Rev 1 01 Aug 27 2008 AS 4 120 REJ10J1906 0101 RENES 4 Library Reference of Library 4 2 5 A D Converter __ClearADCFlag 6 _ ClearADCFlag
15. Clearing status flags of interrupt request for IRQO to IRQ3 __ClearInterruptFlag RAPI_IRQO_FLAG RAPI_IRQ1_FLAG RAPI_IRQ2_ FLAG RAPI_IRQ3_FLAG Rev 1 01 Aug 27 2008 7rtENESAS 4 110 REJ10J1906 0101 4 4 2 5 A D Converter 1 CreateADC Synopsis Description 1 6 Rev 1 01 REJ10J1906 0101 Aug 27 2008 lt Setting of A D converter gt Library Reference 4 2 5 A D Converter __CreateADC Boolean __CreateADC unsigned long data void func data Setup data func Pointer to callback function Sets the operating condition for A D converter data For data set the following parameters To set multiple parameters at the same time use the symbol to separate each specified parameter Note that multiple analog input pins cannot be specified at the same time RAPI_SINGLE Single mode RAPI_4CHANNEL_SCAN 4 channel scan mode RAPI_2CHANNEL_SCAN 2 channel scan mode RAPI_SINGLE_CYCLE Single cycle scan mode RAPI_CONTINUOUS Continuous scan mode RAPI_ANO Analog input pin 0 RAPI_AN1 Analog input pin 1 RAPI_AN2 Analog input pin 2 RAPI_AN3 Analog input pin 3 RAPI_AN4 Analog input pin 4 RAPI_AN5 Analog input pin 5 RAPI_AN6 Analog input pin 6 RAPI_AN7 Analog input pin 7 RAPI_ANO_AN1 Analog input pins 0 and 1 RAPI_ANO_AN2 Analog input pins 0 to 2 RAPI_ANO_AN3 Analog in
16. Count edge Specify one from RAPI_RISING_EDGE RAPI_FALLING_EDGE RAPI_BOTH_EDGE The default value is RAPI_RISING_EDGE Note When RAPI_MP1 is specified for the count source count edge is fixed to the default value Count clearing source Specify one from RAPI_TCNT_CLEAR_DIS RAPIL_TCNT_CLEAR_TGRA RAPI_TCNT_CLEAR_TGRB RAPIL_TCNT_CLEAR_OTHER The default value is RAPI_TCNT_CLEAR_DIS A D converter start Specify one from RAPI_LAD_START_REQ request RAPI_NO_AD_START_REQ The default value is RAPINO_AD_START_REQ Interrupt enable Specify one from RAPIOVERFLOW_ENA RAPI_OVERFLOW_DIS The default value is RAPILOVERFLOW_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_TIMER_INT_LV_2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPI_TIMER_INT_LV_0 Rev 1 01 Aug 27 2008 7rtENESAS 4 78 REJ10J1906 0101 4 Description 5 6 Library Reference 4 2 2 Timer MTU2 __GetPulseWidthMeasurementMode e Selectable parameters when RAPI_MTU2_2 is specified Count source Specify one from RAPI_MP_1 RAPI_MP_4 RAPI_MP_16 RAPI_MP_64 RAPI_MP_1024 2 RAPI_EXTER_TCLKA
17. RAPI_COMPARE_MATCH_DIS The default value is RAPILCOMPARE_MATCH_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_O RAPILTIMER_INT_LV_1 RAPIL_TIMER_INT_LV_ 2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPI_TIMER_INT_LV_0 e Selectable parameters when RAPI_MTU2_1 or RAPI_MTU2_2 is specified Timer general register Specify one from RAPI_TGRA RAPI_TGRB Count output Specify one from RAPI_OUTPUT_RETAIN RAPILOUTPUT_0_0 RAPIOUTPUT_0_1 RAPILOUTPUT_0_TOG RAPI_OUTPUT_1_0 RAPLOUTPUT_1_1 RAPLOUTPUT_1_TOG The default value is RAPI_OUTPUT_RETAIN Interrupt enable Specify one from RAPI_COMPARE_MATCH_ENA RAPI_COMPARE_MATCH_DIS The default value is RAPILCOMPARE_MATCH_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPL_TIMER_INT_LV_1 RAPI_TIMER_INT_LV_ 2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPLTIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPI_TIMER_INT_LV_0
18. RAPI_IRQOUT_INT_OUTPUT Outputs detection signal for interrupt request IRQOUT RAPI_IRQOUT_HIGH_LEVEL Does not output detection signal for interrupt request IRQOUT RAPI_INT_LV_0 Interrupt priority level 0 RAPI_INT_LV_4 Interrupt priority level 1 RAPI_INT_LV_2 Interrupt priority level 2 RAPI_INT_LV_3 Interrupt priority level 3 RAPI_INT_LV_4 Interrupt priority level 4 RAPI_INT_LV_5 Interrupt priority level 5 RAPI_INT_LV_6 Interrupt priority level 6 RAPI_INT_LV_7 Interrupt priority level 7 RAPI_INT_LV_8 Interrupt priority level 8 RAPI_INT_LV_9 Interrupt priority level 9 RAPI_INT_LV_10 Interrupt priority level 10 RAPI INT LV 11 Interrupt priority level 11 RAPI INT LV 12 Interrupt priority level 12 RAPI_INT_LV_13 Interrupt priority level 13 RAPI INT LV 14 Interrupt priority level 14 RAPI_INT_LV_15 Interrupt priority level 15 7rtENESAS 4 106 4 Description 2 2 Return value Category Reference Remark Program example Library Reference 4 2 4 External Interrupt __Createlnterrupt e Selectable parameters when IRQO to IRQ3 interrupts RAPI_IRQO to RAPI_IRQ3 are specified Polarity sense Specify one from RAPI_INT_LOW RAPI_INT_FALLING RAPI_INT_RISING RAPI_INT_BOTH The default value is RAPI_INT_LOW IRQOUT signal output Specify one from RAPI_IRQOUT_INT_OUTPU
19. RAPI_TIMER_INT_LV_10 Interrupt priority level 10 RAPI_TIMER_INT_LV_11 Interrupt priority level 11 RAPI_TIMER_INT_LV_12 Interrupt priority level 12 RAPI_TIMER_INT_LV_13 Interrupt priority level 13 RAPI_TIMER_INT_LV_14 Interrupt priority level 14 RAPI_TIMER_INT_LV_15 Interrupt priority level 15 e Selectable parameters when RAPI_MTU2_0 is specified Count source Count edge Count clearing source A D converter start request Interrupt enable Interrupt priority level Specify one from RAPI_MP_1 RAPI_MP_4 RAPI_MP_16 RAPI_MP_64 The default value is RAPI_MP_1 Specify one from RAPI_RISING_EDGE RAPI_FALLING_EDGE RAPI_BOTH_EDGE The default value is RAPI_RISING_EDGE Note When RAPI_MP1 is specified for the count source count edge is fixed to the default value Specify one from RAPI_LTCNT_CLEAR_DIS RAPI_TCNT_CLEAR_TGRA RAPI_LTCNT_CLEAR_TGRB RAPI_TCNT_CLEAR_TGRC RAPI_TCNT_CLEAR_TGRD The default value is RAPI_TCNT_CLEAR_DIS Specify one from RAPI_AD_START_REQ RAPIL_NO_AD_START_REQ The default value is RAPINO AD _START_REQ Specify one from RAPIOVERFLOW_ENA RAPI_OVERFLOW_DIS The default value is RAPLOVERFLOW_DIS Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_TIMER_INT_LV_ 2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPIL_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7
20. RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_ 15 The default value is RAPI_TIMER_INT_LV_0 4 54 Library Reference 4 4 2 2 Timer MTU2 _ CreatePulsePeriodMeasurementMode Description 5 5 e Selectable parameters when RAPI_MTU2_3 or RAPI_MTU2_4 is specified Count source Count edge Count clearing source A D converter start request Interrupt enable Interrupt priority level Specify one from RAPI_MP_1 RAPI_MP_4 RAPI_MP_16 RAPI_MP_64 RAPI_MP_256_34 RAPI_MP_1024 34 The default value is RAPI_MP_1 Specify one from RAPI_RISING_EDGE RAPI_FALLING_EDGE RAPI_BOTH_EDGE The default value is RAPI_RISING_EDGE Note When RAPI_MP1 is specified for the count source count edge is fixed to the default value Specify one from RAPI_LTCNT_CLEAR_DIS RAPI_TCNT_CLEAR_TGRA RAPI_TCNT_CLEAR_TGRB RAPI_TCNT_CLEAR_TGRC RAPI_TCNT_CLEAR_TGRD The default value is RAPI_TCNT_CLEAR_DIS Specify one from RAPI_AD_START_REQ RAPI_NO_AD_START_REQ The default value is RAPI_NO_ AD _START_REQ Specify one from RAPIOVERFLOW_ENA RAPI_OVERFLOW_DIS The default value is RAPLOVERFLOW_DIS Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_TIMER_INT_LV_ 2 RAPI_TIMER_INT_LV_3 RAPIL_TIMER_INT
21. __SetIOPort RAPI_PORT_A RAPI_LOWER_8_BITS RAPI_FUNC_IO RAPI_PORT_OUTPUT 2tENESAS ol A Library Reference 4 2 3 I O Port __ReadlOPort 2 __ReadlOPort Synopsis lt Reading of data from I O port gt Boolean ReadlOPort unsigned long data1 unsigned short data2 data1 Setup data 1 data2 Pointer to the variable in which the value read from I O port is stored Description Acquires value of the specified I O port data1 For data1 set the following parameters To set multiple parameters at the same time use the symbol to separate each specified parameter e Port Choose one from the following DAP FUNC A Port A RAPI FUNC B L Port B with lower 16 bits RAPI FUNC BH Port B with higher 16 bits RAPI FUNC E Port E RAPI FUNC E Port F Note Port F is an input only port with 8 bits e Bit Multiple bits can be selected RAPI_BIT_O Bit 0 of the specified port RAPI BIT_1 Bit 1 of the specified port RAPI BIT 2 Bit 2 of the specified port RAPI_BIT_3 Bit 3 of the specified port RAPI_BIT_4 Bit 4 of the specified port RAPI_BIT_5 Bit 5 of the specified port RAPI_BIT_6 Bit 6 of the specified port RAPI_BIT_7 Bit 7 of the specified port RAPI_BIT_8 Bit 8 of the specified port RAPI_BIT_9 Bit 9 of the specified port RAPI_BIT_10 Bit 10 of the specified port RAPI_BI
22. If an undefined value is specified in the first argument operation of the API cannot be guaranteed include rapi_io_port_sh_7125 h void func void Writing data to lower 8 bits of Port A __WriteIOPort RAPI_PORT_A RAPI_LOWER_8 BITS RAPI_BYTE_OPE OxAA Rev 1 01 Aug 27 2008 7rtENESAS 4 105 REJ10J1906 0101 4 4 2 4 1 _ Createlnterrupt Synopsis External Interrupt lt Setting of external interrupt gt 4 2 4 External Interrupt Boolean __Createlnterrupt unsigned long data void func Description 1 2 Library Reference ___Createlnterrupt data Setup data func Pointer to callback function Sets the specified external interrupt data For data set the following parameters To set multiple parameters at the same time use the symbol to separate each specified parameter Note that multiple external interrupts cannot be specified at the same time Rev 1 01 Aug 27 2008 REJ10J1906 0101 RAPI_NMI NMI interrupt RAPI_IRQO IRQO interrupt DAP IRQ1 IRQ1 interrupt RAPI_IRQ2 IRQ2 interrupt RAPI_IRQ3 IRQ3 interrupt RAPI_INT_LOW Interrupt request is detected at the low level RAPI_INT_FALLING Interrupt request is detected at the falling edge RAPI_INT_RISING Interrupt request is detected at the rising edge RAPI_INT_BOTH Interrupt request is detected at the both edges
23. Interrupt enable Specify one from RAPIOVERFLOW_ENA RAPI_OVERFLOW_DIS The default value is RAPIOVERFLOW_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_TIMER_INT_LV_2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPI_TIMER_INT_LV_0 Rev 1 01 Aug 27 2008 7rtENESAS 4 42 REJ10J1906 0101 4 Description 5 6 Library Reference 4 2 2 Timer MTU2 __CreatePWM e Selectable parameters when RAPI_MTU2_2 is specified Count source Specify one from RAPI_MP_1 RAPI_MP_4 RAPI_MP_16 RAPI_MP_64 RAPI_MP_1024 2 RAPI_EXTER_TCLKA_0O RAPI_EXTER_TCLKB_0 RAPI_LEXTER_TCLKC_0 The default value is RAPI_MP_1 Count edge Specify one from RAPI_RISING_EDGE RAPI_FALLING_EDGE RAPI_BOTH_EDGE The default value is RAPI_RISING_EDGE Note When RAPI_MP1 is specified for the count source count edge is fixed to the default value Operating mode Specify one from RAPI_PWM_MODE1 RAPI_PWM_MODE2 Count clearing source Specify one from RAPI_LTCNT_CLEAR_DIS RAPIL_TCNT_CLEAR_TGRA RAPI_TCNT_CLEAR_TGRB RAPI_TCNT_CLEAR_OTHER The default value is RAPI_TCNT_CLEAR_DIS
24. Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_TIMER_INT_LV_2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPI_TIMER_INT_LV_0 Rev 1 01 Aug 27 2008 7rtENESAS 4 41 REJ10J1906 0101 4 Description 4 6 Library Reference 4 2 2 Timer MTU2 __CreatePWM e Selectable parameters when RAPI_MTU2_1 is specified Count source Specify one from RAPI_MP_1 RAPI_MP_4 RAPI_MP_16 RAPI_MP_64 RAPI_MP_256_1 RAPI_EXTER_TCLKA_0 RAPI_EXTER_TCLKB_0 The default value is RAPI_MP_1 Count edge Specify one from RAPI_RISING_EDGE RAPI_FALLING_EDGE RAPI_BOTH_EDGE The default value is RAPI_LRISING_EDGE Note When RAPI_MP1 is specified for the count source count edge is fixed to the default value Operating mode Specify one from RAPI_PWM_MODE1 RAPLPWM_MODE2 Count clearing source Specify one from RAPI_TCNT_CLEAR_DIS RAPIL_TCNT_CLEAR_TGRA RAPI_TCNT_CLEAR_TGRB RAPIL_TCNT_CLEAR_OTHER The default value is RAPI_TCNT_CLEAR_DIS A D converter start Specify one from RAPI_LAD_START_REQ request RAPI_NO_AD_START_REQ The default value is RAPINO_AD_START_REQ
25. RAPI_MTU2_5W MTU2 channel 5W RAPI_TIMER_ON Starts the timer in pulse period measurement mode RAPI_TIMER_OFF Stops the timer in pulse period measurement mode If the specification of timer is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Timer MTU2 pulse period measurement mode __EnablelnputCapture If an undefined value is specified in the argument operation of the API cannot be guaranteed include rapi_timer_sh_7125 h void func void Start up timer for MTU2 channel 4 in pulse period measurement mode __EnablePulsePeriodMeasurementMode RAPI_MTU2_4 RAPI_TIMER_ON Rev 1 01 Aug 27 2008 7tENESAS 4 60 REJ10J1906 0101 4 Library Reference 4 2 2 Timer MTU2 __DestroyPulsePeriodMeasurementMode 15 DestroyPulsePeriodMeasurementMode Synopsis Description lt Clearing of setting for pulse period measurement mode gt Boolean DestroyPulsePeriodMeasurementMode unsigned long data data Setup data Clears setting of the specified timer in pulse period measurement mode data For data set the following parameters To set multiple parameters use the symbol to separate each specified parameter Then several settings of timers can be cleared at the same time Return value Category Reference Remark Program example Rev 1 01 Aug 27 2008 REJ10J1906 0101
26. 01 Aug 27 2008 REJ10J1906 0101 RAPITCNT CLEAR TGRA Clears TCNT by TGRA compare match RAPI TCNT CLEAR TGRB Clears TCNT by TGRB compare match RAPI_TCNT_CLEAR_TGRC Clears TCNT by TGRC compare match RAPI _TCNT CLEAR TGRD Clears TCNT by TGRD compare match RAPI TCNT CLEAR OTHER Clears TCNT by counter clearing during synchronously clearing operating for another channel RAPI_OVERFLOW_ENA Enables overflow interrupt RAPI_OVERFLOW_DIS Disables overflow interrupt RAPI_AD_START_REQ Enables generation of A D converter start requests by TGRA input capture compare match RAPI NO_AD_START_REQ Disables generation of A D converter start requests by TGRA input capture compare match RAPI_TIMER_INT_LV_0 Interrupt priority level 0 RAPI_TIMER_INT_LV_1 Interrupt priority level 1 RAPI_TIMER_INT_LV_2 Interrupt priority level 2 RAPI_TIMER_INT_LV_3 Interrupt priority level 3 RAPI_TIMER_INT_LV_4 Interrupt priority level 4 RAPI_TIMER_INT_LV_5 Interrupt priority level 5 RAPI_TIMER_INT_LV_6 Interrupt priority level 6 RAPI_TIMER_INT_LV_7 Interrupt priority level 7 RAPI_TIMER_INT_LV_8 Interrupt priority level 8 RAPI_TIMER_INT_LV_9 Interrupt priority level 9 RAPI_TIMER_INT_LV_10 Interrupt priority level 10 RAPI_TIMER_INT_LV_11 Interrupt priority level 11 RAPI_TIMER_INT_LV_12 Interrupt pr
27. 10 of the specified port RAPI_BIT_11 Bit 11 of the specified port RAPI_BIT_12 Bit 12 of the specified port RAPI_BIT_13 Bit 13 of the specified port RAPI_BIT_14 Bit 14 of the specified port RAPI_BIT_15 Bit 15 of the specified port RAPI_LOWER_8_BITS Lower 8 bits of the specified port RAPI_HIGHER_8_BITS Higher 8 bits of the specified port RAPI_16_BITS 16 bits of the specified port e Access size for data read Choose one from the following RAPI_BITS_OPE Bit handling mode RAPI_BYTE_OPE Byte handling mode RAPILWORD_OPE Word handling mode 7rtENESAS 4 Description 2 2 Return value Category Reference Remark Program example Library Reference 4 2 3 I O Port __WritelOPort data2 For data2 specify the value to be written to I O port e Selectable parameters when RAPI_BITS_OPE is specified Choose one from the following RAPI_L Writes 0 to one or several bits RAPI_H Writes 1 to one or several bits Note When specifying RAPI_BITS OPE the same value RAPI_L or RAPI_H is written to all the specified bits e Assignable value when RAPI_BYTE_OPE or RAPI_WORD_OPE is specified Set the value to be written to the specified port by byte or word size If the specification of I O port is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned I O port __SetlOPort ReadlOPort
28. 27 __CreateOutputCompare Synopsis lt Setting for output compare mode gt Boolean CreateOutputCompare unsigned long data Library Reference 4 2 2 Timer MTU2 __CreateOutputCompare data Setup data Description 1 3 Rev 1 01 data For data set the following parameters To set multiple parameters at the same time use the symbol to separate each specified parameter Sets the specified timer to output compare mode RAPL MTU2_0 MTU2 channel 0 RAPL MTU2_1 MTU2 channel 1 RAPL MTU2 2 MTU2 channel 2 RAPLMTU2 3 MTU2 channel 3 RAPL MTU2 A MTU2 channel 4 HAD MP1 Internal clock counts on MP9 1 HAD MP4 Internal clock counts on MP 9 4 RAPI_MP16 Internal clock counts on MP9 16 RAPI_MP64 Internal clock counts on MPo 64 RAPI_MP256_1 Internal clock counts on MP 256 for channel 1 RAPI_MP256_34 Internal clock counts on MP9 256 for channel 3 or 4 RAPI_MP1024_ 2 Internal clock counts on MP 1024 for channel 2 RAPI_MP1024_34 Internal clock counts on MP9 1024 for channel 3 or 4 RAPI_EXTER_TCLKA_0 External clock counts on TCLKA pin input for channel 0 to 2 RAPI_EXTER_TCLKB_0 External clock counts on TCLKB pin input for channel 0 to 2 RAPI_EXTER_TCLKC_0 External clock counts on TCLKC pin input for channel 0 or 2 RAPI_EXTER_TCLKD_0 External clock counts o
29. Aug 27 2008 7rtENESAS 4 117 REJ10J1906 0101 4 3 _ DestroyADC Synopsis Description Return value Category Reference Remark Program example Library Reference 4 2 5 A D Converter __DestroyADC lt Clearing of setting of A D converter gt Boolean DestroyADC unsigned long data data Setup data Clears setting of the specified A D converter data For data set the following parameters Choose one from the following RAPI_AD_0 A D module 0 RAPI_AD_1 A D module 1 If A D converter setting is successfully cleared RAPI_TRUE is returned if failed DAP FAL GE is returned A D converter __CreateADC _ EnableADC GetADC If an undefined value is specified in the first argument operation of the API cannot be guaranteed include rapi_ad_sh_7125 h void func void Clearing A D converter for module 0 __DestroyADC RAPI_AD_0O Rev 1 01 Aug 27 2008 7rtENESAS 4 118 REJ10J1906 0101 A Library Reference 4 2 5 A D Converter __GetADC 4 __GetADC Synopsis lt Acquisition of A D conversion result gt Boolean GetADC unsigned long data1 unsigned short data2 data1 Setup data 1 data2 Pointer to the buffer in which A D converted value is stored Description Acquires the A D converted valu
30. Description Return value Category Reference Remark Program example Library Reference 4 2 5 A D Converter __EnableADC lt Operation control for A D converter gt Boolean EnableADC unsigned long data data Setup data Controls start stop operation of the specified A D converter data For data set the following parameters To set multiple parameters at the same time use the symbol to separate each specified parameter Refer to note below RAPI_AD_0 A D module 0 RAPI_AD_1 A D module 1 RAPI_AD_ON Sets the A D converter to start operation RAPI_AD_OFF Sets the A D converter to stop operation Note Both A D modules 0 and 1 RAPI_AD_O and RAPI_AD_1 cannot be selected at the same time If A D converter is successfully controlled RAPI_TRUE is returned if failed RAPI_FALSE is returned A D converter __CreateADC DestroyADC GetADC e This API controls only ADST bit in the A D control register ADCR Therefore use this API only when the software converts starts or stops analog value to digital When selecting trigger for A D conversion this API is not necessary e H an undefined value is specified in the first argument operation of the API cannot be guaranteed include rapi_ad_sh_7125 h void func void Disabling A D converter for module 0 __EnableADC RAPI_AD_0O RAPI_AD_OFF Rev 1 01
31. Enables multiprocessor mode RAPI_MULTI_DIS Disables multiprocessor mode Do not set these parameters in clock synchronous mode Multiprocessor bit value in clock asynchronous mode Choose one from the following RAPI_MULTIPRO_BIT_H Specifies the multiprocessor bit value to 1 RAPI_MULTIPRO_BIT_L Specifies the multiprocessor bit value to 0 Do not set these parameters in clock synchronous mode SCI interrupt source Multiple sources can be selected RAPI_INT TX ENA Enables the transmit data empty interrupt RAPI_INT_TEND_ ENA Enables the transmit end interrupt RAPI_INT_RX_ERR_ENA Enables the receive data full and the receive error interrupts DAP INT ERR ENA Enables the receive error interrupt RAPI_INT_MULTI_ENA Enables the multiprocessor interrupt Transmit Receive interrupt priority level Choose one from the following RAPI_SCI_INT_LV_0O Interrupt priority level 0 RAPI SCI INT LV 1 Interrupt priority level 1 RAPI_SCI_INT_LV 2 Interrupt priority level 2 RAPI_SCI_INT_LV_3 Interrupt priority level 3 RAPI SCI INT LV 4 Interrupt priority level 4 RAPI_SCI_INT_LV_5 Interrupt priority level 5 RAPI_SCI_INT_LV_6 Interrupt priority level 6 RAPI SCI INT LV 7 Interrupt priority level 7 RAPI_SCI_INT_LV_8 Interrupt priority level 8 RAPI_SCI_INT_LV_9 Interrupt
32. Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPITIMER_INT_LV_1 RAPI_TIMER_INT_LV_ 2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPI_TIMER_INT_LV_0 e When RAPI_PERIODIC is selected the following parameters can be set Count clearing source Specify one from RAPI_ TCNT_CLEAR_TGRA RAPI_ TCNT_CLEAR_TGRB The default value is RAPI_TCNT_CLEAR_DIS Count output Specify one from RAPI_OUTPUT_RETAIN RAPIL_OUTPUT_0_0 RAPLOUTPUT_0_1 RAPIL_OUTPUT_0_TOG RAPI_LOUTPUT_1_0 RAPIL_OUTPUT_1_1 RAPIOUTPUT_1_TOG The default value is RAP _OUTPUT_RETAIN A D converter start Specify one from RAPI_AD_START_REQ request RAPI_NO_AD_START_REQ The default value is RAPLNO_AD_START_REQ Interrupt enable Specify one from RAPI_COMPARE_MATCH_ENA RAPI_COMPARE_MATCH_DIS The default value is RAPLCOMPARE_MATCH_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPLTIMER_INT_LV_1 RAPI_TIMER_INT_LV_ 2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPIL_TI
33. MTU2 channel 5W RAPI_TIOCA TIOCIA pin i 0 to 4 RAPI_TIOCB TIOCB pin i 0 to 4 RAPI_TIOCC TIOCIC pin i 0 3 or 4 RAPI_TIOCD TIOCD pin i 0 3 or 4 RAPI_CAPTURE_ENA Enables TGR input capture interrupt i A B C D U V or W RAPI_CAPTURE_DIS Disables input capture interrupt RAPI_TIMER_INT_LV_0 Interrupt priority level 0 RAPI_TIMER_INT_LV_1 Interrupt priority level 1 RAPI_TIMER_INT_LV_2 Interrupt priority level 2 RAPI_TIMER_INT_LV_3 Interrupt priority level 3 RAPI_TIMER_INT_LV_4 Interrupt priority level 4 RAPI_TIMER_INT_LV_5 Interrupt priority level 5 RAPI_TIMER_INT_LV_6 Interrupt priority level 6 RAPI_TIMER_INT_LV_7 Interrupt priority level 7 RAPI_TIMER_INT_LV_8 Interrupt priority level 8 RAPI_TIMER_INT_LV_9 Interrupt priority level 9 RAPI_TIMER_INT_LV_10 Interrupt priority level 10 RAPI_TIMER_INT_LV_11 Interrupt priority level 11 RAPI_TIMER_INT_LV_12 Interrupt priority level 12 RAPI_TIMER_INT_LV_13 Interrupt priority level 13 RAPI_TIMER_INT_LV_14 Interrupt priority level 14 RAPI_TIMER_INT_LV_15 Interrupt priority level 15 RENESAS es A Library Reference 4 2 2 Timer MTU2 __ SetlnputWidthPin Description 2 3 e Selectable parameters when RAPI_MTU2_0 RAPI_MTU2_3 or RAPI_MTU2_4 is specified Capture channel Specify one from RAPI_TIOCA RAPI_TIOCB RAPI_TIOCC RAPI_TIOCD Interrupt
34. PIN RAPI_IRQ2 FLAG RAPI_IRQ2_PIN RAPI_IRQ3_FLAG RAPI_IRQ3_PIN irq Acquisition of pin state for NMI __GetInterruptAndPinInfo RAPI_NMI_PIN amp nmi Rev 1 01 Aug 27 2008 AS 4 109 REJ10J1906 0101 RENES 4 Library Reference 4 2 4 External Interrupt __ClearInterruptFlag 4 __ClearinterruptFlag Synopsis Description Return value Category Reference Remark Program example lt Clearing of status of interrupt request gt Boolean __ClearlnterruptFlag unsigned long data data Setup data Clears status flag of interrupt request for the specified external interrupt data For data set the following parameters To clear multiple status flags for IRQ interrupt request i 0 to 3 use the symbol to separate each specified parameter RAPI_IRQO_FLAG Status flag for IRQO interrupt request RAPI_IRQ1_FLAG Status flag for IRQ1 interrupt request RAPI_IRQ2_FLAG Status flag for IRQ2 interrupt request RAPI_IRQ3_FLAG Status flag for IRQ3 interrupt request If the specification of external interrupt is invalid RAPILFALSE is returned otherwise RAPI_TRUE is returned External interrupt __Createlnterrupt Enablelnterrupt GetInterruptAndPinInfo If an undefined value is specified in the argument operation of the API cannot be guaranteed include rapi_interrupt_sh_7125 h void func void
35. RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPIL_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_ 14 RAPI_TIMER_INT_LV_ 15 The default value is RAPI_TIMER_INT_LV_0 Rev 1 01 Aug 27 2008 7rtENESAS 4 64 REJ10J1906 0101 4 Description 3 5 Rev 1 01 Aug 27 2008 REJ10J1906 0101 4 2 2 Timer MTU2 Library Reference _ CreatePulseWidthMeasurementMode Selectable parameters when RAPI_MTU2_1 is specified Count source Count edge Count clearing source A D converter start request Interrupt enable Interrupt priority level 7rtENESAS Specify one from RAPI_MP_1 RAPI_MP_4 RAPI_MP_16 RAPI_MP_64 RAPI_MP_256_1 The default value is RAPI_MP_1 Specify one from RAPI_RISING_EDGE RAPI_FALLING_EDGE RAPI_BOTH_EDGE The default value is RAPI_RISING_EDGE Note When RAPI_MP1 is specified for the count source count edge is fixed to the default value Specify one from RAPI_TCNT_CLEAR_DIS RAPI_TCNT_CLEAR_TGRA RAPI_TCNT_CLEAR_TGRB The default value is RAPI_TCNT_CLEAR_DIS Specify one from RAPI_AD_START_REQ RAPI_NO_AD_START_REQ The default value is RAPINO AD _START_REQ Specify one from RAPIOVERFLOW_ENA RAPI_OVERFLOW_DIS The default value is RAPLOVERFLOW_DIS Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_TIMER_INT_LV_2 RAPI_TIMER_INT_LV_
36. 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 Renesas Electronics products are classified according to the following three quality grades Standard High Quality and Specific The recommended applications for each Renesas Electronics product depends on the product s quality grade as indicated below You must check the quality grade of each Renesas Electronics product before using it in a particular application You may not use any Renesas Electronics product for any application categorized as Specific without the prior written consent of Renesas Electronics Further you may not use any Renesas Electronics product for any application for which it is not intended without the prior written consent of Renesas Electronics Renesas Electronics shall not be in any way liable for any damages or losses incurred by you or third parties arising from the use of any Renesas Electronics product for an application categorized as Specific or for which the product is not intended where you have failed to obtain the prior written consent of Renesas Electronics The quality grade of each Renesas Electronics product is Standard unless otherwise expressly specified in a Renesas Electronics data sheets or data books etc Standard Computers office
37. To set multiple parameters at the same time use the symbol to separate each specified parameter Then several timers can be enabled or disabled at the same time RAPI_MTU2_0 MTU2 channel 0 RAPI_MTU2_1 MTU2 channel 1 RAPI_MTU2_2 MTU2 channel 2 RAPI_MTU2_3 MTU2 channel 3 RAPI_MTU2_4 MTU2 channel 4 RAPI_MTU2_5U MTU2 channel 5U RAPI_MTU2_5V MTU2 channel 5V RAPI_MTU2_5W MTU2 channel 5W RAPI_TIMER_ON Starts the timer in input capture mode RAPI_TIMER_OFF Stops the timer in input capture mode If the specification of timer is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Timer MTU2 input capture mode __CreatelnputCapture DestroyInputCapture GetCaptureValue If an undefined value is specified in the argument operation of the API cannot be guaranteed include rapi_timer_sh_7125 h void func void Start up timer for MTU2 channels 1 and 2 in input capture mode EnableInputCapture RAPI_MTU2_1 RAPI_MTU2_2 RAPI_TIMER_ON ENESAS TS 4 25 Synopsis Description Library Reference 4 2 2 Timer MTU2 __DestroylnputCapture __DestroylnputCapture lt Clearing of setting for input capture mode gt Boolean DestroylnputCapture unsigned long data data Setup data Clears setting of the specified timer in input capture mode data For data set the following parameters To set multi
38. argument operation of the API cannot be guaranteed include rapi_timer_sh_7125 h void func void Start up timer for MTU2 channel 4 in pulse width measurement mode __EnablePulseWidthMeasurementMode RAPI_MTU2_4 RAPI_TIMER_ON RENESAS te 4 Library Reference 4 2 2 Timer MTU2 __DestroyPulseWidthMeasurementMode 20 DestroyPulseWidthMeasurementMode Synopsis Description Return value Category Reference Remark Program example lt Clearing of setting for pulse width measurement mode gt Boolean DestroyPulseWidthMeasurementMode unsigned long data data Setup data Clears settings of the specified timer in pulse width measurement mode data For data set the following parameters To set multiple parameters at the same time use the symbol to separate each specified parameter Then several settings of timers can be cleared at the same time RAPI_MTU2_0 MTU2 channel 0 RAPI_MTU2_1 MTU2 channel 1 RAPI_MTU2_ 2 MTU2 channel 2 RAPI_MTU2_3 MTU2 channel 3 RAPI_MTU2_4 MTU2 channel 4 RAPI_MTU20_ A MTU2 channels 0 to 4 RAPI_MTU2_5U MTU2 channel 5U RAPI_MTU2_5V MTU2 channel 5V RAPI_MTU2_5W MTU2 channel 5W RAPI_MTU2_5 MTU2 channels 5U 5V and 5W RAPI_MTU2_ALL All MTU2 channels If the specification of timer is invalid RAPI_FALSE is returned otherwise RAPI_TRUE i
39. at falling edge for channel 5 Input capture at both edges for channel 5 Capture input source is channel 1 count clock Input capture at TCNT_1 count up count down for channel 0 Input capture at generation of T RC_O compare match input capture for channel 1 TIOC1B pin Input capture at generation of TGRA_O compare match input capture for channel 1 TIOC1A pin Enables TGR input capture interrupt i A B C D U V or W Disables input capture interrupt Interrupt priority level 0 Interrupt priority level 1 Interrupt priority level 2 Interrupt priority level 3 Interrupt priority level 4 Interrupt priority level 5 Interrupt priority level 6 Interrupt priority level 7 Interrupt priority level 8 Interrupt priority level 9 Interrupt priority level 10 Interrupt priority level 11 Interrupt priority level 12 Interrupt priority level 13 Interrupt priority level 14 Interrupt priority level 15 RAPI_TGRCO_CAP RAPI_TGRAO_CAP RAPI_CAPTURE_ENA RAPI_CAPTURE_DIS RAPI_TIMER_INT_LV RAPI_TIMER_INT_LV RAPI_TIMER_INT_LV RAPI_TIMER_INT_LV RAPI_TIMER_INT_LV RAPI_TIMER_INT_LV RAPI_TIMER_INT_LV RAPI_TIMER_INT_LV RAPI_TIMER_INT_LV RAPI_TIMER_INT_LV RAPI_TIMER_INT_LV RAPI_TIMER_INT_LV RAPI_TIMER_INT_LV RAPI_TIMER_INT_LV RAPI_TIMER_INT_LV RAPI_TIMER_INT_LV OO NID AA Co Po o k CH x
40. cannot be guaranteed Program example include rapi_timer_sh_7125 h void func void Clearing count direction flag and overflow flag for MTU2 channel 0 __ClearMTU2Flag RAPI_MTU2_0 RAPI_TCFV RAPI_TGFD Rev 1 01 Aug 27 2008 AS 4 99 REJ10J1906 0101 RENES 4 4 2 3 I O Port __SetlOPort 4 2 3 WO Port 1 SetlOPort Synopsis lt Setting of I O port gt Boolean SetlOPort unsigned long data data Setup data Description Sets the operating condition for the specified I O port data For data set the following parameters To set multiple parameters at the same time use the symbol to separate each specified parameter e Port Choose one from the following RAPI_FUNC_A PortA RAPI_FUNC_B_L Port B with lower 16 bits RAPI_FUNC_B_H Port B with higher 16 bits RAPI_FUNC_E Port E RAPI_FUNC_F Port F Note Port F is an input only port with 8 bits e Bit Multiple bits can be selected RAPI_BIT_O Bit 0 of the specified port RAPI BIT_1 Bit 1 of the specified port RAPI BIT 2 Bit 2 of the specified port RAPI_BIT_ 3 Bit 3 of the specified port RAPI BIT A Bit 4 of the specified port RAPI_BIT_5 Bit 5 of the specified port RAPI_BIT_6 Bit 6 of the specified port RAPI_BIT_7 Bit 7 of the specified port RAPI_BIT_8 Bit 8 of the specified port RAPI BIT 9 Bit 9 of the specified port RAPI_BIT_10 Bit 10 of the specified port RAPI BIT_11 Bit 11 of the specified port RAPIL BIT_12 Bit 12 o
41. clearing source Specify one from RAPI_MP_1 RAPI_MP_4 RAPI_MP_16 RAPI_MP_64 The default value is RAPI_MP_1 Specify one from RAPI_LTCNT_CLEAR_DIS RAPI_TCNT_CLEAR_TGRU RAPI_TCNT_CLEAR_TGRV RAPI_TCNT_CLEAR_TGRW The default value is RAPI_TCNT_CLEAR_DIS e Parameters when synchronous operation is specified When setting synchronous operation for any channels 0 to 4 specify RAPI_TIMER_SYNC When not setting synchronous operation each channel operates independently specify RAPIL_TIMER_NO_SYNC The default value is RAPI_LTIMER_NO_SYNC func Specify a pointer to callback function If this pointer is not specified set RAPI_NULL Rev 1 01 Aug 27 2008 7tENESAS 4 80 REJ10J1906 0101 A Library Reference 4 2 2 Timer MTU2 __GetPulseWidthMeasurementMode Return value If the specification of timer is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Category Timer MTU2 input capture mode Reference __EnablelnputCapture DestroylnputCapture GetCaptureValue Remark If an undefined value is specified in the argument operation of the API cannot be guaranteed Program example include rapi_timer_sh_7125 h Declaration of callback function void TimerIntFunc void void func void Setting MTU2 channelO for input capture mode __CreateInputCapture RAPI_MTU2_0 RAPI_MP_4 RAPI_BOTH_EDGE RAPI_TCNT_CLEAR_TGRB RAPI_OVERFLOW_DIS RAPI IMER
42. converter start Specify one from RAPI_LAD_START_REQ request RAPI_NO_AD_START_REQ The default value is RAPINO_AD_START_REQ Interrupt enable Specify one from RAPI_COMPARE_MATCH_ENA RAPI_COMPARE_MATCH_DIS The default value is RAPICOMPARE_MATCH_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_TIMER_INT_LV_2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPI_TIMER_INT_LV_0 Rev 1 01 Aug 27 2008 AS 4 32 REJ10J1906 0101 RENES Library Reference 4 4 2 2 Timer MTU2 _ CreateEventCounter Description 6 7 e Selectable parameters when RAPI_MTU2_3 or RAPILMTU2_4 and RAPILNORMAL are specified Count source Specify one from RAPI_EXTER_TCLKA_3 RAPI_EXTER_TCLKB_ 3 Operation method Specify one from BAD EREE RUNNING RAPI_ PERIODIC The default value is RAPI_FREE RUNNING Count edge Specify one from RAPI_RISING_EDGE RAPI_FALLING_EDGE RAPI_BOTH_EDGE The default value is RAPI_LRISING_EDGE e When RAD FREE RUNNING e selected the following parameters can be set Interrupt enable Specify one from RAPIOVERFLOW_ENA RAPI_OVERFLOW_DIS The def
43. enable Specify one from RAPI_CAPTURE_ENA RAPI_CAPTURE_DIS The default value is RAPICAPTURE_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_TIMER_INT_LV_ 2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPL_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPIL_TIMER_INT_LV_0 e Selectable parameters when RAPI_MTU2_1 or RAPI_MTU2_2 is specified Capture channel Specify one from RAPI_TIOCA RAPI_TIOCB Interrupt enable Specify one from RAPI_CAPTURE_ENA RAPI_CAPTURE_DIS The default value is RAPI_CAPTURE_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPITIMER_INT_LV_1 RAPI_TIMER_INT_LV_ 2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPL_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPILTIMER_INT_LV_0 e Selectable parameters when RAPI_MTU2_5 is specified Capture channel Specify one from RAPI_MTU2_5U RAPI_MTU2_5V RAPI_MTU2_5W Interrupt enable Specify one
44. equipment communications equipment test and measurement equipment audio and visual equipment home electronic appliances machine tools personal electronic equipment and industrial robots High Quality Transportation equipment automobiles trains ships etc traffic control systems anti disaster systems anti crime systems safety equipment and medical equipment not specifically designed for life support Specific Aircraft aerospace equipment submersible repeaters nuclear reactor control systems medical equipment or systems for life support e g artificial life support devices or systems surgical implantations or healthcare intervention e g excision etc and any other applications or purposes that pose a direct threat to human life You should use the Renesas Electronics products described in this document within the range specified by Renesas Electronics especially with respect to the maximum rating operating supply voltage range movement power voltage range heat radiation characteristics installation and other product characteristics Renesas Electronics shall have no liability for malfunctions or damages arising out of the use of Renesas Electronics products beyond such specified ranges Although Renesas Electronics endeavors to improve the quality and reliability of its products semiconductor products have specific characteristics such as the occurrence of failure at a certain rate and malfunctions under c
45. pulse width modulation mode Reference __EnablePWM DestroyPWM Remark If an undefined value is specified in the first argument operation of the API cannot be guaranteed Rev 1 01 Aug 27 2008 7rtENESAS 4 44 Library Reference 4 4 2 2 Timer MTU2 _ CreatePWM Program example include rapi_timer_sh_7125 h Declaration of callback function void TimerIntFunc void void func void Setting MTU2 channel 1 for pulse width modulation mode __CreatePWM RAPI_MTU2_1 RAPI_MP_4 RAPI_RISING_EDGE RAPI_PWM_MODE1 RAPI_TCNT_CLEAR_TGRB RAPI_OVERFLOW_DIS RAPI_TIMER_INT_LV_O RAPI_TIMER_NO_SYNC TimerIntFunc Rev 1 01 Aug 27 2008 4 45 REJ10J1906 0101 RENESAS 4 9 __SetPWMPin Synopsis Description 1 2 Rev 1 01 REJ10J1906 0101 Aug 27 2008 Library Reference 4 2 2 Timer MTU2 __SetPWMPin lt Setting of timer general register for pulse width modulation gt Boolean SetPWMPin unsigned long data1 unsigned short data2 void func data1 Setup data 1 data2 Setup data 2 func Pointer to callback function Sets the timer general register of the specified channel for pulse width modulation data1 For data1 set the following parameters To set multiple parameters at the same time use the symbol to separate each specified parameter RAPI_MTU2_0 MTU2 channel 0 RAPI_MTU2_1 MT
46. to 4 RAPI_TIOCC TIOCIC pin i 0 3 or 4 RAPI_TIOCD TIOCD pin i 0 3 or 4 Return value If the specification of timer is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Category Timer MTU2 pulse width measurement mode Reference GetCaptureValue Remark e Ifthe state of the specified pin is high for L when this API is executed the counter value of the last L period CH period is stored in data2 Note that this API does not read the pin state A user needs the discriminant processing for the pin state before executing this API Refer to the following Program example e H an undefined value is specified in the first argument operation of the API cannot be guaranteed Program example include rapi_timer_sh_7125 h void func void unsigned short data 2 Acquisition of measured values of TGRA and TGRB for MTU2 channel 4 in pulse width measurement mode __GetPulseWidthMeasurementMode RAPI_MTU2_4 RAPI_TIOCA RAPI_TIOCB data Rev 1 01 Aug 27 2008 4 74 REJ10J1906 0101 RENESAS 4 22 CreatelnputCapture Synopsis Description 1 6 Rev 1 01 lt Setting for input capture mode gt 4 2 2 Timer MTU2 Library Reference __GetPulseWidthMeasurementMode Boolean __CreatelnputCapture unsigned long data1 void func data1 Setup data 1 func Pointer to callback function Sets the
47. 0 4 Library Reference 4 2 2 Timer MTU2 __DestroyTimer 3 __DestroyTimer Synopsis Description lt Clearing of setting for timer mode gt Boolean __DestroyTimer unsigned long data data Setup data Clears setting of the specified timer in timer mode data For data set the following parameters To set multiple parameters use the symbol to separate each specified parameter Then several settings of timers can be cleared at the same time Return value Category Reference Remark Program example Rev 1 01 Aug 27 2008 REJ10J1906 0101 RAPI_MTU2_0 MTU2 channel 0 RAPI_MTU2_1 MTU2 channel 1 RAPI_MTU2_ 2 MTU2 channel 2 RAPI_MTU2_3 MTU2 channel 3 RAPI_MTU2_4 MTU2 channel 4 RAPI_MTU20_ A MTU2 channels 0 to 4 RAPI_MTU2_5U MTU2 channel 5U RAPI_MTU2_5V MTU2 channel 5V RAPI_MTU2_5W MTU2 channel 5W RAPI_MTU2_5 MTU2 channels 5U 5V and 5W RAPI_MTU2_ALL MTU2 all channels RAPI_CMT_0O CMT channel 0 RAPI_CMT_1 CMT channel 1 RAPI_CMT_ALL CMT all channels RAPI_TIMER_ALL all MTU2 and CMT channels If the specification of timer is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Timer MTU2 timer mode __CreateTimer EnableTimer If an undefined value is specified in the argument operation of the API cannot be guaranteed include rapi_timer_sh_7125 h voi
48. 0101 4 Library Reference 4 2 2 Timer MTU2 __DestroyOutputCompare 30 DestroyOutputCompare Synopsis Description Return value Category Reference Remark Program example lt Clearing of setting for output compare mode gt Boolean DestroyOutputCompare unsigned long data data Setup data Clears setting of the specified timer in output compare mode data For data set the following parameters To set multiple parameters at the same time use the symbol to separate each specified parameter RAPI_MTU2_0 MTU2 channel 0 RAPI_MTU2_1 MTU2 channel 1 RAPI_MTU2_2 MTU2 channel 2 RAPI_MTU2_ 3 MTU2 channel 3 RAPI_MTU2_4 MTU2 channel 4 RAPI_MTU20_ A MTU2 channels 0 to 4 If the specification of timer is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Timer MTU2 output compare mode ___DestroyTimer If an undefined value is specified in the argument operation of the API cannot be guaranteed include rapi_timer_sh_7125 h void func void Clearing settings of MTU2 channels 1 and 2 in output compare mode __DestroyOutputCompare RAPI_MTU2_1 RAPI_MTU2_2 Rev 1 01 Aug 27 2008 7rtENESAS 4 95 REJ10J1906 0101 4 Library Reference 4 2 2 Timer MTU2 __GetTimerFlag 31 GetTimerFlag Synopsis lt Acquisition of timer status gt Boolean G
49. 1 Aug 27 2008 7tENESAS 4 6 REJ10J1906 0101 4 2 __DestroySCl Synopsis Description Return value Category Reference Remark Program example Library Reference 4 2 1 Serial Communication Interface SCI __DestroySCl lt Closing of serial port gt Boolean DestroySCl unsigned long data data Setup data Stops clock supply to the specified serial port data For data set one of the following parameters as a channel RAPI_COM1 SCI channel 0 RAPI_COM2 SCI channel 1 RAPI_COM3 SCI channel 2 If the specification of serial port is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned SCI __CreateSCl If an undefined value is specified in the argument operation of the API cannot be guaranteed include rapi_sif_sh_7125 h void func void Closing serial port for SCI channel 0 __DestroySCI RAPI_COM1 Rev 1 01 Aug 27 2008 7rtENESAS 4 7 REJ10J1906 0101 4 Library Reference 4 2 1 Serial Communication Interface SCI __StartSClReceiving 3 StartSClReceiving Synopsis Description Return value Category Reference Remark Program example lt Start of SCI reception gt Boolean __StartSClReceiving unsigned long data unsigned char RcevDtBuf unsigned short byteNum unsigned short RcvNum
50. 1 Serial Communication Interface SCI __StopSClReceiving 5 StopSClReceiving Synopsis Description Return value Category Reference Remark Program example lt Stop of SCI reception gt Boolean StopSClReceiving unsigned long data1 unsigned short data2 data1 Setup data 1 data2 Setup data 2 Stops SCI reception data1 For data1 set one of the following parameters as a channel RAPI_COM1 SCI channel 0 RAPI_COM2 SCI channel 1 RAPI_COM3 SCI channel 2 data2 For data2 specify the wait time until stopping SCI reception If stop of SCI reception is successful and there are no receive errors RAPI_TRUE is returned otherwise RAPI_FALSE is returned SCI __StartSClReceiving If an undefined value is specified in the argument operation of the API cannot be guaranteed include rapi_sif_sh_7125 h void func void Stopping SCI reception for channel 0 __StopSCIReceiving RAPI_COM1 50000 Rev 1 01 Aug 27 2008 7rtENESAS 4 10 REJ10J1906 0101 4 Library Reference 4 2 1 Serial Communication Interface SCI __StopSClSending 6 _ StopSClSending Synopsis Description Return value Category Reference Remark Program example lt Stop of SCI transmission gt Boolean StopSCiSending unsigned long d
51. 1 Setup data 1 data2 Setup data 2 Acquires the counter value of the specified timer in timer mode or event counter mode data1 For data1 set the following parameters To set multiple parameters of channels use the symbol to separate each specified parameter Then counter values of several timers can be obtained at the same time Refer to notes below RAPI_MTU2_0 MTU2 channel 0 TCNT_0 RAPI_MTU2_1 MTU2 channel 1 TCNT_1 RAPI_MTU2 2 MTU2 channel 2 TCNT_2 RAPI_MTU2_3 MTU2 channel 3 TCNT_3 RAPI_MTU2_ A MTU2 channel 4 TCNT_4 RAPI_MTU20 A MTU2 channels 0 to 4 RAPI_MTU2_5U MTU2 channel 5 TCNTU_5 RAPI_MTU2_5V MTU2 channel 5 TCNTV_5 RAPI_MTU2_5W MTU2 channel 5 TCNTW_5 RAPI_MTU2_5 MTU2 channels 5U 5V and 5W RAPI _CMT_0 CMT channel 0 CMCNT_0 RAPI_CMT_1 CMT channel 1 CMCNT_1 RAPI_CMT_ALL CMT all channels e Selectable parameters when timer mode is selected Count channel Specify one from RAPI_LMTU2_0 RAPI_MTU2_1 RAPI_MTU2_2 RAPI_MTU2_3 RAPI_MTU2_4 RAPI_MTU2_5U RAPI_MTU2_5V RAPI_MTU2_5W RAPI_CMT_0 RAPI_CMT_1 Notes e For MTU2 channels 0 to 5 several channels can be specified at the same time e For CMT channels 0 and 1 several channels can be specified at the same time e Selectable parameters when event counter mode is selected Count channel Specify one from RAPI_MTU2_0 RAPI_MTU2_1 RAPI_MTU2_2 RAPI_MTU2_3 RAPIMT
52. 1_TOG The default value is RAPI_OUTPUT_RETAIN A D converter start Specify one from RAPI_AD_START_REQ request RAPI_NO_AD_START_REQ The default value is RAPLNO_AD_START_REQ Interrupt enable Specify one from RAPI_COMPARE_MATCH_ENA RAPI_COMPARE_MATCH_DIS The default value is RAPLCOMPARE_MATCH_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPLTIMER_INT_LV_1 RAPI_TIMER_INT_LV_ 2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPIL_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPILTIMER_INT_LV_0 Rev 1 01 Aug 27 2008 AS 4 23 REJ10J1906 0101 RENES Library Reference 4 4 2 2 Timer MTU2 _ CreateTimer Description 7 7 e Selectable parameters when RAPI_MTU2_5 is specified Count source Specify one from RAPI_MP1 RAPI_MP4 RAPI_MP16 RAPI_MP64 The default value is RAPI_MP1 Operation method Only RAPI_PERIODIC can be selected Count clearing source Specify one from RAPI_LTCNT_CLEAR_DIS RAPI_TCNT_CLEAR_TGRU RAPL_TCNT_CLEAR_TGRV RAPI_TCNT_CLEAR_TGRW The default value is RAPIL_TCNT_CLEAR_DIS Interrupt enable Specify one from RAPI_ COMPARE_MATCH_ENA RAPI_COMPARE_MATCH_DIS The default value is RAPICOMPARE_MATCH_DI
53. 3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_ 15 The default value is RAPI_TIMER_INT_LV_0 4 65 4 Description 4 5 Rev 1 01 Aug 27 2008 REJ10J1906 0101 4 2 2 Timer MTU2 Library Reference _ CreatePulseWidthMeasurementMode Selectable parameters when RAPI_MTU2_2 is specified Count source Count edge Count clearing source A D converter start request Interrupt enable Interrupt priority level 7rtENESAS Specify one from RAPI_MP_1 RAPI_MP_4 RAPI_MP_16 RAPI_MP_64 RAPI_MP_1024 2 The default value is RAPI_MP_1 Specify one from RAPI_RISING_EDGE RAPI_FALLING_EDGE RAPI_BOTH_EDGE The default value is RAPI_RISING_EDGE Note When RAPI_MP1 is specified for the count source count edge is fixed to the default value Specify one from RAPI_TCNT_CLEAR_DIS RAPI_TCNT_CLEAR_TGRA RAPI_TCNT_CLEAR_TGRB The default value is RAPI_TCNT_CLEAR_DIS Specify one from RAPI_AD_START_REQ RAPI_NO_AD_START_REQ The default value is RAPINO AD _START_REQ Specify one from RAPIOVERFLOW_ENA RAPI_OVERFLOW_DIS The default value is RAPLOVERFLOW_DIS Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_T
54. 5 h unsigned short data 2 void func void Setting pin function of lower 8 bits on Port A as the port input __SetIOPort RAPI_FUNC_A RAPI_LOWER_8_BITS RAPI_FUNC_IO RAPI_PORT_INPUT Reading bits 0 and 3 on Port A to data 0 and data 1 respectively __ReadIOPort RAPI_FUNC_A RAPI_BIT_O RAPI_BIT_3 RAPI_BITS_OPE RAPI_PORT_REGISTER data Setting pin function of bits 1 and 3 on Port B as the port output __SetIOPort RAPI_FUNC_B_L RAPI_BIT_1 RAPI_BIT_3 RAPI_FUNC_IO RAPI_PORT_OUTPUT Writing H to bits 1 and 3 on Port B __WriteIOPort RAPI_FUNC_B_L RAPI_BIT_1 RAPI_BIT_3 RAPI_BITS_OPE RAPI_H Figure 5 6 Example of I O Port Read Write Operation Rev 1 01 Aug 27 2008 AS 5 6 REJ10J1906 0101 RENES Usage Example 5 5 4 External Interrupt 5 4 External Interrupt Figure 5 7 shows a usage example of external interrupt A user needs to execute processing by a callback function if necessary include rapi_interrupt_sh_7125 h Declaration of callback function void IntFunc void void func void Setting IRQO interrupt Detection by rising edge output disabling of detection signal for interrupt request interrupt priority level 5 __CreateInterrupt RAPI_IRQO RAPI_INT_RISING RAPI_IRQOUT_HIGH_LE RAPI_INT_LV_5 IntFunc Enabling IRQO interrupt __EnableInterrupt RAPI_IRQO RAPI_INT_REQUEST_CLEAR RAPI_
55. 7 2008 AS 2 6 REJ10J1906 0101 RENES 3 Standard Type 3 Standard Type This chapter describes the standard type defined in this library For details about the setting values refer to the section 4 2 Description of Each APT Table 3 1 Standard Type Standard type Description Boolean Boolean type represents the enum type data that indicates whether it is true RAPI_TRUE 1 or false RAPI_FALSE 0 VoidFuncNotify VoidFuncNotify type represents the type of the notification function to be registered Rev 1 01 Aug 27 2008 7rtENESAS 3 1 REJ10J1906 0101 3 Standard Type Rev 1 01 Aug 27 2008 3 2 REJ10J1906 0101 RENESAS 4 4 Library Reference 4 1 API List by Peripheral Function Library Reference 4 1 API List by Peripheral Function Table 4 1 and Table 4 2 list the Renesas Embedded APIs by peripheral functions Table 4 1 Renesas Embedded API List 1 2 Category No Name Description Serial 1 Create Setting of SCI Communication 2 DestroySCl Closing of serial port Interface 3 StartSClReceiving Start of SCI reception SCI 4 _ StartSClSending Start of SCI transmission 5 _StopSClReceiving Stop of SCI reception 6 _StopSClSending Stop of SCI transmission 7 _ PollingSClReceiving SCI reception by polling 8 PollingSClSending SCI transmis
56. A __ReadIOPort RAPI_FUNC_A RAPI_BIT_1 RAPI_BIT_3 RAPI_PORT_REGISTER RAPI_BITS_OPE data Rev 1 01 Aug 27 2008 7rtENESAS 4 103 REJ10J1906 0101 4 3 __WritelOPort Synopsis Description 1 2 Rev 1 01 REJ10J1906 0101 Library Reference 4 2 3 I O Port __WritelOPort lt Writing of data to I O port gt Boolean WritelOPort unsigned long data1 unsigned short data2 Aug 27 2008 data1 Setup data 1 data2 Data to be written to I O port Writes data to the specified I O port data1 For data1 set the following parameters To set multiple parameters at the same time use the symbol to separate each specified parameter e Port Choose one from the following RAPI_FUNC A PortA RAPI FUNC B L Port B with lower 16 bits RAPI FUNC BH Port B with higher 16 bits RAPI FUNC E Port E RAPI FUNC E Port F e Bit Multiple bits can be selected RAPI_BIT_0 Bit 0 of the specified port RAPI_BIT_1 Bit 1 of the specified port RAPI_BIT_2 Bit 2 of the specified port RAPI_BIT_3 Bit 3 of the specified port RAPI_BIT_4 Bit 4 of the specified port RAPI_BIT_5 Bit 5 of the specified port RAPI_BIT_6 Bit 6 of the specified port RAPI_BIT_7 Bit 7 of the specified port RAPI_BIT_8 Bit 8 of the specified port RAPI_BIT_9 Bit 9 of the specified port RAPI_BIT_10 Bit
57. A D converter start Specify one from RAPI_AD_START_REQ request RAPI_NO_AD_START_REQ The default value is RAPI_NO_AD_START_REQ Interrupt enable Specify one from RAPIOVERFLOW_ENA RAPI_OVERFLOW_DIS The default value is RAPILOVERFLOW_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_TIMER_INT_LV_2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPI_TIMER_INT_LV_0 Rev 1 01 Aug 27 2008 7rtENESAS 4 43 REJ10J1906 0101 4 Description 6 6 REJ10J1906 0101 Library Reference 4 2 2 Timer MTU2 __CreatePWM e Selectable parameters when RAPI_MTU2_3 or RAPI_MTU2_4 is specified only for PWM mode 1 RAPI_PWM_MODE1 Count source Specify one from RAPI_MP_1 RAPI_MP_4 RAPI_MP_16 RAPI_MP_64 RAPI_MP_256_ 34 RAPI_MP_1024 34 RAPI_EXTER_TCLKA_3 RAPI_LEXTER_TCLKB_ 3 The default value is RAPI_MP_1 Count edge Specify one from RAPI_RISING_EDGE RAPI_FALLING_EDGE RAPI_BOTH_EDGE The default value is RAPI_LRISING_EDGE Note When RAPI_MP1 is specified for the count source count edge is fixed to the default value Count clearin
58. API_MTU2_3 MTU2 channel 3 RAPI_MTU2_4 MTU2 channel 4 HAD MP1 Internal clock counts on MP 9 1 HAD MP4 Internal clock counts on MP 9 4 RAPIMP16 Internal clock counts on MP9 16 RAPI_MP64 Internal clock counts on MP 64 RAPI_MP256_1 Internal clock counts on MP9 256 for channel 1 HAD MP256_34 Internal clock counts on MP 9 256 for channel 3 or 4 RAPI_MP1024 2 Internal clock counts on MP 1024 for channel 2 RAPIMP1024 34 Internal clock counts on MP 9 1024 for channel 3 or 4 RAPI_EXTER_TCLKA_0O External clock counts on TCLKA pin input for channel 0 to 2 RAPI_EXTER_TCLKB_0 External clock counts on TCLKB pin input for channel 0 to 2 RAPI_EXTER_TCLKC_0 External clock counts on TCLKC pin input for channel 0 or 2 RAPI_EXTER_TCLKD_0 External clock counts on TCLKD pin input for channel 0 RAPI_EXTER_TCLKA_3 External clock counts on TCLKA pin input for channel 3 or 4 RAPI_EXTER_TCLKB_3 External clock counts on TCLKB pin input for channel 3 or 4 RAPI_RISING_EDGE Counts at rising edge RAPI_FALLING_EDGE Counts at falling edge RAPI_BOTH_ EDGE Counts at both edges Note When MP9 1 is specified as the count source count edge is fixed to rising edge Rev 1 01 Aug 27 2008 7tENESAS 4 39 REJ10J1906 0101 4 Library Reference 4 2 2 Timer MTU2 __CreatePWM Description 2 6 RAPI_PWM_MODE1 PWM mode 1 RAPI_PWM_MODE2 PWM mode 2 only for channel 0 1 or 2 RAPI_TCNT_CLEAR_DIS Disables TCNT clearing Rev 1
59. API_TRUE is returned External interrupt __Createlnterrupt GetlnterruptAndPinInfo ClearInterruptFlag e The Interrupt priority level specified in Createlnterrupt is set to the interrupt priority register IPR after execution of this API specifying RAPI_IRQ_ENA e H an undefined value is specified in the first argument operation of the API cannot be guaranteed include rapi_interrupt_sh_7125 h void func void Enabling IRQ1 interrupt EnableInterrupt RAPI_IRQ1 RAPI_INT_REQUEST_CLEAR RAPI_IRQ_ENA Rev 1 01 Aug 27 2008 7rtENESAS 4 108 REJ10J1906 0101 A Library Reference 4 2 4 External Interrupt __ GetlnterruptAndPinInfo 3 GetInterruptAndPinInfo Synopsis lt Acquisition of input pin level for external interrupt and the status of interrupt request gt Boolean __GeitInterruptAndPinInfo unsigned long data1 unsigned char data2 data1 Setup data 1 data2 Pointer to the buffer in which input pin level and status flag are stored Description Acquires input pin level and status flag of interrupt request for the specified external interrupt data1 For data1 set the following parameters To read multiple IRQ input pin levels or multiple status flags for IRQ interrupt request i O to 3 use the symbol to separate each specified parameter RAPI_NMI_PIN Input pin level for NMI RAPI_
60. Es Se ee aa Compare match Input capture flag for channel 5 Rev 1 01 Aug 27 2008 7rtENESAS 4 96 REJ10J1906 0101 4 Return value Category Reference Remark Program example Library Reference 4 2 2 Timer MTU2 __GetTimerFlag If the specification of timer is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Timer MTU2 __ClearTimerFlag If an undefined value is specified in the first argument operation of the API cannot be guaranteed include rapi_timer_sh_7125 h void func void unsigned char data Acquisition of count direction flag and overflow flag for MTU2 channel 0 __GetMTU2Flag RAPI_MTU2_0 RAPI_TCFV RAPI_TGFD amp data Rev 1 01 Aug 27 2008 7rtENESAS 4 97 REJ10J1906 0101 4 Library Reference 4 2 2 Timer MTU2 __ClearTimerFlag 32 ClearTimerFlag Synopsis lt Clearing of timer status gt Boolean ClearTimerFlag unsigned long data data Setup data Description Clears status flags of the specified timer data For data set the following parameters To clear multiple parameters for flags at the same time use the symbol to separate each specified parameter RAPI_MTU2_0 MTU2 channel 0 RAPI_MTU2_1 MTU2 channel 1 RAPI_MTU2_2 MTU2 channel 2 RAPI_MTU2_ 3 MTU2 channel 3 RAPI_MTU2_4 MTU2 channel 4 RAPI
61. I __StartSClSending 4 _ StartSClSending Synopsis Description Return value Category Reference Remark Program example lt Start of SCI transmission gt Boolean StartSCISending unsigned long data unsigned char SndDtBuf unsigned short byteNum unsigned short SndNum data Setup data SndDtBuf Pointer to transmit data byteNum Number of bytes transmitted SndNum Pointer to address storing the number of the actual transmitted data Starts SCI transmission and transmits data with the specified number of bytes data For data set one of the following parameters as a channel RAPI_COM1 SCI channel 0 RAPI_COM2 SCI channel 1 RAPI_COM3 SCI channel 2 If start up for SCI transmission is successful RAPI_TRUE is returned otherwise RAPI_FALSE is returned SCI __CreateSCl __StopSClSending GetSClStatus e When executing this API function wait for at least a 1 bit period after CreateSCl is called e H an undefined value is specified in the first argument operation of the API cannot be guaranteed include rapi_sif_sh_7125 h unsigned char SendBuf 10 unsigned short SendNum void func void Start up SCI transmission for 5 byte data __ StartSCISending RAPI_COM1 SendBuf 5 amp SendNum Rev 1 01 Aug 27 2008 REJ10J1906 0101 stENESAS Ve 4 Library Reference 4 2
62. I _TCNT CLEAR DIS Disables TCNT clearing RAPI TCNT CLEAR TGRA Clears TCNT by TGRA input capture RAPI_TCNT_CLEAR_TGRB Clears TCNT by TGRB input capture RAPI_TCNT CLEAR TGRC Clears TCNT by TGRC input capture RAPI TCNT CLEAR TGRD Clears TCNT by TGRD input capture RAPI_TCNT_CLEAR_TGRU Clears TCNT by TGRU input capture RAPI TCNT CLEAR _TGRV Clears TCNT by TGRV input capture RAPI_TCNT_CLEAR_TGRW Clears TCNT by TGRW input capture 7rtENESAS 4 51 4 4 2 2 Timer MTU2 Library Reference __CreatePulsePeriodMeasurementMode Description 2 5 RAPI_OVERFLOW_ENA Enables overflow interrupt Rev 1 01 REJ10J1906 0101 RAPI_OVERFLOW_DIS Disables overflow interrupt RAPI_TIMER_INT_LV Interrupt priority level 0 RAPI_TIMER_INT_LV Interrupt priority level 1 RAPI_TIMER_INT_LV Interrupt priority level 2 RAPI_TIMER_INT_LV Interrupt priority level 3 RAPI_TIMER_INT_LV Interrupt priority level 4 RAPI_TIMER_INT_LV Interrupt priority level 5 RAPI_TIMER_INT_LV Interrupt priority level 6 RAPI_TIMER_INT_LV Interrupt priority level 7 RAPI_TIMER_INT_LV Interrupt priority level 8 RAPI_TIMER_INT_LV CO Ni O 01 A Go PO o Interrupt priority level 9 RAPI_TIMER_INT_LV 10 Interrupt priority level 10 RAPI_TIMER_INT_LV 11
63. I channel 0 RAPI_COM2 SCI channel 1 RAPI_COM3 SCI channel 2 If the specification of serial port or the received data is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned SCI __GetSClStatus __StartSCIReceiving If an undefined value is specified in the argument operation of the API cannot be guaranteed include rapi_sif_sh_7125 h unsigned char ReceiveBuf 10 unsigned short ReceiveNum void INT_SCIO_RX void void ErrorOpe void Main routine void func void Setting SCI channel 0 to clock synchronous mode Receive data full and receive error interrupts enabled __CreateSCI RAPI_COM1 RAPI_SM_SYNC RAPI_CKDIR_INT RAPI_BCSS_P1 RAPI_LSB_SEL RAPI_INT_RX_ERR_ENA RAPI_SCI_INT_LV_6 20 Setting receive data size to 5 bytes and Start up SCI reception __StartSCIReceiving RAPI_COM1 ReceiveBuf 5 amp ReceiveNum Interrupt routine for SCI reception void INT_SCIO_RX void Reception of 5 byte data if __PollingSCIReceiving RAPI_COM1 RAPI_TRUE Reception success if ReceiveNum E End of 5 byte data reception StopSCIReceiving RAPI_COM1 5000 else Reception failure ErrorOpe Error processing Rev 1 01 Aug 27 2008 7tENESAS 4 12 REJ10J1906 0101 A Library Reference 4 2 1 Serial Communication Interface SCI
64. IMER_INT_LV Interrupt priority level 0 RAPI_TIMER_INT_LV Interrupt priority level 1 RAPI_TIMER_INT_LV Interrupt priority level 2 RAPI_TIMER_INT_LV Interrupt priority level 3 RAPI_TIMER_INT_LV Interrupt priority level 4 RAPI_TIMER_INT_LV Interrupt priority level 5 RAPI_TIMER_INT_LV Interrupt priority level 6 RAPI_TIMER_INT_LV Interrupt priority level 7 RAPI_TIMER_INT_LV Interrupt priority level 8 OO Ni Od ATA Go PO o RAPI_TIMER_INT_LV Interrupt priority level 9 RAPI_TIMER_INT_LV CH Interrupt priority level 10 RAPI_TIMER_INT_LV i s Interrupt priority level 11 RAPI_TIMER_INT_LV ine Interrupt priority level 12 RAPI_TIMER_INT_LV ao Interrupt priority level 13 RAPI_TIMER_INT_LV CH Interrupt priority level 14 RAPI_TIMER_INT_LV o Interrupt priority level 15 RENESAS ate Library Reference 4 4 2 2 Timer MTU2 _ CreateTimer Description 3 7 e Selectable parameters when RAPI_MTU2_0 is specified Count source Specify one from RAPI_MP1 RAPI_MP4 RAPI_MP16 RAPI_MP64 The default value is RAPI_MP1 Operation method Specify one from RAP EREE RUNNING RAPI_ PERIODIC The default value is RAPI_FREE_RUNNING Count edge Specify one from RAPI_FALLING_EDGE RAPI_RISING_EDGE RAPI_BOTH_EDGE
65. IMER_INT_LV_2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_ 15 The default value is RAPI_TIMER_INT_LV_0 4 66 Library Reference 4 4 2 2 Timer MTU2 _ CreatePulseWidthMeasurementMode Description 5 5 e Selectable parameters when RAPI_MTU2_3 or RAPI_MTU2_4 is specified Count source Count edge Count clearing source A D converter start request Interrupt enable Interrupt priority level Specify one from RAPI_MP_1 RAPI_MP_4 RAPI_MP_16 RAPI_MP_64 RAPI_MP_256_34 RAPI_MP_1024 34 The default value is RAPI_MP_1 Specify one from RAPI_RISING_EDGE RAPI_FALLING_EDGE RAPI_BOTH_EDGE The default value is RAPI_RISING_EDGE Note When RAPI_MP1 is specified for the count source count edge is fixed to the default value Specify one from RAPI_LTCNT_CLEAR_DIS RAPI_TCNT_CLEAR_TGRA RAPI_TCNT_CLEAR_TGRB RAPI_TCNT_CLEAR_TGRC RAPI_TCNT_CLEAR_TGRD The default value is RAPI_TCNT_CLEAR_DIS Specify one from RAPI_AD_START_REQ RAPI_NO_AD_START_REQ The default value is RAPI_NO_ AD _START_REQ Specify one from RAPIOVERFLOW_ENA RAPI_OVERFLOW_DIS The default value is RAPLOVERFLOW_DIS Specify one from RAPI
66. INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_ 15 The default value is RAPI_TIMER_INT_LV_0 4 53 4 Description 4 5 Rev 1 01 Aug 27 2008 REJ10J1906 0101 4 2 2 Timer MTU2 Library Reference _ CreatePulsePeriodMeasurementMode Selectable parameters when RAPI_MTU2_2 is specified Count source Count edge Count clearing source A D converter start request Interrupt enable Interrupt priority level 7rtENESAS Specify one from RAPI_MP_1 RAPI_MP_4 RAPI_MP_16 RAPI_MP_64 RAPI_MP_1024 2 The default value is RAPI_MP_1 Specify one from RAPI_RISING_EDGE RAPI_FALLING_EDGE RAPI_BOTH_EDGE The default value is RAPI_RISING_EDGE Note When RAPI_MP1 is specified for the count source count edge is fixed to the default value Specify one from RAPI_TCNT_CLEAR_DIS RAPI_TCNT_CLEAR_TGRA RAPI_TCNT_CLEAR_TGRB The default value is RAPI_TCNT_CLEAR_DIS Specify one from RAPI_AD_START_REQ RAPI_NO_AD_START_REQ The default value is RAPINO AD _START_REQ Specify one from RAPIOVERFLOW_ENA RAPI_OVERFLOW_DIS The default value is RAPLOVERFLOW_DIS Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_TIMER_INT_LV_2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6
67. IRQO_PIN Input pin level for IRQO RAPI_IRQ1_PIN Input pin level for IRQ1 RAPI_IRQ2_PIN Input pin level for IRQ2 RAPI_IRQ3_PIN Input pin level for IRQ3 RAPI_IRQO_FLAG Status flag for IRQO interrupt request RAPI_IRQ1_FLAG Status flag for IRQ1 interrupt request RAPIIRQ2_FLAG Status flag for IRQ2 interrupt request RAPI_IRQ3_FLAG Status flag for IRQ3 interrupt request e Configuration of the IRQ status register IRQSR IRQ3L IRQ2L IRQ1L IRQOL 0 0 0 0 IRQ3F IRQ2F IRQ1F IRQOF Input pin level for IRQ i 0 to 3 0 low 1 high Status flag for interrupt request 0 Interrupt not requested 1 Interrupt requested e Configuration of the Interrupt control register 0 ICRO NMIL ofojofojojo Nme 0 0 oo of of 0 0 Input pin level for NMI 0 low 1 high Return value If the specification of external interrupt is invalid RAPILFALSE is returned otherwise RAPI_TRUE is returned Category External interrupt Reference __Createlnterrupt Enablelnterrupt ClearlnterruptFlag Remark If an undefined value is specified in the first argument operation of the API cannot be guaranteed Program example include rapi_interrupt_sh_7125 h void func void unsigned char irgq 8 unsigned char nmi Acquisition of status flags of interrupt request and pin states for IRQO to IRQ3 __GetInterruptAndPinInfo RAPI_IRQO_FLAG RAPI_IRQO_PIN RAPI_IRQ1_FLAG RAPI_IRQ1
68. IRQ_ENA Figure 5 7 Example of External Interrupt Rev 1 01 Aug 27 2008 5 7 REJ10J1906 0101 RENESAS Usage Example 5 5 5 A D Converter 5 5 A D Converter Figure 5 8 shows a usage example of A D converter A user needs to execute processing by a callback function if necessary include rapi_ad_sh_7125 h Declaration of callback function void AdIntFunc void void func void Start up A D conversion by external trigger for AN2 pin __CreateADC RAPI_SINGLE RAPI_AN2 RAPI_P_2 RAPI_50_STAT RAPI_TRIGGER_ENA RAPI_EXTERNAL TRIGGER_GO RAPI_AD_INT_ENA RAPI_ADC_INT_LV_3 AdIntFunc Figure 5 8 Example of A D Conversion Rev 1 01 Aug 27 2008 5 8 REJ10J1906 0101 RENESAS Revision History Renesas Embedded Application Programming Interface User s Manual Rev Date Description Page Summary 1 00 Aug 8 2008 First edition issued 1 01 Aug 27 2008 4 89 Modification to fit the Japanese version of Rev 1 03 4 90 Same as above 4 102 Type of the second argument is amended 4 103 Type declaration for data is amended 4 115 Selectable parameters are added 5 6 Type declaration for data is amended for SH Tiny Renesas Embedded Application Programming Interface User s Manual Publication Date Aug 27 2008 Rev 1 01 l Sales Strategic Planning Div Publishe
69. I_TIOCC TIOCIC pin i 0 3 or 4 RAPI_TIOCD TIOCDD pin i 0 3 or 4 RAPI_RISING_CAP_0O Input capture at rising edge for channel 0 to 4 RAPI_FALLING_CAP_0 Input capture at falling edge for channel 0 to 4 RAPI_RISING_CAP_5 Input capture at rising edge for channel 5 RAPI_FALLING_CAP_5 Input capture at falling edge for channel 5 RAPI_CAPTURE_ENA Enables TGR input capture interrupt i A B C D U V or W RAPI_CAPTURE_DIS Disables input capture interrupt Aug 27 2008 RAPI_TIMER_INT_LV_0 Interrupt priority level 0 RAPI_TIMER_INT_LV_1 Interrupt priority level 1 RAPI_TIMER_INT_LV_2 Interrupt priority level 2 RAPI_TIMER_INT_LV_3 Interrupt priority level 3 RAPI_TIMER_INT_LV_4 Interrupt priority level 4 RAPI_TIMER_INT_LV_5 Interrupt priority level 5 RAPI_TIMER_INT_LV_6 Interrupt priority level 6 RAPI_TIMER_INT_LV_7 Interrupt priority level 7 RAPI_TIMER_INT_LV_8 Interrupt priority level 8 RAPI_TIMER_INT_LV_9 Interrupt priority level 9 RAPI_TIMER_INT_LV_10 Interrupt priority level 10 RAPI_TIMER_INT_LV_11 Interrupt priority level 11 RAPI_TIMER_INT_LV_12 Interrupt priority level 12 RAPI_TIMER_INT_LV_13 Interrupt priority level 13 RAPI_TIMER_INT_LV_14 Interrupt priority level 14 RAPI_TIMER_INT_LV_15 Interrupt priority level 15 RENESAS ot A Library Reference 4 2 2 Timer
70. Interrupt priority level 11 RAPI_TIMER_INT_LV 12 Interrupt priority level 12 RAPI_TIMER_INT_LV 13 Interrupt priority level 13 RAPI_TIMER_INT_LV 14 Interrupt priority level 14 RAPI_TIMER_INT_LV 15 Interrupt priority level 15 e Selectable parameters when RAPI_MTU2_0 is specified Count source Count edge Count clearing source A D converter start request Interrupt enable Interrupt priority level Aug 27 2008 7tENESAS Specify one from RAPI_MP_1 RAPI_MP_4 RAPI_MP_16 RAPI_MP_ 64 The default value is RAPI_MP_1 Specify one from RAPI_RISING_EDGE RAPI_FALLING_EDGE RAPI_BOTH_EDGE The default value is RAPI_RISING_EDGE Note When RAPI_MP1 is specified for the count source count edge is fixed to the default value Specify one from RAPI_LTCNT_CLEAR_DIS RAPI_TCNT_CLEAR_TGRA RAPI_TCNT_CLEAR_TGRB RAPI_TCNT_CLEAR_TGRC RAPI_TCNT_CLEAR_TGRD The default value is RAPI_TCNT_CLEAR_DIS Specify one from RAPI_AD_START_REQ HAPDI NO AD START_REQ The default value is RAPI_NO_AD_START_REQ Specify one from RAPI_OVERFLOW_ENA RAPI_OVERFLOW_DIS The default value is RAPIOVERFLOW_DIS Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_TIMER_INT_LV_2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI
71. Interrupt priority level 4 RAPI_TIMER_INT_LV Interrupt priority level 5 RAPI_TIMER_INT_LV Interrupt priority level 6 RAPI_TIMER_INT_LV Interrupt priority level 7 RAPI_TIMER_INT_LV Interrupt priority level 8 00 N OO AA Go PO o RAPI_TIMER_INT_LV Interrupt priority level 9 RAPI_TIMER_INT_LV Sch CH Interrupt priority level 10 RAPI_TIMER_INT_LV i Interrupt priority level 11 RAPI_TIMER_INT_LV k ine Interrupt priority level 12 RAPI_TIMER_INT_LV ao Interrupt priority level 13 RAPI_TIMER_INT_LV CH Interrupt priority level 14 RAPI_TIMER_INT_LV o Interrupt priority level 15 7rtENESAS 4 29 Library Reference 4 4 2 2 Timer MTU2 _ CreateEventCounter Description 3 7 e Selectable parameters when RAPI_MTU2_0 and RAPI_NORMAL are specified Count source Specify one from RAPILEXTER_TCLKA_0 RAPI_EXTER_TCLKB_0 RAPILEXTER_TCLKC_0 RAPI_EXTER_TCLKD_0 Operating method Specify one from RAPI_FREE_RUNNING RAPI_ PERIODIC The default value is RAPI_FREE_RUNNING Count edge Specify one from RAPI_RISING_EDGE RAPI_FALLING_EDGE RAPI_BOTH_EDGE The default value is RAPI_RISING_EDGE e When RAD FREE RUNNING e selected the following parameters can be set Interrupt enable Specify one from RAPILOVERFLOW_ENA RAPI_OVERFLOW_DIS The def
72. L TIME T UE 4 96 32 Eeer Oetrange ee 4 98 4 2 3 LR en EE 4 100 to SSCL OR OME ee EE EE Ee ee 4 100 2 ReAdIOPOPt egene ed Sri ee ENEE SSES EE SEENEN 4 102 3 ELTH 4 104 4 2 4 External Interrtipt isco sosccocessaceceedsevcsceas ese ceusseesccvasadecssasveactapededvhadeGeccedavdceacasandecchaasedecassacencecavecnce ais 4 106 1y MP Ate IMCS EE 4 106 2 Enablelinterruptss 3 2 ccaisececes DEA EE ENEE ins ceana ia EE TEE AE EE NEETER EENET SEEE EE EORR 4 108 3 __GetInterruptAndPinInfo AA 4 109 4 e deen re EI 4 110 4 2 5 ADE SENE a rc Ae E EE E Ee E E 4 111 De Cre at E 4 111 2 EE KEE 4 117 at Destroy AD geesde dete vvawedatasd SEENEN Sege gCee 4 118 Aye e KT 4 119 5 e A GE 4 120 Gy ClearAW CE EE 4 121 Usage Example EE 5 1 5 1 Serial Communication Inerface SCH 5 1 5 2 Timer RRE 5 3 Dede EE Eed A TE EA A E 5 6 SA External Interrupt as caaisia decsdeca gg dE ENEE deed ENEE ENER RETA niiina aiii inea 5 7 KG GEET e 5 8 Rev 1 01 Aug 27 2008 ii REJ10J1906 0101 RENESAS Introduction 1 Introduction The Renesas Embedded Application Programming Interface Renesas Embedded API hereinafter this library is a unified API for the microcomputers made by Renesas System Solutions Beijing Co Ltd Rev 1 01 Aug 27 2008 AS 1 1 REJ10J1906 0101 RENES Introduction Rev 1 01 Aug 27 2008 12 REJ10J1906 0101 RENESAS Driver 2 2 1 Overview 2 Driver 2 1 Overview
73. LV_9 RAPI_TIMER_INT_LV_10 RAPLTIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPIL_TIMER_INT_LV_0 Rev 1 01 Aug 27 2008 AS 4 33 REJ10J1906 0101 RENES 4 Description 7 7 Return value Category Reference Remark Program example Library Reference 4 2 2 Timer MTU2 __CreateEventCounter e Selectable parameters when RAPI_MTU2_1 or RAPILMTU2_2 and RAPI_PHASE_COUNTING_1 RAPI_PHASE_COUNTING_2 RAPI_PHASE_COUNTING_3 or RAPI_LPHASE_COUNTING_4 are specified Channel Specify one from RAPI_LMTU2_1 RAPI_MTU2_2 Interrupt enable Specify one from RAPILOVERFLOW_ENA RAPI_OVERFLOW_DIS and or one from RAPILUNDERFLOW_ENA RAPI_LUNDERFLOW_DIS The default values are RAPI OVERFLOW DIS and RAPI_LUNDERFLOW_DIS respectively Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_TIMER_INT_LV_2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPI_TIMER_INT_LV_O data2 For data2 set 16 bit value to the timer general regis
74. MER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPILTIMER_INT_LV_0 Rev 1 01 Aug 27 2008 AS 4 21 REJ10J1906 0101 RENES Library Reference 4 4 2 2 Timer MTU2 _ CreateTimer Description 5 7 e Selectable parameters when RAPI_MTU2_2 is specified Count source Specify one from RAPI_MP1 RAPI_MP4 RAPI_MP16 RAPI_MP64 RAPI_MP1024 2 The default value is RAPI_MP1 Operation method Specify one from RAP EREE RUNNING RAPI_ PERIODIC The default value is RAPI_FREE_RUNNING Count edge Specify one from RAPI_RISING_EDGE RAPI_FALLING_EDGE RAPI_BOTH_EDGE The default value is RAPI_RISING_EDGE Note When RAPI_MP1 is specified for the count source count edge is fixed to the default value e When RAD FREE RUNNING e selected the following parameters can be set Interrupt enable Specify one from RAPIOVERFLOW_ENA RAPI_OVERFLOW_DIS The default value is RAPIOVERFLOW_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPITIMER_INT_LV_1 RAPI_TIMER_INT_LV_ 2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPI_TIMER_INT_LV_0
75. MTU2 __ SetlinputPeriodPin Description 2 3 e Selectable parameters when RAPI_MTU2_0 RAPI_MTU2_3 or RAPI_MTU2_4 is specified Capture channel Specify one from RAPI_TIOCA RAPI_TIOCB RAPI_TIOCC RAPI_TIOCD Capture edge Specify one from RAPI_RISING_CAP_0 RAPI_FALLING_CAP_0 Interrupt enable Specify one from RAPI_CAPTURE_ENA RAPI_CAPTURE_DIS The default value is RAPI_CAPTURE_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_TIMER_INT_LV_2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPI_TIMER_INT_LV_0 e Selectable parameters when RAPI_MTU2_1 or RAPI_MTU2_2 is specified Capture channel Specify one from RAPI_TIOCA RAPI_TIOCB Capture edge Specify one from RAPI_RISING_CAP_0 RAPI_FALLING_CAP_0 Interrupt enable Specify one from RAPI_CAPTURE_ENA RAPI_CAPTURE_DIS The default value is RAPI_CAPTURE_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_TIMER_INT_LV_2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI
76. PI_LRISING_EDGE Note When RAPI_MP1 is specified for the count source count edge is fixed to the default value Count clearing source Specify one from RAPI_LTCNT_CLEAR_DIS RAPL_TCNT_CLEAR_TGRA RAPI_TCNT_CLEAR_TGRB RAPILTCNT_CLEAR_TGRC RAPLTCNT_CLEAR_TGRD RAPIL_TCNT_CLEAR_OTHER The default value is RAPI_TCNT_CLEAR_DIS A D converter start Specify one from RAPI_LAD_START_REQ request RAPI_NO_AD_START_REQ The default value is RAPINO_AD_START_REQ Interrupt enable Specify one from RAPI_OVERFLOW_ENA RAPI_OVERFLOW_DIS The default value is RAPILOVERFLOW_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_TIMER_INT_LV_2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPIL_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPI_TIMER_INT_LV_0 Rev 1 01 Aug 27 2008 7rtENESAS 4 77 REJ10J1906 0101 4 Description 4 6 Library Reference 4 2 2 Timer MTU2 __GetPulseWidthMeasurementMode e Selectable parameters when RAPI_MTU2_1 is specified Count source Specify one from RAPI_MP_1 RAPI_MP_4 RAPI_MP_16 RAPI_MP_64 RAPI_MP_256_1 RAPIEXTER_TCLKA_0 RAPI_EXTER_TCLKB_0 The default value is RAPI_MP_1
77. RAPI_MP1024 34 The default value is RAPI_MP1 Operation method Specify one from RAP EREE RUNNING RAPI_PERIODIC The default value is RAPI_FREE_RUNNING Count edge Specify one from RAPI_RISING_EDGE RAPI_FALLING_EDGE RAPI_BOTH_EDGE The default value is RAPI_RISING_EDGE Note When RAPI_MP1 is specified for the count source count edge is fixed to the default value e When RAD FREE RUNNING e selected the following parameters can be set Interrupt enable Specify one from RAPIOVERFLOW_ENA RAPI_OVERFLOW_DIS The default value is RAPIOVERFLOW_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPITIMER_INT_LV_1 RAPI_TIMER_INT_LV_ 2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPI_TIMER_INT_LV_0 e When RAPI_PERIODIC is selected the following parameters can be set Count clearing source Specify one from RAPI_ TCNT_CLEAR_TGRA RAPI_TCNT_CLEAR_TGRB RAPI_TCNT_CLEAR_TGRC RAPI_TCNT_CLEAR_TGRD The default value is RAPL_TCNT_CLEAR_DIS Count output Specify one from RAPI_OUTPUT_RETAIN RAPIL_OUTPUT_0_0 RAPLOUTPUT_0_1 RAPIL_OUTPUT_0_TOG RAPI_OUTPUT_1_0 RAPIL_OUTPUT_1_1 RAPIOUTPUT_
78. R_GO TGRA input capture compare match for each MTU2 channel or TCNT_4 underflow trough in complementary PWM mode TRGAN RAPI_TGRA_MTU2_CHANNELO_GO MTU2 channel 0 compare match TRGON RAPI_MTU2_TRG4AN_GO MTU2 A D conversion start request delaying TRG4AN RAPI_MTU2_TRG4BN_GO MTU2 A D conversion start request delaying TRG4BN RAPI_EXTERNAL_TRIGGER_G1 External trigger pin ADTRG input for group 1 in 2 channel scan mode RAPI_TGRA_TCNT4_TRIGGER_G1 TGRA input capture compare match for each MTU2 channel or TCNT_4 underflow trough in complementary PWM mode for group 1 in 2 channel scan mode RAPI_TGRA_MTU2_CHANNELO_G1 MTU2 channel 0 compare match TRGON for group 1 in 2 channel scan mode RAPI_MTU2_TRG4AN_G1 MTU2 A D conversion start request delaying TRG4AN for group 1 in 2 channel scan mode RAPI_MTU2_TRG4BN_G1 MTU2 A D conversion start request delaying TRG4BN for group 1 in 2 channel scan mode Note Parameters for trigger with a GO suffix are specified for group 0 in single mode 4 channel scan mode and 2 channel scan mode Parameters with a _G1 suffix are specified for group 1 in 2 channel scan mode RAPI_ADC_INT_LV_0 Interrupt priority level 0 RAPI_ADC_INT_LV_1 Interrupt priority level 1 RAPI_ADC_INT_LV 2 Interrupt priority level 2 RAPI_ADC_INT_LV_3 Interrupt priority level 3 RAPI_ADC_INT LV 4 Interrupt pr
79. R_TCLKA_0 RAPI_EXTER_TCLKB_0 RAPILEXTER_TCLKC_0 Operation method Specify one from RAPI_FREE_RUNNING RAPI_ PERIODIC The default value is BAD FREE_RUNNING Count edge Specify one from RAPI_RISING_EDGE RAPI_FALLING_EDGE RAPI_BOTH_EDGE The default value is RAPI_LRISING_EDGE Note When RAPI_TCNT2_FLOW is specified for the count source count edge is fixed to the default value e When RAD FREE RUNNING e selected the following parameters can be set Interrupt enable Specify one from RAPI_OVERFLOW_ENA RAPI_OVERFLOW_DIS The default value is RAPILOVERFLOW_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPITIMER_INT_LV_1 RAPI_TIMER_INT_LV_2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPITIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPI_TIMER_INT_LV_0 e When RAPI_PERIODIC is selected the following parameters can be set Count clearing source Specify one from RAPI_LTCNT_CLEAR_TGRA RAPI_TCNT_CLEAR_TGRB RAPI_TCNT_CLEAR_OTHER Count output Specify one from RAPI_OUTPUT_RETAIN RAPI_OUTPUT_0_0 RAPI_OUTPUT_0_1 RAPI_OUTPUT_0_TOG RAPI_OUTPUT_1_0 RAPI_OUTPUT_1_1 RAPIOUTPUT_1_TOG The default value is RAPIOUTPUT_RETAIN A D
80. S Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_TIMER_INT_LV RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPI_TIMER_INT_LV_0 2 4 e Selectable parameters when RAPI_CMT_0 or RAPI_CMT_1 is specified Channel Specify one from RAPI_CMT_0 RAPI_CMT_1 Count source Specify one from RAPI_P8 RAPI_P32 RAPI_P128 RAPI_P512 The default value is RAPI_MP8 Interrupt enable Specify one from RAPI_ COMPARE_MATCH_ENA RAPI_COMPARE_MATCH_DIS The default value is RAPICOMPARE_MATCH_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_TIMER_INT_LV RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPI_TIMER_INT_LV_O 2 4 data2 For data2 set 16 bit value to the timer general register TGR func For func specify a pointer to callback function If thi
81. SPTR at low level through the SCK pin RAPI_SCK_OUTPUT_H Outputs the SPB1DT bit value in serial port register SCSPTR at high level through the SCK pin If the specification of serial port is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned SCI __CreateSCl e When using the SCK pin as a port output pin set the internal clock RAPI_CKDIR_INT as the clock source in CreateSCl beforehand e H an undefined value is specified in the argument operation of the API cannot be guaranteed include rapi_sif_sh_7125 h void func void Setting up SCK pin as high level output for channel 0 return __OutputSCISck RAPI_COM1 RAPI_SCK_OUTPUT_H Rev 1 01 Aug 27 2008 7rtENESAS 4 16 REJ10J1906 0101 4 Library Reference 4 2 1 Serial Communication Interface SCI __OutputSCITxd 12 OutputSCITxd Synopsis Description Return value Category Reference Remark Program example lt Output control for TXD pin gt Boolean OutputSCITxd unsigned long data data Setup data Controls output of the TXD pin in clock asynchronous mode data For data set the following parameters To set multiple parameters at the same time use the symbol to separate each specified parameter RAPI_COM1 SCI channel 0 RAPI_COM2 SCI channel 1 RAPI_COM3 SCI channel 2 RAPI_TXD_BREAK_L Sets the
82. T RAPI_IRQOUT_HIGH_LEVEL The default value is RAP IRQOUT_INT_OUTPUT Interrupt priority level Specify one from RAPI_INT_LV_0 RAPI_INT_LV_1 RAPIINT_LV_2 RAPL_INT_LV_3 RAPI_INT_LV_4 RAPI_INT_LV_5 RAPI_INT_LV_6 RAPI_INT_LV_7 RAPI_INT_LV_8 RAPI_INT_LV_9 RAPI_INT_LV_10 RAPI_INT_LV_11 RAPI_INT_LV_12 RAPI_INT_LV_13 RAPI_INT_LV_14 RAPI_INT_LV_15 The default value is RAPI_INT_LV_0 Selectable parameters when NMI interrupt RAPI_NMI is specified Polarity sense Specify one from RAPI_INT_FALLING RAPI_INT_RISING The default value is RAPI_INT_FALLING IRQOUT signal output Specify one from RAPI_IRQOUT_INT_OUTPUT RAPI_IRQOUT_HIGH_LEVEL The default value is RAPI_IRQOUT_INT_OUTPUT Interrupt priority level The interrrupt priority level of NMI is fixed to 16 and cannot be set func For func specify a pointer to callback function If this pointer is not specified set RAPI_NULL If the specification of external interrupt is invalid RAPI_LFALSE is returned otherwise RAPI_TRUE is returned External interrupt __Enablelnterrupt GetInterruptAndPinInfo ClearlnterruptFlag e The interrupt priority level specified in this API is set to the interrupt priority register IPR only after execution of _ Enablelnterrupt specifying RAPI_IRQ_ENA e H an undefined value is specified in the first argument operation of the API cannot be guaranteed include rapi_interrupt_sh_7125
83. TUZI HA HA HA P PI_OV DI TI 1 and TU2_1 E2 RAPI_MP4 RAPTI_RISING_ EDG RAPI_TCN RAPI CL EAR_OT HER 7 IMER_IN T_LV_O C RAPI_NUL RAPI_TGRA RAP I_COMPAR DutyValue3 DES P H lin RAPI A tAFun _TGRB RAP I COMPAR DutyValue4 Start up timers Rev 1 01 EnablePWwM REJ10J1906 0101 RAPI_MTU2_0 IATCH DIS TimerliIn tBFun RAPI_MTU2_1 L 1 to the duty register RAPI_OU PUT_O_1 RAPI_TIM ER_IN c RAPI_OU PUT_O RAPI_TIM ER_IN c RAPI_TIMI Figure 5 4 Example of PWM Mode 2 Aug 27 2008 7rtENESAS 5 4 Usage Example 5 5 2 Timer MTU2 Counter cleared by TGRC_0O TCNT compare match A TGRC_O r TGRA_0O TGRB_O TGRA_1 TGRB_1 H0000 TIOCOA TIOCOB G 3 4 8 ms TIOCIA 3 3 2 ms TIOC1B Note Values of each period time are corresponding to the case of Ph 25 MHz Figure 5 5 Example of Behavior of PWM Mode 2 and PWM Output Waveform Rev 1 01 Aug 27 2008 AS 5 5 REJ10J1906 0101 RENES Usage Example 5 5 3 W O Port 5 3 I O Port Figure 5 6 shows an example of I O port read write operation include rapi_io_port_sh_712
84. TXD pin as low level output RAPI_TXD_BREAK_H Sets the TXD pin as high level output If the specification of serial port is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned SCI none If an undefined value is specified in the argument operation of the API cannot be guaranteed include rapi_sif_sh_7125 h void func void Setting up TXD pin as high level output for channel 0 return __OutputSCITxd RAPI_COM1 RAPI_TXD_BREAK_H Rev 1 01 Aug 27 2008 7rtENESAS 4 17 REJ10J1906 0101 4 4 2 2 1 Timer MTU2 __CreateTimer Synopsis Description 1 7 Rev 1 01 REJ10J1906 0101 Aug 27 2008 lt Setting for timer mode gt Library Reference 4 2 2 Timer MTU2 Boolean CreateTimer unsigned long data1 unsigned short data2 void func __ CreateTimer data1 Setup data 1 data2 Setup data 2 func Pointer to callback function Sets the specified timer to timer mode data1 For data1 set the following parameters To set multiple parameters at the same time use the symbol to separate each specified parameter RAPL MTU2 O MTU2 channel 0 RAPL MTU2_1 MTU2 channel 1 RAPL MTU2 2 MTU2 channel 2 RAPL MTU2 3 MTU2 channel 3 RAPLMTU2_4 MTU2 channel 4 RAPL MTU2_5U MTU2 channel 5U RAPL MTU2_5V MTU2 channel 5V RAPL MTU2_5W MTU2 channel 5W RAPI_CMT_0 CMT channe
85. T_11 Bit 11 of the specified port RAPI_BIT_12 Bit 12 of the specified port RAPI_BIT_13 Bit 13 of the specified port RAPI_BIT_14 Bit 14 of the specified port RAPI_BIT_15 Bit 15 of the specified port RAPI_LOWER_8 BITS Lower 8 bits of the specified port RAPI_HIGHER_8 BITS Higher 8 bits of the specified port RAPI_16_BITS 16 bits of the specified port e Access size for data read Choose one from the following RAPIBITS_OPE Bit handling mode RAPI_BYTE_OPE Byte handling mode RAPIWORD_OPE Word handling mode e Register for reading Choose one from the following RAPI_DATA_REGISTER Register for storing data Data register RAPI_PORT_REGISTER Register for reading the pin state Port register Selectable parameters when Port F is specified Port F is an input only port with 8 bits Only RAPI_DATA_REGISTER can be selected Rev 1 01 Aug 27 2008 4 102 REJ10J1906 0101 tENESAS 4 Return value Category Reference Remark Program example Library Reference 4 2 3 I O Port __ReadlOPort If the specification of I O port is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned I O port SetlOPort WritelOPort If an undefined value is specified in the first argument operation of the API cannot be guaranteed include rapi_io_port_sh_7125 h unsigned short data 2 void func void Acquisition of the value of bits 1 and 3 for Port
86. The default value is RAPI_RISING_EDGE Note When RAPI_MP1 is specified for the count source count edge is fixed to the default value e When RAD FREE RUNNING e selected the following parameters can be set Interrupt enable Specify one from RAPILOVERFLOW_ENA RAPI_OVERFLOW_DIS The default value is RAPIOVERFLOW_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPITIMER_INT_LV_1 RAPI_TIMER_INT_LV_ 2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPL_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPIL_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPILTIMER_INT_LV_0 e When RAPI_PERIODIC is selected the following parameters can be set Count clearing source Specify one from RAPI_LTCNT_CLEAR_DIS RAPI_TCNT_CLEAR_TGRA RAPI_TCNT_CLEAR_TGRB RAPI_TCNT_CLEAR_TGRC RAPI_TCNT_CLEAR_TGRD RAPI_TCNT_CLEAR_DIS_TGRE RAPI_TCNT_CLEAR_DIS_TGRF The default value is RAPI_TCNT_CLEAR_DIS Count output Specify one from RAPI_OUTPUT_RETAIN RAPI_OUTPUT_0_0 RAPILOUTPUT_0_1 RAPIL_OUTPUT_0_TOG RAPI_OUTPUT_1_0 RAPIL_OUTPUT_1_1 RAPIOUTPUT_1_TOG The default value is RAPI_OUTPUT_RETAIN A D converter start Specify one from RAPI_AD_START_REQ request RAPI_NO_AD_START_REQ The default value is RAPLNO_AD_START_REQ
87. This library provides a peripheral function control program peripheral driver for microcomputer and allows the peripheral driver to be built into a user program 2 2 Control Function This library has the following control functions available as a peripheral driver 1 Serial Communication Interface This library comprises a serial communication interface driver which sets or clears operating conditions of serial communication as well as controls and manages the transmission reception of data 2 Timer This library comprises a timer driver which sets or clears operating conditions of timers as well as controls the timer operation 3 1 0 Port This library comprises an I O port driver which sets or clears conditions of use for I O ports as well as control data read write operation 4 External Interrupt This library comprises an external interrupt driver which sets or clears conditions of use for external interrupts as well as controls interrupt operation 5 A D Converter This library comprises an A D converter driver which sets or clears conditions of use for A D converter as well as controls A D converter operation Rev 1 01 Aug 27 2008 AS 2 1 REJ10J1906 0101 RENES Driver 2 2 3 Serial Communication Interface Driver 2 3 Serial Communication Interface Driver The serial communication interface driver establishes or clears the serial communication and transmits or receives data It is also used to cont
88. Timer MTU2 pulse period measurement mode SetlnputCapturePin If an undefined value is specified in the first argument operation of the API cannot be guaranteed include rapi_timer_sh_7125 h void TimerIntFunc void void func void Setting TGRA for MTU2 channel 0 as input capture pin __SetInputPeriodPin RAPI_MTU2_0 RAPI_TIOCA RAPI_RISING_CAP_0O RAPI_CAPTURE_ENA RAPI_TIMER_INT_LV_3 TimerIntFunc Rev 1 01 Aug 27 2008 7rtENESAS 4 59 REJ10J1906 0101 4 Library Reference 4 2 2 Timer MTU2 __EnablePulsePeriodMeasurementMode 14 EnablePulsePeriodMeasurementMode Synopsis lt Operation control for pulse period measurement mode gt Boolean EnablePulsePeriodMeasurementMode unsigned long data data Setup data Description Controls start stop operation of the specified timer in pulse period measurement mode Return value Category Reference Remark Program example data For data set the following parameters To set multiple parameters use the symbol to separate each specified parameter Then several timers can be enabled or disabled at the same time RAPI_MTU2_0 MTU2 channel 0 RAPI_MTU2_1 MTU2 channel 1 RAPI_MTU2_ 2 MTU2 channel 2 RAPI_MTU2_3 MTU2 channel 3 RAPI_MTU2_4 MTU2 channel 4 RAPI_MTU2_5U MTU2 channel 5U RAPI_MTU2_5V MTU2 channel 5V
89. To our customers Old Company Name in Catalogs and Other Documents On April 1 2010 NEC Electronics Corporation merged with Renesas Technology Corporation and Renesas Electronics Corporation took over all the business of both companies Therefore although the old company name remains in this document it is a valid Renesas Electronics document We appreciate your understanding Renesas Electronics website http www renesas com April 17 2010 Renesas Electronics Corporation Issued by Renesas Electronics Corporation http www renesas com Send any inquiries to http www renesas com inquiry w N E SAS 8 10 11 12 Notice All information included in this document is current as of the date this document is issued Such information however is subject to change without any prior notice Before purchasing or using any Renesas Electronics products listed herein please confirm the latest product information with a Renesas Electronics sales office Also please pay regular and careful attention to additional and different information to be disclosed by Renesas Electronics such as that disclosed through our website Renesas Electronics does not assume any liability for infringement of patents copyrights or other intellectual property rights of third parties by or arising from the use of Renesas Electronics products or technical information described in this document No license express implied or otherwise is gran
90. U2 __EnableOutputCompare 29 EnableOutputCompare Synopsis Description Return value Category Reference Remark Program example lt Operation control for output compare mode gt Boolean EnableOutputCompare unsigned long data data Setup data Controls start stop operation of the specified timer in output compare mode data For data set the following parameters To set multiple parameters at the same time use the symbol to separate each specified parameter Then several timers can be enabled or disabled at the same time RAPI_MTU2_0 MTU2 channel 0 RAPI_MTU2_1 MTU2 channel 1 RAPI_MTU2_ 2 MTU2 channel 2 RAPI_MTU2_3 MTU2 channel 3 RAPI_MTU2_4 MTU2 channel 4 RAPI_MTU20_ A MTU2 channels 0 to 4 RAPI_TIMER_ON Starts the timer in output compare mode RAPI_TIMER_OFF Stops the timer in output compare mode If the specification of timer is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Timer MTU2 output compare mode ___EnableTimer If an undefined value is specified in the argument operation of the API cannot be guaranteed include rapi_timer_sh_7125 h void func void Start up timer for MTU2 channels 0 and 1 in output compare mode __EnableOutputCompare RAPI_MTU2_0 RAPI_MTU2_1 RAPI_TIMER_ON Rev 1 01 Aug 27 2008 7tENESAS 4 94 REJ10J1906
91. U2 channel 1 RAPIMTU2_ 2 MTU2 channel 2 RAPI_MTU2_3 MTU2 channel 3 RAPIMTU2_4 MTU2 channel 4 RAPI_TGRA Timer General Register A RAPI_TGRB Timer General Register B RAPI_TGRC Timer General Register C RAPI_TGRD Timer General Register D RAPI_OUTPUT_RETAIN Output retained RAPI_OUTPUT_0_0 Initial output is 0 and outputs 0 at compare match RAPI_OUTPUT_0_1 Initial output is 0 and outputs 1 at compare match RAPI_OUTPUT_0_TOG Initial output is 0 and outputs toggle at compare match RAPI OUTPUT 1 0 Initial output is 1 and outputs 0 at compare match RAPI OUTPUT _1_1 Initial output is 1 and outputs 1 at compare match RAPI_OUTPUT_1_TOG Initial output is 1 and outputs toggle at compare match DAP COMPARE MATCH ENA Enables compare match interrupt RAPI_COMPARE_MATCH_DIS Disables compare match interrupt RAPI_TIMER_INT_LV Interrupt priority level 0 RAPI_TIMER_INT_LV Interrupt priority level 1 RAPI_TIMER_INT_LV Interrupt priority level 2 RAPI_TIMER_INT_LV Interrupt priority level 3 RAPI_TIMER_INT_LV Interrupt priority level 4 RAPI_TIMER_INT_LV Interrupt priority level 5 RAPI_TIMER_INT_LV Interrupt priority level 6 RAPI_TIMER_INT_LV Interrupt priority level 7 RAPI_TIMER_INT_LV Interrupt priority level 8 CO NI OD O01 A wN o RAPI_TIMER_INT_LV Interrupt priority
92. U2_4 data2 For data2 specify a pointer to a buffer storing the timer counter value Return value If the specification of timer is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Category Timer MTU2 timer mode event counter mode Reference __CreateTimer Remark If an undefined value is specified in the first argument operation of the API cannot be guaranteed Rev 1 01 Aug 27 2008 7tENESAS 4 37 Library Reference 4 4 2 2 Timer MTU2 _ GetTimerCounter Program example include rapi_timer_sh_7125 h void func void unsigned short data 2 Acquisition of counter value of MTU2 channels 0 and 1 __GetTimerCounter RAPI_MTU2_0 RAPI_MTU2_1 data Rev 1 01 Aug 27 2008 AS 4 38 REJ10J1906 0101 RENES Library Reference 4 4 2 2 Timer MIU _ CreatePWM 8 __CreatePWM Synopsis lt Setting for pulse width modulation mode gt Boolean CreatePWM unsigned long data void func data Setup data func Pointer to callback function Description 1 6 Sets the specified timer to pulse width modulation mode data For data set the following parameters To set multiple parameters at the same time use the symbol to separate each specified parameter RAPI_MTU2_0 MTU2 channel 0 RAPI_MTU2_1 MTU2 channel 1 RAPI_MTU2 2 MTU2 channel 2 R
93. _0O RAPI_EXTER_TCLKB_0 RAPI_LEXTER_TCLKC_0 The default value is RAPI_MP_1 Count edge Specify one from RAPI_RISING_EDGE RAPI_FALLING_EDGE RAPI_BOTH_EDGE The default value is RAPI_RISING_EDGE Note When RAPI_MP1 is specified for the count source count edge is fixed to the default value Count clearing source Specify one from RAPI_TCNT_CLEAR_DIS RAPIL_TCNT_CLEAR_TGRA RAPI_TCNT_CLEAR_TGRB RAPIL_TCNT_CLEAR_OTHER The default value is RAPI_TCNT_CLEAR_DIS A D converter start Specify one from RAPI_LAD_START_REQ request RAPI_NO_AD_START_REQ The default value is RAPINO_AD_START_REQ Interrupt enable Specify one from RAPIOVERFLOW_ENA RAPI_OVERFLOW_DIS The default value is RAPILOVERFLOW_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_TIMER_INT_LV_2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPI_TIMER_INT_LV_0 Rev 1 01 Aug 27 2008 7rtENESAS 4 79 REJ10J1906 0101 Library Reference 4 4 2 2 Timer MTU2 _ GetPulseWidthMeasurementMode Description 6 6 e Selectable parameters when RAPI_MTU2_3 or RAPI_MTU2_4 is specified Count sour
94. _9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPIL_TIMER_INT_LV_0 Rev 1 01 Aug 27 2008 AS 4 30 REJ10J1906 0101 RENES Library Reference 4 4 2 2 Timer MTU2 _ CreateEventCounter Description 4 7 e Selectable parameters when RAPI_MTU2_1 and RAPI_NORMAL are specified Count source Specify one from RAPI_EXTER_TCLKA_0 RAPI_EXTER_TCLKB_0 RAPI_TCNT2_FLOW Operation method Specify one from RAPL_FREE_RUNNING RAPI_ PERIODIC The default value is RAPI_FREE_RUNNING Count edge Specify one from RAPI_RISING_EDGE RAPI_FALLING_EDGE RAPI_BOTH_EDGE The default value is RAPI_RISING_EDGE Note When RAPI_TNCT2_FLOW is specified for the count source count edge is fixed to the default value e When RAD FREE RUNNING e selected the following parameters can be set Interrupt enable Specify one from RAPIOVERFLOW_ENA RAPI_OVERFLOW_DIS The default value is RAPIOVERFLOW_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_TIMER_INT_LV_ 2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 Th
95. _AN6_AN7 cannot be guaranteed Therefore if selecting only group 1 specify analog input pin for group 0 RAPI_ANO RAPI_ANO_AN1 RAPI_AN4 or RAPI_AN4_ANS5 Then each corresponding pin for group 1 is also valid State control Clock select Scan setting Trigger enable Trigger source ADF control Interrupt enable Interrupt priority level Rev 1 01 Aug 27 2008 REJ10J1906 0101 7rtENESAS Specify one from RAPI_50_ STATES RAPI_64_STATES The default value is RAPI_50_STATES Specify one from RAPI_P_4 RAPI_P_3 RAPI_P_2 RAPI_P_1 The default value is RAPI_P_4 Specify one from RAPI_SINGLE_CYCLE RAPI_CONTINUOUS The default value is RAPI_SINGLE_CYCLE Specify one from RAPI_TRIGGER_ENA RAPI_TRIGGER_DIS The default value is RAPI_TRIGGER_DIS e For group 0 specify one from RAPI_EXTERNAL_TRIGGER_GO RAPI_TGRA_TCNT4_TRIGGER_GO RAPI_TGRA_MTU2_CHANNELO_GO RAPI_MTU2_TRG4AN_GO RAPI_MTU2_TRG4BN_GO The default value is RAPILEXTERNAL_TRIGGER_GO e For group 1 specify one from RAPI_EXTERNAL_TRIGGER_G1 RAPI_TGRA_TCNT4_TRIGGER_G1 RAPI_TGRA_MTU2_CHANNELO_G1 RAPI_MTU2_TRG4AN_G1 RAPI_MTU2_TRG4BN_G1 The default value is RAPILEXTERNAL_TRIGGER_G1 Note For groups O and 1 specify different triggers respectively Specify one from RAPI_ADF_SOURCE_OR RAPI_ADF_SOURCE_AND The default value is RAPIADF_SOURCE_OR Specify one from RAPI_AD_INT_ENA RAPI_AD_INT_DIS T
96. _INT_LV_O RAPI_TIMER_NO_SYNC TimerIntFunc Rev 1 01 Aug 27 2008 AS 4 81 REJ10J1906 0101 RENES 4 Library Reference 4 2 2 Timer MTU2 __ SetlnputCapturePin 23 SetlnputCapturePin Synopsis Description 1 3 Rev 1 01 Aug 27 2008 REJ10J1906 0101 lt Setting of input pin for input capture gt Boolean SetInputCapturePin unsigned long data void func data Setup data func Pointer to callback function Sets the specified pin for input capture data For data set the following parameters To set multiple parameters at the same time use the symbol to separate each specified parameter RAPI MTU2_0 MTU2 channel 0 RAPI MTU2 1 MTU2 channel 1 RAPI MTU2 2 MTU2 channel 2 RAPI MIUS 3 MTU2 channel 3 RAPI MTU2 4 MTU2 channel 4 RAPI MTU2 5U MTU2 channel SU RAPI MTU2 5V MTU2 channel 5V RAPI MITUS SW MTU2 channel 5W RAPI_TIOCA TIOGIA pin i 0 to 4 RAPI_TIOCB TIOCB pin i 0 to 4 RAPI_TIOCC TIOGIC pin i 0 3 or 4 RAPI_TIOCD TIOCD pin i 0 3 or 4 RAPI_RISING_CAP_0 RAPI_FALLING_CAP_0 RAPI_BOTH CAP_0 RAPI_RISING_CAP_5 RAPI_ FALLING CAP_5 RAPI_BOTH CAP E RAPI TCNT1 CAP Input capture at rising edge for channel 0 to 4 Input capture at falling edge for channel 0 to 4 Input capture at both edges for channel 0 to 4 Input capture at rising edge for channel 5 Input capture
97. _LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPIL_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_ 15 The default value is RAPI_TIMER_INT_LV_0 e Selectable parameters when RAPI_MTU2_5 is specified Count source Count edge Count clearing source func Specify one from RAPI_MP_1 RAPI_MP_4 RAPI_MP_16 RAPI_MP_64 The default value is RAPI_MP_1 Specify one from RAPI_RISING_EDGE RAPI_FALLING_EDGE RAPI_BOTH_EDGE The default value is RAPI_RISING_EDGE Note When RAPI_MP1 is specified for the count source count edge is fixed to the default value Specify one from RAPI_LTCNT_CLEAR_DIS RAPI_TCNT_CLEAR_TGRU RAPI_TCNT_CLEAR_TGRV RAPI_TCNT_CLEAR_TGRW The default value is RAPIL_TCNT_CLEAR_DIS For func specify a pointer to callback function If this pointer is not specified set RAPI_NULL Rev 1 01 Aug 27 2008 7tENESAS 4 55 REJ10J1906 0101 4 Return value Category Reference Remark Program example Library Reference 4 2 2 Timer MTU2 __CreatePulsePeriodMeasurementMode If the specification of timer is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Timer MTU2 pulse period measurement mode ___CreatelnputCapture If an undefined value is sp
98. _MTU2_5U MTU2 channel 5U RAPI_MTU2_5V MTU2 channel 5V RAPI_MTU2_5W MTU2 channel 5W RAPI_CMT_0 CMT channel 0 RAPI_CMT_1 CMT channel 1 RAPI_TGFA Input capture Output compare flag A RAPI_TGFB Input capture Output compare flag B RAPI_TGFC Input capture Output compare flag C RAPI_TGFD Input capture Output compare flag D RAPI_TCFV Overflow flag RAPI_TCFU Underflow flag RAPI_TGFE Compare match flag E RAPI_TGFF Compare match flag F RAPI_CMF Compare match Input capture flag Note When MTU2 channel 5U 5V or 5W is selected each compare match input capture flag CMFU5 CMFV5 or CMFWS5 respectively is cleared Configuration of the timer status register TSR which stores the status flags for timer MTU2 is shown below e TSR_0 to TSR_4 TCFD TCFU TCFV TGFD TGFC TGFB TGFA Count direction flag Underflow Overflow Input capture Output compare flag e TSR2_0 EE ee Compare match flag for channel 0 e TSR_5 P g BE EE OMENS ENEWS Compare match Input capture flag for channel 5 Rev 1 01 Aug 27 2008 7rtENESAS 4 98 REJ10J1906 0101 A Library Reference 4 2 2 Timer MTU2 __ClearTimerFlag Return value If the specification of timer is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Category Timer MTU2 Reference ___GetTimerFlag Remark If an undefined value is specified in the first argument operation of the API
99. _TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_TIMER_INT_LV_ 2 RAPI_TIMER_INT_LV_3 RAPIL_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPIL_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_ 15 The default value is RAPI_TIMER_INT_LV_0 e Selectable parameters when RAPI_MTU2_5 is specified Count source Count edge Count clearing source func Specify one from RAPI_MP_1 RAPI_MP_4 RAPI_MP_16 RAPI_MP_64 The default value is RAPI_MP_1 Specify one from RAPI_RISING_EDGE RAPI_FALLING_EDGE RAPI_BOTH_EDGE The default value is RAPI_RISING_EDGE Note When RAPI_MP1 is specified for the count source count edge is fixed to the default value Specify one from RAPI_LTCNT_CLEAR_DIS RAPI_TCNT_CLEAR_TGRU RAPI_TCNT_CLEAR_TGRV RAPI_TCNT_CLEAR_TGRW The default value is RAPI_TCNT_CLEAR_DIS For func specify a pointer to callback function If this pointer is not specifed set RAPI_NULL Rev 1 01 Aug 27 2008 7tENESAS 4 67 REJ10J1906 0101 4 Return value Category Reference Remark Program example Library Reference 4 2 2 Timer MTU2 __CreatePulseWidthMeasurementMode If the specification of timer is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Tim
100. _TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_ 15 The default value is RAPI_TIMER_INT_LV_0 4 52 4 Description 3 5 Rev 1 01 Aug 27 2008 REJ10J1906 0101 4 2 2 Timer MTU2 Library Reference _ CreatePulsePeriodMeasurementMode Selectable parameters when RAPI_MTU2_1 is specified Count source Count edge Count clearing source A D converter start request Interrupt enable Interrupt priority level 7rtENESAS Specify one from RAPI_MP_1 RAPI_MP_4 RAPI_MP_16 RAPI_MP_64 RAPI_MP_256_1 The default value is RAPI_MP_1 Specify one from RAPI_RISING_EDGE RAPI_FALLING_EDGE RAPI_BOTH_EDGE The default value is RAPI_RISING_EDGE Note When RAPI_MP1 is specified for the count source count edge is fixed to the default value Specify one from RAPI_TCNT_CLEAR_DIS RAPI_TCNT_CLEAR_TGRA RAPI_TCNT_CLEAR_TGRB The default value is RAPI_TCNT_CLEAR_DIS Specify one from RAPI_AD_START_REQ RAPI_NO_AD_START_REQ The default value is RAPINO AD _START_REQ Specify one from RAPIOVERFLOW_ENA RAPI_OVERFLOW_DIS The default value is RAPLOVERFLOW_DIS Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_TIMER_INT_LV_2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_
101. _TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPI_TIMER_INT_LV_0 e Selectable parameters when RAPI_MTU2_5 is specified Capture channel Specify one from RAPI_MTU2_5U RAPI_MTU2_5V RAPI_MTU2_5W Capture edge Specify one from RAPI_RISING_CAP_5 RAPI_FALLING_CAP_5 Interrupt enable Specify one from RAPI_CAPTURE_ENA RAPI_CAPTURE_DIS The default value is RAPI_CAPTURE_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_TIMER_INT_LV_2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPI_TIMER_INT_LV_0 Rev 1 01 Aug 27 2008 AS 4 58 REJ10J1906 0101 RENES 4 Description 3 3 Return value Category Reference Remark Program example Library Reference 4 2 2 Timer MTU2 __ SetlinputPeriodPin func For func specify a pointer to callback function If this pointer is not specified set RAPI_NULL If the specification of timer is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned
102. _TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPI_TIMER_INT_LV_0 func For func specify a pointer to callback function If this pointer is not specified set RAPI_NULL If the specification of timer is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Timer MTU2 input capture mode __EnablelnputCapture DestroylnputCapture GetCaptureValue If an undefined value is specified in the first argument operation of the API cannot be guaranteed include rapi_timer_sh_7125 h Declaration of callback function void TimerIntFunc void void func void Setting TGRA for MTU2 channel 0 as input capture pin __SetInputCapturePin RAPI_MTU2_0 RAPI_TIOCA RAPI_RISING_CAP_0 RAPI_CAPTURE_ENA RAPI_TIMER_INT_LV_3 TimerIntFunc Rev 1 01 Aug 27 2008 SS AS 4 84 REJ10J1906 0101 SENES 4 Library Reference 4 2 2 Timer MTU2 __EnablelnputCapture 24 EnablelnputCapture Synopsis Description Return value Category Reference Remark Program example Rev 1 01 Aug 27 2008 REJ10J1906 0101 lt Operation control for input capture mode gt Boolean EnablelnputCapture unsigned long data data Setup data Controls start stop operation of the specified timer in input capture mode data For data set the following parameters
103. __PollingSClSending 8 PollingSClSending Synopsis lt SCl transmission by polling gt Boolean PollingSClSending unsigned long data data Setup data Description Transmits data in the serial communication by polling Transmits data in transmission buffer with the size specified by StartSClSending data For data set one of the following parameters as a channel RAPI_COM1 SCI channel 0 RAPI_COM2 SCI channel 1 RAPI_COM3 SCI channel 2 Return value If the specification of serial port is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Category SCI Reference __StartSClSending Remark If an undefined value is specified in the argument operation of the API cannot be guaranteed Program example include rapi_sif_sh_7125 h unsigned char SendBuf 10 unsigned short SendNum void INT_SCIO_TX void Main routine void func void Setting up SCI channel 0 to clock synchronous mode Transmit data empty interrupt enabled __CreateSCI RAPI_COM1 RAPI_SM_SYNC RAPI_CKDIR_INT RAPI_BCSS_P1 RAPI_LSB_SEL RAPI_INT_TX_ENA RAPI_SCI_INT_LV_6 20 Setting transmit data size to 5 bytes and start up SCI transmission __StartSerialSending RAPI_COM1 SendBuf 5 amp SendNum 1 Interrupt routine for SCI transmission void INT_SCIO_TX void if SendNum II End of 5 byte data transmission StopSCIsendin
104. a 1 data2 Stores the value of the timer counter Acquires the counter value of the specified timer in input capture mode data1 For data1 set the following parameters To set multiple parameters at the same time use the symbol to separate each specified parameter Then several pins can be selected at the same time Return value Category Reference Remark Program example Rev 1 01 REJ10J1906 0101 Aug 27 2008 RAPI_MTU2_0 MTU2 channel 0 RAPI_MTU2 _1 MTU2 channel 1 RAPI MIUZ 3 MTU2 channel 2 RAPIMTU2_3 MTU2 channel 3 RAPI_MTU2_4 MTU2 channel 4 RAPI_MTU2_5U MTU2 channel 5U RAPIMTU2_5V MTU2 channel 5V RAPI_MTU2_5W MTU2 channel 5W RAPI_TIOCA MTU2 TIOCIA i 0 to 4 RAPI_TIOCB MTU2 TIOCB i 0 to 4 RAPI_TIOCC MTU2 TIOCIC i 0 3 and 4 RAPI_TIOCD MTU2 TIOCD i 0 3 and 4 If the specification of timer is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Timer MTU2 input capture mode __CreatelnputCapture EnablelnputCapture DestroylnputCapture If an undefined value is specified in the first argument operation of the API cannot be guaranteed include rapi_timer_sh_7125 h void func void unsigned short data Acquisition of counter value for MTU2 channel 5U in input capture mode __GetInputCapture RAPI_MTU2_5U amp data RENESAS Sc 4
105. ages arising out of such applications You should use the products described herein within the range specified by Renesas especially with respect to the maximum rating operating supply voltage range movement power voltage range heat radiation characteristics installation and other product characteristics Renesas shall have no liability for malfunctions or damages arising out of the use of Renesas products beyond such specified ranges Although Renesas endeavors to improve the quality and reliability of its products IC products have specific characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use conditions Please be sure to implement safety measures to guard against the possibility of physical injury and injury or damage caused by fire in the event of the failure of a Renesas 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 applicable measures Among others since the evaluation of microcomputer software alone is very difficult please evaluate the safety of the final products or system manufactured by you In case Renesas products listed in this document are detached from the products to which the Renesas products are attached or affixed the risk of accident such as swallowing by infants and small children is very high You should implement safety measures so t
106. allback tAFunc tBFunc tCFunc tAFunc tBFunc void void void void void D D D D PeriodValue DutyValuel DutyValue2 DutyValue3 DutyValue4 50000 40000 30000 20000 rapi_timer_sh_7125 h 60000 function 0xC350 0x9C40 0x7530 0x41 EA60 ay E20 Setting MTU2 channel 0 for PWM mode 2 __CreatePWM Setting TGRC_O to RAPI_MTU2_0 RAPI_PWM_MODI ERFLOW_DIS ER_SYN the period register RAPI_OVI RAPI_TI __SetPWMPin RAPI_MTU2_0 GE RAPI_MP4 RAPTI_RISING_ EDG RAPI_TCN RAPI __CLEAR_ GRC IMER_IN LV_O C RAPI_NUL RAPI_TGRC RAPI_COMPAR PeriodValue P r ATCH_ENA TimerOIntCFu L RAPI_OU RAPI_TIM PUT_RETAIN ER_INT_LV_4 nc Setting of TGRA_O and TGRB_O to the duty register __SetPWMPin BAPI Mi __SetPWMPin BAPI Mi TU2_0 RAPI_TGRA RAPI_COMPAR DutyValuel TU2_0 IATCH_ENA imerOIntAFun RAPI_TGRB RAPI_COMPAR DutyValue2 IATCH_ENA TimerOIntBFun RAPI_OU PUT_O_1 RAPI_TIM ER_IN c RAPI_OU PUT_O RAPI_TIM ER_IN c Setting MTU2 channel 1 for PWM mode 2 Setting TGRA_ __SetPWMPin RAPI __SetPWMPin RAPI CreatePWM RAPI PI_PWM_MOD RFLOW_DIS ER_SYN TGRB_
107. ata1 unsigned short data2 data1 Setup data 1 data2 Setup data 2 Stops SCI transmission data1 For data1 set one of the following parameters as a channel RAPI_COM1 SCI channel 0 RAPI_COM2 SCI channel 1 RAPI_COM3 SCI channel 2 data2 For data2 specify the wait time until SCI transmission is stopped If stop of SCI transmission is successful RAPI_TRUE is returned otherwise RAPI_FALSE is returned SCI __ StartSClSending e When executing in clock synchronous mode SCI reception of data also stops e H an undefined value is specified in the first argument operation of the API cannot be guaranteed include rapi_sif_sh_7125 h void func void Stopping SCI transmission for channel 0 __StopSCISending RAPI_COM1 50000 Rev 1 01 Aug 27 2008 RENESAS 4 11 REJ10J1906 0101 4 Library Reference 4 2 1 Serial Communication Interface SCI __ PollingSClReceiving 7 __PollingSClReceiving Synopsis Description Return value Category Reference Remark Program example lt SCl reception by polling gt Boolean PollingSClReceiving unsigned long data data Setup data Receives data in serial communication by polling Acquires data with the size specified by StartSClReceiving data For data set one of the following parameters as a channel RAPI_COM1 SC
108. ault value is RAPIOVERFLOW_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPITIMER_INT_LV_1 RAPI_TIMER_INT_LV_ 2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPL_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPILTIMER_INT_LV_0 e When RAPI_PERIODIC is selected the following parameters can be set Count clearing source Specify one from RAPI_LTCNT_CLEAR_TGRA RAPI_TCNT_CLEAR_TGRB RAPI_TCNT_CLEAR_TGRC RAPI_TCNT_CLEAR_TGRD RAPI_TCNT_CLEAR_OTHER Count output Specify one from RAPI_OUTPUT_RETAIN RAPIL_OUTPUT_0_0 RAPIOUTPUT_0_1 RAPIL_OUTPUT_0_TOG RAPI_OUTPUT_1_0 RAPIL_OUTPUT_1_1 RAPIOUTPUT_1_TOG The default value is RAPI_OUTPUT_RETAIN A D converter start Specify one from RAPI_AD_START_REQ request RAPI_NO_AD_START_REQ The default value is RAPLNO_AD_START_REQ Interrupt enable Specify one from RAPI_COMPARE_MATCH_ENA RAPI_COMPARE_MATCH_DIS The default value is RAPLCOMPARE_MATCH_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_TIMER_INT_LV_ 2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV
109. ault value is RAPIOVERFLOW_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPLTIMER_INT_LV_1 RAPI_TIMER_INT_LV_ 2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPILTIMER_INT_LV_0 e When RAPI_PERIODIC is selected the following parameters can be set Count clearing source Specify one from RAPI_LTCNT_CLEAR_TGRA RAPI_TCNT_CLEAR_TGRB RAPI_TCNT_CLEAR_TGRC RAPI_TCNT_CLEAR_TGRD RAPI_LTCNT_CLEAR_OTHER Count output Specify one from RAPI_OUTPUT_RETAIN RAPIL_OUTPUT_0_0 RAPILOUTPUT_0_1 RAPIL_OUTPUT_0_TOG RAPI_LOUTPUT_1_0 RAPI_OUTPUT_1_1 RAPIOUTPUT_1_TOG The default value is RAPI_OUTPUT_RETAIN A D converter start Specify one from RAPI_AD_START_REQ request RAPI_NO_AD_START_REQ The default value is RAPINO_AD_START_REQ Interrupt enable Specify one from RAPI_COMPARE_MATCH_ENA RAPI_COMPARE_MATCH_DIS The default value is RAPLCOMPARE_MATCH_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPIL_TIMER_INT_LV_2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_
110. ce Count edge Count clearing source A D converter start request Interrupt enable Interrupt priority level Specify one from RAPI_MP_1 RAPI_MP_4 RAPI_MP_16 RAPI_MP_64 RAPI_MP_256_34 RAPI_MP_1024_ 34 RAPI_EXTER_TCLKA_3 RAPILEXTER_TCLKB_ 3 The default value is RAPI_MP_1 Specify one from RAPI_LRISING_EDGE RAPI_FALLING_EDGE RAPI_BOTH_EDGE The default value is RAPI_RISING_EDGE Note When RAPI_MP1 is specified for the count source count edge is fixed to the default value Specify one from RAPI_LTCNT_CLEAR_DIS RAPI_TCNT_CLEAR_TGRA RAPI_TCNT_CLEAR_TGRB RAPI_TCNT_CLEAR_TGRC RAPI_TCNT_CLEAR_TGRD RAPI_TCNT_CLEAR_OTHER The default value is RAPI_TCNT_CLEAR_DIS Specify one from RAPI_AD_START_REQ RAPI_NO_AD_START_REQ The default value is RAPI_NO_AD_START_REQ Specify one from RAPI_OVERFLOW_ENA RAPI_OVERFLOW_DIS The default value is RAPLOVERFLOW_DIS Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_TIMER_INT_LV_2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPI_TIMER_INT_LV_0 e Selectable parameters when RAPI_MTU2_5 is specified Count source Count
111. clock counts on TCLKA pin input for channel 3 or 4 RAPI_EXTER_TCLKB_3 External clock counts on TCLKB pin input for channel 3 or 4 RAPI_TCNT2_ FLOW Counts on TCNT_ 2 overflow underflow RAPI NORMAL Normal mode RAPI_PHASE_COUNTING_1 Phase counting mode 1 only for channel 1 or 2 RAPI_PHASE_COUNTING 2 RAPI_PHASE_COUNTING_3 Phase counting mode 2 only for channel 1 or 2 Phase counting mode 3 only for channel 1 or 2 RAPI PHASE COUNTING 4 Phase counting mode 4 only for channel 1 or 2 RAPI_FREE_RUNNING Free running count operation RAPI_PERIODIC Periodic count operation RAPI_ RISING EDGE Counts at rising edge RAPI_FALLING_EDGE Counts at falling edge RAPI_BOTH_EDGE Counts at both edges fixed to rising edge Note When TCNT_2 overflow underflow is specified for the count source count edge is RAPI_TCNT_CLEAR_DIS Disables TCNT clearing selectable only in TGRE and TGRF of channel 0 RAPI_TCNT_CLEAR_TGRA Clears TCNT by TGRA compare match RAPI TCNT CLEAR _TGRB Clears TCNT by TGRB compare match RAPI_TCNT_CLEAR_TGRC Clears TCNT by TGRC compare match RAPI_TCNT CLEAR TGRD Clears TCNT by TGRD compare match 2tENESAS Ve 4 Library Reference __CreateEventCounter 4 2 2 Timer MTU2 Description 2 7 RAPI_OUTPUT_RETAIN Output retained Rev 1 01 Au
112. d 5 byte data transmission __ PollingSCISending RAPI_COM1 Figure 5 2 Example of SCI Transmission Rev 1 01 Aug 27 2008 5 2 REJ10J1906 0101 RENESAS Usage Example 5 5 2 Timer MTU2 5 2 Timer MTU2 1 Timer mode Figure 5 3 shows setting of MTU2 channel 0 for the timer mode A user needs to execute processing by a callback function if necessary include rapi_timer_sh_7125 h Declaration of callback function void TimerIntFunc void void func void Setting MTU2 channel 0 for the timer mode __CreateTimer RAPI_MTU2_0 RAPI_MP16 RAPI_PERIODIC RAPI_RISING_EDGE RAPI_TCNT_CLEAR_TGRB RAPI_OUTPUT_O_TOG RAPI_COMPARE_MATCH_ENA RAPI_TIMER_INT_LV_5 0x8000 TimerIntFunc Start up timer EnableTimer RAPI_MTU2_0 RAPI_TIMER_ON Figure 5 3 Example of Timer Mode Rev 1 01 Aug 27 2008 5 3 REJ10J1906 0101 RENESAS 5 Usage Example 5 2 Timer MTU2 2 PWM mode Figure 5 4 shows setting of MTU2 channel 0 and 1 for the PWM mode 2 A user needs to execute processing by a callback function if necessary Figure 5 5 shows an example of behavior of setting by Figure 5 4 and PWM output waveform include unsigned unsigned unsigned unsigned unsigned Declaration void void void void void void TimerOIn shor shor shor shor shor TimerOIn TimerOIn Timerlin Timerlin func void of c
113. d by Renesas Technology Corp Edited by Microcomputer Application Engineering Dept Renesas Solutions Corp 2008 Renesas Technology Corp and Renesas Solutions Corp All rights reserved Printed in Japan Renesas Embedded Application Programming Interface User s Manual 2tENESAS Renesas Electronics Corporation 1753 Shimonumabe Nakahara ku Kawasaki shi Kanagawa 211 8668 Japan REJ10J1906 0101
114. d func void Clearing settings of MTU2 channels 2 and 3 in timer mode _ DestroyTimer RAPI_MTU2_2 RAPI_MTU2_3 2tENESAS e 4 4 __CreateEventCounter Synopsis Description 1 7 Rev 1 01 Aug 27 2008 REJ10J1906 0101 lt Setting for event counter mode gt Library Reference 4 2 2 Timer MTU2 ___CreateEventCounter Boolean __CreateEventCounter unsigned long data1 unsigned short data2 void func1 void func2 data1 Setup data 1 data2 Setup data 2 func1 Pointer to callback function for compare match interrupt or overflow interrupt func2 Pointer to callback function for underflow interrupt Sets the specified timer to event counter mode data1 For data1 set the following parameters To set multiple parameters at the same time use the symbol to separate each specified parameter RAPI_MTU2_0 MTU2 channel 0 RAPI_MTU2_1 MTU2 channel 1 RAPI_MTU2_2 MTU2 channel 2 RAPI_MTU2_3 MTU2 channel 3 RAPI_MTU2_4 MTU2 channel 4 RAPI_EXTER_TCLKA_0 External clock counts on TCLKA pin input for channel 0 1 or 2 RAPI_EXTER_TCLKB_0 External clock counts on TCLKB pin input for channel 0 1 or 2 RAPI_EXTER_TCLKC_0 External clock counts on TCLKC pin input for channel 0 or 2 RAPI_EXTER_TCLKD_0 External clock counts on TCLKD pin input for channel 0 RAPI_EXTER_TCLKA_3 External
115. dth measurement 19 _ EnablePulseWidthMeasurementMode Operation control for pulse width measurement mode 20 _ DestroyPulseWidthMeasurementMode Clearing of setting for pulse width measurement mode 21 GetPulseWidthMeasurementMode Acquisition of measured value in pulse width measurement mode 22 _CreatelnputCapture Setting for input capture mode 23 __SetlnputCapturePin Setting of input pin for input capture 24 _EnablelnputCapture Operation control for input capture mode 25 _DestroylnputCapture Clearing of setting for input capture mode 26 __GetCaptureValue Acquisition of counter value for input capture mode 27 __CreateOutputCompare Setting for output compare mode 28 SetOutputPin Setting of timer general register for output compare 29 __EnableOutputCompare Operation control for output compare mode 30 _ DestroyOutputCompare Clearing of setting for output compare mode 31 __GetTimerFlag Acquisition of timer status 32 _ClearTimerFlag Clearing of timer status Rev 1 01 Aug 27 2008 7rtENESAS 4 1 REJ10J1906 0101 Library Reference 4 1 API List by Peripheral Function Table 4 2 Renesas Embedded API List 2 2 Category No Name Description UO port 1 _ SetlOPort Setting of I O port 2 _ ReadlOPort Reading of data from I O port 3 WritelOPort Writing of data to I O port External 1 Createlnterrupt Setting of external interrupt interrupt 2 _ Enablelnterrupt Ope
116. e data For data set the following parameters To set multiple parameters of channels use the symbol to separate each specified parameter Then several timers can be enabled or disabled at the same time Refer to notes below RAPI_MTU2_0 MTU2 channel 0 RAPI_MTU2_1 MTU2 channel 1 RAPI_MTU2_2 MTU2 channel 2 RAPI_MTU2_3 MTU2 channel 3 RAPI_MTU2_4 MTU2 channel 4 RAPI_MTU20 A MTU2 channels 0 to 4 RAPI_MTU2_5U MTU2 channel 5U RAPI_MTU2_5V MTU2 channel 5V RAPI_MTU2_5W MTU2 channel 5W RAPI_MTU2_5 MTU2 channels 5U 5V and 5W RAPI_CMT_0O CMT channel 0 RAPI_CMT_1 CMT channel 1 RAPI_CMT_ALL CMT all channels RAPI_TIMER_ON Starts the timer in timer mode RAPI_TIMER_OFF Stops the timer in timer mode Notes e For RAPI_MTU2_0 to 4 several channels can be specified at the same time e For RAPIMTU2_5U 5V and DW several channels can be specified at the same time e For RAPI_CMT_0 and 1 several channels can be specified at the same time If the specification of timer is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Timer MTU2 timer mode __ CreateTimer DestroyTimer If an undefined value is specified in the argument operation of the API cannot be guaranteed include rapi_timer_sh_7125 h void func void Start up timer for MTU2 channels 0 and 1 in timer mode __EnableTimer RAPI_MTU2_0 RAPI_MTU2_1 RAPI_TIMER_ON 2tENESAS 2
117. e API function by a program example 2tENESAS ZS 4 Library Reference 4 2 1 Serial Communication Interface SCI __CreateSCl 4 2 1 Serial Communication Interface SCI 1 _ CreateSCl Synopsis Description 1 2 lt Setting of SCI gt Boolean __CreateSCl unsigned long data1 unsigned short data2 data1 Setup data 1 data2 Setup data 2 Sets SCI according to the specified parameters data1 For data1 set the following parameters To set multiple parameters at the same time use the symbol to separate each specified parameter e Channel Multiple channels can be selected RAPI_COM1 SCI channel 0 DAP COM2 SCI channel 1 DAP COM3 SCI channel 2 e Operation for SCI Choose one from the following RAPI SM SYNC Clock synchronous mode RAPI SM ASYNC Clock asynchronous mode e Data length format in clock asynchronous mode Choose one from the following RAPI_7_BIT_LENGTH 7 bit data length RAPI_ 8 BIT _LENGTH 8 bit data length Note Do not set these parameters in clock synchronous mode D Serial parallel conversion format Choose one from the following RAPI_LSB_SEL LSB first RAPI_MSB_SEL MSB first Note Do not set these parameters when 7 bit data is specified for the data length in clock asynchronous mode SCI clock source select and clock output enable disable from SCK pin Choose one from the follo
118. e default value is RAPINO_AD_START_REQ Selectable parameters when RAPI_MTU2_2 is specified Count source Count edge Count clearing source A D converter start request Specify one from RAPI_MP1 RAPI_MP4 RAPI_MP16 RAPI_MP64 RAPI_MP1024_ 2 RAPIEXTER_TCLKA_0 RAPI_EXTER_TCLKB_0 RAPI_LEXTER_TCLKC_0 The default value is RAPI_MP1 Specify one from RAPI_RISING_EDGE RAPI_FALLING_EDGE RAPI_BOTH_EDGE The default value is RAPI_RISING_EDGE Note When RAPI_MP_1 is specified for the count source count edge is fixed to its default value Specify one from RAP TCNT_CLEAR_TGRA RAPI_TCNT_CLEAR_TGRB The default value is RAPI_TCNT_CLEAR_DIS Specify one from RAPI_LAD_START_REQ RAPILNO_AD_START_REQ The default value is RAPI_NO_AD_START_REQ 2tENESAS WE 4 Description 3 3 Return value Category Reference Remark Program example Library Reference 4 2 2 Timer MTU2 __CreateOutputCompare e Selectable parameters when RAPI_MTU2_3 or RAPI_MTU2_4 is specified Count source Specify one from RAPI_MP1 RAPI_MP4 RAPI_MP16 RAPI_MP64 RAPI_MP256_ 34 RAPI_MP1024_ 34 RAPI_EXTER_TCLKA_3 RAPI_LEXTER_TCLKB_ 3 The default value is RAPI_MP1 Count edge Specify one from RAPI_RISING_EDGE RAPI_FALLING_EDGE RAPI_BOTH_EDGE The default value is RAPI_RISING_EDGE Note When RAPI_MP1 is specified for the count source c
119. e default value is RAPI_TIMER_INT_LV_0 e When RAPI_PERIODIC is selected the following parameters can be set Count clearing source Specify one from RAPI_LTCNT_CLEAR_TGRA RAPI_TCNT_CLEAR_TGRB RAPI_TCNT_CLEAR_OTHER Count output Specify one from RAPI_OUTPUT_RETAIN RAPI_OUTPUT_0_0 RAPLOUTPUT_0_1 RAPIL_OUTPUT_0_TOG RAPI_LOUTPUT_1_0 RAPILOUTPUT_1_1 RAPIOUTPUT_1_TOG The default value is RAPI_OUTPUT_RETAIN A D converter start Specify one from RAPI_AD_START_REQ request RAPI_NO_AD_START_REQ The default value is RAPLNO_AD_START_REQ Interrupt enable Specify one from RAPI_COMPARE_MATCH_ENA RAPI_COMPARE_MATCH_DIS The default value is RAPLCOMPARE_MATCH_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_TIMER_INT_LV_ 2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPLTIMER_INT_LV_11 RAPIL_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPIL_TIMER_INT_LV_0 Rev 1 01 Aug 27 2008 AS 4 31 REJ10J1906 0101 RENES Library Reference 4 4 2 2 Timer MTU2 _ CreateEventCounter Description 5 7 e Selectable parameters when RAPI_MTU2_2 and RAPI_NORMAL are specified Count source Specify one from RAPI_EXTE
120. e from a specified A D register data1 For data1 set the following parameters To set multiple parameters at the same time use the symbol to separate each specified parameter RAPI_ADDRO A D data register 0 RAPI_ADDR1 A D data register 1 RAPI_ADDR2 A D data register 2 RAPI_ADDR3 A D data register 3 RAPI_ADDR4 A D data register 4 RAPI_ADDR5 A D data register 5 RAPI_ADDR6 A D data register 6 RAPI_ADDR7 A D data register 7 RAPI_ADDR_ALL All values in the A D data registers 0 to 7 data2 For data2 specify a pointer to buffer in which the A D converted value is stored Note After A D conversion the converted value is right aligned while that is left aligned in the A D data register ADDR Return value If A D converted value is successfully acquired RAPI_TRUE is returned if failed RAPI_FALSE is returned Category A D converter Reference __CreateADC EnableADC DestroyADC Remark If an undefined value is specified in the first argument operation of the API cannot be guaranteed Program example include rapi_ad_sh_7125 h void func void unsigned short data 2 Acquisition of an A D convertered value in the A D data register 0 ___GetADC RAPI_ADDRO RAPI_ADDR1 amp data Rev 1 01 Aug 27 2008 AS 4 119 REJ10J1906 0101 RENES A Library Reference 4 2 5 A D Converter __GetADCFlag 5 GetADCFlag Synopsis lt Acquisition of A D converter status gt
121. e match RAPI_TCNT_CLEAR_TGRD Clears TCNT by TGRD compare match RAPI_TCNT_CLEAR_DIS_TGRE Uses TGRE register but disables TCNT clearing by TGRE compare match RAPI_TCNT_CLEAR_DIS_TGRF Uses TGRF register but disables TCNT clearing by TGRF compare match RAPI_TCNT_CLEAR_TGRU Clears TCNT by TGRU_5 compare match RAPI_TCNT_CLEAR_TGRV Clears TCNT by TGRV_5 compare match RAPI_TCNT_CLEAR_TGRW Clears TCNT by TGRW_5 compare match RAPI_OUTPUT_RETAIN Output retained RAPI_OUTPUT_0_0 Initial output is 0 and outputs Oat compare match RAPI_OUTPUT_0_1 Initial output is 0 and outputs 1 at compare match RAPIOUTPUT_0_TOG Initial output is 0 and outputs toggle at compare match RAPI_OUTPUT_1_0 Initial output is 1 and outputs 0 at compare match RAPI_OUTPUT_1_1 Initial output is 1 and outputs 1 at compare match RAPIOUTPUT_1_TOG Initial output is 1 and outputs toggle at compare match RAPI_OVERFLOW_ENA Enables overflow interrupt RAPI_OVERFLOW_DIS Disables overflow interrupt RAPI_COMPARE_MATCH_ENA Enables compare match interrupt RAPI_COMPARE_MATCH_DIS Disables compare match interrupt RAPI_AD_START_REQ Enables generation of A D converter start requests by TGRA input capture compare match RAPI_NO_AD_START_REQ Disables generation of A D converter start requests by TGRA input capture compare match RAPI_T
122. ePWM unsigned long data data Setup data Controls start stop operation of the specified timer in pulse width modulation mode data For data set the following parameters To set multiple parameters use the symbol to separate each specified parameter Then several timers can be enabled or disabled at the same time RAPI_MTU2_0 MTU2 channel 0 RAPI_MTU2_1 MTU2 channel 1 RAPI_MTU2_ 2 MTU2 channel 2 RAPI_MTU2_3 MTU2 channel 3 RAPI_MTU2_4 MTU2 channel 4 RAPI_MTU20_ A MTU2 channels 0 to 4 RAPI_TIMER_ON Starts the timer in pulse width modulation mode RAPI_TIMER_OFF Stops the timer in pulse width modulation mode If the specification of timer is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Timer MTU2 pulse width modulation mode __CreatePWM DestroyPWM If an undefined value is specified in the argument operation of the API cannot be guaranteed include rapi_timer_sh_7125 h void func void Start up timer for MTU2 channels 1 and 2 in pulse width modulation mode __EnablePWM RAPI_MTU2_1 RAPI_MTU2_2 RAPI_TIMER_ON 2tENESAS SS 4 11 DestroyPWM Synopsis Description Return value Category Reference Remark Program example Library Reference 4 2 2 Timer MTU2 __EnablePWM lt Clearing of setting for pulse width modulation mode gt Boo
123. ecified in the first argument operation of the API cannot be guaranteed include rapi_timer_sh_7125 h Declaration of callback function void TimerIntFunc void void func void Setting MTU2 channel 4 for pulse period measurement mode __CreatePulsePeriodMeasurementMode RAPI_MTU2_4 RAPI_MP_4 RAIP_RISING_EDGE RAPI_TCNT_CLEAR_DIS RAPI_OVERFLOW_ENA RAPI_TIMER_INT_LV_1 TimerIntFunc Rev 1 01 Aug 27 2008 7rtENESAS 4 56 REJ10J1906 0101 4 13 SetInputPeriodPin Synopsis Description 1 3 Rev 1 01 REJ10J1906 0101 Library Reference 4 2 2 Timer MTU2 lt Setting of input pin for pulse period measurement gt Boolean SetInputPeriodPin unsigned long data void func __SetlnputPeriodPin data Setup data func Pointer to callback function Sets the specified pin to input pin for pulse period measurement data For data set the following parameters To set multiple parameters at the same time use the symbol to separate each specified parameter RAPI MTU2_0 MTU2 channel 0 RAPI MTU2 1 MTU2 channel 1 RAPI MTU2 2 MTU2 channel 2 RAPI MTU2 3 MTU2 channel 3 RAPI MTU2 4 MTU2 channel 4 RAPI MTU2 5U MTU2 channel 5U RAPI MTU2 5V MTU2 channel 5V RAPI MITUS SW MTU2 channel SW RAPI_TIOCA TIOCIA pin i 0 to 4 RAPI_TIOCB TIOCB pin 0 to 4 RAP
124. er MTU2 pulse width measurement mode __CreatelnputCapture If an undefined value is specified in the first argument operation of the API cannot be guaranteed include rapi_timer_sh_7125 h Declaration of callback function void TimerIntFunc void void func void Setting MTU2 channel 4 for pulse width measurement mode __CreatePulseWidthMeasurementMode RAPI_MTU2_4 RAPI_MP_4 RAPI_RISING_EDGE RAPI_TCNT_CLEAR_TGRB RAPI_OVERFLOW_DIS RAPI_TIMER_ INT Lu D TimerIntFunc Rev 1 01 Aug 27 2008 7rtENESAS 4 68 REJ10J1906 0101 4 18 SetinputWidthPin Synopsis Description 1 3 Rev 1 01 4 2 2 Timer MTU2 lt Setting of input pin for pulse width measurement gt Boolean SetinputWidthPin unsigned long data void func Library Reference SetlnputWidthPin data Setup data func Pointer to callback function data For data set the following parameters To set multiple parameters at the same time use the symbol to separate each specified parameter Aug 27 2008 REJ10J1906 0101 Sets the specified pin to input for pulse width measurement RAPI_MTU2_0 MTU2 channel 0 RAPI_MTU2_1 MTU2 channel 1 RAPI_MTU2_2 MTU2 channel 2 RAPIMTU2_3 MTU2 channel 3 RAPI_MTU2_4 MTU2 channel 4 RAPI_MTU2_5U MTU2 channel 5U RAPI_MTU2_5V MTU2 channel 5V RAPI_MTU2_5W
125. ertain use conditions Further Renesas Electronics products are not subject to radiation resistance design Please be sure to implement safety measures to guard them against the possibility of physical injury and injury or damage caused by fire in the event of the failure of a Renesas Electronics product such as safety design for hardware and software including but not limited to redundancy fire control and malfunction prevention appropriate treatment for aging degradation or any other appropriate measures Because the evaluation of microcomputer software alone is very difficult please evaluate the safety of the final products or system manufactured by you Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental compatibility of each Renesas Electronics product Please use Renesas Electronics products in compliance with all applicable laws and regulations that regulate the inclusion or use of controlled substances including without limitation the EU RoHS Directive Renesas Electronics assumes no liability for damages or losses occurring as a result of your noncompliance with applicable laws and regulations This document may not be reproduced or duplicated in any form in whole or in part without prior written consent of Renesas Electronics Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this document or Renesas Electro
126. etTimerFlag unsigned long data1 unsigned char data2 data1 Setup data 1 data2 Pointer to the buffer in which counter flag value is stored Description Acquires status flags of the specified timer data1 For data1 set the following parameters To set multiple parameters for flags at the same time use the symbol to separate each specified parameter RAPI_MTU2_0 MTU2 channel 0 RAPI_MTU2_1 MTU2 channel 1 RAPI_MTU2 2 MTU2 channel 2 RAPI_MTU2_3 MTU2 channel 3 RAPI_MTU2_4 MTU2 channel 4 RAPI_MTU2_5U MTU2 channel 5U RAPI_MTU2_5V MTU2 channel 5V RAPI_MTU2_5W MTU2 channel 5W RAPI _CMT_0 CMT channel 0 RAPI_CMT_1 CMT channel 1 RAPI_TGFA Input capture Output compare flag A RAPI_TGFB Input capture Output compare flag B RAPI_TGFC Input capture Output compare flag C RAPI_TGFD Input capture Output compare flag D RAPI_TCFD Count direction flag RAPI_TCFV Overflow flag RAPI_TCFU Underflow flag RAPI_TGFE Compare match flag E RAPI_TGFF Compare match flag F RAPI_CMF Compare match Input capture flag Note When MTU2 channel 5U 5V or 5W is selected each compare match input capture flag CMFU5 CMFV5 or CMFWS respectively is acquired Configuration of the timer status register TSR which stores the status flags for timer MTU2 is shown below e TSR_0 to TSR_4 TCED TCFU TCFV TGFD TGFC TGFB TGFA Count direction flag Underflow Overflow Input capture Output compare flag e TSR2_0 Be EE BE Compare match flag for channel 0 e TSR_5
127. f the specified port RAPI_BIT_13 Bit 13 of the specified port RAPI BIT 14 Bit 14 of the specified port RAPI_BIT_15 Bit 15 of the specified port RAPI_LOWER_8 BITS Lower 8 bits of the specified port RAPI_HIGHER_8 BITS Higher 8 bits of the specified port RAPI_16_BITS 16 bits of the specified port e Pin function Choose one from the following RAPI_FUNC_IO I O port RAPI_FUNC_MTU2 Timer MTU2 RAPI_FUNC_SCI Serial communication interface RAPI_FUNC_AD A D converter RAPI_FUNC_POE Port output enable RAPI_FUNC_INT External interrupt e Port input output direction Choose one from the following RAPI_PORT_INPUT Sets the specified port to input RAPI_PORT_OUTPUT Sets the specified port to output Rev 1 01 Aug 27 2008 REJ10J1906 0101 Library Reference 7tENESAS 4 Return value Category Reference Remark Program example Rev 1 01 Aug 27 2008 REJ10J1906 0101 Library Reference 4 2 3 I O Port __SetlOPort If the specification of I O port is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned I O port __ReadlOPort WritelOPort If an undefined value is specified in the first argument operation of the API cannot be guaranteed include rapi_io_port_sh_7125 h void func void Setting Port A with lower 8 bits to port output
128. face SCI This chapter shows programming example to set each each driver in this library 5 1 Serial Communication Inerface SCI 1 SCI Reception Figure 5 1 shows the setting of SCI channel 0 for clock asynchronous mode and the SCI reception of 5 byte data user needs to execute the processing after detecting reception error if necessary Rev 1 01 REJ10J1906 0101 include rapi_sif_sh_7125 h Boolean ErrorFlag unsigned char ReceiveBuf 5 unsigned short ReceiveNum unsigned short SpeedValue 25000000 32 38400 1 P clock Po 25 MHz Bit rate 38400 bit s unsigned short WaitTimerValue 30000 void INT_SCIO_RX void void ErrorOpe void Main routine void func void Setting SCI channel 0 for clock asynchronous mode __CreateSCI RAPI_COM1 RAPI_SM_ASYNC RAPI_CKDIR_INT RAPI_BCSS_P1 RAPI_LSB_SEL RAPI_8 BIT_LENGTH RAPI_STPB_1 RAPI_PARITY_ODD RAPI_MULTI_DIS RAPI_INT_RX_ERR_ENA RAPI_SCI_INT_LV_2 SpeedValue Setting receive data size to 5 bytes and start up SCI reception __StartSCIReceiving RAPI_COM1 ReceiveBuf 5 amp ReceiveNum while RAPI_TRUE if ErrorFlag RAPI_TRUE Detection of receive error and stop SCI reception after waiting for a definite period __StopSCIReceiving RAPI_COM1 WaitTimerValue Error processing ErrorOpe break if ReceiveNum 5 End of 5 byte data receptio
129. from RAPI_CAPTURE_ENA RAPI_CAPTURE_DIS The default value is RAPICAPTURE_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_TIMER_INT_LV_2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPL_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPI_TIMER_INT_LV_0 Rev 1 01 Aug 27 2008 AS 4 70 REJ10J1906 0101 RENES 4 Description 3 3 Return value Category Reference Remark Program example Library Reference 4 2 2 Timer MTU2 __ SetlnputWidthPin func For func specify a pointer to callback function If this pointer is not specified set RAPI_NULL If the specification of timer is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Timer MTU2 pulse width measurement mode SetInputCapturePin If an undefined value is specified in the first argument operation of the API cannot be guaranteed include rapi_timer_sh_7125 h Declaration of callback function void TimerIntFunc void void func void Setting TGRA for MTU2 channel 4 as input capture pin __SetInputWidthPin RAPI_MTU2_4 RAPI_TIOCA RAPI_CAPTURE_ENA RAPI_TIMER_INT_LV_3 TimerIntFunc
130. g 27 2008 REJ10J1906 0101 RAPI_OUTPUT_0_0 Initial output is 0 and outputs 0 at compare match RAPI_OUTPUT_0_1 Initial output is 0 and outputs 1 at compare match RAPI_OUTPUT_0_TOG Initial output is 0 and outputs toggle at compare match RAPI_OUTPUT_1_0 Initial output is 1 and outputs 0 at compare match RAPI OUTPUT 1 1 Initial output is 1 and outputs 1 at compare match RAPIOUTPUT_1_TOG Initial output is 1 and outputs toggle at compare match RAPI_OVERFLOW_ENA Enables overflow interrupt RAPI_OVERFLOW_DIS Disables overflow interrupt RAPI_COMPARE_MATCH_ENA Enables compare match interrupt RAPI_COMPARE_MATCH_DIS Disables compare match interrupt RAPI_UNDERFLOW_ENA Enables underflow interrupt selectable only when channel 1 or 2 is set in phase counting mode RAPI_UNDERFLOW_DIS Disables underflow interrupt selectable only when channel 1 or 2 is set in phase counting mode RAPI_AD_START_REQ Enables generation of A D converter start requests by TGRA input capture compare match RAPI_NO_AD_START_REQ Disables generation of A D converter start requests by TGRA input capture compare match RAPI_TIMER_INT_LV Interrupt priority level 0 RAPI_TIMER_INT_LV Interrupt priority level 1 RAPI_TIMER_INT_LV Interrupt priority level 2 RAPI_TIMER_INT_LV Interrupt priority level 3 RAPI_TIMER_INT_LV
131. g RAPI_COM1 5000 else Transmission of 5 byte data __ PollingSCISending RAPI_COM1 Rev 1 01 Aug 27 2008 AS 4 13 REJ10J1906 0101 RENES 4 Library Reference 4 2 1 Serial Communication Interface SCI __GetScClStatus 9 GetSClStatus Synopsis Description lt Acquisition of SCI status gt Boolean GetSClStatus unsigned long data unsigned char status data Setup data status Byte address to store the receive error flag Acquires status of SCI transmission reception data For data set the following parameters To set multiple parameters at the same time use the symbol to separate each specified parameter Return value Category Reference Remark Program example Rev 1 01 Aug 27 2008 REJ10J1906 0101 RAPI_COM1 SCI channel 0 RAPI_COM2 SCI channel 1 RAPI_COM3 SCI channel 2 RAPI_TDRE Transmit data register empty flag RAPI_RDRF Receive data register full flag RAPI_ORER Overrun error flag RAPI_FER Framing error flag RAPI_PER Parity error flag RAPI_TEND Transmit end flag RAPI_MPB Multiprocessor bit flag for reception RAPIMPBT Multiprocessor bit flag for transmission RAPI_RECV_ERROR All receive error flags Overrun framing and parity errors RAPI_ALL_FLAG All status flags of SCI If the specification of serial port is invalid RAPI_FALSE is
132. g source Specify one from RAPI_LTCNT_CLEAR_DIS RAPIL_TCNT_CLEAR_TGRA RAPI_TCNT_CLEAR_TGRB RAPIL_TCNT_CLEAR_TGRC RAPLTCNT_CLEAR_TGRD RAPL_TCNT_CLEAR_OTHER The default value is RAPI_TCNT_CLEAR_DIS A D converter start Specify one from RAPI_LAD_START_REQ request RAPI_NO_AD_START_REQ The default value is RAPINO_AD_START_REQ Interrupt enable Specify one from RAPI_OVERFLOW_ENA RAPI_OVERFLOW_DIS The default value is RAPIOVERFLOW_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPI_TIMER_INT_LV_1 RAPI_TIMER_INT_LV_2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPI_TIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPI_TIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPI_TIMER_INT_LV_0 e Parameters when synchronous operation is specified When setting synchronous operation for any channels 0 to 4 specify RAPI_TIMER_SYNC When not setting synchronous operation each channel operates independently specify RAPI_TIMER_NO_SYNC The default value is RAPI_TIMER_NO_SYNC func For func specify a pointer to callback function If this pointer is not specified set RAPI_NULL Return value If the specification of timer is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Category Timer MTU2
133. h Declaration of callback function void IntFunc void void func void Setting IRQO interrupt __CreateInterrupt RAPI_IRQO RAPI_INT_FALLING RAPI_IRQOUT_INT_OUTPUT RAPI_INT_LV_7 IntFunc Rev 1 01 Aug 27 2008 7rtENESAS 4 107 REJ10J1906 0101 4 Library Reference 4 2 4 External Interrupt __Enablelnterrupt 2 __Enablelnterrupt Synopsis Description Return value Category Reference Remark Program example lt Operation control for external interrupt gt Boolean Enablelnterrupt unsigned long data data Setup data Controls the operating condition of the specified external interrupt data For data set the following parameters To set multiple parameters at the same time use the symbol to separate each specified parameter RAPI_IRQO IRQO interrupt RAPI_IRQ1 IRQ1 interrupt RAPI_IRQ2 IRQ2 interrupt RAPI_IRQ3 IRQ3 interrupt RAPI_INT_REQUEST_CLEAR Clears the status flag of IRQ interrupt request i 0 to 3 it is invalid if the low level detection is set RAPI_INT_REQUEST_REMAIN Retains the status flag of IRQ interrupt request i 0 to 3 it is invalid if the low level detection is set RAPI_IRQ_DIS Disables interrupt RAPI_IRQ_ENA Enables interrupt If the specification of external interrupt is invalid RAPI_LFALSE is returned otherwise R
134. hat Renesas products may not be easily detached from your products Renesas shall have no liability for damages arising out of such detachment This document may not be reproduced or duplicated in any form in whole or in part without prior written approval from Renesas Please contact a Renesas sales office if you have any questions regarding the information contained in this document Renesas semiconductor products or if you have any other inquiries Table of Contents Table of Contents eneen Ae e ege eh eas i 1 IntrOdCtiOn 4 5 2sccccs ctesscicdaccccsscesevenscdi ees sdeludeccbsieasesessueces cocapteassbelnnecdtuatessatdseddetuassasediaccecseduasvestcsestavasesest es 1 1 KE Ku EE 2 1 o e 2 1 2 2 TT 271 2 3 Serial Communication Interface Driver 2 2 2 4 Timer Driver vseisiiiisss ajasin iii a aaa iii aa iaaa aiai a iii eiaeia iaa iaai Een 2 3 2 4 1 Timer E 2 3 2 4 2 Event Counter Mode wsiessicciessstsstveccstiaen snsevsveecedetes cunwesscoccdatendesevdnedecdeues EEE EANN 2 3 2 4 3 Pulse Width Modulation Mode PWM Mode 2 3 2 4 4 Pulse Period Meastrement MOd6isscsczsccdassnisvecdes stn casveds ces ccaacndsvueseesecca cusesvessevecedannslevsoasatdaxwbevecedeeiedwss 2 3 2 4 5 Pulse Width Measurement Mode 2 3 2 4 6 Input Capture Mod s g eegente 2 3 2 4 7 Output Compare MOE eege isuevnsitersccsstesvensioepectobarsarndstesncestnedvnsdieepsdensaetsredtonessecndtobsbentecseeeseesimnaihens 2 3 2 3 MO Port Dive TE 2 4 G External I
135. he default value is RAPI_AD_INT_DIS Specify one from RAPI_ADC_INT_LV_0 RAPI_ADC_INT_LV_1 RAPI_ADC_INT_LV_2 RAPI_ADC_INT_LV_3 RAPI_ADC_INT_LV_4 RAPI_ADC_INT_LV_5 RAPI_ADC_INT_LV_6 RAPI_ADC_INT_LV_7 RAPI_ADC_INT_LV_8 RAPI_ADC_INT_LV_9 RAPI_ADC_INT_LV_10 RAPI_ADC_INT_LV_11 RAPI_ADC_INT_LV_ 12 RAPI_ADC_INT_LV_13 RAPI_ADC_INT_LV_14 RAPI_ADC_INT_LV_15 The default value is RAPI_ADC_INT_LV_0 4 115 4 Description 6 6 Return value Category Reference Remark Program example Library Reference 4 2 5 A D Converter __CreateADC func For func specify a pointer to callback function If this pointer is not specified set RAPI_NULL If A D converter is successfully set RAPI_TRUE is returned if failed RAPI_FALSE is returned A D converter __EnableADC DestroyADC GetADC If an undefined value is specified in the first argument operation of the API cannot be guaranteed include rapi_ad_sh_7125 h Declaration of callback function void AdIntFunc void void func void Setting A D converter for single mode __CreateADC RAPI_SINGLE RAPI_AN2 RAPI_50_STATE RAPI_P 2 RAPI_TRIGGER_ENA RAPI_AD INT_ENA RAPI_EXTERNAL_TRIGGER_Gl RAPI_ADC_INT_LV_5 AdIntFunc Rev 1 01 Aug 27 2008 7rtENESAS 4 116 REJ10J1906 0101 4 2 __EnableADC Synopsis
136. id func Description 1 5 data Setup data func Pointer to callback function data For data set the following parameters To set multiple parameters at the same time use the symbol to separate each specified parameter Rev 1 01 Aug 27 2008 REJ10J1906 0101 Sets the specified timer to pulse width measurement mode RAPL MTU2 0 MTU2 channel 0 RAPL MTU2_1 MTU2 channel 1 RAPLMTU2 2 MTU2 channel 2 RAPL MTU2 3 MTU2 channel 3 RAPL MTU2 A MTU2 channel 4 RAPL MTU2_5U MTU2 channel 5U RAPL MTU2_5V MTU2 channel 5V RAPLMTU2_5W MTU2 channel 5W RAPIMP_1 Internal clock counts on MP 9 1 HAD MP A Internal clock counts on MPAA RAPIMP_16 Internal clock counts on MP9 16 HAD MP GA Internal clock counts on MPAGA RAPI_MP_256_1 Internal clock counts on MP9 256 for channel 1 RAPI_MP_256 34 Internal clock counts on MP 9 256 for channel 3 or 4 RAPI_MP_1024 2 Internal clock counts on MP 1024 for channel 2 RAPI_MP_1024_34 Internal clock counts on MP for channel 3 or 4 1024 RAPI_RISING_EDGE Counts at rising edge RAPI_FALLING_EDGE Counts at falling edge RAPI _BOTH EDGE Counts at both edges Note When MP9 1 is specified for the count source count edge is fixed to rising edge RAPI_TCNT_CLEAR_DIS Disables TCNT clearing RAPI_TCNT_CLEAR_TGRA Clears TCNT by TGRA in
137. ied Count source Count edge Count clearing source A D converter start request Specify one from RAPI_MP1 RAPI_MP4 RAPI_MP16 RAPI_MP64 RAPI_EXTER_TCLKA_0 RAPI_EXTER_TCLKB_0 RAPI_LEXTER_TCLKC_0 RAPI_EXTER_TCLKD_0 The default value is RAPI_MP1 Specify one from RAPI_RISING_EDGE RAPI_FALLING_EDGE RAPI_BOTH_EDGE The default value is RAPI_RISING_EDGE Note When RAPI_MP_1 is specified for the count source count edge is fixed to the default value Specify one from RAPlL_TCNT_CLEAR_TGRA RAPI_TCNT_CLEAR_TGRB RAPI_TCNT_ CLEAR TGRC RAPI_TCNT_CLEAR_TGRD The default value is RAPI TCNT CLEAR DIS Specify one from RAPI_AD_START_REQ RAPI_NO_AD_START_REQ The default value is RAPI_NO_AD_START_REQ Selectable parameters when RAPI_MTU2_1 is specified Count source Count edge Count clearing source A D converter start request Specify one from RAPI_MP1 RAPI_MP4 RAPI_MP16 RAPI_MP64 RAPI_MP256_1 RAPI_EXTER_TCLKA_0 RAPI_EXTER_TCLKB_0 The default value is RAPI_MP1 Specify one from RAPI_RISING_EDGE RAPI_FALLING_EDGE RAPI_BOTH_EDGE The default value is RAPI_RISING_EDGE Note When RAPI_MP1 is specified for the count source count edge is fixed to the default value Specify one from RAPl_TCNT_CLEAR_TGRA RAPI_TCNT_CLEAR_TGRB The default value is RAPL_TCNT_CLEAR_DIS Specify one from RAPI_LAD_START_REQ RAPILNO_AD_START_REQ Th
138. in data2 is changed Rev 1 01 Aug 27 2008 4 47 REJ10J1906 0101 RENESAS A Library Reference 4 2 2 Timer MTU2 __SetPWMPin Return value If the specification of channel is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Category Timer MTU2 pulse width modulation mode Reference __EnablePWM DestroyPWM Remark If an undefined value is specified in the first argument operation of the API cannot be guaranteed Program example include rapi_timer_sh_7125 h Declaration of callback function void TimerIntBFunc void void TimerIntAFunc void void func void Setting TGRB TGRB_1 in MTU2 channel 1 for cycle register _ SetPWMPin RAPI_MTU2_1 RAPI_TGRB RAPI_OUTPUT_0_0 RAPI_COMPARE_MATCH_ENA RAPI_TIMER_INT_LV_3 50000 TimerIntBFunc Setting TGRA TGRA_1 in MTU2 channel 1 for duty register ___SetPWMPin RAPI_MTU2_1 RAPI_TGRA RAPI_OUTPUT_0_1 RAPI_COMPARE_MATCH_ENA RAPI_TIMER_INT_LV_3 30000 TimerIntAFunc Rev 1 01 Aug 27 2008 4 48 REJ10J1906 0101 RENESAS 4 10 EnablePWM Synopsis Description Return value Category Reference Remark Program example Rev 1 01 REJ10J1906 0101 Aug 27 2008 Library Reference 4 2 2 Timer MTU2 __EnablePWM lt Operation control for pulse width modulation mode gt Boolean Enabl
139. iority level 12 RAPI_TIMER_INT_LV_13 Interrupt priority level 13 RAPI_TIMER_INT_LV_14 Interrupt priority level 14 RAPITIMER_INT_LV_15 Interrupt priority level 15 RAPI_TIMER_SYNC Synchronizes operation for channels 0 to 4 RAPI_ TIMER _NO_SYNC Does not synchronize operation for channels 0 to 4 7rtENESAS 4 40 4 Description 3 6 Library Reference 4 2 2 Timer MTU2 __CreatePWM e Selectable parameters when RAPI_MTU2_0 is specified Count source Specify one from RAPI_MP_1 RAPI_MP_4 RAPI_MP_16 RAPI_MP_64 RAPI_EXTER_TCLKA_0 RAPI_EXTER_TCLKB_0 RAPI_LEXTER_TCLKC_0 RAPI_EXTER_TCLKD_0 The default value is RAPI_MP_1 Count edge Specify one from RAPI_RISING_EDGE RAPI_FALLING_EDGE RAPI_BOTH_EDGE The default value is RAPI_RISING_EDGE Note When RAPI_MP1 is specified for the count source count edge is fixed to the default value Operating mode Specify one from RAPI_PWM_MODE1 RAPI_PWM_MODE2 Count clearing source Specify one from RAPI_LTCNT_CLEAR_DIS RAPIL_TCNT_CLEAR_TGRA RAPI_TCNT_CLEAR_TGRB RAPL_TCNT_CLEAR_TGRC RAPLTCNT_CLEAR_TGRD RAPIL_TCNT_CLEAR_OTHER The default value is RAPI_TCNT_CLEAR_DIS A D converter start Specify one from RAPI_LAD_START_REQ request RAPI_NO_AD_START_REQ The default value is RAPINO_AD_START_REQ Interrupt enable Specify one from RAPILOVERFLOW_ENA RAPI_LOVERFLOW_DIS The default value is RAPIOVERFLOW_DIS
140. iority level 4 RAPI_ADC_INT_LV_5 Interrupt priority level 5 RAPI_ADC_INT_LV_6 Interrupt priority level 6 RAPI_ADC_INT_LV_7 Interrupt priority level 7 RAPI_ADC_INT_LV_8 Interrupt priority level 8 RAPI_ADC_INT_LV_9 Interrupt priority level 9 RAPI_ADC_INT_LV_10 Interrupt priority level 10 RAPI_ADC_INT_LV_11 Interrupt priority level 11 RAPI_ADC_INT_LV_12 Interrupt priority level 12 RAPI_ADC_INT_LV_13 Interrupt priority level 13 RAPI _ADC_INT LV 14 Interrupt priority level 14 RAPI_ADC_INT_LV_15 Interrupt priority level 15 RENESAS E 4 Rev 1 01 Aug 27 2008 REJ10J1906 0101 Description 3 6 Library Reference 4 2 5 A D Converter __CreateADC Selectable parameters when single mode RAPI_SINGLE is specified Analog input pin State control Clock select Trigger enable Trigger source Interrupt enable Interrupt priority level Specify one from RAPI_ANO RAPI_AN1 RAPI_AN2 RAPI_AN3 RAPI_AN4 RAPI_AN5 RAPI_AN6 RAPI_AN7 The default value is RAPI_ANO for A D module 0 or RAPI_AN4 for A D module 1 Specify one from RAPI_50_ STATES RAPI_64_STATES The default value is RAPI_50 STATES Specify one from RAPI_P_4 RAPI_P_3 RAPI_P_2 RAPI_P_1 The default value is RAPI_P_4 Specify one from RAPI_TRIGGER_ENA RAPI_TRIGGER_DIS The default value is RAPI_TRIGGER_DIS Specify o
141. l 0 RAPI_CMT_1 CMT channel 1 RAPI_MP1 Internal clock counts on MP9 1 HAD MP4 Internal clock counts on MP 9 4 RAPI_MP16 Internal clock counts on MP9 16 RAPI_MP64 Internal clock counts on MP 9 64 RAPI_MP256_1 Internal clock counts on MP9 256 for channel 1 HAD MP256_34 Internal clock counts on MP9 256 for channel 3 or 4 RAPI_MP1024_2 Internal clock counts on MP9 1024 for channel 2 RAPI_MP1024_ 34 Internal clock counts on MP 1024 for channel 3 or 4 RAPI_P8 Internal clock counts on Po 8 RAPI_P32 Internal clock counts on P 32 RAPI_P128 Internal clock counts on P 128 RAPI_P512 Internal clock counts on P 512 RAPI_FREE_RUNNING Free running count operation RAPI_PERIODIC Periodic count operation RAPI_RISING EDGE Counts at rising edge RAPI_FALLING_EDGE Counts at falling edge RAPI_BOTH_EDGE Counts at both edges Note When MP 9 1 is specified for the count source count edge is fixed to rising edge 7rtENESAS 4 18 4 Library Reference 4 2 2 Timer MTU2 _ CreateTimer Description 2 7 Rev 1 01 Aug 27 2008 REJ10J1906 0101 RAPI_TCNT_CLEAR_DIS Disables TCNT clearing selectable only in TGRE and TGRF of channel 0 RAPIL_TCNT CLEAR TGRA Clears TCNT by TGRA compare match RAPI_TCNT_CLEAR_TGRB Clears TCNT by TGRB compare match RAPI_TCNT_CLEAR_TGRC Clears TCNT by TGRC compar
142. l fed in from an input pin When an input capture interrupt or an overflow interrupt occurs a preset callback function is called 2 4 6 Input Capture Mode In this mode the timer latches the timer value upon an active signal edge or clock pulse at an input pin thereby generating an interrupt request When an input capture interrupt or an overflow interrupt occurs a preset callback function is called 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 overflow interrupt occurs a preset callback function is called Rev 1 01 Aug 27 2008 AS 2 3 REJ10J1906 0101 RENES Driver 2 2 5 I O Port Driver 2 5 WO Port Driver The I O port driver sets I O port as the input or output writes data to the I O port and reads data from the I O port Rev 1 01 Aug 27 2008 2 4 REJ10J1906 0101 RENESAS Driver 2 2 6 External Interrupt Driver 2 6 External Interrupt Driver The external interrupt driver sets or controls external interrupts and acquires or clears the status of the external interrupt flags Rev 1 01 Aug 27 2008 AS 2 5 REJ10J1906 0101 RENES Driver 2 2 7 A D Converter Driver 2 7 A D Converter Driver The A D converter driver sets and controls A D converter and also clears the setting It is also used to obtain the A D conversion value and acquires or clears the status of A D converter Rev 1 01 Aug 2
143. lean DestroyPWM unsigned long data data Setup data Clears setting of the specified timer in pulse width modulation mode data For data set the following parameters To set multiple parameters use the symbol to separate each specified parameter Then several settings of timers can be cleared at the same time RAPI_MTU2_0 MTU2 channel 0 RAPI_MTU2_1 MTU2 channel 1 RAPI_MTU2_ 2 MTU2 channel 2 RAPI_MTU2_3 MTU2 channel 3 RAPI_MTU2_4 MTU2 channel 4 RAPI_MTU20_ A MTU2 channels 0 to 4 If the specification of timer is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Timer MTU2 pulse width modulation mode __CreatePWM EnablePWM If an undefined value is specified in the argument operation of the API cannot be guaranteed include rapi_timer_sh_7125 h void func void Clearing settings of MTU2 channels 1 and 2 in pulse width modulation mode __DestroyPWM RAPI_MTU2_1 RAPI_MTU2_2 Rev 1 01 Aug 27 2008 7rtENESAS 4 50 REJ10J1906 0101 4 12 Synopsis 4 2 2 Timer MTU2 __CreatePulsePeriodMeasurementMode lt Setting for pulse period measurement mode gt Library Reference __CreatePulsePeriodMeasurementMode Boolean CreatePulsePeriodMeasurementMode unsigned long data void func Description 1 5 data Setup data func Pointer to callback function data For data
144. level 9 RAPI_TIMER_INT_LV e CH Interrupt priority level 10 RAPI_TIMER_INT_LV i i Interrupt priority level 11 RAPI_TIMER_INT_LV n ine Interrupt priority level 12 RAPI_TIMER_INT_LV e oo Interrupt priority level 13 RAPI_TIMER_INT_LV CH Interrupt priority level 14 RAPI_TIMER_INT_LV o Interrupt priority level 15 7tENESAS 4 46 Library Reference 4 4 2 2 Timer MTU2 __SetPWMPin Description 2 2 e Selectable parameters when RAPI_MTU2_0 RAPI_MTU2_3 or RAPI_MTU2_4 is specified Timer general register Specify one from RAPI_TGRA RAPI_TGRB RAPI_TGRC RAPI_TGRD Count output Specify one from RAPI_OUTPUT_RETAIN RAPILOUTPUT_0_0 RAPIOUTPUT_0_1 RAPILOUTPUT_0_TOG RAPI_OUTPUT_1_0 RAPLOUTPUT_1_1 RAPIOUTPUT_1_TOG The default value is RAPIOUTPUT_RETAIN Interrupt enable Specify one from RAPI_COMPARE_MATCH_ENA RAPI_COMPARE_MATCH_DIS The default value is RAPILCOMPARE_MATCH_DIS Interrupt priority level Specify one from RAPI_TIMER_INT_LV_0 RAPLTIMER_INT_LV_1 RAPI_TIMER_INT_LV_2 RAPI_TIMER_INT_LV_3 RAPI_TIMER_INT_LV_4 RAPI_TIMER_INT_LV_5 RAPI_TIMER_INT_LV_6 RAPI_TIMER_INT_LV_7 RAPI_TIMER_INT_LV_8 RAPI_TIMER_INT_LV_9 RAPI_TIMER_INT_LV_10 RAPLTIMER_INT_LV_11 RAPI_TIMER_INT_LV_12 RAPITIMER_INT_LV_13 RAPI_TIMER_INT_LV_14 RAPI_TIMER_INT_LV_15 The default value is RAPI_TIMER_INT_LV_0
145. n __StopSCIReceiving RAPI_COM1 0 break Interrupt routine for SCI reception void INT_SCIO_RX void 5 byte data reception if __PollingSCIReceiving RAPI_COM1 ErrorFlag RAPI_TRUE RAPI_FALSE Reception failure Figure 5 1 SCI Reception Example Aug 27 2008 7tENESAS A 5 1 Usage Example 5 5 1 Serial Communication Interface SCI 2 SCI Transmission Figure 5 2 shows the setting of SCI channel 0 for clock asynchronous mode and the SCI transmission of 5 byte data include rapi_sif_sh_7125 h unsigned char SendBuf 5 unsigned short SendNum unsigned short SpeedValue 25000000 32 38400 1 P clock Po 25 MHz Bit rate 38400 bit s unsigned short WaitTimerValue 30000 void INT_SCIO_TX void Main routine void func void Setting SCI channel 0 for clock asynchronous mode __CreateSCI RAPI_COM1 RAPI_SM_ASYNC RAPI_CKDIR_INT RAPI_BCSS_P1 RAPI_LSB_ SEL RAPI_8_BIT_LENGTH RAPI_STPB_1 RAPI_PARITY_ODD RAPI_MULTI_DIS RAPI_INT_TX_ENA RAPI_SCI_INT_LV_2 SpeedValue Setting transmit data size to 5 bytes and start up SCI transmission __ StartSCISending RAPI_COM1 SendBuf 5 amp SendNum while RAPI_TRUE if SendNum Il End of 5 byte data transmission __StopSCISending RAPI_COM1 WaitTimerValue break Interrupt routine for SCI transmission void INT_SCIO_TX voi
146. n TCLKD pin input for channel 0 or 2 RAPI_EXTER_TCLKA_3 External clock counts on TCLKA pin input for channel 3 or 4 RAPI_EXTER_TCLKB_3 External clock counts on TCLKB pin input for channel 3 or 4 RAPI_RISING EDGE Count at rising edge RAPI_FALLING_EDGE Count at falling edge RAPI_BOTH_EDGE Count at both edges Note When MP9 1 is specified for the count source count edge is fixed to rising edge RAPI TCNT CLEAR TGRA Clears TCNT by TGRA compare match RAPI_TCNT_CLEAR_TGRB Clears TCNT by TGRB compare match RAPI_TCNT_CLEAR_TGRC Clears TCNT by TGRC compare match RAPI_TCNT_CLEAR_TGRD Clears TCNT by TGRD compare match RAPI_TCNT_CLEAR_OTHER Clears TCNT by counter clearing during synchronously clearing operating for another channel RAPI_AD_START_REQ Enables generation of A D converter start requests by TGRA input capture compare match RAPI_NO_AD_START_REQ Disables generation of A D converter start requests by TGRA input capture compare match RAPI_TIMER_SYNC Synchronizes operation for channels 0 to 4 RAPI_TIMER_NO_SYNC Does not synchronize operation for channels 0 to 4 Aug 27 2008 REJ10J1906 0101 RENESAS ee 4 Description 2 3 Rev 1 01 Aug 27 2008 REJ10J1906 0101 Library Reference 4 2 2 Timer MTU2 __CreateOutputCompare Selectable parameters when RAPI_MTU2_0 is specif
147. ne from RAPI_EXTERNAL_TRIGGER_GO RAPI_TGRA_TCNT4_TRIGGER_GO RAPI_TGRA_MTU2_CHANNELO_GO RAPI_MTU2_TRG4AN_GO RAPILMTU2_TRG4BN_GO The default value is RAPIEXTERNAL_TRIGGER_GO Specify one from RAPI_AD_INT_ENA RAPI_AD_INT_DIS The default value is RAPI_AD_INT_DIS Specify one from RAPI_ADC_INT_LV_0 RAPI_ADC_INT_LV_1 RAPI_ADC_INT_LV_2 RAPI_ADC_INT_LV_3 RAPI_ADC_INT_LV_4 RAPI_ADC_INT_LV_5 RAPI_ADC_INT_LV_6 RAPI_ADC_INT_LV_7 RAPI_ADC_INT_LV_8 RAPI_ADC_INT_LV_9 RAPI_ADC_INT_LV_10 RAPI_ADC_INT_LV_11 RAPI_ADC_INT_LV_ 12 RAPI_ADC_INT_LV_13 RAPI_ADC_INT_LV_14 RAPI_ADC_INT_LV_15 The default value is RAPI_ADC_INT_LV_0 2tENESAS ae 4 Rev 1 01 Aug 27 2008 REJ10J1906 0101 Description 4 6 Library Reference 4 2 5 A D Converter __CreateADC Selectable parameters when 4 channel scan mode RAPI_4CHANNEL_SCAN is specified Analog input pin State control Clock select Scan setting Trigger enable Trigger source Interrupt enable Interrupt priority level Specify one from RAPI_ANO RAPI_ANO_AN1 RAPI_ANO_AN2 RAPI_ANO_AN3 RAPI_AN4 RAPI_AN4_AN5 RAPI_AN4_AN6 RAPI_AN4_AN7 The default value is RAPI_ANO for A D module 0 or RAPI_AN4 for A D module 1 Specify one from RAPI_50_STATES RAPI_64_STATES The default value is RAPI_50_STATES Specify one from RAPI_P_4 RAPI_P_3 RAPI_P_2 RAPI_P_1 The default value is RAPI_P_4 S
148. nics products or if you have any other inquiries Note 1 Renesas Electronics as used in this document means Renesas Electronics Corporation and also includes its majority owned subsidiaries Note 2 Renesas Electronics product s means any product developed or manufactured by or for Renesas Electronics tENESAS C 7 D me d lt D D Renesas Embedded Application Programming Interface User s Manual for SH Tiny Renesas Electronics Rev 1 01 2008 08 www renesas com 10 11 12 13 Notes regarding these materials This document is provided for reference purposes only so that Renesas customers may select the appropriate Renesas products for their use Renesas neither makes warranties or representations with respect to the accuracy or completeness of the information contained in this document nor grants any license to any intellectual property rights or any other rights of Renesas or any third party with respect to the information in this document Renesas shall have no liability for damages or infringement of any intellectual property or other rights arising out of the use of any information in this document including but not limited to product data diagrams charts programs algorithms and application circuit examples You should not use the products or the technology described in this document for the purpose of military applications such as the development of weapons of mass destruction
149. nterrupt DIVER aicina ineeie enee i a ai T aa 2 5 2 43 A D RE 26 3 Standard Type E 3 1 4 Library EE 4 1 4 1 API List by Peripheral Function mermernrnnriiniroroaiiine i ooa Onen EVE EEVEE COO N R EREA 4 1 AQ ET 4 3 4 2 1 Serial Communication Interface SCT 4 4 Fy Creates EE 4 4 Dy Ee E EE 4 7 St tat eege ei leegen leed eeh EE EE 4 8 4 StartSCISSndin E 4 9 5 StOPSCIRECEIVING j c55scsscccteisaadidasssosdnadsatnsenedenecsenced aces EA AE ON AKE AER AORTAE AAT EIA EEA RANE ANERER ENAIRE 4 10 Ver RN TEE 4 11 T POU SS CIRGCOIVING j2ssbseceessscssatanteeodassesssuadstagenaissdssntdathaendissesaned deg eebe Een 4 12 8 Polling SCISen dine ee ageticiseviaced ENEE EEN a ENE E V NEEE ENEE NENEN ANERE ASENA EEA 4 13 Oy EE E 4 14 10 Clear el ETC 4 15 11 JOUEPUTS CIS ere eessen EE Egeter 4 16 12 Ree CLK EEN 4 17 4 2 2 EICH RRE 4 18 We Create Wien 2 ee ee E Eet 4 18 2 EE Ke 4 26 SH Destroy Ee 4 27 Ay _ CreateBventCoumter EE 4 28 5 EnableEventCounter 0 ccccccccccssscccesseececeeseccecsnccceusesceceaaeecesssceeeuseececsaeecesseneeeessenceeeeaeecesseneeeeaas 4 35 6 __ _DestroyEventCounter 292 EENS ENEE ENEE ENEE ENEE Eed 4 36 CR x e NK GUM ten EE 4 37 8 lt e EA EEN 4 39 O SELPWIMPII ei ss Geier dE E S TA Na deer edd e SE N ETEEN 4 46 10 GOEN 4 49 11 Destroy PWM erien bn catesicatecdescadstesa tin A de satedhdaussgandesiaudasaaseaaatataccapedadetebhaadedaandadene
150. or for the purpose of any other military use When exporting the products or technology described herein you should follow the applicable export control laws and regulations and procedures required by such laws and regulations All information included in this document such as product data diagrams charts programs algorithms and application circuit examples is current as of the date this document is issued Such information however is subject to change without any prior notice Before purchasing or using any Renesas products listed in this document please confirm the latest product information with a Renesas sales office Also please pay regular and careful attention to additional and different information to be disclosed by Renesas such as that disclosed through our website http www renesas com Renesas has used reasonable care in compiling the information included in this document but Renesas assumes no liability whatsoever for any damages incurred as a result of errors or omissions in the information included in this document When using or otherwise relying on the information in this document you should evaluate the information in light of the total system before deciding about the applicability of such information to the intended application Renesas makes no representations warranties or guaranties regarding the suitability of its products for any particular application and specifically disclaims any liability arising out of the applica
151. ount edge is fixed to its default value Count clearing source Specify one from RAPI_LTCNT_CLEAR_TGRA RAPILTCNT_CLEAR_TGRB RAPI_TCNT_CLEAR_TGRC RAPL_TCNT_CLEAR_TGRD The default value is RAPI_TCNT_CLEAR_DIS A D converter start Specify one from RAPI_LAD_START_REQ request RAPI_NO_AD_START_REQ The default value is RAPINO_AD_START_REQ e Parameters when synchronous operation is specified When setting synchronous operation for any channels 0 to 4 specify RAPI_TIMER_SYNC When not setting synchronous operation each channel operates independently specify RAPI_TIMER_NO_SYNC The default value is RAPI_TIMER_NO_SYNC If the specification of timer is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Timer MTU2 output compare mode __CreatePWM If an undefined value is specified in the argument operation of the API cannot be guaranteed include rapi_timer_sh_7125 h Declaration of callback function void TimerIntFunc void void func void Setting MTU2 channel 0 for output compare mode _ CreateOutputCompare RAPI_MTU2_0 RAPI_MP_4 RAPI_FALLING_EDGE RAPI_TCNT_CLEAR_TGRA RAPI_TIMER_NO_SYNC Rev 1 01 Aug 27 2008 7rtENESAS 4 90 REJ10J1906 0101 4 28 SetOutputPin Synopsis Description 1 2 Rev 1 01 REJ10J1906 0101 Aug 27 2008 Library Reference 4 2 2 Timer MTU2 __SetOutputPin lt Setting of time
152. pecify one from RAPI_SINGLE_CYCLE RAPI_CONTINUOUS The default value is RAPI_LSINGLE_CYCLE Specify one from RAPI_TRIGGER_ENA RAPI_TRIGGER_DIS The default value is RAPI_TRIGGER_DIS Specify one from RAPI_EXTERNAL_TRIGGER_GO RAPI_TGRA_TCNT4_TRIGGER_GO RAPI_TGRA_MTU2_CHANNELO_GO RAPI_MTU2_TRG4AN RAPI_MTU2_TRG4BN_GO0 The default value is RAPLEXTERNAL_TRIGGER_GO Specify one from RAPI_AD_INT_ENA RAPI_AD_INT_DIS The default value is RAPI_AD_INT_DIS Specify one from RAPI_ADC_INT_LV_0 RAPI_ADC_INT_LV_1 RAPI_ADC_INT_LV_2 RAPI_ADC_INT_LV_3 RAPI_ADC_INT_LV_4 RAPI_ADC_INT_LV_5 RAPI_ADC_INT_LV_6 RAPI_ADC_INT_LV_7 RAPI_ADC_INT_LV_8 RAPI_ADC_INT_LV_9 RAPI_ADC_INT_LV_10 RAPI_ADC_INT_LV_11 RAPI_ADC_INT_LV_ 12 RAPI_ADC_INT_LV_13 RAPI_ADC_INT_LV_14 RAPI_ADC_INT_LV_15 The default value is RAPI_ADC_INT_LV_0 2tENESAS SC 4 Description 5 6 specified Analog input pin Note Library Reference 4 2 5 A D Converter __CreateADC Selectable parameters when 2 channel scan mode RAPI_L2CHANNEL_SCAN is Specify one from RAPI_ANO RAPI_ANO_AN1 RAPI_AN2 RAPI_AN2_AN3 RAPI_AN4 RAPI_AN4_AN5 RAPI_AN6 RAPI_AN6_AN7 The default value is RAPI_ANO for A D module 0 or RAPI_AN4 for A D module 1 When using trigger in 2 channel scan mode Trigger enable RAPI_TRIGGER_ENA the specification of analog input pin for group 1 RAPI_AN2 RAPI_AN2_AN3 RAPI_AN6 or RAPI
153. ple parameters at the same time use the symbol to separate each specified parameter Then settings of several timers can be cleared at the same time Return value Category Reference __CreatelnputCapture Remark Program example Rev 1 01 REJ10J1906 0101 Aug 27 2008 RAPI_MTU2_0 MTU2 channel 0 RAPI_MTU2_1 MTU2 channel 1 RAPI_MTU2_ 2 MTU2 channel 2 RAPI_MTU2_3 MTU2 channel 3 RAPI_MTU2_4 MTU2 channel 4 RAPI_MTU20 A MTU2 channels 0 to 4 RAPI_MTU2_5U MTU2 channel 5U RAPI_MTU2_5V MTU2 channel 5V RAPI_MTU2_5W MTU2 channel 5W RAPI_MTU2_5 MTU2 channels 5U 5V and 5W RAPI_MTU2_ALL All MTU2 channels If the specification of timer is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Timer MTU2 input capture mode EnablelnputCapture GetCaptureValue If an undefined value is specified in the argument operation of the API cannot be guaranteed include rapi_timer_sh_7125 h void func void Clearing settings of MTU2 channels 2 and 3 in input capture mode __DestroyInputCapture RAPI_MTU2_2 RAPI_MTU2_3 RENESAS i 4 Library Reference 4 2 2 Timer MTU2 __GetCaptureValue 26 GetCaptureValue Synopsis Description lt Acquisition of counter value in input capture mode gt Boolean GetCaptureValue unsigned long data1 unsigned short data2 data1 Setup dat
154. priority level 9 RAPI_SCI_INT_LV_10 Interrupt priority level 10 RAPI SCI INT LV 11 Interrupt priority level 11 RAPI_SCI_INT_LV_12 Interrupt priority level 12 RAPI_SCI_INT_LV_13 Interrupt priority level 13 RAPI SCI INT LV 14 Interrupt priority level 14 RAPI_SCI_INT_LV_15 Interrupt priority level 15 data2 For data2 set value N O lt N lt 255 of bit rate register SCBRR in the baud rate generator Aug 27 2008 RENESAS Fa 4 Return value Category Reference Remark Program example Library Reference 4 2 1 Serial Communication Interface SCI __CreateSCl If SCI communication is successful RAPI_TRUE is returned otherwise RAPI_FALSE is returned SCI none If an undefined value is specified in the first argument operation of the API cannot be guaranteed include rapi_sif_sh_7125 h void func void Setting SCI channel 0 for clock synchronous mode __CreateSCI RAPI_COM1 RAPI_SM_SYNC RAPI_CKDIR_INT RAPI_BCSS_P1 RAPI_LSB_SEL RAPI_INT_RX_ERR_ENA RAPI_INT_LV_6 20 E ey void func void Setting SCI channel 0 for clock asynchronous mode __CreateSCI RAPI_COM1 RAPI_SM_ASYNC RAPI_8_BIT_LENGTH RAPI_LSB_SEL RAPI_STPB_1 RAPI_CKDIR_INT RAPI_BCSS_P1 RAPI_PARITY_NON RAPI_MULTI_DIS RAPI_INT_RX_ERR_ENA RAPI_SCI_INT_LV_6 20 Rev 1 0
155. put capture RAP TCNT CLEAR TGRB Clears TCNT by TGRB input capture RAPI_TCNT_CLEAR_TGRC Clears TCNT by TGRC input capture RAPI TCNT CLEAR TGRD Clears TCNT by TGRD input capture RAPI_TCNT_CLEAR_TGRU Clears TCNT by TGRU input capture RAPI_TCNT_CLEAR_TGRV Clears TCNT by TGRV input capture RAPI TCNT CLEAR TGRW Clears TCNT by TGRW input capture 7tENESAS 4 63 Library Reference 4 4 2 2 Timer MTU2 _ CreatePulseWidthMeasurementMode Description 2 5 RAPI_OVERFLOW_ENA Enables overflow interrupt RAPI_OVERFLOW_DIS Disables overflow interrupt RAPI_AD_START_REQ Enables generation of A D converter start requests by TGRA input capture compare match RAPI_NO_AD_START_REQ Disables generation of A D converter start requests by TGRA input capture compare match RAPI_TIMER_INT_LV Interrupt priority level 0 RAPI_TIMER_INT_LV Interrupt priority level 1 RAPI_TIMER_INT_LV Interrupt priority level 2 RAPI_TIMER_INT_LV Interrupt priority level 3 RAPI_TIMER_INT_LV Interrupt priority level 4 RAPI_TIMER_INT_LV Interrupt priority level 5 RAPI_TIMER_INT_LV Interrupt priority level 6 RAPI_TIMER_INT_LV Interrupt priority level 7 RAPI_TIMER_INT_LV Interrupt priority level 8 CO N OO AA Go PO o RAPI_TIMER_INT_LV Interrupt priority level 9
156. put pins 0 to 3 RAPI_AN4_AN5 Analog input pins 4 and 5 RAPI_AN4_AN6 Analog input pins 4 to 6 RAPI_AN4_AN7 Analog input pins 4 to 7 RAPI_AN2_AN3 Analog input pins 2 and 3 RAPI_AN6_AN7 Analog input pins 6 and 7 RAPI_50_STATES State control Conversion time 50 states RAPI_64_STATES State control Conversion time 64 states RAPI_P_4 Po 4 clock RAPI_P_3 Po 3 clock RAPI_P_2 Po 2 clock RAPI_P_1 Po clock for Pd lt 25 MHz RAPI TRIGGER ENA Enables A D conversion triggering by ADTRG or MTU2 trigger RAPI_TRIGGER_DIS Disables A D conversion triggering by ADTRG or MTU2 trigger RAPI_ADF_SOURCE_OR When group 0 or group 1 trigger completed A D conversion the A D end flag ADF is set It is valid only when A D conversion triggering is enabled in 2 channel scan mode RAPI_ADF_SOURCE_AND When group O and group 1 triggers have completed A D conversion the ADF is set It is valid only when A D conversion triggering is enabled in 2 channel scan mode Note that the order of the triggers has no effect on the ADF setting 7tENESAS 4 111 4 Library Reference 4 2 5 A D Converter __CreateADC Description 2 6 RAPI_AD_INT ENA Enables A D interrupt Rev 1 01 Aug 27 2008 REJ10J1906 0101 RAPI_AD_INT_DIS Disables A D interrupt RAPI_EXTERNAL_TRIGGER_GO External trigger pin ADTRG input RAPI_TGRA_TCNT4_TRIGGE
157. r general register for output compare gt Boolean SetOutputPin unsigned long data1 unsigned short data2 void func data1 Setup data 1 data2 Setup data 2 func Pointer to callback function Sets the timer general register of the specified channel for output compare data1 For data1 set the following parameters To set multiple parameters at the same time use the symbol to separate each specified parameter RAPI_MTU2_0 MTU2 channel 0 RAPILMTU2_1 MTU2 channel 1 RAPIMTU2_ 2 MTU2 channel 2 RAPI_MTU2_3 MTU2 channel 3 RAPI_MTU2_4 MTU2 channel 4 RAPI_TGRA Timer General Register A RAPI_TGRB Timer General Register B RAPI_TGRC Timer General Register C RAPI_TGRD Timer General Register D RAPI_OUTPUT_RETAIN Output retained RAPI_OUTPUT_0_0 Initial output is 0 0 output at compare match RAPI_OUTPUT_0_1 Initial output is 0 1 output at compare match RAPI_OUTPUT_0_TOG Initial output is 0 toggle output at compare match RAPI_OUTPUT_1_0 Initial output is 1 0 output at compare match RAPI_OUTPUT_1_1 Initial output is 1 1 output at compare match RAPI_OUTPUT_1_TOG Initial output is 1 toggle output at compare match RAPI_COMPARE_MATCH_ENA Enables compare match interrupt RAPI_COMPARE_MATCH_DIS Disables compare match interrupt RAPI_TIMER_INT_LV Interrupt priority level 0 RAPI_TIMER_INT_LV Interr
158. raming and parity errors RAPI_ALL_FLAG All status flags of SCI If the specification of serial port is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned SCI __GetSClStatus If an undefined value is specified in the argument operation of the API cannot be guaranteed include rapi_sif_sh_7125 h void func void Clearing parity error flag for SCI channel 0 return __ClearSCIStatus RAPI_COM1 RAPI_PER Rev 1 01 Aug 27 2008 7tENESAS 4 15 REJ10J1906 0101 4 Library Reference 4 2 1 Serial Communication Interface SCI __OutputSClSck 11 OutputSClSck Synopsis Description Return value Category Reference Remark Program example lt Output control for SCK pin gt Boolean OutputSCiISck unsigned long data data Setup data Controls output of the SCK pin in clock asynchronous mode data For data set the following parameters To set multiple parameters at the same time use the symbol to separate each specified parameter RAPI_COM1 SCI channel 0 RAPI_COM2 SCI channel 1 RAPI_COM3 SCI channel 2 RAPI_SCK_OUTPUT Outputs clock with a frequency of 16 times of the bit rate RAPI_SCK_NO_OUTPUT Does not output the SPB1DT bit value in serial port register SCSPTR through the SCK pin RAPI_SCK_OUTPUT_L Outputs the SPB1DT bit value in serial port register SC
159. ration control for external interrupt 3 _ GetlnterruptAndPinInfo Acquisition of input pin level for external interrupt and the status of interrupt request 4 ClearinterruptFlag Clearing of status of interrupt request A D converter 1 CreateADC Setting of A D converter 2 __EnableADC Operation control for A D converter 3 TI DestroyADC Clearing of setting of A D converter 4 Ger t Acquisition of A D conversion result 5 _GetADCFlag Acquisition of A D converter status 6 _ClearADCFlag Clearing of A D converter status Rev 1 01 Aug 27 2008 REJ10J1906 0101 7rtENESAS 4 2 4 Library Reference 4 2 Description of Each API 4 2 Description of Each API This section describes each API and explains how to use them showing a program example for each The description of each API is divided into the following items Synopsis Description Return value Category Reference Remark Program example Rev 1 01 Aug 27 2008 REJ10J1906 0101 Summarizes processing by the API function and shows its format Then also gives a brief explanation of arguments Explains how to use the API function and shows assignable parameters separating each argument with argumenf Describes the returned value of the API function Indicates the category of the API function Indicates the API functions to be referred Describes notes to use the API function Represents how to use th
160. returned otherwise RAPI_TRUE is returned SCI __ClearSClStatus If an undefined value is specified in the first argument operation of the API cannot be guaranteed include rapi_sif_sh_7125 h unsigned char statusvalue void func void Acquisition of parity error flag for SCI channel 0 return __GetSCIStatus RAPI_COM1 RAPI_PER amp statusvalue 2tENESAS W 4 Library Reference 4 2 1 Serial Communication Interface SCI __ClearSClStatus 10 ClearSClStatus Synopsis Description Return value Category Reference Remark Program example lt Clearing of SCI status gt Boolean ClearSCiStatus unsigned long data data Setup data Clears status of SCI transmission reception data For data set the following parameters To set multiple parameters at the same time use the symbol to separate each specified parameter RAPI_COM1 SCI channel 0 RAPI_COM2 SCI channel 1 RAPI_COM3 SCI channel 2 RAPI_TDRE Transmit data register empty flag RAPI_RDRF Receive data register full flag RAPI_ORER Overrun error flag RAPI_FER Framing error flag RAPI_PER Parity error flag RAPI_TEND Transmit end flag RAPI_MPB Multiprocessor bit flag for reception RAPI_MPBT Multiprocessor bit flag for transmission RAPI_RECV_ERROR All receive error flags of SCI Overrun f
161. rol the status of the serial communication Rev 1 01 Aug 27 2008 AS 2 2 REJ10J1906 0101 RENES Driver 2 2 4 Timer Driver 2 4 Timer Driver The timer driver sets or clears the timer and controls timer operation It is also used to acquire counter values in 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 a compare match interrupt or an overflow interrupt occurs a preset callback function is called 2 4 2 Event Counter Mode In this mode the timer counts the external signal from an input pin or other counter s overflow underflow When a compare match interrupt an input capture interrupt or an overflow underflow interrupt occurs a preset callback function is called 2 4 3 Pulse Width Modulation Mode PWM Mode In this mode the timer outputs pulses in a given width successively When a compare match interrupt occurs a preset callback function is called 2 4 4 Pulse Period Measurement Mode In this mode the timer measures the pulse period of an external signal from an input pin When an input capture interrupt or an overflow interrupt occurs a preset callback function is called 2 4 5 Pulse Width Measurement Mode In this mode the timer measures the pulse width of an external signa
162. s returned Timer MTU2 pulse width measurement mode __DestroylnputCapture If an undefined value is specified in the argument operation of the API cannot be guaranteed include rapi_timer_sh_7125 h void func void Clearing setting of MTU2 channel 4 in pulse width measurement mode __DestroyPulseWidthMeasurementMode RAPI_MTU2_4 Rev 1 01 Aug 27 2008 7rtENESAS 4 73 REJ10J1906 0101 Library Reference 4 4 2 2 Timer MTU2 _ GetPulseWidthMeasurementMode 21 GetPulseWidthMeasurementMode Synopsis lt Acquisition of measured value in pulse width measurement mode gt Boolean GetPulseWidthMeasurementMode unsigned long data1 unsigned short data2 data1 Setup data 1 data2 Pointer to the buffer in which counter value is stored Description Acquires the counter value of the specified timer in pulse width measurement mode data1 For data1 set the following parameters To set multiple parameters at the same time use the symbol to separate each parameter Then several pins can be selected at the same time RAPI_MTU2_0 MTU2 channel 0 RAPI_MTU2_1 MTU2 channel 1 RAPI_MTU2_ 2 MTU2 channel 2 RAPI_MTU2_3 MTU2 channel 3 RAPI_MTU2_4 MTU2 channel 4 RAPI_MTU2_5U MTU2 channel 5U RAPI_MTU2_5V MTU2 channel 5V RAPI_MTU2_5W MTU2 channel 5W RAPI_TIOCA TIOCIA pin i 0 to 4 RAPI_TIOCB TIOCB pin i 0
163. s heads 4 50 12 Createbulse BenodMeasurementMode 4 51 13 __SetInputPenOd PiN arero serrera ee EEN EEE ENN EEES EENES EAS EEEREN ee Reese 4 57 Rev 1 01 Aug 27 2008 7rtENESAS i REJ10J1906 0101 14 _ EnablePulsePeriodMeasurementMode cccccseeccesccceecceessccucccuuscescsuuecceusseeucesuuseeccsueeceesseusess 4 60 15 __DestroyPulsePeriodMeasurementMode 00 0 ee ececeeeeeeeeeeeceeeceeeeeeeceeeeeeeeeeeeeeeeeeeeeeeeeeeseseseseeeeees 4 61 16 __GetPulsePeriodMeasurementMode ccscsssescececescesesescececeneasssseseececeaseeesesceeeeeseaaeaeseeeeeaeaaanseees 4 62 17 __CreatePulseWidthMeasurementMode ccccccccecessesssescececeneaueneseeceeeceaseaseeeceseseaeaaaaeseseeeaeaaenssees 4 63 18 SetInput Width E EE 4 69 19 PnablebulsewidthMeasurementMode 4 72 20 DestroyPulseWidthMeasurementMode ssssseseeeeessssseseersssssrsrrrersssssteersessssssteeesessssesteeeeeeseesssset 4 73 21 _ GetPulse WidthMeasurementMode cccsseccccceseececeeeeeceaseeeeceeeeeeecseeeeesseneeeeaeeeeeseeeeesseeeeeeaeesees 4 74 22 EN UE E 4 75 23 SetIniputCap ture EN 4 82 24 _ sEnableInputCaptute jisc s cccdisseageissata decsvvsigedeasencedas vets NENEN EER EEEE ENERET 4 85 25 Ken ba TR 4 86 26 EE 4 87 27 e RULLT 4 88 28 SOUPIR EE 4 91 29 EnableOutputCom pare ees ENEE d SNE e ESA Ieren eene 4 94 30 DestroyOutputCompare due EEN AANEREN EENS EENS de 4 95 31 GO
164. s pointer is not specified set RAPI_NULL Rev 1 01 Aug 27 2008 4 24 REJ10J1906 0101 RENESAS 4 Return value Category Reference Remark Program example Library Reference 4 2 2 Timer MTU2 __ CreateTimer If the specification of timer is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Timer MTU2 timer mode __EnableTimer DestroyTimer If an undefined value is specified in the first argument operation of the API cannot be guaranteed include rapi_timer_sh_7125 h Declaration of callback function void TimerIntFunc void void func void Setting MTU2 channel 0 for timer mode __ CreateTimer RAPI_MTU2_0 RAPI_MP16 RAPI_PERIODIC RAPI_RISING_EDGE RAPI_TCNT_CLEAR_TGRA RAPI_OUTPUT_O_TOG RAPI_NO_AD_ START_REQ RAPI_COMPARE MATCH ENA RAPI_TIMER_INT_LV_5 0x8000 TimerIntFunc Rev 1 01 Aug 27 2008 7rtENESAS 4 25 REJ10J1906 0101 4 2 __EnableTimer Synopsis Description Return value Category Reference Remark Program example Rev 1 01 Aug 27 2008 REJ10J1906 0101 Library Reference 4 2 2 Timer MTU2 __EnableTimer lt Operation control for timer mode gt Boolean EnableTimer unsigned long data data Setup data Controls start stop operation of the specified timer in timer mod
165. set the following parameters To set multiple parameters at the same time use the symbol to separate each specified parameter Rev 1 01 Aug 27 2008 REJ10J1906 0101 Sets the specified timer in pulse period measurement mode RAPL MTU2 0 MTU2 channel 0 RAPL MTU2_1 MTU2 channel 1 RAPLMTU2 2 MTU2 channel 2 RAPL MTU2 3 MTU2 channel 3 RAPL MTU2 A MTU2 channel 4 RAPL MTU2_5U MTU2 channel 5U RAPL MTU2_5V MTU2 channel 5V RAPLMTU2_5W MTU2 channel 5W RAPIMP_1 Internal clock counts on MP 9 1 HAD MP A Internal clock counts on MPAA RAPIMP_16 Internal clock counts on MP9 16 HAD MP GA Internal clock counts on MPAGA RAPI_MP_256_1 Internal clock counts on MP9 256 for channel 1 RAPI_MP_256 34 Internal clock counts on MP 9 256 for channel 3 or 4 RAPI_MP_1024 2 Internal clock counts on MP 1024 for channel 2 RAPI_MP_1024_34 Internal clock counts on MP for channel 3 or 4 1024 RAPI_RISING_EDGE Counts at rising edge RAPI_FALLING_EDGE Counts at falling edge RAPI_BOTH EDGE Counts at both edges Note When MP9 1 is specified for the count source count edge is fixed to rising edge RAPI_AD_START_REQ Enables generation of A D converter start requests by TGRA input capture compare match RAPI_NO_AD_START_REQ Disables generation of A D converter start requests by TGRA input capture compare match RAP
166. sion by polling 9 _GetSClStatus Acquisition of SCI status 10 _ ClearSClStatus Clearing of SCI status 11 _ OutputSClSck Output control for SCK pin 12 _ OutputSCITxd Output control for TXD pin Timer 1 CreateTimer Setting for timer mode 2 __EnableTimer Operation control for timer mode 3 __DestroyTimer Clearing of setting for timer mode 4 _CreateEventCounter Setting for event counter mode 5 _EnableEventCounter Operation control for event counter mode 6 DestroyEventCounter Clearing of setting for event counter mode 7 __GetTimerCounter Acquisition of counter value in timer mode or event counter mode 8 _CreatePWM Setting for pulse width modulation mode 9 SetPWMPin Setting of timer general register for pulse width modulation 10 _ EnablePWM Operation control for pulse width modulation mode 11 DestroyPWM Clearing of setting for pulse width modulation mode 12 _CreatePulsePeriodMeasurementMode Setting for pulse period measurement mode 13 _ SetlnputPeriodPin Setting of input pin for pulse period measurement 14 EnablePulsePeriodMeasurementMode Operation control for pulse period measurement mode 15 _ DestroyPulsePeriodMeasurementMode Clearing of setting for pulse period measurement mode 16 GetPulsePeriodMeasurementMode Acquisition of measured value in pulse period measurement mode 17 CreatePulseWidthMeasurementMode Setting for pulse width measurement mode 18 SetlnputWidthPin Setting of input pin for pulse wi
167. specified timer to input capture mode data1 For data1 set the following parameters To set multiple parameters at the same time use the symbol to separate each specified parameter RAPI_MTU2_0 MTU2 channel 0 RAPI_MTU2_1 MTU2 channel 1 RAPI_MTU2_2 MTU2 channel 2 RAPI_MTU2_3 MTU2 channel 3 RAPI_MTU2_4 MTU2 channel 4 RAPI_MTU2_5U MTU2 channel 5U RAPI_MTU2_5V MTU2 channel 5V RAPI_MTU2_5W MTU2 channel 5W RAPI_MP_1 Internal clock counts on MP 9 1 HAD MP A Internal clock counts on MPAA RAPI_MP_16 Internal clock counts on MP9 16 RAPI_MP_64 Internal clock counts on MP4 64 RAPI_MP_256_1 Internal clock counts on MP 256 for channel 1 RAPI_MP_256 34 Internal clock counts on MP 9 256 for channel 3 or 4 RAPI_MP_1024 2 Internal clock counts on MP9 1024 for channel 2 RAPIMP_1024 34 Internal clock counts on MP 9 1024 for channel 3 or 4 RAPI_EXTER_TCLKA_0O External clock counts on TCLKA pin input for channel 0 to 2 RAPI EXTER_TCLKB_0 External clock counts on TCLKB pin input for channel 0 to 2 RAPI EXTER_TCLKC_0 External clock counts on TCLKC pin input for channel 0 or 2 RAPI EXTER_TCLKD_0 External clock counts on TCLKD pin input for channel 0 or 2 RAPI EXTER_TCLKA_3 External clock counts on TCLKA pin input for channel 3 or 4 RAPI EXTER_TCLKB_3 External clock counts on TCLKB pin inpu
168. t for channel 3 or 4 RAPI_RISING_EDGE Counts at rising edge RAPI_FALLING_EDGE Counts at falling edge RAPI_BOTH_ EDGE Counts at both edges Notes When MP 1 is specified for the count source count edge is fixed to rising edge Aug 27 2008 REJ10J1906 0101 RENESAS Aara 4 Library Reference 4 2 2 Timer MTU2 __GetPulseWidthMeasurementMode Description 2 6 RAPI_TCNT_CLEAR_DIS Disables TCNT clearing Rev 1 01 Aug 27 2008 REJ10J1906 0101 RAPI TCNT CLEAR TGRA Clears TCNT by TGRA input capture RAPI TCNT CLEAR TGRB Clears TCNT by TGRB input capture RAPI_TCNT CLEAR TGRC Clears TCNT by TGRC input capture RAPI_TCNT_CLEAR_TGRD Clears TCNT by TGRD input capture RAPILTCNT CLEAR _TGRU Clears TCNT by TGRU input capture RAPI_TCNT CLEAR _TGRV Clears TCNT by TGRV input capture RAPI TCNT CLEAR TGRW Clears TCNT by TGRW input capture RAPI TCNT CLEAR OTHER Clears TCNT by counter clearing during synchronously clearing operating for another channel RAPI_OVERFLOW_ENA Enables overflow interrupt RAPI OVERFLOW DIS Disables overflow interrupt RAPI_AD_START_REQ Enables generation of A D converter start requests by TGRA input capture compare match RAPI NO_AD_START_REQ Disables generation of A D converter start requests by TGRA input capture compare match
169. ted hereby under any patents copyrights or other intellectual property rights of Renesas Electronics or others You should not alter modify copy or otherwise misappropriate any Renesas Electronics product whether in whole or in part Descriptions of circuits software and other related information in this document are provided only to illustrate the operation of semiconductor products and application examples You are fully responsible for the incorporation of these circuits software and information in the design of your equipment Renesas Electronics assumes no responsibility for any losses incurred by you or third parties arising from the use of these circuits software or information When exporting the products or technology described in this document you should comply with the applicable export control laws and regulations and follow the procedures required by such laws and regulations You should not use Renesas Electronics products or the technology described in this document for any purpose relating to military applications or use by the military including but not limited to the development of weapons of mass destruction Renesas Electronics products and technology may not be used for or incorporated into any products or systems whose manufacture use or sale is prohibited under any applicable domestic or foreign laws or regulations Renesas Electronics has used reasonable care in preparing the information included in this document but
170. ter TGR func1 For func1 specify a pointer to callback function This callback function is for compare match interrupt or overflow interrupt in normal event counter mode If not specifying the callback function set RAPI_NULL func2 For func2 specify a pointer to callback function This callback function is for underflow interrupt in phase counting mode If this pointer is not specified set RAPI_NULL If the specification of timer is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Timer MTU2 event counter mode __EnableEventCounter _ DestroyEventCounter __GetTimerCounter If an undefined value is specified in the first argument operation of the API cannot be guaranteed include rapi_timer_sh_7125 h Declaration of callback function void TimerIntFunc void void func void Setting MTU2 channel 0 for event counter mode __CreateEventCounter RAPI_MTU2_0 RAPI_EXTER_TCLKA_0O RAPI_PERIODIC RAPI_RISING_EDGE RAPI_TCNT_CLEAR_TGRA RAPI_OUTPUT_RETAIN RAPI_COMPARE_MATCH_ENA RAPI_TIMER_INT_LV_5 0x8000 TimerIntFunc RAPI_NULL Rev 1 01 Aug 27 2008 7tENESAS 4 34 REJ10J1906 0101 4 Library Reference 4 2 2 Timer MTU2 ___EnableEventCounter 5 __EnableEventCounter Synopsis Description Return value Category Reference Remark Program example
171. tion and use of the information in this document or Renesas products With the exception of products specified by Renesas as suitable for automobile applications Renesas products are not designed manufactured or tested for applications or otherwise in systems the failure or malfunction of which may cause a direct threat to human life or create a risk of human injury or which require especially high quality and reliability such as safety systems or equipment or systems for transportation and traffic healthcare combustion control aerospace and aeronautics nuclear power or undersea communication transmission If you are considering the use of our products for such purposes please contact a Renesas sales office beforehand Renesas shall have no liability for damages arising out of the uses set forth above Notwithstanding the preceding paragraph you should not use Renesas products for the purposes listed below 1 artificial life support devices or systems 2 surgical implantations 3 healthcare intervention e g excision administration of medication etc 4 any other purposes that pose a direct threat to human life Renesas shall have no liability for damages arising out of the uses set forth in the above and purchasers who elect to use Renesas products in any of the foregoing applications shall indemnify and hold harmless Renesas Technology Corp its affiliated companies and their officers directors and employees against any and all dam
172. unter value of the specified timer in pulse period measurement mode Return value Category Reference Remark Program example Rev 1 01 REJ10J1906 0101 Aug 27 2008 RAPI_MTU2_0 MTU2 channel 0 RAPI MTU2 1 MTU2 channel 1 RAPI MTU2 2 MTU2 channel 2 RAPI MTU2 3 MTU2 channel 3 RAPI MTU2 4 MTU2 channel 4 RAPI_MTU2_5U MTU2 channel 5 RAPI_MTU2_5V MTU2 channel 5V RAPI_MTU2_5W MTU2 channel SW RAPI_TIOCA TIOGIA pin i 0 to 4 RAPI_TIOCB TIOCB pin 0 to 4 RAPI_TIOCC TIOGIC pin i 0 3 or 4 RAPI_TIOCD TIOCDD pin i 0 3 or 4 If the specification of timer is invalid RAPI_FALSE is returned otherwise RAPI_TRUE is returned Timer MTU2 pulse period measurement mode __GetCaptureValue If an undefined value is specified in the first argument operation of the API cannot be guaranteed include rapi_timer_sh_7125 h void func void unsigned short data 2 Acquisition of measured values of TGRA and TGRB for MTU2 channel 4 in pulse period measurement mode __GetPulsePeriodMeasurementMode RAPI_MTU2_4 RAPI_TIOCA RAPI_TIOCB data RENESAS Tos 4 17 Synopsis 4 2 2 Timer __CreatePulseWidthMeasurementMode MTU2 lt Setting for pulse width measurement mode gt Library Reference __CreatePulseWidthMeasurementMode Boolean CreatePulseWidthMeasurementMode unsigned long data vo
173. upt priority level 1 RAPI_TIMER_INT_LV Interrupt priority level 2 RAPI_TIMER_INT_LV Interrupt priority level 3 RAPI_TIMER_INT_LV Interrupt priority level 4 RAPI_TIMER_INT_LV Interrupt priority level 5 RAPI_TIMER_INT_LV Interrupt priority level 6 RAPI_TIMER_INT_LV Interrupt priority level 7 RAPI_TIMER_INT_LV Interrupt priority level 8 CO NI O O01 A Go PO o RAPI_TIMER_INT_LV Interrupt priority level 9 RAPI_TIMER_INT_LV e CH Interrupt priority level 10 RAPI_TIMER_INT_LV i i Interrupt priority level 11 RAPI_TIMER_INT_LV n ine Interrupt priority level 12 RAPI_TIMER_INT_LV e oo Interrupt priority level 13 RAPI_TIMER_INT_LV CH Interrupt priority level 14 RAPI_TIMER_INT_LV o Interrupt priority level 15 RENESAS ool A Library Reference 4 2 2 Timer MTU2 __ SetOutputPin Description 2 2 e Selectable parameters when RAPI_MTU2_0 RAPI_MTU2_3 or RAPI_MTU2_4 is specified Timer general register Specify one from RAPI_LTGRA RAPI_TGRB RAPI_TGRC RAPI_TGRD Count output Specify one from RAPI_OUTPUT_RETAIN RAPI_OUTPUT_0_0 RAPI_LOUTPUT_0_1 RAPI_OUTPUT_0_TOG RAPI_OUTPUT_1_0 RAPI_OUTPUT_1_1 RAPILOUTPUT_1_TOG The default value is RAPI_OUTPUT_RETAIN Interrupt enable Specify one from RAPI_COMPARE_MATCH_ENA
174. wing RAPI_CKDIR_INT Internal clock SCK pin used for input pin CKE 1 0 00 SCK pin used for clock ouput in clock synchronous mode RAPI_CKDIR_EXT External clock SCK pin used for clock input CKE 1 0 10 The input clock frequency is 16 times of the bit rate in clock asynchronous mode and synchronous clock input in clock synchronous mode e Stop bit length in clock asynchronous mode Choose one from the following RAPI_STPB_1 One stop bit RAPI_STPB 2 Two stop bits Note Do not set these parameters in clock synchronous mode e Clock source of the on chip baud rate generator Choose one from the following RAPI _BCSS_P1 Po clock RAPI_BCSS_P4 DA clock RAPIL BCSS P16 P 16 clock DAP BCSS P64 P 64 clock Rev 1 01 Aug 27 2008 7tENESAS 4 4 REJ10J1906 0101 4 Description 2 2 4 2 1 Library Reference Serial Communication Interface SCI __CreateSCl Parity mode in clock asynchronous mode Choose one from the following Rev 1 01 REJ10J1906 0101 Note e Note e Note RAPI_PARITY_NON No parity bit RAPI_PARITY_EVEN Even parity bit RAPI_PARITY_ODD Odd parity bit This setting is invalid in multiprocessor mode e Do not set these parameters in clock synchronous mode Multiprocessor mode in clock asynchronous mode enable disable Choose one from the following RAPI_MULTI_ENA

Download Pdf Manuals

image

Related Search

Related Contents

Manuale istruzioni  Manual del producto Ranurado y torneado  Forensic DNA Fingerprinting Kit Instruction Manual  "取扱説明書"  User Manual  取扱説明書  AE Series Convection Reflow Ovens  Manual: CAN plugin card ISA/XT, passiv  CAMÉRA RÉSEAU  Fournisseur: A.Y.P  

Copyright © All rights reserved.
Failed to retrieve file