Peripheral Driver Generator V.2.09 Reference Manual (RX62T Group)
User’s Manual
RX62T Group
Peripheral Driver Generator
Reference Manual
All information contained in these materials, including products and product specifications, represents
information on the product at the time of publication and is subject to change by Renesas Electronics
Corporation without notice. Please review the latest information published by Renesas Electronics
Corporation through various means, including the Renesas Electronics Corporation website
(http://www.renesas.com).
Rev.1.03 May 2014
RX62T Group Peripheral Driver Generator Reference Manual
Introduction
Introduction
This manual was written to explain how to make the peripheral I/O drivers on the Peripheral Driver Generator
for RX62T. For the basic information about the Peripheral Driver Generator, refer to the Peripheral Driver
Generator user’s manual.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 3 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Table of Contents
Table of Contents
Introduction ..................................................................................................................................................................... 3
Table of Contents ............................................................................................................................................................ 4
1.
Overview .............................................................................................................................................................. 10
1.1
Supported peripheral modules .................................................................................................................... 10
1.2
Tool requirements ....................................................................................................................................... 11
2.
Creating a new project .......................................................................................................................................... 12
3.
Setting Up the Peripheral Modules ....................................................................................................................... 13
4.
5.
3.1
Main Window ............................................................................................................................................. 13
3.2
Pin Functions .............................................................................................................................................. 14
3.2.1
[Pin function] Sheet ................................................................................................................................ 14
3.2.2
[Peripheral pin usage] Sheet ................................................................................................................... 15
Tutorial ................................................................................................................................................................. 17
4.1
An LED blinking on a Compare Match Timer (CMT) interrupt ................................................................ 18
4.2
An LED blinking on the PWM output of the multi-function timer pulse unit 3 (MTU3) ........................... 29
4.3
Continuously scanning on10-Bit A/D converter (ADA)............................................................................. 35
4.4
Triggering DTC by IRQ.............................................................................................................................. 41
4.5
Data transfer between SCIb channels 0 and 2 ............................................................................................. 47
Specification of Generated Functions ................................................................................................................... 54
5.1
Clock-Generation Circuit ............................................................................................................................ 60
5.1.1
R_PG_Clock_Set .................................................................................................................................... 60
5.1.2
R_PG_Clock_GetMainClockStatus ....................................................................................................... 61
5.2
Voltage Detection Circuit (LVD) ............................................................................................................... 62
5.2.1
R_PG_LVD_Set ..................................................................................................................................... 62
5.2.2
R_PG_LVD_GetLVDDetectionFlag ...................................................................................................... 63
5.3
Low Power Consumption ........................................................................................................................... 64
5.3.1
R_PG_LPC_Set ...................................................................................................................................... 64
5.3.2
R_PG_LPC_Sleep .................................................................................................................................. 65
5.3.3
R_PG_LPC_AllModuleClockStop ......................................................................................................... 66
5.3.4
R_PG_LPC_SoftwareStandby................................................................................................................ 67
5.3.5
R_PG_LPC_DeepSoftwareStandby ....................................................................................................... 68
5.3.6
R_PG_LPC_IOPortRelease .................................................................................................................... 69
5.3.7
R_PG_LPC_GetPowerOnResetFlag ...................................................................................................... 70
5.3.8
R_PG_LPC_GetLVDDetectionFlag....................................................................................................... 71
5.3.9
R_PG_LPC_GetDeepSoftwareStandbyResetFlag.................................................................................. 72
5.3.10
R_PD_LPC_GetDeepSoftwareStandbyCancelFlag ............................................................................... 73
5.3.11
R_PG_LPC_GetStatus............................................................................................................................ 74
5.3.12
R_PG_LPC_WriteBackup ...................................................................................................................... 75
5.3.13
R_PG_LPC_ReadBackup ....................................................................................................................... 76
5.4
Interrupt Controller (ICU)........................................................................................................................... 77
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 4 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Table of Contents
5.4.1
R_PG_ExtInterrupt_Set_<interrupt type> ............................................................................................. 77
5.4.2
R_PG_ExtInterrupt_Disable_<interrupt type> ...................................................................................... 79
5.4.3
R_PG_ExtInterrupt_GetRequestFlag_<interrupt type> ........................................................................ 80
5.4.4
R_PG_ExtInterrupt_ClearRequestFlag_<interrupt type> ..................................................................... 81
5.4.5
R_PG_SoftwareInterrupt_Set ................................................................................................................. 82
5.4.6
R_PG_SoftwareInterrupt_Generate ........................................................................................................ 83
5.4.7
R_PG_FastInterrupt_Set ......................................................................................................................... 84
5.4.8
R_PG_Exception_Set ............................................................................................................................. 85
5.5
Buses ........................................................................................................................................................... 86
5.5.1
R_PG_ExtBus_SetBus ........................................................................................................................... 86
5.5.2
R_PG_ExtBus_GetErrorStatus ............................................................................................................... 87
5.5.3
R_PG_ExtBus_ClearErrorFlags ............................................................................................................. 88
5.6
Data Transfer Controller (DTC) ................................................................................................................. 89
5.6.1
R_PG_DTC_Set ..................................................................................................................................... 89
5.6.2
R_PG_DTC_Set_<trigger source> ......................................................................................................... 90
5.6.3
R_PG_DTC_Activate ............................................................................................................................. 91
5.6.4
R_PG_DTC_SuspendTransfer ............................................................................................................... 92
5.6.5
R_PG_DTC_GetTransmitStatus............................................................................................................. 93
5.6.6
R_PG_DTC_StopModule ....................................................................................................................... 94
5.7
I/O Ports ...................................................................................................................................................... 95
5.7.1
R_PG_IO_PORT_Set_P<port number>................................................................................................ 95
5.7.2
R_PG_IO_PORT_Set_P<port number><pin number> ........................................................................ 96
5.7.3
R_PG_IO_PORT_Read_P<port number> ............................................................................................ 97
5.7.4
R_PG_IO_PORT_Read_P<port number><pin number> ..................................................................... 98
5.7.5
R_PG_IO_PORT_Write_P<port number>............................................................................................ 99
5.7.6
R_PG_IO_PORT_Write_P<port number><pin number> .................................................................. 100
5.8
Multi-Function Timer Pulse Unit 3 (MTU3) ............................................................................................ 101
5.8.1
R_PG_Timer_Set_MTU_U<unit number>_<channels> .................................................................... 101
5.8.2
R_PG_Timer_StartCount_MTU_U<unit number>_C<channel number>(_<phase>) ...................... 103
5.8.3
R_PG_Timer_SynchronouslyStartCount_MTU_U<unit number> ..................................................... 104
5.8.4
R_PG_Timer_HaltCount_MTU_U<unit number>_C<channel number>(_<phase>) ....................... 105
5.8.5
R_PG_Timer_GetCounterValue_MTU_U<unit number>_C<channel number>............................... 106
5.8.6
R_PG_Timer_SetCounterValue_MTU_U<unit number>_C<channel number>(_<phase>) ............ 107
5.8.7
R_PG_Timer_GetRequestFlag_MTU_U<unit number>_C<channel number> ................................. 108
5.8.8
R_PG_Timer_StopModule_MTU_U<unit number>........................................................................... 110
5.8.9
R_PG_Timer_GetTGR_MTU_U<unit number>_C<channel number> ............................................. 111
5.8.10
R_PG_Timer_SetTGR_<general register>_MTU_U<unit number>_C<channel number> ............. 113
5.8.11
R_PG_Timer_SetBuffer_AD_MTU_U<unit number>_C<channel number> ................................... 114
5.8.12
R_PG_Timer_SetBuffer_CycleData_MTU_U<unit number>_<channels>....................................... 115
5.8.13
R_PG_Timer_SetOutputPhaseSwitch_MTU_U<unit number>_<channels> .................................... 116
5.8.14
R_PG_Timer_ControlOutputPin_MTU_U<unit number>_<channels> ............................................ 117
5.8.15
R_PG_Timer_SetBuffer_PWMOutputLevel_MTU_U<unit number>_<channels> .......................... 118
5.8.16
R_PG_Timer_ControlBufferTransfer_MTU_U<unit number>_<channels> ..................................... 119
5.9
5.9.1
Port Output Enable 3 (POE3).................................................................................................................... 120
R_PG_POE_Set.................................................................................................................................... 120
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 5 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Table of Contents
5.9.2
R_PG_POE_SetHiZ_<Timer channels> ............................................................................................. 121
5.9.3
R_PG_POE_GetRequestFlagHiZ_<Timer channels> ......................................................................... 122
5.9.4
R_PG_POE_GetShortFlag_<Timer channels> ................................................................................... 123
5.9.5
R_PG_POE_ClearFlag_<Timer channels> ......................................................................................... 124
5.10
General PWM Timer (GPT) ..................................................................................................................... 125
5.10.1
R_PG_Timer_Set_GPT_U<unit number> .......................................................................................... 125
5.10.2
R_PG_Timer_Set_GPT_U<unit number>_C<channel number> ....................................................... 126
5.10.3
R_PG_Timer_StartCount_GPT_U<unit number>_C<channel number> ........................................... 127
5.10.4
R_PG_Timer_SynchronouslyStartCount_GPT_U<unit number>....................................................... 128
5.10.5
R_PG_Timer_HaltCount_GPT_U<unit number>_C<channel number> ........................................... 129
5.10.6
R_PG_Timer_SynchronouslyHaltCount_GPT_U<unit number> ....................................................... 130
5.10.7
R_PG_Timer_SetGTCCR_<GTCCR>_GPT_U<unit number>_C<channel number> ..................... 131
5.10.8
R_PG_Timer_GetGTCCR_GPT_U<unit number>_C<channel number> ......................................... 132
5.10.9
R_PG_Timer_SetCounterValue_GPT_U<unit number>_C<channel number>................................. 133
5.10.10 R_PG_Timer_GetCounterValue_GPT_U<unit number>_C<channel number> ................................ 134
5.10.11 R_PG_Timer_SynchronouslyClearCounter_GPT_U<unit number> .................................................. 135
5.10.12 R_PG_Timer_SetCycle_GPT_U<unit number>_C<channel number>.............................................. 136
5.10.13 R_PG_Timer_SetBuffer_Cycle_GPT_U<unit number>_C<channel number> ................................. 137
5.10.14 R_PG_Timer_SetDoubleBuffer_Cycle_GPT_U<unit number>_C<channel number>...................... 138
5.10.15 R_PG_Timer_SetAD_GPT_U<unit number>_C<channel number> ................................................. 139
5.10.16 R_PG_Timer_SetBuffer_AD_GPT_U<unit number>_C<channel number> ..................................... 140
5.10.17 R_PG_Timer_SetDoubleBuffer_AD_GPT_U<unit number>_C<channel number> ......................... 141
5.10.18 R_PG_Timer_SetBuffer_GTDV<U/D>_GPT_U<unit number>_C<channel number> .................... 142
5.10.19 R_PG_Timer_GetRequestFlag_GPT_U<unit number>_C<channel number> .................................. 143
5.10.20 R_PG_Timer_GetRequestFlag_GPT_U<unit number> ...................................................................... 144
5.10.21 R_PG_Timer_GetCounterStatus_GPT_U<unit number>_C<channel number> ................................ 145
5.10.22 R_PG_Timer_BufferEnable_GPT_U<unit number>_C<channel number>....................................... 146
5.10.23 R_PG_Timer_BufferDisable_GPT_U<unit number>_C<channel number> ..................................... 147
5.10.24 R_PG_Timer_Buffer_Force_GPT_U<unit number>_C<channel number>....................................... 148
5.10.25 R_PG_Timer_CountDirection_Down_GPT_U<unit number>_C<channel number>........................ 149
5.10.26 R_PG_Timer_CountDirection_Up_GPT_U<unit number>_C<channel number> ............................ 150
5.10.27 R_PG_Timer_SoftwareNegate_GPT_U<unit number>_C<channel number> .................................. 151
5.10.28 R_PG_Timer_StartCount_LOCO_GPT_U<unit number>.................................................................. 152
5.10.29 R_PG_Timer_HaltCount_LOCO_GPT_U<unit number> .................................................................. 153
5.10.30 R_PG_Timer_ClearCounter_LOCO_GPT_U<unit number> ............................................................. 154
5.10.31 R_PG_Timer_InitialiseCountResultValue_LOCO_GPT_U<unit number>........................................ 155
5.10.32 R_PG_Timer_GetCounterValue_LOCO_GPT_U<unit number> ....................................................... 156
5.10.33 R_PG_Timer_GetCounterAverageValue_LOCO_GPT_U<unit number> ......................................... 157
5.10.34 R_PG_Timer_GetCountResultValue_LOCO_GPT_U<unit number> ................................................ 158
5.10.35 R_PG_Timer_SetPermissibleDeviation_LOCO_GPT_U<unit number>............................................ 159
5.10.36 R_PG_Timer_StopModule_GPT_U<unit number> ............................................................................ 160
5.11
Compare Match Timer (CMT).................................................................................................................. 161
5.11.1
R_PG_Timer_Start_CMT_U<unit number>_C<channel number> ................................................... 161
5.11.2
R_PG_Timer_HaltCount_CMT<unit number>_C<channel number> ............................................... 162
5.11.3
R_PG_Timer_ResumeCount_CMT_U<unit number>_C<channel number> .................................... 163
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 6 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Table of Contents
5.11.4
R_PG_Timer_GetCounterValue_CMT_U<unit number>_C<channel number> ............................... 164
5.11.5
R_PG_Timer_SetCounterValue_CMT_U<unit number>_C<channel number> ............................... 165
5.11.6
R_PG_Timer_StopModule_CMT_U<unit number> ........................................................................... 166
5.12
Watchdog Timer (WDT)........................................................................................................................... 167
5.12.1
R_PG_Timer_Start_WDT .................................................................................................................... 167
5.12.2
R_PG_Timer_HaltCount_WDT ........................................................................................................... 168
5.12.3
R_PG_Timer_ResetCounter_WDT ...................................................................................................... 169
5.12.4
R_PG_Timer_ClearOverflowFlag_WDT ............................................................................................. 170
5.13
Independent Watchdog Timer (IWDT)..................................................................................................... 171
5.13.1
R_PG_Timer_Set_IWDT ..................................................................................................................... 171
5.13.2
R_PG_Timer_RefreshCounter_IWDT ................................................................................................. 172
5.13.3
R_PG_Timer_GetCounterValue_IWDT .............................................................................................. 173
5.13.4
R_PG_Timer_ClearUnderflowFlag_IWDT ......................................................................................... 174
5.14
Serial Communications Interface (SCIb) .................................................................................................. 175
5.14.1
R_PG_SCI_Set_C<channel number> .................................................................................................. 175
5.14.2
R_PG_SCI_StartSending_C<channel number> .................................................................................. 176
5.14.3
R_PG_SCI_SendAllData_C<channel number> .................................................................................. 178
5.14.4
R_PG_SCI_GetSentDataCount_C<channel number> ........................................................................ 179
5.14.5
R_PG_SCI_StartReceiving_C<channel number> ............................................................................... 180
5.14.6
R_PG_SCI_ReceiveAllData_C<channel number> ............................................................................. 182
5.14.7
R_PG_SCI_StopCommunication_C<channel number>...................................................................... 183
5.14.8
R_PG_SCI_GetReceivedDataCount_C<channel number> ................................................................. 184
5.14.9
R_PG_SCI_GetReceptionErrorFlag_C<channel number> ................................................................. 185
5.14.10 R_PG_SCI_GetTransmitStatus_C<channel number>......................................................................... 186
5.14.11 R_PG_SCI_SendTargetStationID_C<channel number> ..................................................................... 187
5.14.12 R_PG_SCI_ReceiveStationID_C<channel number> .......................................................................... 188
5.14.13 R_PG_SCI_StopModule_C<channel number> ................................................................................... 189
5.15
CRC Calculator (CRC) ............................................................................................................................. 190
5.15.1
R_PG_CRC_Set ................................................................................................................................... 190
5.15.2
R_PG_CRC_InputData ........................................................................................................................ 191
5.15.3
R_PG_CRC_GetResult ........................................................................................................................ 192
5.15.4
R_PG_CRC_StopModule ..................................................................................................................... 193
5.16
I2C Bus Interface (RIIC) .......................................................................................................................... 194
5.16.1
R_PG_I2C_Set_C<channel number>.................................................................................................. 194
5.16.2
R_PG_I2C_MasterReceive_C<channel number> ............................................................................... 195
5.16.3
R_PG_I2C_MasterReceiveLast_C<channel number> ........................................................................ 197
5.16.4
R_PG_I2C_MasterSend_C<channel number>.................................................................................... 199
5.16.5
R_PG_I2C_MasterSendWithoutStop_C<channel number> ............................................................... 201
5.16.6
R_PG_I2C_GenerateStopCondition_C<channel number> ................................................................. 203
5.16.7
R_PG_I2C_GetBusState_C<channel number> ................................................................................... 204
5.16.8
R_PG_I2C_SlaveMonitor_C<channel number> ................................................................................. 205
5.16.9
R_PG_I2C_SlaveSend_C<channel number> ...................................................................................... 207
5.16.10 R_PG_I2C_GetDetectedAddress_C<channel number> ...................................................................... 208
5.16.11 R_PG_I2C_GetTR_C<channel number> ............................................................................................ 209
5.16.12 R_PG_I2C_GetEvent_C<channel number>........................................................................................ 210
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 7 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Table of Contents
5.16.13 R_PG_I2C_GetReceivedDataCount_C<channel number> ................................................................. 211
5.16.14 R_PG_I2C_GetSentDataCount_C<channel number>......................................................................... 212
5.16.15 R_PG_I2C_Reset_C<channel number> .............................................................................................. 213
5.16.16 R_PG_I2C_StopModule_C<channel number> ................................................................................... 214
5.17
Serial Peripheral Interface (RSPI)............................................................................................................. 215
5.17.1
R_PG_RSPI_Set_C<channel number>................................................................................................ 215
5.17.2
R_PG_RSPI_SetCommand_C<channel number>............................................................................... 216
5.17.3
R_PG_RSPI_StartTransfer_C<channel number> ............................................................................... 217
5.17.4
R_PG_RSPI_TransferAllData_C<channel number> .......................................................................... 219
5.17.5
R_PG_RSPI_GetStatus_C<channel number> ..................................................................................... 221
5.17.6
R_PG_RSPI_GetError_C<channel number> ...................................................................................... 222
5.17.7
R_PG_RSPI_GetCommandStatus_C<channel number> .................................................................... 223
5.17.8
R_PG_RSPI_StopModule_C<channel number>................................................................................. 224
5.17.9
R_PG_RSPI_LoopBack<loopback mode>_C<channel number> ...................................................... 225
5.18
LIN Module (LIN) .................................................................................................................................... 226
5.18.1
R_PG_LIN_Set_LIN<channel number> ............................................................................................. 226
5.18.2
R_PG_LIN_Transmit_LIN<channel number>.................................................................................... 227
5.18.3
R_PG_LIN_Receive_LIN<channel number> ..................................................................................... 229
5.18.4
R_PG_LIN_ReadData_LIN<channel number> .................................................................................. 231
5.18.5
R_PG_LIN_EnterResetMode_LIN<channel number> ....................................................................... 232
5.18.6
R_PG_LIN_EnterOperationMode_LIN<channel number> ................................................................ 233
5.18.7
R_PG_LIN_EnterWakeUpMode_LIN<channel number> .................................................................. 234
5.18.8
R_PG_LIN_WakeUpTransmit_LIN<channel number>...................................................................... 235
5.18.9
R_PG_LIN_WakeUpReceive_LIN<channel number> ....................................................................... 236
5.18.10 R_PG_LIN_GetCheckSum_LIN<channel number> ........................................................................... 237
5.18.11 R_PG_LIN_EnterSelfTestMode_LIN<channel number> ................................................................... 238
5.18.12 R_PG_LIN_WriteCheckSum_LIN<channel number>........................................................................ 240
5.18.13 R_PG_LIN_GetMode_LIN<channel number> ................................................................................... 242
5.18.14 R_PG_LIN_GetStatus_LIN<channel number>................................................................................... 243
5.18.15 R_PG_LIN_GetErrorStatus_LIN<channel number> .......................................................................... 244
5.18.16 R_PG_LIN_StopModule_LIN<channel number> .............................................................................. 246
5.19
12-Bit A/D Converter (S12ADA) ............................................................................................................. 247
5.19.1
R_PG_ADC_12_Set_S12ADA<unit number> ................................................................................... 247
5.19.2
R_PG_ADC_12_Set ............................................................................................................................. 248
5.19.3
R_PG_ADC_12_StartConversionSW_S12ADA<unit number> ......................................................... 249
5.19.4
R_PG_ADC_12_StopConversion_S12ADA<unit number> ............................................................... 250
5.19.5
R_PG_ADC_12_GetResult_S12ADA<unit number> ......................................................................... 251
5.19.6
R_PG_ADC_12_StopModule_S12ADA<unit number> ..................................................................... 253
5.20
10-Bit A/D Converter (ADA) ................................................................................................................... 254
5.20.1
R_PG_ADC_10_Set_AD<unit number> ............................................................................................ 254
5.20.2
R_PG_ADC_10_StartConversionSW_AD<unit number> .................................................................. 255
5.20.3
R_PG_ADC_10_StopConversion_AD<unit number> ........................................................................ 256
5.20.4
R_PG_ADC_10_GetResult_AD<unit number> .................................................................................. 257
5.20.5
R_PG_ADC_10_SetSelfDiag_VREF_<voltage>_AD<unit number> ............................................... 258
5.20.6
R_PG_ADC_10_StopModule_AD<unit number> .............................................................................. 259
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 8 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.21
6.
Table of Contents
Notes on Notification Functions ............................................................................................................... 260
5.21.1
Interrupts and processor mode .............................................................................................................. 260
5.21.2
Interrupts and DSP instructions ............................................................................................................ 260
Registering Files with the HEW or CubeSuite+ and Building Them ................................................................. 261
Appendix 1. Pin Functions for which the Allocation Can be Changed ....................................................................... 263
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 9 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Overview
1. Overview
1.1
Supported peripheral modules
The Peripheral Driver Generator supports the following products of RX62T group, peripheral modules and
endian.
(1)
Products
Part No.
R5F562TAADFH
R5F562TAADFP
R5F562TAADFF
R5F562TAADFM
R5F562TAADFK
R5F562T7ADFH
R5F562T7ADFP
R5F562T7ADFF
R5F562T7ADFM
R5F562T7ADFK
R5F562T6ADFF
R5F562T6ADFM
R5F562T6ADFK
R5F562TABDFH
R5F562TABDFP
R5F562TABDFF
R5F562TABDFM
R5F562TABDFK
R5F562T7BDFH
R5F562T7BDFP
R5F562T7BDFF
R5F562T7BDFM
R5F562T7BDFK
R5F562T6BDFF
R5F562T6BDFM
R5F562T6BDFK
(2)
Package
PLQP0112JA-A
PLQP0100KB-A
PLQP0080JA-A
PLQP0064KB-A
PLQP0064GA-A
PLQP0112JA-A
PLQP0100KB-A
PLQP0080JA-A
PLQP0064KB-A
PLQP0064GA-A
PLQP0080JA-A
PLQP0064KB-A
PLQP0064GA-A
PLQP0112JA-A
PLQP0100KB-A
PLQP0080JA-A
PLQP0064KB-A
PLQP0064GA-A
PLQP0112JA-A
PLQP0100KB-A
PLQP0080JA-A
PLQP0064KB-A
PLQP0064GA-A
PLQP0080JA-A
PLQP0064KB-A
PLQP0064GA-A
Part No.
R5F562TADDFH
R5F562TADDFP
R5F562TADDFF
R5F562TADDFM
R5F562TADDFK
R5F562T7DDFH
R5F562T7DDFP
R5F562T7DDFF
R5F562T7DDFM
R5F562T7DDFK
R5F562T6DDFF
R5F562T6DDFM
R5F562T6DDFK
R5F562TAEDFH
R5F562TAEDFP
R5F562TAEDFF
R5F562TAEDFM
R5F562TAEDFK
R5F562T7EDFH
R5F562T7EDFP
R5F562T7EDFF
R5F562T7EDFM
R5F562T7EDFK
R5F562T6EDFF
R5F562T6EDFM
R5F562T6EDFK
Package
PLQP0112JA-A
PLQP0100KB-A
PLQP0080JA-A
PLQP0064KB-A
PLQP0064GA-A
PLQP0112JA-A
PLQP0100KB-A
PLQP0080JA-A
PLQP0064KB-A
PLQP0064GA-A
PLQP0080JA-A
PLQP0064KB-A
PLQP0064GA-A
PLQP0112JA-A
PLQP0100KB-A
PLQP0080JA-A
PLQP0064KB-A
PLQP0064GA-A
PLQP0112JA-A
PLQP0100KB-A
PLQP0080JA-A
PLQP0064KB-A
PLQP0064GA-A
PLQP0080JA-A
PLQP0064KB-A
PLQP0064GA-A
Peripheral Modules
Voltage Detection Circuit (LVD)
Clock Generation Circuit
Low Power Consumption
Interrupt Control Unit (ICU), Exceptions
Buses
*Illegal address access detection
Data Transfer Controller (DTC)
I/O Ports
Multi-Function Timer Pulse Unit 3 (MTU3)
Port Output Enable 3 (POE3)
General PWM Timer (GPT)
Compare Match Timer (CMT)
Watchdog Timer (WDT)
Independent Watchdog Timer (IWDT)
Serial Communications Interface (SCIb)
CRC Calculator (CRC)
I2C Bus Interface (RIIC)
Serial Peripheral Interface (RSPI)
LIN Module (LIN)
12-Bit A/D Converter (S12ADA)
10-Bit A/D Converter (ADA)
The CAN module is not supported.
The self-diagnostic function and the comparator in 12-Bit A/D converter (S12ADA) are not supported.
(3)
Endian
Little endian / Big endian
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 10 of 270
RX62T Group Peripheral Driver Generator Reference Manual
1.2
Overview
Tool requirements
The following tools are required for this version of RX62T group Peripheral Driver Generator.
- RX Family C/C++ Compiler Package
V.1.02 Release 01
- RX62G/RX62T Group Renesas Peripheral Driver Library V.1.10
(Bundled in Peripheral Driver Generator)
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 11 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Creating a new project
2. Creating a new project
To create the new project file, select the menu [File] -> [New Project]. New project dialog box will open.
Fig 2.1 New project dialog box
For RX62T group, select [RX600] as a series and select [RX62T] as a group. The package type, ROM capacity
and RAM capacity of selected product are displayed.
By clicking [OK], new project is created and opened.
The EXTAL input clock frequency is not set after opening a new project. Therefore an error icon is displayed.
For error display, refer to the user’s manual.
Fig 2.2 Error display of new project
Set the frequency of the lock to be used here.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 12 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Setting Up the Peripheral Modules
3. Setting Up the Peripheral Modules
3.1
Main Window
Figure 3.1 shows the main window for setting up peripheral modules.
Resource pane
Peripheral-module selection tabs
Figure 3.1
Display in the Main Window (Example)
Table 3.1 shows the correspondence between the peripheral-module selection tabs, items in the resource pane,
and peripheral modules to be set up.
Table 3.1
Peripheral-Module Selection Tabs, Items in the Resource Pane, and Peripheral Modules
Tab
Resource pane
Corresponding Peripheral Module or Function
SYSTEM
Clock Generation Circuit
Pin
Clock Generation Circuit
Pinfunctions
LVD
LPC
LVD
Low Power Consumption
LVD1 and 2
Low Power Consumption Functions
ICU
Interrupts
Interrupt Control Unit (ICU)
(Fastinterrupt, Software Interrupt, External Interrupt (NMI, IRQ0 to IRQ7) )
Buses
Exceptions
Bus Error Monitoring
Exceptions
Bus Error Monitoring (Illegal address access detection)
DTC
I/O
DTC
Port 0 to Port G
Data Transfer Controller (DTC)
I/O Port 0 to G
MTU3
POE3
MTU3_0 to MTU3_7
POE3
Multi-Function Timer Pulse Unit 3 (MTU3) Channel 0 to 7
Port Output Enable 3 (POE3)
GPT
CMT
GPT0 to GPT3
Unit0 (CMT0 and CMT1)
General PWM Timer (GPT) Channel 0 to 3
Compare Match Timer (CMT) Unit 0 (Channlel 0 and 1)
WDT
Unit1 (CMT2 and CMT3)
WDT
Compare Match Timer (CMT) Unit 1 (Channlel 2 and 3)
Watchdog Timer
IWDT
SCIb
IWDT
SCI0 to SCI2
Independent Watchdog Timer
Serial Communications Interface (SCIb) Channel 0 to 2
CRC
RIIC
CRC
RIIC0
CRC Calculator (CRC)
I2C Bus Interface (RIIC) Channel 0
RSPI
LIN
RSPI0
LIN0
Serial Peripheral Interface (RSPI) Channel 0
LIN Module (LIN) Channel 0
S12ADA
ADA
S12ADA0 and S12ADA1
ADA0
12-Bit A/D Converter (S12ADA) Unit 0 and 1
10-Bit A/D Converter (ADA) Unit 0
For how to set up the peripheral modules, refer to the user’s manual. For details on the setting of pin functions,
refer to section 3.2, Pin Functions.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 13 of 270
RX62T Group Peripheral Driver Generator Reference Manual
3.2
Setting Up the Peripheral Modules
Pin Functions
Select the [SYSTEM] tab from the peripheral-module selection tabs and click on [Pin] in the resource pane
to open the pin-function pane.
Figure 3.2 Opening the Pin-Function Pane
The pin-function pane has [Pin function] and [Peripheral pin usage] sheets.
3.2.1
[Pin function] Sheet
The [Pin function] sheet shows all of the MCU pins in order.
Figure 3.3 Pin-Function Pane ([Pin function] Sheet)
The contents of each column are shown in table 3.2.
Table 3.2
Columns on the [Pin function] Sheet
Column
Description
Pin No.
Pin number
Pin name
Name of the pin (which shows all of the functions assigned to that pin)
Selected function
Pin function for the selected peripheral module
Direction
Input or output
State
Current state
When a peripheral module associated with input to or output from pins has been set up, the current setting
is shown on the [Pin function] sheet. In 112-pin LQFP package, if you have set A/D converter AD0 in the
detailed settings pane up so that the input on analog input pin AN0 will be converted, for example, the [Pin
function] sheet shows the setting of pin 86 (P60/AN0) as follows.
Figre 3.4
R20UT0681EJ0103
May 16, 2014
Display of selected pin function
Rev.1.03
Page 14 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Setting Up the Peripheral Modules
Setting up I/O port P60 in this state will cause a conflict between P60 and AN0 and a warning message will
be output as shown in figure 3.5.
Figre 3.5
Confliction between Pin Functions
Notes
•
Pin-by-pin designation of pin functions for RX62T-group MCUs is not possible because the
settings of peripheral modules automatically determine the pin functions. The assigned pin
functions also cannot be changed in this pane.
•
The allocations of some pin functions, however, can be changed on the [Peripheral pin usage]
sheet.
•
If two or more output functions are enabled on a single pin, the pin only outputs the signal of the
function with the highest priority. For details, refer to the hardware manual.
3.2.2
[Peripheral pin usage] Sheet
The [Peripheral pin usage] sheet shows which pins are used by the corresponding peripheral module. The
pin functions specific to the peripheral module selected in the left section are listed in the right section.
Figure 3.6 Pin-Function Pane ([Peripheral pin usage] Sheet)
Table 3.3 lists the columns on the [Peripheral pin usage] sheet.
Table 3.3
Columns on the [Peripheral pin usage] Sheet
Column
Contents
Pin Name
Names of pins used by the peripheral module selected in the left section
Pin Function
Pin function
Assignment
Full name of the MCU pin, showing all of the functions assigned to that pin
Pin No.
Pin number
Direction
Input or output
State
Current state
When a peripheral module associated with input to or output from pins has been set up, the current setting
is shown on the [Peripheral pin usage] sheet. In 112-pin LQFP package, if you have set external interrupt
IRQ0 in the detailed settings pane up, for example, the [Peripheral pin usage] sheet shows the setting of pin
IRQ0 as follows.
Figre 3.7
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Display of a Pin Function (Example)
Page 15 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Setting Up the Peripheral Modules
Then setting up I/O port P10, which uses the same pin as IRQ0, will cause a conflict between P10 and
IRQ0 and a warning message will be output as shown in figure 3.8.
Figure 3.8 Confliction between pin functions
Other pins to which IRQ0 can be assigned are selectable from a drop-down list box. Placing the mouse
pointer on the [Assignment] column brings up a drop-down button.
Figure 3.9 Drop-Down Button
Click on the drop-down button and select one of the options displayed in the list box.
Figure 3.10 Changing the Allocation of a Pin Function
If IRQ0 is assigned to PE5/IRQ0 and that pin is not being used by any other peripheral module, the conflict
between P10 and IRQ0 can be resolved.
Figure 3.11 Display after Changing the Allocation
The pin functions for which you can select the assignment are listed in appendix 1, Pin Functions for which
the Allocation Can be Changed.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 16 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Tutorial
4. Tutorial
This section introduces the usage of the Peripheral Driver Generator by giving instructions on how to use the
Peripheral Driver Generator and HEW to create a tutorial program that implements the following operations on
the Renesas Starter Kit board for the RX62T.
•
An LED blinking on a Compare Match Timer (CMT) interrupt
•
An LED blinking on the PWM output of the multi-function timer pulse unit 3 (MTU3)
•
Continuously scanning on 10-Bit A/D converter (ADA)
•
Triggering DTC by IRQ
•
Data transfer between SCIb channels 0 and 2
The labels given below respectively indicate operations to take place in the Peripheral Driver Generator and in
the HEW.
PDG
: Operations in the Peripheral Driver Generator
HEW
: Operations in the HEW
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 17 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Tutorial
4.1 An LED blinking on a Compare Match Timer (CMT) interrupt
The LED3 on RSK board is connected to P33. In this tutorial, Compare Match Timer and I/O port will be set
up to blink this LED as follows.
The LED3 turns on when the output from P33 is 0, and turns off when the output is 1.
- Turn on the LED
at compare match
(odd number of times)
- Turn off the LED
LED3
at compare match
(even number of times)
even number of times
even number of times
CMT counter value
odd number
of times
even number
of times
odd number
of times
even number
of times
0.5 [s]
t
LED ON
R20UT0681EJ0103
May 16, 2014
Rev.1.03
LED OFF
LED ON
LED OFF
Page 18 of 270
RX62T Group Peripheral Driver Generator Reference Manual
(1)
Making the Peripheral Driver Generator project
Tutorial
PDG
1. Start the Peripheral Driver Generator.
2. Select [File]->[New Project] menu.
3. Specify "rx62t_demo1" as the project name.
Set the CPU type as follows.
Series : RX600
Group : RX62T
Type : R5F562TAADFP
Note: If another type of chip is mounted on your RSK board, select corresponding CPU type.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 19 of 270
RX62T Group Peripheral Driver Generator Reference Manual
(2)
Initial state
Tutorial
PDG
-The clock setting window opens and the error icons are displayed in the initial state.
Clock setting window
Place the mouse pointer on the error icon, then the contents of error is displayed.
There are 3 types of icons in Peripheral Driver Generator
Error
The setting is not allowed.
The source filese cannot be generated if there is an error setting.
Warning
The setting is possible but may be wrong.
Source files can be generated.
Information
Additional information for the complex setting.
Only icons on the setting window can display the tooltip.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 20 of 270
RX62T Group Peripheral Driver Generator Reference Manual
(3)
Tutorial
PDG
Clock setting
1. It is necessary to set the main (EXTAL) clock frequency first.
External clock frequency of the RSK board is 12.5 MHz. Input “12.5” into the edit box.
2. PCLK is used in 12.5 MHz.
Select the multiplication "EXTAL x 1" to set the PCLK to 12.5 MHz.
1
2
(4)
PDG
I/O Port setting
The LED3 on RSK is connected to P33 so set P33 to output port.
1. Select “I/O” tab
2. Select “Port 3”
3. Check “Pn3”
4. Select “Output”
2
3
4
1
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 21 of 270
RX62T Group Peripheral Driver Generator Reference Manual
(5)
Tutorial
PDG
CMT setting-1
In this tutorial, CMT0 is used.
1. Select "CMT" tab
2. Select "CMT0"
3. Check "Use this channel"
2
3
1
(6)
CMT setting-2
PDG
Set the other items as follows.
-Count source: Internal clock(PCLK/512)
-Interrupt operating period: 500 msec
Compare match values are
automatically calculated
(7)
CMT setting-3
PDG
Set the interrupt notification functions.
This functions are called when the interrupt occurs.
-Check “Use compare match interrupt (CMIn)”
Notification function name is "Cmt0IntFunc"
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 22 of 270
RX62T Group Peripheral Driver Generator Reference Manual
(8)
Generating source files
1. To generate source files, click
Tutorial
PDG
on the tool bar.
2. Save confirmation dialog box is displayed. Click [OK].
3. Click [OK] on the message box.
4. Generated functions are listed in lower panel.
By double clicking the line of function, source file can be opened.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 23 of 270
RX62T Group Peripheral Driver Generator Reference Manual
(9)
Preparing the HEW project
Tutorial
HEW
Start the HEW and make RX62T workspace.
Project Types: Application
Workspace Name: rx62t_demo1
CPU type : RX62T
Endian : Little
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 24 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Tutorial
Specify the target emulator.
Project is complete
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 25 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Tutorial
(10) Adding the generated source files to the HEW project
1. To add source files to HEW, click
on the tool bar.
PDG
2. Click [OK] on the confirmation dialog box.
3. This is a linkage setting of RPDL library.
When using multiple lib files, linkage order can be set in this dialog box.
4. Source files are added to HEW.
HEW
Added source files are put in
"AddFromPDG" folder.
Source files are registered via HEW Target Server.
Make sure that the HEW Target Server has been set up before executing
registration.
For details, refer Peripheral Driver Generator user’s manual.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 26 of 270
RX62T Group Peripheral Driver Generator Reference Manual
(11) Making the program on HEW
Tutorial
HEW
By changing the part of “main” function, make the following program on HEW.
//Include "R_PG_<project name>.h"
#include "R_PG_rx62t_demo1.h"
bool led=false;
void main(void)
{
//Set up the clock
R_PG_Clock_Set();
//Set up port P33
R_PG_IO_PORT_Write_P33(1); // Initial output value
R_PG_IO_PORT_Set_P33();
//Set up CMT0 and start count
R_PG_Timer_Start_CMT_U0_C0();
while(1);
}
// Compare match interrupt notification function
void Cmt0IntFunc(void)
{
if( led ){
//Turn off the LED
R_PG_IO_PORT_Write_P33(1);
led = false;
}
else{
//Turn on the LED
R_PG_IO_PORT_Write_P33(0);
led = true;
}
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 27 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Tutorial
HEW
(12) Connecting to the emulator, building the program and executing
1. Before connecting the emulator, make sure that J7(MDE) on RSK board is “OPEN” to
set CPU to little endian.
J7(MDE)
OPEN
2. Connect to the emulator
Connect button
3. Just by clicking [Build] button, program can be built because RPDL library and include
directory are automatically registered in build setting.
Build button
Note: When using RX Family C/C++ compiler package V.1.01 or later, the error message
may be output in building the program. For details, refer to section 6.(5).
4. Download the program
5. Execute the program and see the LED on RSK board.
Reset go button
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 28 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Tutorial
4.2 An LED blinking on the PWM output of the multi-function timer pulse unit 3 (MTU3)
The LED3 on RSK board is connected to P33. This port can also be used as PWM output pin (MTIOC3A) of
the multi-function timer pulse unit 3. In this tutorial, the multi-function timer pulse unit 3 will be set up to
operate in PWM mode 1 and the PWM output will blink the LED3 as follows.
Note : If there is a switch that enables/disables P33(MTIOC3A) on the RSK board, enable it.
The LED3 turns on when the output from P33 is 0, and turns off when the output is 1.
LED3
The MTU3 channel 3 (MTU3_3) will be operated in PWM mode 1. In PWM mode 1, the output signal is
controlled by compare match A and B.
Operation of the timer to be set
- Output 0 at compare match B -> LED turns on
- Output 1 at compare match A -> LED turns off
- Clear the counter at compare match A (Intervals of 0.3 sec)
Counter value
Compare match A
(Counter clear)
Compare match A
(Counter clear)
Compare match B
Compare match B
0.3 Sec
t
MTIOC3A
Output waveform
LED OFF
LED OFF
LED ON
R20UT0681EJ0103
May 16, 2014
Rev.1.03
LED ON
Page 29 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Tutorial
PDG
(1)
Making the Peripheral Driver Generator project
Make the new Peripheral Driver Generator project
“rx62t_demo2”. For details on how to make the new
Peripheral Driver Generator project, refer to section
4.1(1), Making the Peripheral Driver Generator project.
Set the CPU type as follows.
Series : RX600
Group : RX62T
Type : R5F562TAADFP
Note: If another type of chip is mounted on your
RSK board, select corresponding CPU type.
(2)
PDG
Clock setting
1. The clock setting window opens and the error icons are displayed in the initial state. For icons such as
and
displayed on window, refer to section 4.1(2), Initial state.
2. External clock frequency of the RSK board is 12.5 MHz. Input “12.5” into the edit box.
3. PCLK is used in 12.5 MHz. Select the multiplication "EXTAL * 1" to set the PCLK to 12.5 MHz.
1
2
3
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 30 of 270
RX62T Group Peripheral Driver Generator Reference Manual
(3)
Tutorial
PDG
MTU3 setting-1
Opening MTU3 channel 3(MTU3_3) setting window
1. Select "MTU3" tab.
2. Select "MTU3_3” on tree view.
3. Check “Use this channel”.
2
3
1
(4)
MTU3 setting-2
PDG
Select “PWM mode 1” for the operation mode.
Explanation of selected mode
(5)
MTU3 setting-3
PDG
The counter setting is as follows.
1. Select "TGRA compare match (use TGRA as a cycle register)" for a counter clearing source.
2. Select "ICLK/1024 (system clock/1024)” for a count source.
3. Set timer operation period to “300 msec”.
1
2
3
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 31 of 270
RX62T Group Peripheral Driver Generator Reference Manual
(6)
MTU3 setting-4
Tutorial
PDG
General register setting is as follows.
1. The TGRA is selected as a counter clearing source in the counter setting. Then the TGRA value is
calculated from the count source frequency and the timer operating period.
2. Select "Initial output of MTIOCnA pin is high: High output at compare match” for TGRA output
compare operation.
3. Set TGRB initial value to “6000”.
4. Select "Low output from MTIOCnA pin at compare match” for TGRB output compare operation.
5. The MTIOCnC output is not used in this tutorial. Select “MTIOCnC pin output is disabled” for TGRD
output compare operation.
1
3
2
4
5
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 32 of 270
RX62T Group Peripheral Driver Generator Reference Manual
(7)
MTU3 setting-5
Tutorial
PDG
The compare match timing and the output waveform are displayed in a diagram.
(8)
Generating source files
To generate source files, click
PDG
on the tool bar. For details on generating source files, refer to section
4.1(8), Generating source files.
(9)
Preparing the HEW project
HEW
Start the HEW and make RX62T workspace. For details on making HEW project, refer to section 4.1(9),
Preparing the HEW project.
(10) Adding the generated source files to the HEW project
To add the generated source files to HEW, click
PDG
on the tool bar. For details on adding the source
files to HEW project, refer to section 4.1(10), Adding the generated source files to the HEW project.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 33 of 270
RX62T Group Peripheral Driver Generator Reference Manual
(11) Making the program on HEW
Tutorial
HEW
By changing the part of “main” function, make the following program on HEW.
//Include "R_PG_<project name>.h"
#include "R_PG_rx62t_demo2.h"
void main(void)
{
//Set up the clock
R_PG_Clock_Set();
//Set up MTU3 Channel 3
R_PG_Timer_Set_MTU_U0_C3();
//Start the count of MTU3 Channel 3
R_PG_Timer_StartCount_MTU_U0_C3();
while(1);
}
(12) Connecting to the emulator, building the program and executing
HEW
Execute the program and see the LED blinking on RSK board. For details on connecting to the emulator,
building the program, and executing the program, refer to section 4.1(12), connecting to the emulator,
building the program and executing.
Note: When using RX Family C/C++ compiler package V.1.01 or later, the error message
may be output in building the program. For details, refer to section 6.(5).
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 34 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Tutorial
4.3 Continuously scanning on10-Bit A/D converter (ADA)
In RX62T RSK board, the potentiometer is connected to AN0 analog input. In this tutorial, the 10-Bit A/D
converter (ADA) will be set up to execute A/D conversion continuously. And the result of A/D conversion will
be monitored on HEW.
Potentiometer
Note : If there is a switch that enables/disables P05 on the RSK board, enable it.
(1)
Making the Peripheral Driver Generator project
PDG
Make the new Peripheral Driver Generator project
“rx62t_demo3”. For details on how to make the new
Peripheral Driver Generator project, refer to section
4.1(1), Making the Peripheral Driver Generator project.
Set the CPU type as follows.
Series : RX600
Group : RX62T
Type : R5F562TAADFP
Note: If another type of chip is mounted on your
RSK board, select corresponding CPU type.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 35 of 270
RX62T Group Peripheral Driver Generator Reference Manual
(2)
Tutorial
PDG
Clock setting
1. The clock setting window opens and the error icons are displayed in the initial state. For icons such as
and
displayed on window, refer to section 4.1(2), Initial state.
2. External clock frequency of the RSK board is 12.5 MHz. Input “12.5” into the edit box.
3. PCLK is used in 12.5 MHz. Select the multiplication "EXTAL x 1" to set the PCLK to 12.5 MHz
1
2
3
(3)
A/D converter setting-1
PDG
Select “ADA” tab and click ADA0 on tree view.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 36 of 270
RX62T Group Peripheral Driver Generator Reference Manual
(4)
A/D converter setting-2
Tutorial
PDG
Make the following setting for ADA0.
1. Check "Use this unit".
2. Select "Continuous scan mode" for the operation mode.
3. Select "AN0" for the analog input channel.
4. Select "Software trigger only" for the conversion start trigger.
5. Select "Internal clock (PCLK/2)" for the conversion clock.
6. Set the sampling state register value to 25.
7. Check "Use A/D conversion end interrupt (ADI0)".
8. Set A/D conversion end interrupt notification function name to "Ad0IntFunc".
1
2
3
4
5
6
7
8
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 37 of 270
RX62T Group Peripheral Driver Generator Reference Manual
(5)
Checking the pin usage
Tutorial
PDG
- It is possible to check the usage of pins on the pin function windows
1. After setting up the ADA0, select “SYSTEM” tab and click “Pin” on the tree view.
2. On the Pin function window, you can see that No.77 pin is used as AN0.
- State of pin usage for each peripheral module is displayed in the Peripheral Pin Usage Window
Select Peripheral pin usage sheet and click ADA0 to check the usage of AN0 pin.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 38 of 270
RX62T Group Peripheral Driver Generator Reference Manual
(6)
Generating source files
To generate source files, click
Tutorial
PDG
on the tool bar. For details on generating source files, refer to section
4.1(8), Generating source files.
(7)
Preparing the HEW project
HEW
Start the HEW and make RX62T workspace. For details on making HEW project, refer to section 4.1(9),
Preparing the HEW project.
(8)
PDG
Adding the generated source files to the HEW project
To add the generated source files to HEW, click
on the tool bar. For details on adding the source
files to HEW project, refer to section 4.1(10), Adding the generated source files to the HEW project.
(9)
Making the program on HEW
HEW
By changing the part of “main” function, make the following program on HEW.
//Include "R_PG_<project name>.h"
#include "R_PG_rx62t_demo3.h"
void main(void)
{
//Set up the clock
R_PG_Clock_Set();
//Set up ADA0
R_PG_ADC_10_Set_AD0();
//Start A/D conversion
R_PG_ADC_10_StartConversionSW_AD0();
while(1);
}
// Variable to store the result
uint16_t result;
// A/D conversion end interrupt notification function
void Ad0IntFunc(void)
{
// Get the result of conversion
R_PG_ADC_10_GetResult_AD0(&result);
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 39 of 270
RX62T Group Peripheral Driver Generator Reference Manual
(10) Connecting to the emulator, building the program and downloading
Tutorial
HEW
Buid the program and download it. For details on connecting to the emulator, building the program, and
downloading refer to section 4.1(12), connecting to the emulator, building the program and executing.
Note: When using RX Family C/C++ compiler package V.1.01 or later, the error message
may be output in building the program. For details, refer to section 6.(5).
(11) Adding the variable of A/D conversion result to the watch window
HEW
Open the Watch window and add the variable "result". Set "result" to the real time update to monitor the
variable change during execution.
(12) Executing the program and monitoring the A/D conversion result
HEW
Start the execution and screw the potentiometer to change the analog input voltage. The value of “result”
on the watch window will change.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 40 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Tutorial
4.4 Triggering DTC by IRQ
In RX62T RSK board, switch 3 (SW3) is connected to IRQ3. In this tutorial, the data transfer controller (DTC)
and IRQ3 will be set up and DTC transfer triggered by IRQ3 will be performed.
SW3
Note : If there is a switch that enables/disables IRQ3 on the RSK board, enable it.
PDG
(1)
Making the Peripheral Driver Generator project
Make the new Peripheral Driver Generator project
“rx62t_demo4”. For details on how to make the new
Peripheral Driver Generator project, refer to section
4.1(1), Making the Peripheral Driver Generator project.
Set the CPU type as follows.
Series : RX600
Group : RX62T
Type : R5F562TAADFP
Note:
If another type of chip is mounted on your RSK board,
select corresponding CPU type.
Only R5F562TAxxxx is targeted in this tutorial.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 41 of 270
RX62T Group Peripheral Driver Generator Reference Manual
(2)
Tutorial
PDG
Clock setting
1. The clock setting window opens and the error icons are displayed in the initial state. For icons such as
and
displayed on window, refer to section 4.1(2), Initial state.
2. External clock frequency of the RSK board is 12.5 MHz. Input “12.5” into the edit box.
1
2
(3)
PDG
DTC setting-1
1. Select “DTC” tab to open the DTC setting window.
2. Check "Use data transfer controller".
3. The DTC vector table will be allocated from 2,000. Input “2” into the edit box.
2
3
1
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 42 of 270
RX62T Group Peripheral Driver Generator Reference Manual
(4)
Tutorial
PDG
DTC setting-2
1. Click [Add transfer data] to add the transfer data.
2. Select “IRQ3 (external pin interrupt)” for the activating source.
3. Set the transfer data start address to “3000”.
4. Select “Normal transfer mode” for the transfer mode.
5. Select “1” for the transfer unit size.
6. Set transfer count to “10”.
7. Set the transfer source start address to “3500”.
8. Select “Increment” for the transfer source address mode.
9. Set the transfer destination start address to “3600”.
10. Select “Increment” for the transfer destination address mode.
2
1
3
4
5
6
7
8
9
10
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 43 of 270
RX62T Group Peripheral Driver Generator Reference Manual
(5)
Tutorial
PDG
IRQ setting
1. Select “ICU” tab to open the ICU setting window.
2. Click “Interrupts” on the tree view.
3. Check "Use IRQ3".
4. Select “Falling edge” for the detection method of IRQ3.
5. Select “CPU (After activating DTC and data transfer completion)”.
6. CPU interrupt will not be used then set the CPU interrupt priority level to “0”.
3
4
2
5
6
1
(6)
Generating source files
To generate source files, click
PDG
on the tool bar. For details on generating source files, refer to section
4.1(8), Generating source files.
(7)
Preparing the HEW project
HEW
Start the HEW and make RX62T workspace. For details on making HEW project, refer to section 4.1(9),
Preparing the HEW project.
(8)
Adding the generated source files to the HEW project
To add the generated source files to HEW, click
PDG
on the tool bar. For details on adding the source
files to HEW project, refer to section 4.1(10), Adding the generated source files to the HEW project.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 44 of 270
RX62T Group Peripheral Driver Generator Reference Manual
(9)
Making the program on HEW
Tutorial
HEW
By changing the part of “main” function, make the following program on HEW.
//Include "R_PG_<project name>.h"
#include "R_PG_rx62t_demo4.h"
//DTC vector table
#pragma address dtc_vector_table = 0x00002000
uint32_t dtc_vector_table [256];
//DTC transfer data storage area (IRQ3)
#pragma address dtc_transfer_data_IRQ3 = 0x00003000
uint32_t dtc_transfer_data_IRQ3 [2];
//Transfer source
#pragma address dtc_src_data = 0x00003500
uint8_t dtc_src_data [10] = "ABCDEFGHIJ";
//Transfer destination
#pragma address dtc_dest_data = 0x00003600
uint8_t dtc_dest_data [10];
void main(void)
{
//initialize transfer destination
int i;
for(i=0; i<10; i++ ){
dtc_dest_data[i] = 0;
}
// Set up the clock
R_PG_Clock_Set();
// Set up the DTC (e.g. vector table address)
R_PG_DTC_Set();
// Set up the DTC (transfer data of IRQ3)
R_PG_DTC_Set_IRQ3();
// Set up IRQ3
R_PG_ExtInterrupt_Set_IRQ3();
// Make the DTC be ready to the trigger
R_PG_DTC_Activate();
while(1);
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 45 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Tutorial
(10) Connecting to the emulator, building the program and downloading
HEW
Build the program and download it. For details on connecting to the emulator, building the program, and
downloading refer to section 4.1(12), connecting to the emulator, building the program and executing.
Note: When using RX Family C/C++ compiler package V.1.01 or later, the error message
may be output in building the program. For details, refer to section 6.(5).
(11) Adding the variable of the transfer destination
HEW
Open the Watch window and add the variable "dtc_dest_data". Expand the array and set it to the real time
update to monitor the variable change during execution.
(12) Executing the program and monitoring the result of the transfer
HEW
Start the execution and push the SW3. The value of “dtc_dest_data” on the watch window will change.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 46 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Tutorial
4.5 Data transfer between SCIb channels 0 and 2
In this tutorial, SCIb channel 0 and 2 will be set up to transfer data in asynchronous mode. Connect the
transmission pin of channel 2 (TXD2-B) and the reception pin of channel 0 (RXD0) on the RSK board as
follows.
J4/No.22
1
J2/No.9
2
21 22 TXD2-B
10 9
RXD0
2 1
35 36
Note : If there are switches that enables/disables TXD2-B and RXD0 on the RSK board, enable it.
PDG
(1)
Making the Peripheral Driver Generator project
Make the new Peripheral Driver Generator project
“rx62t_demo5”. For details on how to make the new
Peripheral Driver Generator project, refer to section
4.1(1), Making the Peripheral Driver Generator project.
Set the CPU type as follows.
Series : RX600
Group : RX62T
Type : R5F562TAADFP
Note: If another type of chip is mounted on your
RSK board, select corresponding CPU type.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 47 of 270
RX62T Group Peripheral Driver Generator Reference Manual
(2)
Tutorial
PDG
Clock setting
1. The clock setting window opens and the error icons are displayed in the initial state. For icons such as
and
displayed on window, refer to section 4.1(2), Initial state.
2. External clock frequency of the RSK board is 12.5 MHz. Input “12.5” into the edit box.
1
2
(3)
PDG
SCIb setting
Select “SCIb” tab to open the SCIb setting window.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 48 of 270
RX62T Group Peripheral Driver Generator Reference Manual
(4)
Tutorial
PDG
SCI2 (transmitter) setting
Make the setting for SCI2 as follows.
1. Select SCI2 on the tree view.
1
2. Check “Use this channel”.
3. Select “Asynchronous mode”.
4. Select “Transmission” for the function.
5. Leave the data format settings at the default.
2
3
4
5
6. Set the bit rate to 9,600 bps.
6
7. Select “Notify the transmission completion of all data by function call” for the data transmission method.
7
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 49 of 270
RX62T Group Peripheral Driver Generator Reference Manual
(5)
Tutorial
PDG
SCI0 (receptor) setting
Make the setting for SCI0 as follows.
1. Select SCI0 on the tree view.
1
2. Check “Use this channel”.
3. Select “Asynchronous mode”.
4. Select “Reception” for the function.
5. Leave the data format settings at the default.
2
3
4
5
6. Set the bit rate to 9,600 bps.
6
7. Select “Notify the reception completion of all data by function call” for the data reception method.
7
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 50 of 270
RX62T Group Peripheral Driver Generator Reference Manual
(6)
Tutorial
PDG
Pin setting
The TXD2 can be assigned to TXD2-A (PB5) or TXD2-B (P81). Select the pin function assignment as
follows.
1. Select “SYSTEM” tab.
2. Select “Pin” on tree view.
3. Select “Peripheral pin usage” tab.
4. Select “SCI2” from the peripheral module list.
5. When the mouse pointer is placed on “Assignment” column of TXD2 line, a dropdown button is
displayed. Select “P81/MTIC5V/TXD2” from the dropdown list.
2
4
5
3
1
(7)
Generating source files
To generate source files, click
PDG
on the tool bar. For details on generating source files, refer to section
4.1(8), Generating source files.
(8)
Preparing the HEW project
HEW
Start the HEW and make RX62T workspace. For details on making HEW project, refer to section 4.1(9),
Preparing the HEW project.
(9)
Adding the generated source files to the HEW project
To add the generated source files to HEW, click
PDG
on the tool bar. For details on adding the source
files to HEW project, refer to section 4.1(10), Adding the generated source files to the HEW project.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 51 of 270
RX62T Group Peripheral Driver Generator Reference Manual
(10) Making the program on HEW
Tutorial
HEW
By changing the part of “main” function, make the following program on HEW.
//Include "R_PG_<project name>.h"
#include "R_PG_rx62t_demo5.h"
//SCI2 transmission data
uint8_t tr_data[10] = "ABCDEFGHIJ";
//SCI0 reception data storage area
uint8_t re_data[10] = "----------";
void main(void)
{
// Set up the clock
R_PG_Clock_Set();
// Set up the SCI2
R_PG_SCI_Set_C2();
// Set up the SCI0
R_PG_SCI_Set_C0();
// Start SCI0 reception (number of data : 10)
R_PG_SCI_StartReceiving_C0( re_data, 10 );
// Start SCI2 transmission (number of data : 10)
R_PG_SCI_StartSending_C2( tr_data, 10 );
while(1);
}
//SCI2 transmission end notification function
void Sci2TrFunc(void)
{
//Stop SCI2 communication
R_PG_SCI_StopCommunication_C2();
}
//SCI0 reception end notification function
void Sci0ReFunc(void)
{
//Stop SCI0 communication
R_PG_SCI_StopCommunication_C0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 52 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Tutorial
(11) Connecting to the emulator, building the program and downloading
HEW
Buid the program and download it. For details on connecting to the emulator, building the program, and
downloading refer to section 4.1(12), connecting to the emulator, building the program and executing.
(12) Adding the variable of the reception data
HEW
Open the Watch window and add the variable "re_data". Expand the array and set it to the real time update
to monitor the variable change during execution.
(13) Executing the program and monitoring the result of the transfer
HEW
Start the execution and check the value of “re_data” on the watch window.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 53 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Specification of Generated Functions
5. Specification of Generated Functions
Table 5.1 shows generated functions for the RX62T.
Table 5.1
Generated Functions for the RX62T
Clock-generation circuit
Generated Function
Description
R_PG_Clock_Set
Set up the clocks
R_PG_Clock_GetMainClockStatus
Get the main clock status
Voltage Detection Circuit (LVD)
Generated Function
Description
R_PG_LVD_Set
Set up the voltage detection circuit
R_PG_LVD_GetLVDDetectionFlag
R_PG_LVD_GetLVDDetectionFlag
Low Power Consumption
Generated Function
Description
R_PG_LPC_Set
Set up the low power consumption functions.
R_PG_LPC_Sleep
Enter sleep mode.
R_PG_LPC_AllModuleClockStop
Enter all module clock stop mode.
R_PG_LPC_SoftwareStandby
Enter software standby mode
R_PG_LPC_DeepSoftwareStandby
Enter deep software standby mode
R_PG_LPC_IOPortRelease
Release retained I/O port state
R_PG_LPC_GetPowerOnResetFlag
Acquire the value of the power-on reset flag
R_PG_LPC_GetLVDDetectionFlag
Acquire the value of the LVD detection flag
R_PG_LPC_GetDeepSoftwareStandbyResetFlag
Acquire the value of the deep software
standby reset flag
R_PD_LPC_GetDeepSoftwareStandbyCancelFlag
Acquire the value of the deep software
standby cancel flag
R_PG_LPC_GetStatus
Get the status of the low power consumption
functions
R_PG_LPC_WriteBackup
Write data into the backup registers
R_PG_LPC_ReadBackup
Read data from the backup registers
Interrupt controller (ICU)
Generated Function
Description
R_PG_ExtInterrupt_Set_<interrupt type>
Set up an external interrupt
R_PG_ExtInterrupt_Disable_<interrupt type>
Disable an external interrupt
R_PG_ExtInterrupt_GetRequestFlag_<interrupt type>
Get an external interrupt request flag
R_PG_ExtInterrupt_ClearRequestFlag_<interrupt type>
Clear an external interrupt request flag
R_PG_SoftwareInterrupt_Set
Set up the software interrupt
R_PG_SoftwareInterrupt_Generate
Generate the software interrupt
R_PG_FastInterrupt_Set
Set an interrupt as the fast interrupt
R_PG_Exception_Set
Set exception handlers
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 54 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Specification of Generated Functions
Buses
Generated Function
Description
R_PG_ExtBus_SetBus
Set up bus error monitoring
R_PG_ExtBus_GetErrorStatus
Acquire the status of bus error generation
R_PG_ExtBus_ClearErrorFlags
Clear the bus-error status registers
Data Transfer Controller (DTC)
Generated Function
Description
R_PG_DTC_Set
Set up the DTC
R_PG_DTC_Set_<trigger source>
Set up DTC transfer data
R_PG_DTC_Activate
Make DTC be ready for the trigger
R_PG_DTC_SuspendTransfer
Stop transfer
R_PG_DTC_GetTransmitStatus
Get transfer status
R_PG_DTC_StopModule
Shut down the DTC
I/O port
Generated Function
Description
R_PG_IO_PORT_Set_P<port number>
Set the I/O ports
R_PG_IO_PORT_Set_P<port number><pin number>
Set an I/O port (one pin)
R_PG_IO_PORT_Read_P<port number>
Read data from an I/O port register
R_PG_IO_PORT_Read_P<port number><pin number>
Read a bit from an I/O port register
R_PG_IO_PORT_Write_P<port number>
Write data to an I/O port data register
R_PG_IO_PORT_Write_P <port number><pin number>
Write a bit to an I/O port data register
Multi-Function Timer Pulse Unit 3 (MTU3)
Generated Function
Description
R_PG_Timer_Set_MTU_U<unit number>_<channels>
Set up the MTU
R_PG_Timer_StartCount_MTU_U<unit number>_C<channel
number>(_<phase>)
Start the MTU count operation
R_PG_Timer_SynchronouslyStartCount_MTU_U<unit number>
Start the MTU count operation
simultaneously
R_PG_Timer_HaltCount_MTU_U<unit number>_C<channel number>
(_<phase>)
Halt the MTU count operation
R_PG_Timer_GetCounterValue_MTU_U<unit number>_C<channel
number>
Acquire the MTU counter value
R_PG_Timer_SetCounterValue_MTU_U<unit number>_C<channel
number>(_<phase>)
Set the counter value
R_PG_Timer_GetRequestFlag_MTU_U<unit number>_C<channel
number>
Acquire the interrupt request flag
R_PG_Timer_StopModule_MTU_U<unit number>
Shut down the MTU unit
R_PG_Timer_GetTGR_MTU_U<unit number>_C<channel number>
R_PG_Timer_SetTGR_<general register>_MTU_U<unit
number>_C<channel number>
Acquire the general register values
R_PG_Timer_SetBuffer_AD_MTU_U<unit number>_C<channel
number>
R_PG_Timer_SetBuffer_CycleData_MTU_U<unit
number>_<channels>
R_PG_Timer_SetOutputPhaseSwitch_MTU_U<unit
number>_<channels>
R_PG_Timer_ControlOutputPin_MTU_U<unit
number>_<channels>
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Set the general register A value
Set A/D converter start request cycle set
buffer registers
Set the cycle buffer register
Switch PWM output level
Enable or disable the PWM output
Page 55 of 270
RX62T Group Peripheral Driver Generator Reference Manual
R_PG_Timer_SetBuffer_PWMOutputLevel_MTU_U<unit
number>_<channels>
R_PG_Timer_ControlBufferTransfer_MTU_U<unit
number>_<channels>
Specification of Generated Functions
Set the PWM output level in the buffer
register
Enable or disable buffer transfer from the
buffer registers to the temporary registers
Port Output Enable 3 (POE3)
Generated Function
Description
R_PG_POE_Set
Set up the POE
Place the MTU output pins in
high-impedance state
Acquire the high-impedance request flags
Acquire the MTU output short flags
Clear the high-impedance request flags and
the output short flags
R_PG_POE_SetHiZ_<Timer channels>
R_PG_POE_GetRequestFlagHiZ_<Timer channels>
R_PG_POE_GetShortFlag_<Timer channels>
R_PG_POE_ClearFlag_<Timer channels>
General PWM Timer (GPT)
Generated Function
Description
R_PG_Timer_Set_GPT_U<unit number>
Set up the GPT
R_PG_Timer_Set_GPT_U<unit number>_C<channel number>
Set up the GPT channel
R_PG_Timer_StartCount_GPT_U<unit number>_C<channel number>
Start the GPT count operation
R_PG_Timer_SynchronouslyStartCount_GPT_U<unit number>
Start the GPT count operation of two or more
channels simultaneously
R_PG_Timer_HaltCount_GPT_U<unit number>_C<channel number>
Halt the GPT count operation
R_PG_Timer_SynchronouslyHaltCount_GPT_U<unit number>
Halt the GPT count operation of two or more
channels simultaneously
R_PG_Timer_SetGTCCR_<GTCCR>_GPT_U<unit number>_C<channel
number>
Set the value to the compare capture register
( GTCCRn n : A to F )
R_PG_Timer_GetGTCCR_GPT_U<unit number>_C<channel number>
Get the value from the compare capture registers
( GTCCRA to F )
R_PG_Timer_SetCounterValue_GPT_U<unit number>_C<channel
number>
Set the GPT counter value
R_PG_Timer_GetCounterValue_GPT_U<unit number>_C<channel
number>
Get the GPT counter value
R_PG_Timer_SynchronouslyClearCounter_GPT_U<unit number>
Clear the counter of two or more channels
simultaneously
R_PG_Timer_SetCycle_GPT_U<unit number>_C<channel number>
Set the value to the timer cycle setting register
(GTPR)
R_PG_Timer_SetBuffer_Cycle_GPT_U<unit number>_C<channel
number>
Set the value to the timer cycle setting buffer
register (GTPBR)
R_PG_Timer_SetDoubleBuffer_Cycle_GPT_U<unit number>_C<channel
number>v
Set the value to the timer cycle setting
double-buffer register (GTPDBR)
R_PG_Timer_SetAD_GPT_U<unit number>_C<channel number>
Set the value to the A/D converter start request
timing register A, B (GTADTRA, B)
R_PG_Timer_SetBuffer_AD_GPT_U<unit number>_C<channel number>
Set the value to the A/D converter start request
timing buffer register A, B (GTADTBRA,
GTADTBRB)
R_PG_Timer_SetDoubleBuffer_AD_GPT_U<unit number>_C<channel
number>
Set the value to the A/D converter start request
timing double-buffer register A, B (GTADTDBRA,
GTADTDBRB)
R_PG_Timer_SetBuffer_GTDV<U/D>_GPT_U<unit number>_C<channel
number>
Set the value to the timer dead time buffer register
U, D (GTDBU, GTDBD)
R_PG_Timer_GetRequestFlag_GPT_U<unit number>_C<channel
number>
Get and clear the GPT interrupt flag
R_PG_Timer_GetRequestFlag_GPT_U<unit number>_C<channel
number>
Get and clear the GPT interrupt flags of LOCO
count function and external trigger
R_PG_Timer_GetCounterStatus_GPT_U<unit number>_C<channel
number>
Get the counter status
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 56 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Specification of Generated Functions
R_PG_Timer_BufferEnable_GPT_U<unit number>_C<channel number>
Enable the buffer operation
R_PG_Timer_BufferDisable_GPT_U<unit number>_C<channel number>
Disable the buffer operation
R_PG_Timer_Buffer_Force_GPT_U<unit number>_C<channel number>
Execute forcible buffer transfer
R_PG_Timer_CountDirection_Down_GPT_U<unit number>_C<channel
number>
Set the count direction to down-counting
R_PG_Timer_CountDirection_Up_GPT_U<unit number>_C<channel
number>
Set the count direction to up-counting
R_PG_Timer_SoftwareNegate_GPT_U<unit number>_C<channel
number>
Control GTIOCnA and GTIOCnB pin output
negation by software (n:Channel number)
R_PG_Timer_StartCount_LOCO_GPT_U<unit number>
Start the LOCO count
R_PG_Timer_HaltCount_LOCO_GPT_U<unit number>
Halt the LOCO count
R_PG_Timer_ClearCounter_LOCO_GPT_U<unit number>
Clear the LOCO count value register
R_PG_Timer_InitialiseCountResultValue_LOCO_GPT_U<unit number>
Initialize the LOCO count result registers
R_PG_Timer_GetCounterValue_LOCO_GPT_U<unit number>
Get the value of the LOCO count value register
R_PG_Timer_GetCounterAverageValue_LOCO_GPT_U<unit number>
Get the LOCO count result average value
R_PG_Timer_GetCountResultValue_LOCO_GPT_U<unit number>
Get the LOCO count result registers value
R_PG_Timer_SetPermissibleDeviation_LOCO_GPT_U<unit number>
Set the LOCO count upper/lower permissible
deviation value
R_PG_Timer_StopModule_GPT_U<unit number>
Shut down the GPT unit
Compare Match Timer (CMT)
Generated Function
Description
R_PG_Timer_Start_CMT_U<unit number>_C<channel number>
Set up the CMT and start the count operation
R_PG_Timer_HaltCount_CMT_U<unit number>_C<channel
number>
R_PG_Timer_ResumeCount_CMT_U<unit number>_C<channel
number>
R_PG_Timer_GetCounterValue_CMT_U<unit number>_C<channel
Halt the CMT count operation
Resume the CMT count operation
Acquire the CMT counter value
number>
R_PG_Timer_SetCounterValue_CMT_U<unit number>_C<channel
Set the CMT counter value
number>
R_PG_Timer_StopModule _CMT_U<unit number>
Shut down the CMT unit
Watchdog Timer (WDT)
Generated Function
Description
R_PG_Timer_Start_WDT
Set up the WDT and start the count
R_PG_Timer_HaltCount_WDT
Stop the count operation
R_PG_Timer_ResetCounter_WDT
Reset the counter
R_PG_Timer_ClearOverflowFlag_WDT
Clear the counter overflow flag
Independent Watchdog Timer (IWDT)
Generated Function
Description
R_PG_Timer_Set_IWDT
Set up the IWDT
R_PG_Timer_RefreshCounter_IWDT
Refresh the counter
R_PG_Timer_GetCounterValue_IWDT
Acquire the IWDT counter value
R_PG_Timer_ClearUnderflowFlag_IWDT
Acquire and clear the underflow flag
Serial Communications Interface (SCI)
Generated Function
Description
R_PG_SCI_Set_C<channel number>
Set up a SCI channel
R_PG_SCI_StartSending_C<channel number>
Start the data transmission
R_PG_SCI_SendAllData_C<channel number>
Transmit all data
R_PG_SCI_GetSentDataCount_C<channel number>
Acquire the number of transmitted data
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 57 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Specification of Generated Functions
R_PG_SCI_StartReceiving_C<channel number>
Start the data reception
R_PG_SCI_ReceiveAllData_C<channel number>
Receive all data
R_PG_SCI_StopCommunication_C<channel number>
Stop transmission and reception
R_PG_SCI_GetReceivedDataCount_C<channel number>
Acquire the number of received data
R_PG_SCI_GetReceptionErrorFlag_C<channel number>
Get the serial reception error flag
R_PG_SCI_GetTransmitStatus_C<channel number>
Get the state of transmission
R_PG_SCI_SendTargetStationID_C<channel number>
Transmits the ID code of the receiving
station
R_PG_SCI_ReceiveStationID_C<channel number>
Receives the ID code matches the ID of the
receiving station itself
R_PG_SCI_StopModule_C<channel number>
Shut down a SCI channel
CRC Calculator (CRC)
Generated Function
Description
R_PG_CRC_Set
Set up CRC calculator
R_PG_CRC_InputData
Input a data to CRC calculator
R_PG_CRC_GetResult
Get the the result of calculation
R_PG_CRC_StopModule
Shut down CRC Calculator
I2C Bus Interface (RIIC)
Generated Function
Description
R_PG_I2C_Set_C<channel number>
Set up the I2C bus interface channel
R_PG_I2C_MasterReceive_C<channel number>
Master data reception
R_PG_I2C_MasterReceiveLast_C<channel number>
Complete a master reception process
R_PG_I2C_MasterSend_C<channel number>
Master data transmission
R_PG_I2C_MasterSendWithoutStop_C<channel number>
Master data transmission (No stop condition)
R_PG_I2C_GenerateStopCondition_C<channel number>
Generate a stop condition
R_PG_I2C_GetBusState_C<channel number>
Get the bus status
R_PG_I2C_SlaveMonitor_C<channel number>
Slave bus monitor
R_PG_I2C_SlaveSend_C<channel number>
Slave data transmission
R_PG_I2C_GetDetectedAddress_C<channel number>
Get the detected address
R_PG_I2C_GetTR_C<channel number>
Get the transmit/receive mode
R_PG_I2C_GetEvent_C<channel number>
Get the detected event
R_PG_I2C_GetReceivedDataCount_C<channel number>
Acquires the count of transmitted data
R_PG_I2C_GetSentDataCount_C<channel number>
Acquires the count of received data
R_PG_I2C_Reset_C<channel number>
Reset the bus
R_PG_I2C_StopModule_C<channel number>
Shut down the I2C bus interface channel
Serial Peripheral Interface (RSPI)
Generated Function
Description
R_PG_RSPI_Set_C<channel number>
Set up a RSPI channel
R_PG_RSPI_SetCommand_C<channel number>
Set commands
R_PG_RSPI_StartTransfer_C<channel number>
Start the data transfer
R_PG_RSPI_TransferAllData_C<channel number>
Transfer all data
R_PG_RSPI_GetStatus_C<channel number>
Acquire the transfer status
R_PG_RSPI_GetError_C<channel number>
Acquire the error flags
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 58 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Specification of Generated Functions
R_PG_RSPI_GetCommandStatus_C<channel number>
Acquire the command status
R_PG_RSPI_StopModule_C<channel number>
Shut down a RSPI channel
R_PG_RSPI_LoopBack<loopback mode>_C<channel number>
Set loopback mode
12-Bit A/D Converter (S12ADA)
Generated Function
Description
R_PG_ADC_12_Set_S12AD0
Set up the 12-Bit A/D Converter
R_PG_ADC_12_Set
Set up the programmable gain amplifier
R_PG_ADC_12_StartConversionSW_S12AD0(void)
Start A/D conversion (Software trigger)
R_PG_ADC_12_StopConversion_S12AD0
Stop A/D conversion
R_PG_ADC_12_GetResult_S12AD0
Acquire the result of A/D conversion
R_PG_ADC_12_StopModule_S12AD0
Shut down the 12-Bit A/D converter
10-Bit A/D Converter (ADA)
Generated Function
Description
R_PG_ADC_10_Set_AD<unit number>
Set up the 10-Bit A/D Converter (ADa)
R_PG_ADC_10_StartConversionSW_AD<unit number>
Start A/D conversion (software trigger)
R_PG_ADC_10_StopConversion_AD<unit number>
Stop A/D conversion
R_PG_ADC_10_GetResult_AD<unit number>
Get the result of A/D conversion
R_PG_ADC_10_SetSelfDiag_VREF_<voltage>_AD<unit number>
Set up the A/D self-diagnostic function
R_PG_ADC_10_StopModule_AD<unit number>
Shut down the 10-Bit A/D Converter (ADa)
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 59 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.1
Specification of Generated Functions
Clock-Generation Circuit
5.1.1
R_PG_Clock_Set
Definition
bool R_PG_Clock_Set(void)
Description
Set up the clocks
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_Clock.c
RPDL function
R_CGC_Set
Details
•
Sets registers in the clock-generation circuit and multiplication ratios to derive the system
clock (ICLK) and peripheral module clock (PCLK).
•
Example
Sets the oscillation stop detection function.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
void func(void)
{
//Set the clock-generation circuit.
R_PG_Clock_Set();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 60 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.1.2
Specification of Generated Functions
R_PG_Clock_GetMainClockStatus
Definition
bool R_PG_Clock_GetMainClockStatus(bool * stop)
Description
Get the main clock oscillation stop detection flag
Conditions for
The main clock oscillator stop detection function is enabled
output
Parameter
bool * stop
The address of storage area for the main clock oscillation stop flag
Return value
true
Acquisition succeeded
false
Acquisition failed
File for output
R_PG_Clock.c
RPDL function
R_CGC_GetStatus
Details
•
This function gets the main clock oscillation stop detection flag.
•
To generate the NMI when the main clock oscillator stop is detected, enable the
oscillation stop detection interrupt through the NMI settings in GUI. The NMI can be set
up by the function R_PG_ExtInterrupt_Set_NMI.
Example
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
bool main_stop;
void func(void)
{
// Get the main clock oscillation stop detection flag
R_PG_Clock_GetMainClockStatus(&main_stop);
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 61 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.2
Specification of Generated Functions
Voltage Detection Circuit (LVD)
5.2.1
R_PG_LVD_Set
Definition
bool R_PG_LVD_Set (void)
Description
Set up the voltage detection circuit.
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_LVD.c
RPDL function
R_LVD_Control
Details
•
This function sets the operation (internal reset or interrupt) when low voltage is detected.
•
Both LVD1 and LVD2 can be set up in one function call.
•
When an interrupt is selected as the operation in case of low voltage detection, NMI
must be set up. To generate the NMI when low voltage is detected, enable the
power-voltage falling detection interrupt through the NMI settings in GUI. The NMI can
be set up by the function R_PG_ExtInterrupt_Set_NMI.
•
Use R_PG_LVD_GetLVDDetectionFlag to acquire the low voltage detection flags
(LVD1 and LVD2).
Example
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
void func(void)
{
// Set up the voltage detection circuit.
R_PG_LVD_Set (void);
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 62 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.2.2
Specification of Generated Functions
R_PG_LVD_GetLVDDetectionFlag
Definition
bool R_PG_LVD_GetLVDDetectionFlag (bool * lvd1, bool * lvd2)
Description
Acquire the value of the LVD detection flags.
Parameter
bool * lvd1
The address of storage area for the LVD1 detection flag
bool * lvd2
The address of storage area for the LVD2 detection flag
true
Acquisition succeeded
false
Acquisition failed
Return value
File for output
R_PG_LVD.c
RPDL function
R_LPC_GetStatus
Details
Example
•
This function acquires the value of the LVD detection flag.
•
Specify 0 for a flag that is not required.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
bool lvd1;
bool lvd2;
void func(void)
{
// Acquire the LVD1 and LVD2 flags.
R_PG_LVD_GetLVDDetectionFlag ( &lvd1, &lvd2);
if( lvd1 ){
//Processing when the LVD1 is detected
}
if( lvd2 ){
//Processing when the LVD2 is detected
}
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 63 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.3
Specification of Generated Functions
Low Power Consumption
5.3.1
R_PG_LPC_Set
Definition
bool R_PG_LPC_Set (void)
Description
Set up the low power consumption functions.
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_LPC.c
RPDL function
R_LPC_Create
Details
Example
•
This function configures the low power conditions.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
void func(void)
{
// Set up the low power consumption functions.
R_PG_LPC_Set (void);
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 64 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.3.2
Specification of Generated Functions
R_PG_LPC_Sleep
Definition
bool R_PG_LPC_Sleep (void)
Description
Enter sleep mode.
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_LPC.c
RPDL function
R_LPC_Control
Details
Example
•
This function set the system to sleep mode.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
void func(void)
{
// Enter sleep mode.
R_PG_LPC_Sleep(void);
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 65 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.3.3
Specification of Generated Functions
R_PG_LPC_AllModuleClockStop
Definition
bool R_PG_LPC_AllModuleClockStop (void)
Description
Enter all module clock stop mode.
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_LPC.c
RPDL function
R_LPC_Control
Details
Example
•
This function sets the system to all module clock stop mode.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
void func(void)
{
// Enter all module clock stop mode.
R_PG_LPC_AllModuleClockStop (void);
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 66 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.3.4
Specification of Generated Functions
R_PG_LPC_SoftwareStandby
Definition
bool R_PG_LPC_SoftwareStandby(void)
Description
Enter software standby mode.
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_LPC.c
RPDL function
R_LPC_Control
Details
•
This function set the system to software standby mode.
•
Call R_PG_LPC_Set before calling this function to set the operation during software
standby mode.
Example
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
void func(void)
{
// Set up the low power consumption functions.
R_PG_LPC_Set (void);
// Enter software standby mode.
R_PG_LPC_SoftwareStandby (void);
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 67 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.3.5
Specification of Generated Functions
R_PG_LPC_DeepSoftwareStandby
Definition
bool R_PG_LPC_DeepSoftwareStandby(void)
Description
Enter deep software standby mode.
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_LPC.c
RPDL function
R_LPC_Control
Details
•
This function set the system to deep software standby mode.
•
Call R_PG_LPC_Set before calling this function to set the operation during deep
software standby mode and release triggers.
•
The deep software standby cancel flag is set to 1 when a cancel request is generated in
any mode. In this function, the deep software standby cancel flag is not cleared before
entering deep software standby mode. Clear the deep software standby cancel flag before
calling this function by R_PD_LPC_GetDeepSoftwareStandbyCancelFlag.
Example
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
void func(void)
{
// Set up the low power consumption functions.
R_PG_LPC_Set (void);
// Clear deep software standby cancel flag.
R_PD_LPC_GetDeepSoftwareStandbyCancelFlag(0,0,0,0);
// Enter deep software standby mode.
R_PG_LPC_DeepSoftwareStandby (void);
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 68 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.3.6
Specification of Generated Functions
R_PG_LPC_IOPortRelease
Definition
bool R_PG_LPC_IOPortRelease (void)
Description
Release retained I/O port state.
Conditions for
On the GUI, [Release retained port state when 0 is written to the IOKEEP bit after release
output
from deep software standby mode] is selected for the setting of [I/O port state retention].
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_LPC.c
RPDL function
R_LPC_Control
Details
•
This function releases I/O ports from the retention state after the system is releasd from
deep software standby mode.
Example
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
void func(void)
{
// Release I/O ports from the retention state
R_PG_LPC_IOPortRelease(void);
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 69 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.3.7
Specification of Generated Functions
R_PG_LPC_GetPowerOnResetFlag
Definition
bool R_PG_LPC_GetPowerOnResetFlag (bool *reset)
Description
Acquire the value of the power-on reset flag.
Parameter
bool *reset
The address of storage area for the power-on reset flag
Return value
true
Acquisition succeeded
false
Acquisition failed
File for output
R_PG_LPC.c
RPDL function
R_LPC_GetStatus
Details
•
This function acquires the value of the power-on reset flag.
•
The RSTSR.LVD1F ( LVD1 detection flag), RSTSR.LVD2F( LVD2 detection flag),
RSTSR.DPSRSTF (deep software standby reset flag) and DPSIFR(deep software
standby cancel request flags) are cleared by calling this function. Use
R_PG_LPC_GetStatus instead of this function to get these flags simultaneously if
•
needed.
RSTSR.PORF( power-on reset flag) is only initialized by a pin reset.
Example
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
bool reset;
void func(void)
{
// Acquire the power-on reset flags.
R_PG_LPC_GetPowerOnResetFlag( &reset );
if( reset ){
// Processing when the power-on reset is detected
}
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 70 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.3.8
Specification of Generated Functions
R_PG_LPC_GetLVDDetectionFlag
Definition
bool R_PG_LPC_GetLVDDetectionFlag (bool * lvd1, bool * lvd2)
Description
Acquire the value of the LVD detection flags.
Parameter
bool * lvd1
The address of storage area for the LVD1 detection flag
bool * lvd2
The address of storage area for the LVD2 detection flag
true
Acquisition succeeded
false
Acquisition failed
Return value
File for output
R_PG_LPC.c
RPDL function
R_LPC_GetStatus
Details
•
This function acquires the value of the LVD detection flags.
•
Specify the address of storage area for the flags to be acquired.
•
Specify 0 for a flag that is not required.
•
The RSTSR.LVD1F ( LVD1 detection flag), RSTSR.LVD2F( LVD2 detection flag),
RSTSR.DPSRSTF (deep software standby reset flag) and DPSIFR(deep software
standby cancel request flags) are cleared by calling this function. Use
R_PG_LPC_GetStatus instead of this function to get these flags simultaneously if
needed.
Example
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
bool lvd1;
bool lvd2;
void func(void)
{
// Acquire the LVD1 and LVD2 flags.
R_PG_LPC_GetLVDDetectionFlag ( &lvd1, &lvd2);
if( lvd1 ){
//Processing when the LVD1 is detected
}
if( lvd2 ){
//Processing when the LVD2 is detected
}
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 71 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.3.9
Specification of Generated Functions
R_PG_LPC_GetDeepSoftwareStandbyResetFlag
Definition
bool R_PG_LPC_GetDeepSoftwareStandbyResetFlag(bool *reset)
Description
Acquire the value of the deep software standby reset flag.
Parameter
bool *reset
The address of storage area for the deep software standby reset flag
Return value
true
Acquisition succeeded
false
Acquisition failed
File for output
R_PG_LPC.c
RPDL function
R_LPC_GetStatus
Details
•
This function acquires the value of the deep software standby reset flag.
•
The RSTSR.LVD1F ( LVD1 detection flag), RSTSR.LVD2F( LVD2 detection flag),
RSTSR.DPSRSTF (deep software standby reset flag) and DPSIFR(deep software
standby cancel request flags) are cleared by calling this function. Use
R_PG_LPC_GetStatus instead of this function to get these flags simultaneously if
needed.
Example
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
bool reset;
void func(void)
{
// Acquire the deep software standby reset flag.
R_PG_LPC_GetDeepSoftwareStandbyResetFlag ( &reset);
if( reset ){
//Processing when the deep software standby reset is detected
}
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 72 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.3.10
Specification of Generated Functions
R_PD_LPC_GetDeepSoftwareStandbyCancelFlag
bool R_PD_LPC_GetDeepSoftwareStandbyCancelFlag
Definition
(bool *irq0, bool *irq1, bool *lvd, bool *nmi)
Description
Acquire the value of the deep software standby cancel request flags.
Parameter
bool *irq0
The address of storage area for the flag of cancel request by IRQ0
bool *irq1
The address of storage area for the flag of cancel request by IRQ1
bool *lvd
The address of storage area for the flag of cancel request by LVD
bool *nmi
The address of storage area for the flag of cancel request by NMI
true
Acquisition succeeded
false
Acquisition failed
Return value
File for output
R_PG_LPC.c
RPDL function
R_LPC_GetStatus
Details
•
This function acquires the value of the deep software standby cancel request flags.
•
Specify the address of storage area for the flags to be acquired.
•
Specify 0 for a flag that is not required.
•
The RSTSR.LVD1F ( LVD1 detection flag), RSTSR.LVD2F( LVD2 detection flag),
RSTSR.DPSRSTF (deep software standby reset flag) and DPSIFR(deep software
standby cancel request flags) are cleared by calling this function. Use
R_PG_LPC_GetStatus instead of this function to get these flags simultaneously if
needed.
Example
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
bool irq0;
bool nmi;
void func(void)
{
// Acquire the deep software standby cancel request flags (IQR0-A and NMI)
R_PD_LPC_GetDeepSoftwareStandbyCancelFlag ( &irq0, 0, 0, &nmi );
if( irq0 ){
//Processing when the deep software standby cancel request form IRQ0-A is detected
}
if( nmi ){
// Processing when the deep software standby cancel request form NMI is detected
}
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 73 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.3.11
Specification of Generated Functions
R_PG_LPC_GetStatus
Definition
bool R_PG_LPC_GetStatus(uint16_t *data)
Description
Get the status of the low power consumption functions.
Parameter
uint16_t *data
The address of storage area for the status data
Return value
true
Acquisition succeeded
false
Acquisition failed
File for output
R_PG_LPC.h
RPDL function
R_LPC_GetStatus
Details
•
This function acquires the reset status and deep software standby cancel request flags.
•
When calling this function, the function of RPDL R_PG_LPC_GetStatus is called
directly.
•
The status flags shall be stored in the format below.
b15
b14-b11
b10
b9
b8
LVD1
Power-on reset
b2
b1
Reset status (RSTSR) (0: not detected; 1: detected)
Deep software reset
b7
b6
0
b5
LVD2
b4
b3
b0
Deep software standby cancel request detection (DPSIFR) (0: not detected; 1: detected)
NMI
•
0
0
LVD
0
0
IRQ1-A
IRQ0-A
The RSTSR( LVD detection flags, deep software standby reset flag) and DPSIFR(deep
software standby cancel request flags) are cleared by calling this function.
•
Example
RSTSR.PORF( power-on reset flag) is only initialized by a pin reset.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
uint16_t data;
void func(void)
{
// Acquire the LPC status
R_PG_LPC_GetStatus( &data );
//Has deep software standby reset been detected?
if( (data >> 15) & 0x1 ){
if( (data >> 7) &0x1){
// Processing when the deep software standby is canceled by NMI
}
else if( data &0x1){
// Processing when the deep software standby is canceled by IRQ0-A
}
}
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 74 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.3.12
Specification of Generated Functions
R_PG_LPC_WriteBackup
Definition
bool R_PG_LPC_WriteBackup (uint8_t * data, uint8_t count)
Description
Write data into the deep standby backup registers.
Parameter
uint8_t * data
The start address of data to be written to the backup area.
uint8_t count
The number of bytes to be written to the backup area. Valid from 1 to 32.
true
Setting was made correctly
false
Setting failed
Return value
File for output
R_PG_LPC.h
RPDL function
R_LPC_WriteBackup
Details
•
Writes data into the deep standby backup registers.
•
When calling this function, the function of RPDL R_LPC_WriteBackup is called
directly.
Example
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
uint8_t w_data[]=”ABCDEFG”;
uint8_t r_data[]=”-------”;
void func1(void)
{
// Set up the low power consumption functions.
R_PG_LPC_Set (void);
// Write data into the deep standby backup registers
R_PG_LPC_WriteBackup( w_data, 7 );
// Enter deep software standby mode.
R_PG_LPC_DeepSoftwareStandby (void);
}
void func2(void)
{
// Read data from the deep standby backup registers
R_PG_LPC_ReadBackup( r_data, 7 );
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 75 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.3.13
Specification of Generated Functions
R_PG_LPC_ReadBackup
Definition
bool R_PG_LPC_ReadBackup (uint8_t * data, uint8_t count)
Description
Read data from the deep standby backup registers.
Parameter
uint8_t * data
The start address of storage area for the data read from the backup area.
uint8_t count
The number of bytes to be read from the backup area. Valid from 1 to 32.
true
Acquisition succeeded.
false
Acquisition failed.
Return value
File for output
R_PG_LPC.h
RPDL function
R_LPC_ReadBackup
Details
•
Reads data from the deep standby backup registers.
•
When calling this function, the function of RPDL R_LPC_ReadBackup is called
directly.
Example
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
uint8_t w_data[]=”ABCDEFG”;
uint8_t r_data[]=”-------”;
void func1(void)
{
// Set up the low power consumption functions.
R_PG_LPC_Set (void);
// Write data into the deep standby backup registers
R_PG_LPC_WriteBackup( w_data, 7 );
// Enter deep software standby mode.
R_PG_LPC_DeepSoftwareStandby (void);
}
void func2(void)
{
// Read data from the deep standby backup registers
R_PG_LPC_ReadBackup( r_data, 7 );
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 76 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.4
Specification of Generated Functions
Interrupt Controller (ICU)
5.4.1
R_PG_ExtInterrupt_Set_<interrupt type>
bool R_PG_ExtInterrupt_Set_<interrupt type> (void)
Definition
<interrupt type>: IRQ0 to IRQ7 or NMI
Description
Set up an external interrupt
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_ExtInterrupt_<interrupt type>.c
<interrupt type>: IRQ0 to IRQ7 or NMI
RPDL function
Details
R_INTC_CreateExtInterrupt
•
Enables an external interrupt (IRQ0 to IRQ7 or the NMI) and sets the input direction and
input buffer for the pins to be used for the external interrupt signal. For IRQn, the pin to
be used (IRQn-A/B/C) is set according to the selection in the [Peripheral Pin Usage]
window.
•
When the name of the interrupt notification function has been specified in the GUI, if an
interrupt occurs in the CPU, the function having the specified name will be called. Create
the interrupt notification function as follows:
void <name of the interrupt notification function> (void)
For the interrupt notification function, note the contents of 5.21, Notes on Notification
Functions.
•
If the interrupt propriety level is set to 0 in the GUI, an interrupt handler will not be called
even when the external interrupt is input. The request flag can be acquired by calling
R_PG_ExtInterrupt_GetRequestFlag_<interrupt type> and the flag can be cleared by
R_PG_ExtInterrupt_ClearRequestFlag_<interrupt type>.
Example1
A case where Irq0IntFunc has been specified as the name of an interrupt notification
function:
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
void func(void)
{
//Set IRQ0.
R_PG_ExtInterrupt_Set_IRQ0();
}
//IRQ0 notification function
void Irq0IntFunc (void)
{
func_irq0();
//Processing of IRQ0
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 77 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Example2
Specification of Generated Functions
A case where the interrupt propriety level is set to 0:
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
void func(void)
{
bool flag;
//Set IRQ0.
R_PG_ExtInterrupt_Set_IRQ0();
do{
//Acquire the interrupt request flag for IRQ0.
R_PG_ExtInterrupt_GetRequestFlag_IRQ0( &flag );
}while( ! flag )
func_irq0();
//Processing of IRQ0
//Clear the interrupt request flag for IRQ0.
R_PG_ExtInterrupt_ClearRequestFlag_IRQ0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 78 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.4.2
Specification of Generated Functions
R_PG_ExtInterrupt_Disable_<interrupt type>
Definition
bool R_PG_ExtInterrupt_Disable_<interrupt type> (void)
<interrupt type>: IRQ0 to IRQ7
Description
Disable an external interrupt
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_ExtInterrupt_<interrupt type>.c
<interrupt type>: IRQ0 to IRQ7
RPDL function
Details
R_INTC_ControlExtInterrupt
•
Disables an external interrupt (IRQ0 to IRQ7).
•
Settings of the input/output direction and input buffer for the pin being used for the
external interrupt signal are retained.
Example
A case where Irq0IntFunc has been specified as the name of an interrupt notification
function:
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
void func(void)
{
//Set IRQ0.
R_PG_ExtInterrupt_Set_IRQ0();
}
//External interrupt (IRQ0) notification function
void Irq0IntFunc (void)
{
//Disable IRQ0.
R_PG_ExtInterrupt_Disable_IRQ0();
func_irq0();
//Processing of IRQ0
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 79 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.4.3
Specification of Generated Functions
R_PG_ExtInterrupt_GetRequestFlag_<interrupt type>
bool R_PG_ExtInterrupt_GetRequestFlag_<interrupt type> (bool * flag)
Definition
<interrupt type>: IRQ0 to IRQ7 or NMI
Description
Get an external interrupt request flag
Parameter
bool * flag
The address of storage area for the interrupt request flag
Return value
true
Acquisition succeeded
false
Acquisition failed
File for output
R_PG_ExtInterrupt_<interrupt type>.c
<interrupt type>: IRQ0 to IRQ7 or NMI
RPDL function
Details
R_INTC_GetExtInterruptStatus
•
Acquires the interrupt request flag for an external interrupt (IRQ0 to IRQ7 or the NMI).
When an interrupt is requested, ‘true’ is entered in the specified destination for storage of
the flag’s value.
Example
A case where the interrupt propriety level is set to 0:
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
void func(void)
{
bool flag;
//Set IRQ0.
R_PG_ExtInterrupt_Set_IRQ0();
do{
//Acquire the interrupt request flag for IRQ0.
R_PG_ExtInterrupt_GetRequestFlag_IRQ0( &flag );
}while( ! flag )
func_irq0();
//Processing of IRQ0
//Clear the interrupt request flag for IRQ0.
R_PG_ExtInterrupt_ClearRequestFlag_IRQ0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 80 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.4.4
Specification of Generated Functions
R_PG_ExtInterrupt_ClearRequestFlag_<interrupt type>
bool R_PG_ExtInterrupt_ClearRequestFlag_<interrupt type> (void)
Definition
<interrupt type>: IRQ0 to IRQ7 or NMI
Description
Clear an external interrupt request flag
Parameter
None
Return value
true
Clearing succeeded
false
Clearing failed
File for output
R_PG_ExtInterrupt_<interrupt type>.c
<interrupt type>: IRQ0 to IRQ7 or NMI
RPDL function
Details
R_INTC_ControlExtInterrupt
•
Clears the interrupt request flag for an external interrupt (IRQ0 to IRQ7 or NMI).
•
If the level-sensitive interrupt is selected, the interrupt request flag is cleared when
high-level is input to the interrupt pin. The request flag of level-sensitive interrupt cannot
be cleared by this function.
Example
A case where the interrupt propriety level is set to 0:
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
void func(void)
{
bool flag;
//Set IRQ0.
R_PG_ExtInterrupt_Set_IRQ0();
do{
//Acquire the interrupt request flag for IRQ0.
R_PG_ExtInterrupt_GetRequestFlag_IRQ0( &flag );
}while( ! flag )
func_irq0();
//Processing of IRQ0
//Clear the interrupt request flag for IRQ0.
R_PG_ExtInterrupt_ClearRequestFlag_IRQ0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 81 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.4.5
Specification of Generated Functions
R_PG_SoftwareInterrupt_Set
Definition
bool R_PG_SoftwareInterrupt_Set(void)
Description
Set up the software interrupt
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_SoftwareInterrupt.c
RPDL function
R_INTC_CreateSoftwareInterrupt
Details
•
Sets up the software interrupt.
•
The software interrupt cannot be generated by calling this function. To generate the
software interrupt, call R_PG_SoftwareInterrupt_Generate.
Example
A case where SwIntFunc was specified as the name of the software interrupt notification
function in the GUI.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
void SwIntFunc(void);
void func(void)
{
//Set up the software interrupt
R_PG_SoftwareInterrupt_Set();
//Generate the software interrupt
R_PG_SoftwareInterrupt_Generate();
}
void SwIntFunc(void)
{
//Processing of software interrupt
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 82 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.4.6
Specification of Generated Functions
R_PG_SoftwareInterrupt_Generate
Definition
bool R_PG_SoftwareInterrupt_Generate(void)
Description
Generate the software interrupt
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_SoftwareInterrupt.c
RPDL function
R_INTC_Write
Details
•
Generates the software interrupt.
•
Call R_PG_SoftwareInterrupt_Set before calling this function to set up the software
interrupt.
Example
SwIntFunc was specified as the name of the software interrupt function in the GUI.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
void SwIntFunc(void);
void func(void)
{
//Set up the software interrupt
R_PG_SoftwareInterrupt_Set();
//Generate the software interrupt
R_PG_SoftwareInterrupt_Generate();
}
void SwIntFunc(void)
{
//Processing of software interrupt
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 83 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.4.7
Specification of Generated Functions
R_PG_FastInterrupt_Set
Definition
bool R_PG_FastInterrupt_Set (void)
Description
Set up the fast interrupt
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_FastInterrupt.c
RPDL function
R_INTC_CreateFastInterrupt
Details
•
Sets the interrupt source specified in the GUI as the fast interrupt. The specified interrupt
source is not set or enabled. The interrupt source to be set as the fast interrupt must be set
and enabled by the functions for the peripheral module.
•
This function uses an unconditional trap instruction (BRK) to set the fast-interrupt vector
register (FINTV). If interrupts are disabled (the interrupt enable bit (I) of the processor
status word is 0), this function will be locked.
•
The interrupt handler that is specified as a fast interrupt will be compiled as a fast
interrupt handler by specifying fint in #pragma interrupt declaration.
Example
A case where IRQ0 has been specified as the fast interrupt in the GUI:
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
void func(void)
{
//Set IRQ0 as the fast interrupt.
R_PG_FastInterrupt_Set ();
//Set IRQ0.
R_PG_ExtInterrupt_Set_IRQ0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 84 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.4.8
Specification of Generated Functions
R_PG_Exception_Set
Definition
bool R_PG_Exception_Set (void)
Description
Set the exception handlers
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_Exception.c
RPDL function
R_INTC_CreateExceptionHandlers
Details
•
Sets the exception notification functions. If an exception for which the name of the
exception notification function was specified in the GUI occurs after this function is
called, the function with the specified name will be called.
Create the exception notification function as follows:
void <name of the exception notification function> (void)
For the exception notification function, note the contents of 5.21, Notes on Notification
Functions.
Example
A case where the following exception notification functions have been set in the GUI:
Privileged instruction exception: PrivInstExcFunc
Undefined instruction exception: UndefInstExcFunc
Floating-point exception: FpExcFunc
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
void func(void)
{
//Set the exception handlers.
R_PG_Exception_Set();
}
void PrivInstExcFunc(){
func_pi_excep();
//Processing in response to a privileged instruction exception
}
void UndefInstExcFunc (){
func_ui_excep();
//Processing in response to an undefined instruction exception
}
void FpExcFunc (){
funct_fp_excep();
//Processing in response to a floating-point exception
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 85 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.5
Specification of Generated Functions
Buses
5.5.1
R_PG_ExtBus_SetBus
Definition
bool R_PG_ExtBus_SetBus(void)
Description
Set up the bus error monitoring
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_ExtBus.c
RPDL function
R_BSC_Create
Details
•
•
Sets up the bus error monitoring.
The bus error interrupt is set by this function. If [Notify the bus error interrupt by function
call] is selected in the GUI, the function having the specified name will be called when an
interrupt occurs. Create the interrupt notification function as follows:
void <name of the interrupt notification function> (void)
For the interrupt notification function, note the contents of 5.21, Notes on Notification
Functions.
The status of bus error generation can be acquired by calling
R_PG_ExtBus_ClearErrorFlags.
•
Example
A case where BusErrFunc has been specified as the name of the bus error interrupt
notification function.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
void func(void)
{
R_PG_ExtBus_SetBus();
}
//Set up the bus pins and bus error monitoring.
//Bus error notification function
void BusErrFunc(void)
{
bool addr_err;
uint8_t master;
uint16_t err_addr;
//Aquire bus error status
R_PG_ExtBus_GetErrorStatus(&addr_err, &master, &err_addr);
if( addr_err ){
//Processing when illegal address access error occurs
}
//Clear the bus error status registers
R_PG_ExtBus_ClearErrorFlags();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 86 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.5.2
Specification of Generated Functions
R_PG_ExtBus_GetErrorStatus
Definition
bool R_PG_ExtBus_GetErrorStatus
(bool * addr_err, uint8_t * master, uint16_t * err_addr)
Description
Acquire the status of bus error generation
Parameter
bool * addr_err
uint8_t * master
uint16_t * err_addr
Return value
true
Acquisition succeeded.
false
Acquisition failed.
File for output
R_PG_ExtBus.c
RPDL function
R_BSC_GetStatus
Details
•
•
The address of storage area for the illegal address access error flag
The address of storage area for ID code of bus master that accessed
a bus when a bus error occurred
ID code of bus master:
0:CPU 3: DTC
The address of storage area for upper 13 bits of an address that was
accessed when a bus error occurred
Acquires the status of bus error generation from the bus error status registers.
Specify the address of storage area for an item to be acquired. Specify 0 for an item that is
not required.
Example
R20UT0681EJ0103
May 16, 2014
Refer to the example of R_PG_ExtBus_SetBus
Rev.1.03
Page 87 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.5.3
Specification of Generated Functions
R_PG_ExtBus_ClearErrorFlags
Definition
bool R_PG_ExtBus_ClearErrorFlags(void)
Description
Clear the bus-error status registers
Parameter
None
Return value
true
Clearing succeeded
false
Clearing failed
File for output
R_PG_ExtBus.c
RPDL function
R_BSC_Control
Details
•
•
Example
R20UT0681EJ0103
May 16, 2014
Clears the bus-error status registers (illegal address access error flag, ID code of bus
master and a value of accessed address).
The DMA interrupt request flag (IR flag) is cleared in this function.
Refer to the example of R_PG_ExtBus_SetBus
Rev.1.03
Page 88 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.6
Specification of Generated Functions
Data Transfer Controller (DTC)
5.6.1
R_PG_DTC_Set
Definition
bool R_PG_DTC_Set (void)
Description
Set the common options for DTC
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_Dtc.c
RPDL function
R_DTC_Set
Details
•
This function configures the read skip control, address mode and the DTC vector table
base address.
Example
A case where the setting is made as follows.
•
The DTC vector table address has been set to 15000h.
•
The transfer setting of which the transfer start trigger is IRQ0 has been made.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
//DTC vector table
#pragma address dtc_vector_table = 0x00015000
uint32_t dtc_vector_table [256];
//Set up the DTC
void func(void)
{
// Set the common options for DTC
R_PG_DTC_Set();
//Make the transfer setting of which the transfer start trigger is IRQ0
R_PG_DTC_Set_IRQ0();
//Make DTC be ready for the transfer start trigger
R_PG_DTC_Activate();
//Set up IRQ0
R_PG_ExtInterrupt_Set_IRQ0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 89 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.6.2
Specification of Generated Functions
R_PG_DTC_Set_<trigger source>
bool R_PG_DTC_Set_<trigger source> (void)
Definition
< trigger source > :
SWINT, CMT0 to 3, SPRI0, SPTI0, IRQ0 to 7, ADI0, S12ADI0 to 1, CMPI,
TGIA0 to D7, TCIV4 and 7, TGIU5 to W5, GTCIA0 to C3, GTCIE0 to E3,
GTCIV0 to V3, LOCOI, RXI0 to 2, TXI0 to 2, ICRXI0, ICTXI0
Description
Set the DTC transfer data
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_Dtc.c
RPDL function
R_DTC_Create
Details
•
•
•
Store the transfer data that will be triggered by transfer start trigger in specified address.
The transfer data of the chain transfer will also be stored.
If other transfer data has already been stored in the specified address, new data will be
overwritten.
This function does not set any interrupts used for transfer start triggers. Set up interrupts
by each peripheral function.
Select DTC as the request destination of interrupts used for the transfer start trigger.
•
•
Example
•
•
•
A case where the setting is made as follows.
The DTC vector table address has been set to 15000h.
The transfer setting of which the transfer start trigger is IRQ0 has been made.
The transfer setting of which the transfer start trigger is IRQ1 has been made.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
//DTC vector table
#pragma address dtc_vector_table = 0x00015000
uint32_t dtc_vector_table [256];
//Set up the DTC
void func(void)
{
// Set the common options for DTC
R_PG_DTC_Set();
//Make the transfer setting of which the transfer start trigger is IRQ0
R_PG_DTC_Set_IRQ0();
//Make the transfer setting of which the transfer start trigger is IRQ1
R_PG_DTC_Set_IRQ1();
//Make DTC be ready for the transfer start trigger
R_PG_DTC_Activate();
//Set up IRQ0 and IRQ1
R_PG_ExtInterrupt_Set_IRQ0();
R_PG_ExtInterrupt_Set_IRQ1();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 90 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.6.3
Specification of Generated Functions
R_PG_DTC_Activate
Definition
bool R_PG_DTC_Activate (void)
Description
Make the DTC be ready for the transfer start trigger
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_Dtc.c
RPDL function
R_DTC_Control
Details
•
•
Example
•
•
•
•
•
Makes the DTC be ready for the transfer start trigger.
Call R_PG_DTC_Set_<trigger source> to store the transfer data before calling this
function.
A case where the setting is made as follows.
The DTC vector table address has been set to 15000h.
The transfer setting of which the transfer start trigger is IRQ0 has been made.
“Request is transferred to CPU when specified transfer is completed” has been selected
in the interrupt setting.
The chain transfer has been disabled.
Irq0IntFunc has been specified as an IRQ0 interrupt notification function name.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
//DTC vector table
#pragma address dtc_vector_table = 0x00015000
uint32_t dtc_vector_table [256];
//Set up the DTC
void func(void)
{
// Set the common options for DTC
R_PG_DTC_Set();
//Make the transfer setting of which the transfer start trigger is IRQ0
R_PG_DTC_Set_IRQ0();
//Make DTC be ready for the transfer start trigger
R_PG_DTC_Activate();
}
void Irq0IntFunc(void)
{
//Disable the IRQ0
//(After specified number of transfer completes, transfer will be executed
// when the trigger is input. To stop the data transfer, disable the interrupt.)
R_PG_ExtInterrupt_Disable_IRQ0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 91 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.6.4
Specification of Generated Functions
R_PG_DTC_SuspendTransfer
Definition
bool R_PG_DTC_SuspendTransfer (void)
Description
Stop the data transfer
Parameter
None
Return value
true
Stopping succeeded
false
Stopping failed
File for output
R_PG_Dtc.c
RPDL function
R_DTC_Control
Details
•
Stops the data transfer.
•
If transfer is stopped during data transfer, the accepted start request is active until the
processing is completed.
Call R_DTC_Activate to resume the transfer.
Example
A case where the setting is made as follows.
The DTC vector table address has been set to 15000h.
•
•
The transfer setting of which the transfer start trigger is IRQ0 has been made.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
//DTC vector table
#pragma address dtc_vector_table = 0x00015000
uint32_t dtc_vector_table [256];
//Set up the DTC
void func(void)
{
// Set the common options for DTC
R_PG_DTC_Set();
//Make the transfer setting of which the transfer start trigger is IRQ0
R_PG_DTC_Set_IRQ0();
//Make DTC be ready for the transfer start trigger
R_PG_DTC_Activate();
//Set up IRQ0
R_PG_ExtInterrupt_Set_IRQ0();
}
//Suspend the DTC transfer
void func2(void)
{
R_PG_DTC_SuspendTransfer();
}
//Resume the DTC transfer
void func3(void)
{
R_PG_DTC_Activate();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 92 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.6.5
Specification of Generated Functions
R_PG_DTC_GetTransmitStatus
Definition
bool R_PG_DTC_GetTransmitStatus (uint8_t * vector, bool * active)
Description
Get transfer status
Parameter
uint8_t * vector
The address of storage area for the vector number of current data
transfer (Valid when “* active” is 1 )
bool * active
The address of storage area for the progress flag. If this value is 1, the
data transfer is processed.
Return value
true
Acquisition succeeded
false
Acquisition failed
File for output
R_PG_Dtc.c
RPDL function
R_DTC_GetStatus
Details
Example
•
This function acquires the active flag and the vector number of the current data transfer.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
uint8_t vector;
bool active;
void func(void)
{
//Get the DTC transfer status
R_PG_DTC_GetTransmitStatus ( &vector, &active);
if(active){
switch( vector ){
case 64:
//Processing when the transfer of vector 64 is in progress
break;
case 65:
//Processing when the transfer of vector 65 is in progress
break;
default:
}
}
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 93 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.6.6
Specification of Generated Functions
R_PG_DTC_StopModule
Definition
bool R_PG_DTC_StopModule (void)
Description
Shut down the DTC
Parameter
None
Return value
true
Shutting down succeeded
false
Shutting down failed
File for output
R_PG_Dtc.c
RPDL function
R_DTC_Destroy
Details
•
•
Example
A case where the setting is made as follows.
The DTC vector table address has been set to 15000h.
•
The transfer setting of which the transfer start trigger is IRQ0 has been made.
•
•
The transfer setting of which the transfer start trigger is IRQ1 has been made.
This function shuts down the DTC and places it in the module-stop state.
Disable the interrupt used for transfer start trigger before calling this function.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
//DTC vector table
#pragma address dtc_vector_table = 0x00015000
uint32_t dtc_vector_table [256];
void func(void)
{
// Set the common options for DTC
R_PG_DTC_Set();
//Make the transfer setting of which the transfer start trigger is IRQ0
R_PG_DTC_Set_IRQ0();
//Make the transfer setting of which the transfer start trigger is IRQ1
R_PG_DTC_Set_IRQ1();
//Make DTC be ready for the transfer start trigger
R_PG_DTC_Activate();
//Set up IRQ0 and IRQ1
R_PG_ExtInterrupt_Set_IRQ0();
R_PG_ExtInterrupt_Set_IRQ1();
}
void func2(void)
{
//Disable IRQ0 and IRQ1
R_PG_ExtInterrupt_Disable_IRQ0();
R_PG_ExtInterrupt_Disable_IRQ1();
//Shut down the DTC
R_PG_DTC_StopModule();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 94 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.7
Specification of Generated Functions
I/O Ports
5.7.1
R_PG_IO_PORT_Set_P<port number>
bool R_PG_IO_PORT_Set_P<port number> (void)
Definition
<port number>: 1 to 9 and A, B, D, E and G
Description
Set up the I/O port
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_IO_PORT_P<port number>.c
<port number>: 1 to 9 and A, B, D, E and G
RPDL function
Details
R_IO_PORT_Set
•
Selects the direction (input or output) and input buffer for pins for which [Used as I/O
port] was specified in the GUI.
•
This function is used to set all pins in a port for which [Used as I/O port] has been
selected.
Example
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
void func(void)
{
//Set P1.
R_PG_IO_PORT_Set_P1();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 95 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.7.2
Specification of Generated Functions
R_PG_IO_PORT_Set_P<port number><pin number>
bool R_PG_IO_PORT_Set_P<port number><pin number> (void)
Definition
<port number>: 1 to 9 and A, B, D, E and G
<pin number>: 0 to 7
Description
Set up the I/O port pin
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_IO_PORT_P<port number>.c
<port number>: 1 to 9 and A, B, D, E and G
RPDL function
Details
R_IO_PORT_Set
•
Selects the direction (input or output), input buffer, pulling up, and open-drain output for
a pin for which [Used as I/O port] was specified in the GUI.
•
Example
The setting only applies to one pin.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
void func(void)
{
//Set P10.
R_PG_IO_PORT_Set_P10();
//Set P11.
R_PG_IO_PORT_Set_P11();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 96 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.7.3
Specification of Generated Functions
R_PG_IO_PORT_Read_P<port number>
bool R_PG_IO_PORT_Read_P<port number> (uint8_t * data)
Definition
<port number>: 1 to 9 and A, B, D, E and G
Description
Read data from the I/O port register
Parameter
uint8_t * data
Destination for storage of the read pin state
Return value
true
Reading proceeded correctly.
false
Reading failed.
File for output
R_PG_IO_PORT_P<port number>.c
<port number>: 1 to 9 and A, B, D, E and G
RPDL function
Details
Example
R_IO_PORT_Read
•
Reads an I/O port register to acquire the states of the pins.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
void func(void)
{
uint8_t data
//Acquire the states of P1 pins.
R_PG_IO_PORT_Read_P1( &data );
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 97 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.7.4
Specification of Generated Functions
R_PG_IO_PORT_Read_P<port number><pin number>
bool R_PG_IO_PORT_Read_P<port number><pin number> (uint8_t * data)
Definition
<port number>: 1 to 9 and A, B, D, E and G
<pin number>: 0 to 7
Description
Read 1-bit data from the I/O port register
Parameter
uint8_t * data
Destination for storage of the read pin state
Return value
true
Reading proceeded correctly.
false
Reading failed.
File for output
R_PG_IO_PORT_P<port number>.c
(<port number>: 1 to 9 and A, B, D, E and G)
RPDL function
Details
Example
R_IO_PORT_Read
•
Reads an I/O port register to acquire the state of one pin.
•
The value is stored in the lowest-order bit of *data.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
void func(void)
{
uint8_t data_p10, data_p11;
//Acquire the state of pin P10.
R_PG_IO_PORT_Read_P10( & data_p10);
//Acquire the state of pin P11.
R_PG_IO_PORT_Read_P11( & data_p11);
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 98 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.7.5
Specification of Generated Functions
R_PG_IO_PORT_Write_P<port number>
Definition
bool R_PG_IO_PORT_Write_P<port number> (uint8_t data)
<port number>: 1 to 9 and A, B, D, E and G
Description
Write data to the I/O port data register
Parameter
uint8_t data
Value to be written
Return value
true
Writing proceeded correctly.
false
Writing failed.
File for output
R_PG_IO_PORT_P<port number>.c
<port number>: 1 to 9 and A, B, D, E and G
RPDL function
Details
R_IO_PORT_Write
•
Writes a value to an I/O port data register. A value written to the register is output from
the output port.
Example
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
void func(void)
{
//Set P1.
R_PG_IO_PORT_Set_P1();
//Output 0x03 from P1.
R_PG_IO_PORT_Set_P1( 0x03 );
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 99 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.7.6
Specification of Generated Functions
R_PG_IO_PORT_Write_P<port number><pin number>
bool R_PG_IO_PORT_Write_P<port number><pin number> (uint8_t data)
Definition
<port number>: 1 to 9 and A, B, D, E and G
<pin number>: 0 to 7
Description
Write 1-bit data to the I/O port data register
Parameter
uint8_t data
Value to be written
Return value
true
Writing proceeded correctly.
false
Writing failed.
File for output
R_PG_IO_PORT_P<port number>.c
<port number>: 1 to 9 and A, B, D, E and G
RPDL function
Details
R_IO_PORT_Write
•
Writes a value to an I/O port data register. A value written to an output port is output.
Store the value in the lowest-order bit of data.
Example
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
void func(void)
{
//Set P10.
R_PG_IO_PORT_Set_P10();
//Set P11.
R_PG_IO_PORT_Set_P11();
//Output low level from P10.
R_PG_IO_PORT_Write_P10( 0x00 );
//Output high level from P11.
R_PG_IO_PORT_Write_P11( 0x01 );
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 100 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.8
Specification of Generated Functions
Multi-Function Timer Pulse Unit 3 (MTU3)
5.8.1
R_PG_Timer_Set_MTU_U<unit number>_<channels>
Definition
bool R_PG_Timer_Set_MTU_U<unit number>_<channels> (void)
<unit number>: 0
<channels>: C0 to C7 or C3_C4 or C6_C7
Description
Set up the MTU
Parameter
None
Return value
true
false
File for output
R_PG_Timer_MTU_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 7
RPDL function
R_MTU3_Set, R_MTU3_Create
Details
•
•
•
•
•
•
•
R20UT0681EJ0103
May 16, 2014
Setting was made correctly
Setting failed
Releases the MTU from the module-stop and makes initial settings.
Interrupts of the MTU are set by this function. When the name of the interrupt notification
function has been specified in the GUI, if an interrupt occurs in the CPU, the function
having the specified name will be called. Create the interrupt notification function as
follows:
void <name of the interrupt notification function> (void)
For the interrupt notification function, note the contents of 5.21, Notes on Notification
Functions.
If the interrupt propriety level is set to 0 in the GUI, a CPU interrupt does not occur. The
state of a request flag can be acquired by calling
R_PG_Timer_GetRequestFlag_MTU_U<unit number>_C<channel number>.
When counting driven by an externally input clock, the external reset signal, input
capture, or pulse output is in use, the direction (input or output) and input buffer for the
pin to be used is set in this function.
To start the count operation, call R_PG_Timer_StartCount_MTU_U<unit
number>_C<channel number>(_<phase>) or
R_PG_Timer_SynchronouslyStartCount_MTU_U<unit number> after calling this
function.
In complementary PWM mode or reset-synchronized PWM mode, paired channels are set
up in the same time. Channels 3 and 4 are set up in channel 3 setting, channels 6 and 7 are
set up in channel 6 setting.
In complementary PWM mode or reset-synchronized PWM mode, PWM output is
disabled in the initial state. To enable the pin output, call
R_PG_Timer_ControlOutputPin_MTU_U<unit number>_<channels> before starting the
count operation.
Rev.1.03
Page 101 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Example 1
Specification of Generated Functions
A case where the setting is made as follows.
• MTU channel 6 was set up in normal mode
• Mtu6IcCmAIntFunc was specified as a compare match A interrupt notification function
name
#include "R_PG_default.h" //Include "R_PG_<project name>.h" to use this function.
void func(void)
{
R_PG_Timer_Set_MTU_U0_C6();
//Set up the MTU6
R_PG_Timer_StartCount_MTU_U0_C6();
// Start the count operation
}
void Mtu6IcCmAIntFunc(void)
{
//Processing in response to a compare match A interrupt
}
Example 2
A case where the setting is made as follows.
• MTU channel 3 and 4 were set up in complementary PWM mode
#include "R_PG_default.h" //Include "R_PG_<project name>.h" to use this function.
void func(void)
{
//Set up the MTU3 and MTU4 in complementary PWM mode
R_PG_Timer_Set_MTU_U0_C3_C4();
//Enable PWM output pin 1 positive and negative phase
R_PG_Timer_ControlOutputPin_MTU_U0_C3_C4(
1, //p1 : enable
1, //n1 : enable
0, //p2 : disable
0, //n2 : disable
0, //p3 : disable
0 //n3 : disable
);
// Start the MTU3 and 4 count operation
R_PG_Timer_SynchronouslyStartCount_MTU_U0(
0, //ch0
0, //ch1
0, //ch2
1, //ch3
1, //ch4
0, //ch6
0 //ch7
);
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 102 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.8.2
Specification of Generated Functions
R_PG_Timer_StartCount_MTU_U<unit number>_C<channel number>(_<phase>)
Definition
bool R_PG_Timer_StartCount_MTU_U<unit number>_C<channel number> (void)
<unit number>: 0
<channel number>: 0 to 7
bool R_PG_Timer_StartCount_MTU_U<unit number>_C<channel number>_<phase> (void)
<unit number>: 0
<channel number>: 5
<phase>: U, V or W
Description
Start the MTU count operation
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_Timer_MTU_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 7
RPDL function
R_MTU3_ControlChannel
Details
•
Starts the MTU count operation.
•
Call R_PG_Timer_Set_MTU_U<unit number>_<channels> to make the initial settings
before calling this function.
•
In complementary PWM mode or reset-synchronized PWM mode, start the count
operation of paired 2 channels simultaneously by
R_PG_Timer_SynchronouslyStartCount_MTU_U<unit number>.
•
R_PG_Timer_StartCount_MTU_U0_C5 can start the count of U, V, and W phase
simultaneously.
Example
A case where the setting is made as follows.
• MTU channel 1 was set up
• Mtu1IcCmAIntFunc was specified as the compare match A interrupt notification function
name
#include "R_PG_default.h" //Include "R_PG_<project name>.h" to use this function.
void func(void)
{
R_PG_Timer_Set_MTU_U0_C1();
//Set up the MTU1
R_PG_Timer_StartCount_MTU_U0_C1();
// Start the count operation
}
void Mtu1IcCmAIntFunc(void)
{
R_PG_Timer_HaltCount_MTU_U0_C1();
//Halt the count operation
func_cmA();
//Processing in response to a compare match A interrupt
R_PG_Timer_StartCount_MTU_U0_C1();
//Resume the count operation
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 103 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.8.3
Specification of Generated Functions
R_PG_Timer_SynchronouslyStartCount_MTU_U<unit number>
bool R_PG_Timer_SynchronouslyStartCount_MTU_U<unit number>
Definition
(bool ch0, bool ch1, bool ch2, bool ch3, bool ch4, bool ch6, bool ch7)
<unit number>: 0
Description
Start the MTU count operation of two or more channels simultaneously
Parameter
bool ch0
Count operation of channel 0 (0:Do not start count
1:Start count)
bool ch1
Count operation of channel 1 (0:Do not start count
1:Start count)
bool ch2
Count operation of channel 2 (0:Do not start count
1:Start count)
bool ch3
Count operation of channel 3 (0:Do not start count
1:Start count)
bool ch4
Count operation of channel 4 (0:Do not start count
1:Start count)
bool ch6
Count operation of channel 6 (0:Do not start count
1:Start count)
bool ch7
Count operation of channel 7 (0:Do not start count
1:Start count)
true
Setting was made correctly
false
Setting failed
Return value
File for output
R_PG_Timer_MTU_U<unit number>.c
<unit number>: 0
RPDL function
R_MTU3_ControlUnit
Details
•
Starts the MTU count operation of two or more channels simultaneously.
•
Call R_PG_Timer_Set_MTU_U<unit number>_<channels> to make the initial settings
before calling this function.
•
In complementary PWM mode or reset-synchronized PWM mode, start the count
operation of paired 2 channels simultaneously by this function.
Example
R20UT0681EJ0103
May 16, 2014
Refer to the example 2 of R_PG_Timer_Set_MTU_U<unit number>_<channels>
Rev.1.03
Page 104 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.8.4
Specification of Generated Functions
R_PG_Timer_HaltCount_MTU_U<unit number>_C<channel number>(_<phase>)
Definition
bool R_PG_Timer_HaltCount_MTU_U<unit number>_C<channel number> (void)
<unit number>: 0
<channel number>: 0 to 7
bool R_PG_Timer_HaltCount_MTU_U<unit number>_C<channel number>_<phase> (void)
<unit number>: 0
<channel number>: 5
<phase>: U, V or W
Description
Halt the MTU count operation
Parameter
None
Return value
true
Halting succeeded.
false
Halting failed.
File for output
R_PG_Timer_MTU_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 7
RPDL function
Details
R_MTU3_ControlChannel
•
Halts the MTU count operation.
•
To make the MTU resume counting, call
R_PG_Timer_StartCount_MTU_U<unit number>_C<channel number>(_<phase>) or
R_PG_Timer_SynchronouslyStartCount_MTU_U<unit number>.
•
R_PG_Timer_HaltCount_MTU_U0_C5 can stop the count of U, V, and W phase
simultaneously.
Example
A case where the setting is made as follows.
• MTU channel 1 was set up
• Mtu1IcCmAIntFunc was specified as the compare match A interrupt notification function
name
#include "R_PG_default.h" //Include "R_PG_<project name>.h" to use this function.
void func(void)
{
R_PG_Timer_Set_MTU_U0_C1();
//Set up the MTU1
R_PG_Timer_StartCount_MTU_U0_C1();
// Start the count operation
}
void Mtu1IcCmAIntFunc(void)
{
R_PG_Timer_HaltCount_MTU_U0_C1();
//Halt the count operation
func_cmA();
//Processing in response to a compare match A interrupt
R_PG_Timer_StartCount_MTU_U0_C1();
//Resume the count operation
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 105 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.8.5
Specification of Generated Functions
R_PG_Timer_GetCounterValue_MTU_U<unit number>_C<channel number>
Definition
bool R_PG_Timer_GetCounterValue_MTU_U<unit number>_C<channel number>
(uint16_t * counter_val)
<unit number>: 0
<channel number>: 0 to 4 and 6, 7
bool R_PG_Timer_GetCounterValue_MTU_U<unit number>_C<channel number>
( uint16_t * counter_u_val, uint16_t * counter_v_val, uint16_t * counter_w_val )
<unit number>: 0
<channel number>: 5
Description
Acquire the MTU counter value
Parameter
For MTU0 to MTU4 and MTU6, MTU7
uint16_t * counter_val
Destination for storage of the counter value
For MTU5
Return value
File for output
uint16_t * counter_u_val
Destination for storage of the counter U value
uint16_t * counter_v_val
Destination for storage of the counter V value
uint16_t * counter_w_val
Destination for storage of the counter value
true
Acquisition of the counter value succeeded.
false
Acquisition of the counter value failed.
R_PG_Timer_MTU_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 7
RPDL function
R_MTU3_ReadChannel
Details
•
Example
A case where the setting is made as follows.
• MTU channel 0 was set up
• Set TGRA as an input capture register and enable an input capture A interrupt
• Mtu0IcCmAIntFunc was specified as the input capture A interrupt notification function
name
Acquires the counter value of a MTU.
#include "R_PG_default.h" //Include "R_PG_<project name>.h" to use this function.
uint16_t counter_val;
void func(void)
{
R_PG_Timer_Set_MTU_U0_C0();
//Set up the MTU0
R_PG_Timer_StartCount_MTU_U0_C0();
// Start the count operation
}
void Mtu0IcCmAIntFunc(void)
{
// Acquire the value of the MTU0 counter
R_PG_Timer_GetCounterValue_MTU_U0_C0( & counter_val );
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 106 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.8.6
Specification of Generated Functions
R_PG_Timer_SetCounterValue_MTU_U<unit number>_C<channel
number>(_<phase>)
Definition
bool R_PG_Timer_SetCounterValue_MTU_U<unit number>_C<channel number>
(uint16_t counter_val)
<unit number>: 0
<channel number>: 0 to 4 and 6, 7
bool R_PG_Timer_SetCounterValue_MTU_U<unit number>_C<channel number>_<phase>
(uint16_t counter_val)
<unit number>: 0
<channel number>: 5
<phase>: U, V or W
bool R_PG_Timer_SetCounterValue_MTU_U<unit number>_C<channel number>
( uint16_t counter_u_val, uint16_t counter_v_val, uint16_t counter_w_val )
<unit number>: 0
<channel number>: 5
Description
Set the MTU counter value
Parameter
For MTU0 to MTU7
uint16_t counter_val
Value to be written to the counter
For MTU5
uint16_t counter_u_val
uint16_t counter_v_val
uint16_t counter_w_val
Value to be written to the counter U
Value to be written to the counter V
Value to be written to the counter W
Return value
true
false
Setting of the counter value succeeded.
Setting of the counter value failed.
File for output
R_PG_Timer_MTU_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 7
RPDL function
R_MTU3_ControlChannel
Details
•
Example
A case where the setting is made as follows.
• MTU channel 1 was set up
• Set TGRA as an output compare register and enable a compare match A interrupt
• Mtu1IcCmAIntFunc was specified as the compare match A interrupt notification function
name
Set the counter value of a MTU.
#include "R_PG_default.h" //Include "R_PG_<project name>.h" to use this function.
void func (void)
{
R_PG_Timer_Set_MTU_U0_C1(); //Set up the MTU1
R_PG_Timer_StartCount_MTU_U0_C1(); // Start the count operation
}
void Mtu1IcCmAIntFunc(void)
{
R_PG_Timer_SetCounterValue_MTU_U0_C1( 0 ); //Clear the counter
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 107 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.8.7
Specification of Generated Functions
R_PG_Timer_GetRequestFlag_MTU_U<unit number>_C<channel number>
Definition
bool R_PG_Timer_GetRequestFlag_MTU_U<unit number>_C<channel number>
( bool* cm_ic_a,
bool* cm_ic_b, bool* cm_ic_c, bool* cm_ic_d,
bool* cm_e,
bool* cm_f,
bool* ov,
bool* un
);
<unit number>: 0
<channel number>: 0 to 4 and 6, 7
bool R_PG_Timer_GetRequestFlag_MTU_U<unit number>_C<channel number>
( bool* cm_ic_u,
bool* cm_ic_v,
bool* cm_ic_w );
<unit number>: 0
<channel number>: 5
Description
Acquire and clear the MTU interrupt flags
Parameter
bool* cm_ic_a
The address of storage area for the compare match/input capture A flag
bool* cm_ic_b
The address of storage area for the compare match/input capture B flag
bool* cm_ic_c
The address of storage area for the compare match/input capture C flag
bool* cm_ic_d
The address of storage area for the compare match/input capture D flag
bool* cm_e
The address of storage area for the compare match E flag
bool* cm_f
The address of storage area for the compare match F flag
bool* ov
The address of storage area for the overflow flag
bool* un
The address of storage area for the underflow flag
bool* cm_ic_u
The address of storage area for the compare match/input capture U flag
bool* cm_ic_v
The address of storage area for the compare match/input capture V flag
bool* cm_ic_w
The address of storage area for the compare match/input capture W flag
Available flags for each channel are as follows.
Return value
File for output
MTU0
cm_ic_a to cm_ic_d, cm_e, cm_f, and ov
MTU1, 2
cm_ic_a, cm_ic_b, ov, and un
MTU3, 4, 6, 7
cm_ic_a to cm_ic_d, and ov
MTU5
MTU3, 6
(complementary PWM mode and
reset-synchronized PWM mode)
MTU4, 7
(complementary PWM mode and
reset-synchronized PWM mode)
cm_ic_u, cm_ic_v, and cm_ic_w
cm_ic_a and cm_ic_b
cm_ic_a, cm_ic_b, and un
true
Acquisition of the flags succeeded
false
Acquisition of the flags failed
R_PG_Timer_MTU_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 7
RPDL function
Details
R_MTU3_ReadChannel
•
•
•
This function acquires the interrupt flags of MTU.
All flags will be cleared in this function.
Specify the address of storage area for the flags to be acquired.
Specify 0 for a flag that is not required.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 108 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Example
•
•
•
Specification of Generated Functions
A case where the setting is made as follows.
MTU channel 1 was set up
TGRA is set as an output compare register and the compare match interrupt is enabled
The priority level of compare match interrupt is set to 0
#include "R_PG_default.h" //Include "R_PG_<project name>.h" to use this function.
bool cma_flag;
void func(void)
{
R_PG_Timer_Set_MTU_U0_C1(); //Set up the MTU1
R_PG_Timer_StartCount_MTU_U0_C1(); // Start the count operation
//Wait for the compare match A
do{
R_PG_Timer_GetRequestFlag_MTU_U0_C1(
& cma_flag, //a
0, //b
0, //c
0, //d
0, //e
0, //f
0, //e
0, //ov
0 //un
);
} while( !cma_flag );
//Processing in response to a compare match A
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 109 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.8.8
Specification of Generated Functions
R_PG_Timer_StopModule_MTU_U<unit number>
bool R_PG_Timer_StopModule_MTU_U<unit number> (void)
Definition
<unit number>: 0
Description
Shut down the MTU unit
Parameter
None
Return value
true
Shutting down succeeded
false
Shutting down failed
File for output
R_PG_Timer_MTU_U<unit number>.c
<unit number>: 0
RPDL function
Details
R_MTU3_Destroy
•
Stops a MTU and places it in the module-stop state. If two or more channels are running
when this function is called, all channels will be stopped. Call
R_PG_Timer_HaltCount_MTU_U<unit number>_C<channel number>(_<phase>) to
stop a single channel.
Example
•
•
A case where the setting is made as follows.
MTU channel 1 was set up
Set TGRA as an output compare register and enable a compare match A interrupt
Mtu1IcCmAIntFunc was specified as the compare match A interrupt notification function
name
#include "R_PG_default.h" //Include "R_PG_<project name>.h" to use this function.
void func(void)
{
R_PG_Timer_Set_MTU_U0_C1(); //Set up the MTU1
R_PG_Timer_StartCount_MTU_U0_C1(); // Start the count operation
}
void Mtu1IcCmAIntFunc(void)
{
// Stop the MTU unit 0
R_PG_Timer_StopModule_MTU_U0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 110 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.8.9
Specification of Generated Functions
R_PG_Timer_GetTGR_MTU_U<unit number>_C<channel number>
bool R_PG_Timer_GetRequestFlag_MTU_U<unit number>_C<channel number>
Definition
( uint16_t* tgr_a_val,
uint16_t* tgr_b_val,
uint16_t* tgr_d_val, uint16_t* tgr_e_val,
<unit number>: 0
<channel number>: 0 to 4 or 6, 7
uint16_t* tgr_c_val,
uint16_t* tgr_f_val
);
bool R_PG_Timer_GetRequestFlag_MTU_U<unit number>_C<channel number>
( uint16_t * tgr_u_val, uint16_t * tgr_v_val,
<unit number>: 0
<channel number>: 5
uint16_t * tgr_w_val );
Description
Acquire the general register value
Parameter
uint16_t* tgr_a_val
The address of storage area for the general register A value
uint16_t* tgr_b_val
The address of storage area for the general register B value
uint16_t* tgr_c_val
The address of storage area for the general register C value
uint16_t* tgr_d_val
The address of storage area for the general register D value
uint16_t* tgr_e_val
The address of storage area for the general register E value
uint16_t* tgr_f_val
The address of storage area for the general register F value
uint16_t* tgr_u_val
The address of storage area for the general register U value
uint16_t* tgr_v_val
The address of storage area for the general register V value
uint16_t* tgr_w_val
The address of storage area for the general register W value
Available arguments for each channel are as follows.
Return value
File for output
MTU0
tgr_a_val to tgr_f_val
MTU1, 2
tgr_a_val and tgr_b_val
MTU3, 4, 6, 7
tgr_a_val to tgr_d_val
MTU5
tgr_u_val to tgr_w_val
MTU3, 6 (complementary PWM mode)
tgr_a_val to tgr_e_val
MTU4, 7 (complementary PWM mode)
tgr_a_val to tgr_f_val
MTU3, 4, 6, 7 (reset-synchronized PWM mode)
tgr_a_val to tgr_d_val
true
Acquisition of the flags succeeded
false
Acquisition of the flags failed
R_PG_Timer_MTU_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 7
RPDL function
Details
R_MTU3_ReadChannel
•
•
This function acquires the general register value.
Specify the address of storage area for an item to be acquired. Specify 0 for an item that is
not required.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 111 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Example
Specification of Generated Functions
A case where the setting is made as follows.
• MTU channel 0 was set up
• Set TGRA as an input capture register and enable an input capture A interrupt
• Mtu0IcCmAIntFunc was specified as the input capture A interrupt notification function
name
#include "R_PG_default.h" //Include "R_PG_<project name>.h" to use this function.
uint16_t tgr_a_val;
void func(void)
{
R_PG_Timer_Set_MTU_U0_C0();
//Set up the MTU0
R_PG_Timer_StartCount_MTU_U0_C0();
// Start the count operation
}
void Mtu0IcCmAIntFunc(void)
{
// Acquire the value of the TGRA
R_PG_Timer_GetTGR_MTU_U0_C0(
& tgr_a_val, //a
0, //b
0, //c
0, //d
0, //e
0 //f
);
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 112 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.8.10
Specification of Generated Functions
R_PG_Timer_SetTGR_<general register>_MTU_U<unit number>_C<channel
number>
Definition
bool R_PG_Timer_SetTGR_<general register>_MTU_U<unit number>_C<channel number>
(uint16_t value);
<general register>:
MTU1, 2
: A or B
MTU3, 4, 6, 7
: A, B, C or D
MTU5
: U, V or W
MTU3, 4, 6, 7 (complementary PWM mode)
: A, B, C, D, E(*1), or F(*1)
MTU3, 4, 6, 7 (reset-synchronized PWM mode)
: A, B, C(*2), or D(*3)
(*1 Only when the double buffer operation is enabled)
(*2 Only when the TGRC is used as a buffer register)
(*3 Only when the TGRD is used as a buffer register)
<unit number>: 0
<channel number>: 0 to 7
Description
Set the general register value
Parameter
uint16_t value
Value to be written to the general register
Return value
true
Setting of the general register succeeded.
false
Setting of the general register failed.
File for output
R_PG_Timer_MTU_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 7
RPDL function
R_MTU3_ControlChannel
Details
•
Example
A case where the setting is made as follows.
• MTU channel 1 was set up
• Set TGRA as an output compare register and enable a compare match A interrupt
• Mtu1IcCmAIntFunc was specified as the compare match A interrupt notification function
name
This function sets the general register value.
#include "R_PG_default.h" //Include "R_PG_<project name>.h" to use this function.
void func (void)
{
R_PG_Timer_Set_MTU_U0_C1(); //Set up the MTU1
R_PG_Timer_StartCount_MTU_U0_C1(); // Start the count operation
}
void Mtu1IcCmAIntFunc(void)
{
R_PG_Timer_SetTGR_A__MTU_U0_C1( 1000 ); //Set TGRA
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 113 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.8.11
Specification of Generated Functions
R_PG_Timer_SetBuffer_AD_MTU_U<unit number>_C<channel number>
bool R_PG_Timer_SetBuffer_AD_MTU_U<unit number>_C<channel number>
Definition
( uint16_t tadcobr_a_val, uint16_t tadcobr_b_val );
<unit number>: 0
<channel number>: 4 or 7
Description
Set A/D converter start request cycle set buffer registers (TADCOBRA and TADCOBRB)
Conditions for
The buffer transfer of A/D converter start request cycle value is enabled.
output
Parameter
Return value
File for output
uint16_t tadcobr_a_val
Value to be written to TADCOBRA
uint16_t tadcobr_b_val
Value to be written to TADCOBRB
true
Setting of the counter value succeeded.
false
Setting of the counter value failed.
R_PG_Timer_MTU_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 3(*), 4, 6(*), 7
(* complementary PWM mode and reset-synchronized PWM mode)
RPDL function
Details
R_MTU3_ControlChannel
•
Example
•
This function sets the TADCOBRA and TADCOBRB values.
A case where the setting is made as follows.
Buffer transfer of A/D converter start request cycle set register has been enabled
#include "R_PG_default.h" //Include "R_PG_<project name>.h" to use this function.
void func (void)
{
R_PG_Timer_Set_MTU_U0_C4(); //Set up the MTU1
R_PG_Timer_StartCount_MTU_U0_C4(); // Start the count operation
}
void Mtu1IcCmAIntFunc(void)
{
// Set TADCOBRA and TADCOBRB
R_PG_Timer_SetBuffer_AD_MTU_U0_C4( 0x10, 0x20 );
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 114 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.8.12
Specification of Generated Functions
R_PG_Timer_SetBuffer_CycleData_MTU_U<unit number>_<channels>
bool R_PG_Timer_SetBuffer_CycleData_MTU_U<unit number>_<channels>
Definition
( uint16_t tcbr_val );
<unit number>: 0
<channels>: C3_C4 or C6_C7
Description
Set the cycle buffer register
Conditions for
MTU channels are set to complementary PWM mode
output
Parameter
uint16_t tcbr_val
Value to be written to the cycle buffer registerr
Return value
true
Setting of the counter value succeeded.
false
Setting of the counter value failed.
File for output
R_PG_Timer_MTU_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 3 or 6
RPDL function
Details
Example
R_MTU3_ControlUnit
•
This function sets the cycle buffer register (TCBRA (channel 3 and 4) or TCBRB
(channel 6 and 7).
#include "R_PG_default.h" //Include "R_PG_<project name>.h" to use this function.
void func (void)
{
R_PG_Timer_SetBuffer_CycleData_MTU_U0_C3_C4(0x1000);
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 115 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.8.13
Specification of Generated Functions
R_PG_Timer_SetOutputPhaseSwitch_MTU_U<unit number>_<channels>
bool R_PG_Timer_SetOutputPhaseSwitch_MTU_U<unit number>_<channels>
Definition
( uint8_t output_level );
<unit number>: 0
<channels>: C3_C4
Description
output
Switch PWM output level
• The MTU channels are set to complementary PWM mode or reset-synchronized PWM
mode
• The brushless DC motor control is enabled and the software is selected for the output
control method
Parameter
uint8_t output_level
Conditions for
PWM output setting (0 to 7)
The output level for each value is as follows
MTIOC3B MTIOC4A MTIOC4B
Value
U phase
V phase
W phase
0
1
2
3
4
5
6
7
Return value
File for output
OFF
ON
OFF
OFF
OFF
ON
OFF
OFF
OFF
OFF
ON
ON
OFF
OFF
OFF
OFF
OFF
OFF
OFF
OFF
ON
OFF
ON
OFF
MTIOC3D
U phase
MTIOC4C
V phase
MTIOC4D
W phase
OFF
OFF
ON
OFF
OFF
OFF
ON
OFF
OFF
OFF
OFF
OFF
ON
ON
OFF
OFF
OFF
ON
OFF
ON
OFF
OFF
OFF
OFF
true
Setting of the counter value succeeded.
false
Setting of the counter value failed.
R_PG_Timer_MTU_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 3
RPDL function
Details
Example
R_MTU3_ControlUnit
•
This function switches the PWM output level in brushless DC motor control
#include "R_PG_default.h" //Include "R_PG_<project name>.h" to use this function.
void func (void)
{
R_PG_Timer_SetOutputPhaseSwitch_MTU_U0_C3_C4 (0x7);
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 116 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.8.14
Specification of Generated Functions
R_PG_Timer_ControlOutputPin_MTU_U<unit number>_<channels>
bool R_PG_Timer_ControlOutputPin_MTU_U<unit number>_<channels>
Definition
( bool p1_enable,
bool n1_enable,
bool p2_enable,
bool n2_enable,
bool p3_enable, bool n3_enable )
<unit number>: 0
<channels>: C3_C4 or C6_C7
Description
Enable or disable the PWM output
MTU channels are set to complementary PWM mode or reset-synchronized PWM mode
Conditions for
output
Parameter
Return value
File for output
bool p1_enable
U positive phase (MTIOCmB) output (0: Disable
1: Enable)
bool n1_enable
U negative phase (MTIOCmD) output (0: Disable
1: Enable)
bool p2_enable
V positive phase (MTIOCnA) output (0: Disable
1: Enable)
bool n2_enable
V negative phase (MTIOCnC) output (0: Disable
1: Enable)
bool p3_enable
W positive phase (MTIOCnB) output (0: Disable
1: Enable)
bool n3_enable
W negative phase (MTIOCnD) output (0: Disable
m : 3, 6 n : 4, 7
1: Enable)
true
Setting of the counter value succeeded.
false
Setting of the counter value failed.
R_PG_Timer_MTU_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 3 or 6
RPDL function
Details
R_MTU3_ControlUnit
•
•
Example
R20UT0681EJ0103
May 16, 2014
This function enables or disables PWM output in complementary PWM mode or
reset-synchronized PWM mode.
In complementary PWM mode or reset-synchronized PWM mode, PWM output is
disabled in the initial state. To enable the pin output, call this function before starting the
count operation.
Refer to the example 2 of R_PG_Timer_Set_MTU_U<unit number>_<channels>
Rev.1.03
Page 117 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.8.15
Specification of Generated Functions
R_PG_Timer_SetBuffer_PWMOutputLevel_MTU_U<unit
number>_<channels>
Definition
bool R_PG_Timer_SetBuffer_PWMOutputLevel_MTU_U<unit number>_<channels>
( bool p1_high, bool n1_high, bool p2_high, bool n2_high,
bool p3_high, bool n3_high )
<unit number>: 0
<channels>: C3_C4 or C6_C7
Description
Set the PWM output level in the buffer register
MTU channels are set to complementary PWM mode or reset-synchronized PWM mode
Conditions for
output
Parameter
bool p1_high
bool n1_high
bool p2_high
bool n2_high
bool p3_high
bool n3_high
U positive phase (MTIOCmB) output
U negative phase (MTIOCmD) output
V positive phase (MTIOCnA) output
V negative phase (MTIOCnC) output
W positive phase (MTIOCnB) output
W negative phase (MTIOCnD) output
m : 3, 6 n : 4, 7
The output level in each value is as follows
Value
Category
0
1
Return value
File for output
Positive phase
Negative phase
Low
Low
Low
High
High
High
High
Low
Low
Low
High
Low
High
High
Low
High
Active level
Initial output
Compare match when up count
Compare match when down count
Active level
Initial output
Compare match when up count
Compare match when down count
true
Setting of the counter value succeeded.
false
Setting of the counter value failed.
R_PG_Timer_MTU_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 3 or 6
RPDL function
Details
Example
R_MTU3_ControlUnit
•
This function sets the output level settings to the timer output level buffer register
(TOLBRA (channel 3 and 4) or TOLBRB (channel 6 and 7)
#include "R_PG_default.h" //Include "R_PG_<project name>.h" to use this function.
void func (void)
{
R_PG_Timer_SetBuffer_PWMOutputLevel_MTU_U0_C3_C4( 0, 0, 0, 0, 0, 0 );
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 118 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.8.16
Specification of Generated Functions
R_PG_Timer_ControlBufferTransfer_MTU_U<unit number>_<channels>
Definition
bool R_PG_Timer_ControlBufferTransfer_MTU_U<unit number>_<channels>
(bool enable)
<unit number>: 0
<channels>: C3_C4 or C6_C7
Description
Enable or disable buffer transfer from the buffer registers to the temporary registers
Conditions for
output
•
•
Parameter
bool enable
Buffer transfer control (0 :Disable
Return value
true
Setting of the counter value succeeded.
false
Setting of the counter value failed.
File for output
The MTU channels are set to complementary PWM mode
Interrupt skipping function 1 is selected for the interrupt skipping mode
1 :Enable)
R_PG_Timer_MTU_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 3 or 6
RPDL function
Details
Example
R_MTU3_ControlUnit
•
This function enables or disables transfer from the buffer registers used in complementary
PWM mode to the temporary registers.
#include "R_PG_default.h" //Include "R_PG_<project name>.h" to use this function.
void func (void)
{
R_PG_Timer_ControlBufferTransfer_MTU_U0_C3_C4( 1 );
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 119 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.9
Specification of Generated Functions
Port Output Enable 3 (POE3)
5.9.1
R_PG_POE_Set
Definition
bool R_PG_POE_Set (void)
Description
Set up the POE
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_POE.c
RPDL function
R_POE_Set, R_POE_Create
•
•
•
•
Example
Sets up the output control of MTU0, 3, 4, 6, 7 and GPT0, 1, 2, 3 pins, the POE pins used for
high-impedance request signal input, and the output enable interrupt.
The MTU and GPT module is not set up in this function.
Do not set pins that are not used for MTU output.
When the name of the interrupt notification function has been specified in the GUI, if an
interrupt occurs in the CPU, the function having the specified name will be called. Create the
interrupt notification function as follows:
void <name of the interrupt notification function> (void)
For the interrupt notification function, note the contents of 5.21, Notes on Notification
Functions.
A case where the setting is made as follows.
• The output enable interrupt 2(OEI2) has been set
PoeOei2IntFunc has been specified as an interrupt notification function name
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
R_PG_POE_Set();
}
// Set up the POE
void PoeOei2IntFunc (void)
{
// Processing when the output enable interrupt occurs
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 120 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.9.2
Specification of Generated Functions
R_PG_POE_SetHiZ_<Timer channels>
Definition
bool R_PG_POE_SetHiZ_<Timer channels>(void)
<Timer channels>: MTU3_4, MTU6_7, MTU0, GPT0_1, GPT2_3
Description
Place the timer output pins in high-impedance state
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_POE.c
RPDL function
R_POE_Control
Details
Example
Places MTU0, 3, 4, 6, 7, or GPT0, 1, 2, 3 output pins in high-impedance state.
A case where the setting is made as follows.
• MTU0 pin output has been set (Setting of MTU)
• MTU0 output pins have been set to be controlled by the high impedance request
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func1(void)
{
R_PG_Timer_Set_MTU_U0_C0();
//Set up the MTU0
R_PG_POE_Set();
// Set up the POE
R_PG_Timer_StartCount_MTU_U0_C0();
//Start the count operation of MTU0
}
void func2(void)
{
R_PG_POE_SetHiZ_MTU0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
// Place the MTU0 output pins in high-impedance state
Page 121 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.9.3
Specification of Generated Functions
R_PG_POE_GetRequestFlagHiZ_<Timer channels>
Definition
bool R_PG_POE_GetRequestFlagHiZ_MTU3_4 (bool* poe0)
bool R_PG_POE_GetRequestFlagHiZ_MTU6_7 (bool* poe4)
bool R_PG_POE_GetRequestFlagHiZ_MTU0 (bool* poe8)
bool R_PG_POE_GetRequestFlagHiZ_GPT0_1 (bool* poe10)
bool R_PG_POE_GetRequestFlagHiZ_GPT2_3 (bool* poe11)
Description
Acquire the high-impedance request flags
Parameter
bool* poe0
bool* poe4
bool* poe8
bool* poe10
bool* poe11
The address of storage area for POE0# high-impedance request flags
The address of storage area for POE4# high-impedance request flags
The address of storage area for POE8# high-impedance request flags
The address of storage area for POE10# high-impedance request flags
The address of storage area for POE11# high-impedance request flags
Return value
true
Acquisition succeeded
false
Acquisition failed
File for output
R_PG_POE.c
RPDL function
R_POE_GetStatus
Details
•
Acquires the flags of high-impedance request signals input to POEn#pins(n:0 to 9) (POEnF
n:0 to 9).
Specify the address of storage area for the flags to be acquired. Specify 0 for a flag that is not
required.
The flag is valid only when the POE pin is set to a high-impedance request input in GUI.
•
•
Example
A case where the setting is made as follows.
• MTU3 and 4 pin output has been set (Setting of MTU)
• MTU3 and 4 output pins have been set to be controlled by the high impedance request
• POE0 has been selected as a high-impedance request signal input
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
bool poe0;
void func(void)
{
R_PG_Timer_Set_MTU_U0_C3();
//Set up the MTU
R_PG_POE_Set();
// Set up the POE
R_PG_Timer_StartCount_MTU_U0_C3();
//Start the count operation of MTU
//Wait for the high-impedance request signal to be input
do{
R_PG_POE_GetRequestFlagHiZ_MTU3_4( &poe0, 0, 0, 0 );
}while( ! poe0 );
//Processing when the high-impedance request signal is input
R_PG_POE_ClearFlag_MTU3_4();
//Clear high-impedance request flag
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 122 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.9.4
Specification of Generated Functions
R_PG_POE_GetShortFlag_<Timer channels>
Definition
bool R_PG_POE_GetShortFlag_MTU3_4 (bool * detected)
bool R_PG_POE_GetShortFlag_MTU6_7 (bool * detected)
Description
Acquire the MTU output short flags
Parameter
bool* detected
The address of storage area for the output short flag (MTU3,4:OSF1 or
MTU6,7:OSF2)
Return value
true
Acquisition succeeded
false
Acquisition failed
File for output
R_PG_POE.c
RPDL function
R_POE_GetStatus
Details
•
Example
A case where the setting is made as follows.
• The output enable interrupt1(OEI1) has been set.
• PoeOei1IntFunc has been specified as the output enable interrupt 1 notification function
name.
Acquires the MTU3 ,4 or MTU6,7 complementary PWM output short flags (MTU3,4:OSF1
or MTU6,7:OSF2).
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
R_PG_POE_Set();
}
// Set up the POE
void PoeOei1IntFunc(void)
{
bool detected;
//Acquire the output short flag
R_PG_POE_GetShortFlag_MTU3_4 (&detected);
if( detected ){
//Processing when MTU3,4 output short is detected
R_PG_POE_ClearFlag_MTU3_4();
// Clear the output short flag(OSF1)
}
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 123 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.9.5
Specification of Generated Functions
R_PG_POE_ClearFlag_<Timer channels>
bool R_PG_POE_ClearFlag_<Timer channels> (void)
Definition
<Timer channels>: MTU3_4, MTU6_7, MTU0, GPT0_1, GPT2_3
Description
Clear the high-impedance request flags and the output short flags
Parameter
None
Return value
true
Clearing succeeded
false
Clearing failed
File for output
R_PG_POE.c
RPDL function
R_POE_Control
Details
Example
R20UT0681EJ0103
May 16, 2014
•
•
Clears the high-impedance request flags and the output short flags.
The flags that shall be cleared by each function are as follows.
Timer channels
Flags
MTU3, 4
MTU6, 7
MTU0
GPT0,1
GPT2,3
POE0 request flag (POE0F), MTU3,4 output short flag(OSF1)
POE4 request flag (POE4F), MTU6,7 output short flag(OSF2)
POE8 request flag (POE8F)
POE10 request flag (POE10F)
POE11 request flag (POE11F)
Refer to the example of R_PG_POE_GetShortFlag_<Timer channels>
Rev.1.03
Page 124 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10
Specification of Generated Functions
General PWM Timer (GPT)
5.10.1
R_PG_Timer_Set_GPT_U<unit number>
bool R_PG_Timer_Set_GPT_U<unit number> (void)
Definition
<unit number>: 0
Description
Set up the GPT
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_Timer_GPT_U<unit number>.c
<unit number>: 0
RPDL function
Details
R_GPT_Set, R_GPT_ControlUnit
•
Releases the GPT from the module-stop and sets the timer input/output pins to be used.
This function also sets up LOCO count function when it has been set in GUI. Call this
function before calling R_PG_Timer_Set_GPT_U<unit number>_C<channel number>.
•
To start the LOCO count, call R_PG_Timer_StartCount_LOCO_GPT_U<unit number>
after calling this function.
Example
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
R_PG_Timer_Set_GPT_U0(); // Release GPT form module stop
R_PG_Timer_Set_GPT_U0_C0(); // Set up GPT0
R_PG_Timer_SetGTCCR_A_GPT_U0_C0( 0x6000 ); // Set GTCCRA
R_PG_Timer_SetGTCCR_C_GPT_U0_C0( 0x4000 ); // Set GTCCRC
R_PG_Timer_StartCount_GPT_U0_C0(); // Start the count operaion
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 125 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.2
Specification of Generated Functions
R_PG_Timer_Set_GPT_U<unit number>_C<channel number>
Definition
bool R_PG_Timer_Set_GPT_U<unit number>_C<channel number> (void)
<unit number>: 0
<channel number>: 0 to 3
Description
Set up the GPT channel
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_Timer_GPT_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 3
RPDL function
Details
R_GPT_Create, R_GPT_ControlChannel
•
This function makes initial settings for GPT channel.
•
Call R_PG_Timer_Set_GPT_U<unit number> before calling this function to release GPT
from module-stop state.
•
The compare capture registers (GTCCRA to GTCCRF) are not set in this function. Call
functions R_PG_Timer_SetGTCCR_n_GPT_U<unit number>_C<channel number> (n :
A to F) to set the compare capture registers. In saw-wave one-shot pulse mode and
triangle-wave PWM mode 3, compare capture registers A and B can be set by forcible
buffer transfer. The forcible buffer transfer can be executed by
R_PG_Timer_Buffer_Force_GPT_U<unit number>_C<channel number> .
•
To start the count operation call R_PG_Timer_StartCount_GPT_U<unit
number>_C<channel number> or R_PG_Timer_SynchronouslyStartCount_GPT_U<unit
•
Example
R20UT0681EJ0103
May 16, 2014
number> after setting the compare capture registers.
Interrupts of the GPT are set by this function. When the name of the interrupt notification
function has been specified in the GUI, if an interrupt occurs in the CPU, the function
having the specified name will be called. Create the interrupt notification function as
follows:
void <name of the interrupt notification function> (void)
For the interrupt notification function, note the contents of 5.21, Notes on Notification
Functions.
Refer to the example of R_PG_Timer_Set_GPT_U<unit number>.
Rev.1.03
Page 126 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.3
Specification of Generated Functions
R_PG_Timer_StartCount_GPT_U<unit number>_C<channel number>
Definition
bool R_PG_Timer_StartCount_GPT_U<unit number>_C<channel number> (void)
<unit number>: 0
<channel number>: 0 to 3
Description
Start the GPT count operation
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_Timer_GPT_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 3
RPDL function
Details
R_GPT_ControlChannel
•
Starts the GPT count operation.
•
Call R_PG_Timer_Set_GPT_U<unit number> and R_PG_Timer_GPT_U<unit
number>_C<channel number> to make the initial settings before calling this function.
•
To start the count operation of two or more channels simultaneously, use
R_PG_Timer_SynchronouslyStartCount_GPT_U<unit number>.
Example
R20UT0681EJ0103
May 16, 2014
Refer to the example of R_PG_Timer_Set_GPT_U<unit number>.
Rev.1.03
Page 127 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.4
Specification of Generated Functions
R_PG_Timer_SynchronouslyStartCount_GPT_U<unit number>
bool R_PG_Timer_SynchronouslyStartCount_GPT_U<unit number>
Definition
( bool gpt0, bool gpt1,
<unit number>: 0
bool gpt2,
bool gpt3 )
Description
Start the GPT count operation of two or more channels simultaneously
Parameter
bool gpt0
Count operation of channel 0 (0:Do not start count
1:Start count)
bool gpt1
Count operation of channel 1 (0:Do not start count
1:Start count)
bool gpt2
Count operation of channel 2 (0:Do not start count
1:Start count)
bool gpt3
Count operation of channel 3 (0:Do not start count
1:Start count)
true
Setting was made correctly
false
Setting failed
Return value
File for output
R_PG_Timer_GPT_U<unit number>.c
<unit number>: 0
RPDL function
Details
R_GPT_ControlUnit
•
Starts the GPT count operation of two or more channels simultaneously.
•
Call R_PG_Timer_Set_GPT_U<unit number> and R_PG_Timer_GPT_U<unit
number>_C<channel number> to make the initial settings before calling this function.
Example
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func1(void)
{
R_PG_Timer_Set_GPT_U0(); // Release GPT form module stop
R_PG_Timer_Set_GPT_U0_C0(); // Set up GPT0
R_PG_Timer_Set_GPT_U0_C2(); // Set up GPT2
R_PG_Timer_SetGTCCR_A_GPT_U0_C0( 0x0000 ); // Set GPT0.GTCCRA
R_PG_Timer_SetGTCCR_C_GPT_U0_C0( 0x00ff ); // Set GPT0.GTCCRC
R_PG_Timer_SetGTCCR_A_GPT_U0_C2( 0x0000 ); // Set GPT2.GTCCRA
R_PG_Timer_SetGTCCR_C_GPT_U0_C2( 0x00ff ); // Set GPT2.GTCCRC
}
void func2(void)
{
// Start the count operation of GPT0 and 2
R_PG_Timer_SynchronouslyStartCount_GPT_U0( 1, 0, 1, 0 );
}
void func3(void)
{
// Halt the count operation of GPT0 and 2
R_PG_Timer_SynchronouslyHaltCount_GPT_U0( 1, 0, 1, 0 );
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 128 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.5
Specification of Generated Functions
R_PG_Timer_HaltCount_GPT_U<unit number>_C<channel number>
Definition
bool R_PG_Timer_HaltCount_GPT_U<unit number>_C<channel number> (void)
<unit number>: 0
<channel number>: 0 to 3
Description
Halt the GPT count operation
Parameter
None
Return value
true
Halting succeeded.
false
Halting failed.
File for output
R_PG_Timer_GPT_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 3
RPDL function
Details
R_GPT_ControlChannel
•
Halts the GPT count operation.
•
To resume the count operation, call
R_PG_Timer_StartCount_GPT_U<unit number>_C<channel number> or
R_PG_Timer_SynchronouslyStartCount_GPT_U<unit number>.
Example
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
// Halt the count operation of GPT0
R_PG_Timer_HaltCount_GPT_U0_C0();
// Set counter
R_PG_Timer_SetCounterValue_GPT_U0_C0( 0xff );
// Start the count operaion of GPT0
R_PG_Timer_StartCount_GPT_U0_C0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 129 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.6
Specification of Generated Functions
R_PG_Timer_SynchronouslyHaltCount_GPT_U<unit number>
bool R_PG_Timer_SynchronouslyHaltCount_GPT_U<unit number>
Definition
( bool gpt0, bool gpt1,
<unit number>: 0
bool gpt2,
bool gpt3 )
Description
Halt the GPT count operation of two or more channels simultaneously
Parameter
bool gpt0
Count operation of channel 0 (0:Do not stop count
1:Stop count)
bool gpt1
Count operation of channel 1 (0:Do not stop count
1:Stop count)
bool gpt2
Count operation of channel 2 (0:Do not stop count
1:Stop count)
bool gpt3
Count operation of channel 3 (0:Do not stop count
1:Stop count)
true
Halting succeeded.
false
Halting failed.
Return value
File for output
R_PG_Timer_GPT_U<unit number>.c
<unit number>: 0
RPDL function
Details
R_GPT_ControlUnit
•
Halts the GPT count operation of two or more channels simultaneously.
•
To resume the count operation, call
R_PG_Timer_StartCount_GPT_U<unit number>_C<channel number> or
R_PG_Timer_SynchronouslyStartCount_GPT_U<unit number>.
Example
R20UT0681EJ0103
May 16, 2014
Refer to the example of R_PG_Timer_SynchronouslyStartCount_GPT_U<unit number>.
Rev.1.03
Page 130 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.7
Specification of Generated Functions
R_PG_Timer_SetGTCCR_<GTCCR>_GPT_U<unit number>_C<channel
number>
bool R_PG_Timer_SetGTCCR_<GTCCR>_GPT_U<unit number>_C<channel number>
Definition
( uint16_t gtccr_val )
<GTCCR>: A to F
<unit number>: 0
<channel number>: 0 to 3
Description
Write the value to the compare capture register ( GTCCRn
Parameter
uint16_t gtccr_val
The value to be written to the compare capture register
Return value
true
Setting was made correctly
false
Setting failed
File for output
n : A to F )
R_PG_Timer_GPT_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 3
RPDL function
Details
R_GPT_ControlChannel
•
This function sets the compare capture register ( GTCCRn
•
The compare capture registers are not set in
n : A to F ) .
R_PG_Timer_Set_GPT_U<unit number>_C<channel number>.
To write the value to the compare capture registers in the initial setting, use this function.
Example
R20UT0681EJ0103
May 16, 2014
Refer to the example of R_PG_Timer_Set_GPT_U<unit number>.
Rev.1.03
Page 131 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.8
Specification of Generated Functions
R_PG_Timer_GetGTCCR_GPT_U<unit number>_C<channel number>
bool R_PG_Timer_GetGTCCR_GPT_U<unit number>_C<channel number>
( uint16_t * gtccr_a_val, uint16_t * gtccr_b_val, uint16_t * gtccr_c_val,
uint16_t * gtccr_d_val, uint16_t * gtccr_e_val, uint16_t * gtccr_f_val
)
Definition
<unit number>: 0
<channel number>: 0 to 3
Description
Get the value from the compare capture registers ( GTCCRA to F )
Parameter
uint16_t * gtccr_a_val
The address of storage area for compare capture register A value
uint16_t * gtccr_b_val
The address of storage area for compare capture register B value
uint16_t * gtccr_c_val
The address of storage area for compare capture register C value
uint16_t * gtccr_d_val
The address of storage area for compare capture register D value
uint16_t * gtccr_e_val
The address of storage area for compare capture register E value
uint16_t * gtccr_f_val
The address of storage area for compare capture register F value
true
Acquisition succeeded
false
Acquisition failed
Return value
File for output
R_PG_Timer_GPT_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 3
RPDL function
Details
R_GPT_ReadChannel
•
This function acquires the compare capture register ( GTCCRA to F ) value.
•
Specify the address of storage area for an item to be acquired. Specify 0 for an item that is
not required.
Example
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
uint16_t gtccr_a_val, gtccr_c_val;
void func(void)
{
//Get GTCCRA and GTCCRB value
R_PG_Timer_GetGTCCR_GPT_U0_C0(
&gtccr_a_val,
//GTCCRA
0,
//GTCCRB (not required)
&gtccr_c_val,
//GTCCRC
0,
//GTCCRD (not required)
0,
//GTCCRE (not required)
0
//GTCCRF (not required)
);
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 132 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.9
Specification of Generated Functions
R_PG_Timer_SetCounterValue_GPT_U<unit number>_C<channel number>
bool R_PG_Timer_SetCounterValue_GPT_U<unit number>_C<channel number>
Definition
( uint16_t counter_val )
<unit number>: 0
<channel number>: 0 to 3
Description
Set the GPT counter value
Parameter
uint16_t counter_val
The value to be written to the counter
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_Timer_GPT_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 3
RPDL function
Details
Example
R_GPT_ControlChannel
•
Set the counter value
•
The counter value can be changed only when the counting is stopped.
Refer to the example of R_PG_Timer_HaltCount_GPT_U<unit number>_C<channel
number>.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 133 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.10
Specification of Generated Functions
R_PG_Timer_GetCounterValue_GPT_U<unit number>_C<channel number>
bool R_PG_Timer_GetCounterValue_GPT_U<unit number>_C<channel number>
Definition
( uint16_t * counter_val )
<unit number>: 0
<channel number>: 0 to 3
Description
Get the GPT counter value
Parameter
uint16_t * counter_val
The address of storage area for compare capture register A value
Return value
true
Acquisition succeeded
false
Acquisition failed
File for output
R_PG_Timer_GPT_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 3
RPDL function
Details
Example
R_GPT_ReadChannel
•
Get the counter value
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
uint16_t counter_val;
void func(void)
{
//Get counter value
R_PG_Timer_GetCounterValue_GPT_U0_C0( & counter_val );
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 134 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.11
Specification of Generated Functions
R_PG_Timer_SynchronouslyClearCounter_GPT_U<unit number>
bool R_PG_Timer_SynchronouslyClearCounter_GPT_U<unit number>
Definition
( bool gpt0, bool gpt1,
<unit number>: 0
bool gpt2,
bool gpt3 )
Description
Clear the counter of two or more channels simultaneously
Parameter
bool gpt0
GPT0 counter clearing control ( 0:Do not clear counter 1:Clear counter )
bool gpt1
GPT1 counter clearing control ( 0:Do not clear counter 1:Clear counter )
bool gpt2
GPT2 counter clearing control ( 0:Do not clear counter 1:Clear counter )
bool gpt3
GPT3 counter clearing control ( 0:Do not clear counter 1:Clear counter )
true
Clearing succeeded
false
Clearing failed
Return value
File for output
R_PG_Timer_GPT_U<unit number>.c
<unit number>: 0
RPDL function
Details
Example
R_GPT_ControlUnit
•
Clear the GPT counter of two or more channels simultaneously.
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
uint16_t counter_val;
void func(void)
{
//Clear the counter of GPT0 and GPT2
R_PG_Timer_SynchronouslyClearCounter_GPT_U0( 1, 0, 1, 0 );
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 135 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.12
Specification of Generated Functions
R_PG_Timer_SetCycle_GPT_U<unit number>_C<channel number>
Definition
bool R_PG_Timer_SetCycle_GPT_U<unit number>_C<channel number> (uint16_t gtpr_val )
<unit number>: 0
<channel number>: 0 to 3
Description
Set the timer cycle setting register (GTPR)
Parameter
uint16_t gtpr_val
The value to be written to the timer cycle setting register
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_Timer_GPT_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 3
RPDL function
Details
Example
R_GPT_ControlChannel
•
This function sets the timer cycle setting register (GTPR).
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
//Set timer cycle register
R_PG_Timer_SetCycle_GPT_U0_C0( 0x6000 );
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 136 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.13
Specification of Generated Functions
R_PG_Timer_SetBuffer_Cycle_GPT_U<unit number>_C<channel number>
bool R_PG_Timer_SetBuffer_Cycle_GPT_U<unit number>_C<channel number>
Definition
( uint16_t gtpbr_val )
<unit number>: 0
<channel number>: 0 to 3
Description
Set the timer cycle setting buffer register (GTPBR)
Conditions for
The buffer operation of the cycle setting register (GTPR) is selected
output
Parameter
uint16_t gtpbr_val
The value to be written to the timer cycle setting buffer register
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_Timer_GPT_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 3
RPDL function
Details
Example
R_GPT_ControlChannel
•
This function sets the timer cycle setting buffer register (GTPBR).
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
//Set timer cycle setting buffer register
R_PG_Timer_SetBuffer_Cycle_GPT_U0_C0( 0x5000 );
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 137 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.14
Specification of Generated Functions
R_PG_Timer_SetDoubleBuffer_Cycle_GPT_U<unit number>_C<channel
number>
bool R_PG_Timer_SetDoubleBuffer_Cycle_GPT_U<unit number>_C<channel number>
Definition
( uint16_t gtpdbr_val )
<unit number>: 0
<channel number>: 0 to 3
Description
Set the timer cycle setting double-buffer register (GTPDBR)
Conditions for
The double buffer operation of the cycle setting register (GTPR) is selected
output
Parameter
uint16_t gtpdbr_val
The value to be written to the timer cycle setting double-buffer
register
Return value
File for output
true
Setting was made correctly
false
Setting failed
R_PG_Timer_GPT_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 3
RPDL function
Details
Example
R_GPT_ControlChannel
•
This function sets the timer cycle setting double-buffer register (GTPDBR).
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
//Set timer cycle setting double-buffer register
R_PG_Timer_SetDoubleBuffer_Cycle_GPT_U0_C0( 0x4000 );
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 138 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.15
Specification of Generated Functions
R_PG_Timer_SetAD_GPT_U<unit number>_C<channel number>
bool R_PG_Timer_SetAD_GPT_U<unit number>_C<channel number>
Definition
( uint16_t gtadtra_val, uint16_t gtadtrb_val )
<unit number>: 0
<channel number>: 0 to 3
Description
Set the A/D converter start request timing register A, B (GTADTRA, B)
Conditions for
The A/D converter start request is enabled
output
Parameter
Return value
File for output
uint16_t gtadtra_val
The value to be written to GTADTRA
uint16_t gtadtrb_val
The value to be written to GTADTRB
true
Setting was made correctly
false
Setting failed
R_PG_Timer_GPT_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 3
RPDL function
Details
Example
R_GPT_ControlChannel
•
This function sets the A/D converter start request timing register A, B (GTADTRA, B).
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
// Set the A/D converter start request timing registers
R_PG_Timer_SetAD_GPT_U0_C0(
0x3000, // A/D converter start request timing register A (GTADTRA)
0x2000 // A/D converter start request timing register B (GTADTRB)
);
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 139 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.16
Specification of Generated Functions
R_PG_Timer_SetBuffer_AD_GPT_U<unit number>_C<channel number>
bool R_PG_Timer_SetBuffer_AD_GPT_U<unit number>_C<channel number>
Definition
( uint16_t gtadtbra_val, uint16_t gtadtbrb_val )
<unit number>: 0
<channel number>: 0 to 3
Description
Set the A/D converter start request timing buffer register A, B (GTADTBRA,
GTADTBRB)
Conditions for
The buffer transfer of A/D converter start request timing register is enabled
output
Parameter
Return value
File for output
uint16_t gtadtbra_val
The value to be written to GTADTBRA
uint16_t gtadtbrb_val
The value to be written to GTADTBRB
true
Setting was made correctly
false
Setting failed
R_PG_Timer_GPT_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 3
RPDL function
Details
R_GPT_ControlChannel
•
This function sets the A/D converter start request timing buffer register A, B
(GTADTBRA, GTADTBRB).
Example
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
// Set the A/D converter start request timing buffer registers
R_PG_Timer_SetBuffer_AD_GPT_U0_C0(
0x6000, // A/D converter start request timing buffer register A (GTADTBRA)
0x3000 // A/D converter start request timing buffer register B (GTADTBRB)
);
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 140 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.17
Specification of Generated Functions
R_PG_Timer_SetDoubleBuffer_AD_GPT_U<unit number>_C<channel
number>
bool R_PG_Timer_SetDoubleBuffer_AD_GPT_U<unit number>_C<channel number>
Definition
( uint16_t gtadtdbra_val, uint16_t gtadtdbrb_val )
<unit number>: 0
<channel number>: 0 to 3
Description
Set the A/D converter start request timing double-buffer register A, B (GTADTDBRA,
GTADTDBRB)
Conditions for
The double-buffer transfer of A/D converter start request timing register is enabled
output
Parameter
Return value
File for output
uint16_t gtadtdbra_val
The value to be written to GTADTDBRA
uint16_t gtadtdbrb_val
The value to be written to GTADTDBRB
true
Setting was made correctly
false
Setting failed
R_PG_Timer_GPT_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 3
RPDL function
Details
R_GPT_ControlChannel
•
This function sets the A/D converter start request timing double-buffer register A, B
(GTADTDBRA, GTADTDBRB).
Example
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
// Set the A/D converter start request timing double-buffer register
R_PG_Timer_SetDoubleBuffer_AD_GPT_U0_C0(
0x8000, // GTADTDBRA
0x4000 // GTADTDBRB
);
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 141 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.18
Specification of Generated Functions
R_PG_Timer_SetBuffer_GTDV<U/D>_GPT_U<unit number>_C<channel
number>
bool R_PG_Timer_SetBuffer_GTDVU_GPT_U<unit number>_C<channel number>
Definition
( uint16_t gtdbu_val )
bool R_PG_Timer_SetBuffer_GTDVD_GPT_U<unit number>_C<channel number>
( uint16_t gtdbd_val)
<unit number>: 0
<channel number>: 0 to 3
Description
Set the timer dead time buffer register U, D (GTDBU, GTDBD)
Conditions for
Automatic addition of dead time is enabled
output
Parameter
Return value
File for output
uint16_t gtdbu_val
The value to be written to GTDBU
uint16_t gtdbd_val
The value to be written to GTDBD
true
Setting was made correctly
false
Setting failed
R_PG_Timer_GPT_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 3
RPDL function
Details
R_GPT_ControlChannel
•
This function sets the timer dead time buffer register U, D (GTDBU, GTDBD) that are
the buffer registers of the timer dead time value register U, D (GTDVU, GTDVD),.
Example
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
// Set the timer dead time buffer register U
R_PG_Timer_SetBuffer_GTDVU_GPT_U0_C0( 0x500 );
// Set the timer dead time buffer register D
R_PG_Timer_SetBuffer_GTDVD_GPT_U0_C0( 0x300 );
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 142 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.19
Specification of Generated Functions
R_PG_Timer_GetRequestFlag_GPT_U<unit number>_C<channel number>
bool R_PG_Timer_GetRequestFlag_GPT_U<unit number>_C<channel number>
( bool * cm_ic_a, bool * cm_ic_b, bool * cm_c,
bool * cm_d,
bool * cm_e,
bool * cm_f,
bool * ov,
bool * un,
bool * dt_error )
Definition
<unit number>: 0
<channel number>: 0 to 3
Description
Get and clear the GPT interrupt flag
Parameter
bool * cm_ic_a
The address of storage area for the compare match/input capture A flag
bool * cm_ic_b
The address of storage area for the compare match/input capture B flag
bool * cm_c
The address of storage area for the compare match/input capture C flag
bool * cm_d
The address of storage area for the compare match/input capture D flag
bool * cm_e
The address of storage area for the compare match/input capture E flag
bool * cm_f
The address of storage area for the compare match/input capture F flag
bool * ov
The address of storage area for the overflow flag
bool * un
The address of storage area for the underflow flag
bool * dt_error
The address of storage area for the dead time error flag
true
Acquisition succeeded
false
Acquisition failed
Return value
File for output
R_PG_Timer_GPT_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 3
RPDL function
R_GPT_ReadChannel
Details
•
•
•
This function acquires the interrupt flags of GPT.
All flags will be cleared in this function.
Specify the address of storage area for the flags to be acquired. Specify 0 for a flag that is not
required.
Example
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
bool cm_ic_a, ov;
void func(void)
{
//Get compare match/input capture A flag and overflow flag
R_PG_Timer_GetRequestFlag_GPT_U0_C0(
&cm_ic_a, // Compare match/input capture A flag
0,
// Compare match/input capture B flag (not required )
0,
// Compare match/input capture C flag (not required )
0,
// Compare match/input capture D flag (not required )
0,
// Compare match/input capture E flag (not required )
0,
// Compare match/input capture F flag (not required )
&ov,
// Overflow flag
0,
// Underflow flag (not required )
0
// dead time error flag (not required )
}
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 143 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.20
Specification of Generated Functions
R_PG_Timer_GetRequestFlag_GPT_U<unit number>
bool R_PG_Timer_GetRequestFlag_GPT_U<unit number>
bool * loco_deviation,
bool * loco_ov,
( bool * loco_rising,
bool * ext_rising,
bool * ext_falling )
Definition
<unit number>: 0
<channel number>: 0 to 3
Description
Get and clear the GPT interrupt flags of LOCO count function and external trigger
Parameter
bool * loco_rising
bool * loco_deviation
bool * loco_ov
bool * ext_rising
bool * ext_falling
Return value
The address of storage area for the frequency-divided LOCO clock
rise interrupt request flag
The address of storage area for the fLOCO count value deviation
exceedance interrupt request flag
The address of storage area for the LCNT overflow interrupt
request flag
The address of storage area for the external trigger rising input
interrupt request flag
The address of storage area for the external trigger falling input
interrupt request flag
true
Acquisition succeeded
false
Acquisition failed
File for output
R_PG_Timer_GPT_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 3
RPDL function
R_GPT_ReadUnit
Details
•
•
•
This function acquires and clears the interrupt flags of LOCO count function and external
trigge.
All flags will be cleared in this function.
Specify the address of storage area for the flags to be acquired. Specify 0 for a flag that is not
required.
Example
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
bool loco_deviation, ext_rising;
void func(void)
{
//Get fLOCO count deviation exceedance interrupt flag and
//external trigger rising input interrupt flag
R_PG_Timer_GetRequestFlag_GPT_U0 (
0,
// frequency-divided LOCO clock rise interrupt flag (not required)
&loco_deviation, // fLOCO count deviation exceedance interrupt flag
0,
// LCNT overflow interrupt flag (not required)
&ext_rising,
// External trigger rising input interrupt flag
0
// External trigger falling input interrupt flag (not required)
);
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 144 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.21
Specification of Generated Functions
R_PG_Timer_GetCounterStatus_GPT_U<unit number>_C<channel number>
bool R_PG_Timer_GetCounterStatus_GPT_U<unit number>_C<channel number>
( bool * active, bool * up )
Definition
<unit number>: 0
<channel number>: 0 to 3
Description
Get the counter status
Parameter
bool * active
bool * up
Return value
The address of storage area for the count start bit
( 0 : Count operation is performed 1 : Count operation is stopped )
The address of storage area for the count direction flag
( 0 : Downward 1 : Upward )
true
Acquisition succeeded
false
Acquisition failed
File for output
R_PG_Timer_GPT_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 3
RPDL function
R_GPT_ReadChannel
Details
•
•
This function acquires the count start bit and count direction flag.
Specify the address of storage area for the flags to be acquired. Specify 0 for a flag that is not
required.
Example
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
bool up;
void func(void)
{
//Get count direction
R_PG_Timer_GetCounterStatus_GPT_U0_C0 (
0,
// Count start bit (not required)
& up
// Count direction flag
);
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 145 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.22
Specification of Generated Functions
R_PG_Timer_BufferEnable_GPT_U<unit number>_C<channel number>
bool R_PG_Timer_BufferEnable_GPT_U<unit number>_C<channel number>
Definition
( bool gtccr,
bool gtpr,
bool gtadtr,
bool gtdv )
<unit number>: 0
<channel number>: 0 to 3
Description
Enable the buffer operation
Parameter
bool gtccr
bool gtpr
bool gtadtr
bool gtdv
Return value
Buffer operation setting of compare capture register GTCCRA, GTCCRC,
GTCCRD and GTCCRB, GTCCRE, GTCCRF.
( 0:Do not enable buffer operation 1:Enable buffer operation)
Buffer operation setting of timer cycle setting register (GTPR) and timer
cycle setting buffer register (GTPBR)
( 0:Do not enable buffer operation 1:Enable buffer operation)
Buffer operation setting of A/D converter start request timing register
(GTADTRA), A/D converter start request timing buffer register
(GTADTBRA) and A/D converter start request timing double-buffer register
(GTADTDBRA)
( 0:Do not enable buffer operation 1:Enable buffer operation)
Buffer operation setting of timer dead time value register U, D (GTDVU,
GTDVD) and timer dead time value register U,D (GTDBU, GTDBD)
( 0:Do not enable buffer operation 1:Enable buffer operation)
true
Setting was made correctly
false
Setting failed
File for output
R_PG_Timer_GPT_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 3
RPDL function
R_GPT_ControlChannel
Details
Example
•
This function enables the buffer operation.
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
// Enable buffer operation of GTCCRA, C, D and GTCCRB, E, F.
R_PG_Timer_BufferEnable_GPT_U0_C0 (
1, //Enable buffer operation of GTCCRA, C, D and GTCCRB, E, F
0, //Do not enable buffer operation of GTPR
0, //Do not enable buffer operation of GTADTRA
//Do not enable buffer operation of GTDVU and GTDVD
0
);
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 146 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.23
Specification of Generated Functions
R_PG_Timer_BufferDisable_GPT_U<unit number>_C<channel number>
bool R_PG_Timer_BufferDisable_GPT_U<unit number>_C<channel number>
Definition
( bool gtccr,
bool gtpr,
bool gtadtr,
bool gtdv )
<unit number>: 0
<channel number>: 0 to 3
Description
Disable the buffer operation
Parameter
bool gtccr
bool gtpr
bool gtadtr
bool gtdv
Return value
Buffer operation setting of compare capture register GTCCRA, GTCCRC,
GTCCRD and GTCCRB, GTCCRE, GTCCRF.
( 0:Do not disable buffer operation 1:Disable buffer operation)
Buffer operation setting of timer cycle setting register (GTPR) and timer
cycle setting buffer register (GTPBR)
( 0:Do not disable buffer operation 1:Disable buffer operation)
Buffer operation setting of A/D converter start request timing register
(GTADTRA), A/D converter start request timing buffer register
(GTADTBRA) and A/D converter start request timing double-buffer register
(GTADTDBRA)
( 0:Do not disable buffer operation 1:Disable buffer operation)
Buffer operation setting of timer dead time value register U, D (GTDVU,
GTDVD) and timer dead time value register U,D (GTDBU, GTDBD)
( 0:Do not disable buffer operation 1:Disable buffer operation)
true
Setting was made correctly
false
Setting failed
File for output
R_PG_Timer_GPT_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 3
RPDL function
R_GPT_ControlChannel
Details
Example
•
This function disables the buffer operation.
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
// Disable buffer operation of GTCCRA, C, D and GTCCRB, E, F.
R_PG_Timer_BufferDisable_GPT_U0_C0 (
1, //Disable buffer operation of GTCCRA, C, D and GTCCRB, E, F
0, //Do not disable buffer operation of GTPR
0, //Do not disable buffer operation of GTADTRA
//Do not disable buffer operation of GTDVU and GTDVD
0
);
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 147 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.24
Specification of Generated Functions
R_PG_Timer_Buffer_Force_GPT_U<unit number>_C<channel number>
bool R_PG_Timer_Buffer_Force_GPT_U<unit number>_C<channel number> (void)
Definition
<unit number>: 0
<channel number>: 0 to 3
Description
Execute forcible buffer transfer
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_Timer_GPT_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 3
RPDL function
R_GPT_ControlChannel
Details
Example
•
Execute forcible buffer transfer of GTCCRA and GTCCRB.
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
R_PG_Timer_Set_GPT_U0();
// Release GPT form module stop
R_PG_Timer_Set_GPT_U0_C0();
// Set up GPT0
R_PG_Timer_SetGTCCR_C_GPT_U0_C0( 0x6000 ); // Set GTCCRC
R_PG_Timer_SetGTCCR_D_GPT_U0_C0( 0x3000); // Set GTCCRD
R_PG_Timer_SetGTCCR_E_GPT_U0_C0( 0x8000 ); // Set GTCCRE
R_PG_Timer_SetGTCCR_F_GPT_U0_C0( 0x4000 ); // Set GTCCRF
R_PG_Timer_Buffer_Force_GPT_U0_C0();
//Execute forcible transfer
R_PG_Timer_StartCount_GPT_U0_C0();
// Start the count operaion
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 148 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.25
Specification of Generated Functions
R_PG_Timer_CountDirection_Down_GPT_U<unit number>_C<channel
number>
bool R_PG_Timer_CountDirection_Down_GPT_U<unit number>_C<channel number>
Definition
(bool force)
<unit number>: 0
<channel number>: 0 to 3
Description
Set the count direction to down-counting
Parameter
bool force
Forcible count direction setting
( 0:Do not set forcibly 1:Set forcibly)
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_Timer_GPT_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 3
RPDL function
R_GPT_ControlChannel
Details
Example
•
This function sets the count direction to down-counting.
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
// Set count direction to down ( Do not set forcibly)
R_PG_Timer_CountDirection_Down_GPT_U0_C0( 0 );
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 149 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.26
Specification of Generated Functions
R_PG_Timer_CountDirection_Up_GPT_U<unit number>_C<channel
number>
bool R_PG_Timer_CountDirection_Up_GPT_U<unit number>_C<channel number>
Definition
(bool force)
<unit number>: 0
<channel number>: 0 to 3
Description
Set the count direction to up-counting
Parameter
bool force
Forcible count direction setting
( 0:Do not set forcibly 1:Set forcibly)
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_Timer_GPT_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 3
RPDL function
R_GPT_ControlChannel
Details
Example
•
This function sets the count direction to up-counting.
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
// Set count direction to up ( Set forcibly )
R_PG_Timer_CountDirection_Up_GPT_U0_C0( 1 );
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 150 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.27
Specification of Generated Functions
R_PG_Timer_SoftwareNegate_GPT_U<unit number>_C<channel number>
bool R_PG_Timer_SoftwareNegate_GPT_U<unit number>_C<channel number>
Definition
( bool on )
<unit number>: 0
<channel number>: 0 to 3
Description
Control GTIOCnA and GTIOCnB pin output negation by software (n:Channel number)
Conditions for
GTIOCnA or GTIOCnB pin output negation control is enabled and software control is
output
selected for the negation source
Parameter
bool on
Output value of the negation source (1:ON
Return value
true
Setting was made correctly
false
Setting failed
0:OFF)
File for output
R_PG_Timer_GPT_U<unit number>_C<channel number>.c
<unit number>: 0
<channel number>: 0 to 3
RPDL function
R_GPT_ControlChannel
Details
Example
•
This function controls the negation of GTIOCnA and GTIOCnB pin output. (n:Channel
number)
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
// Set the value of the negation source to 1
R_PG_Timer_CountDirection_Up_GPT_U0_C0( 1 );
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 151 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.28
Specification of Generated Functions
R_PG_Timer_StartCount_LOCO_GPT_U<unit number>
Definition
bool R_PG_Timer_StartCount_LOCO_GPT_U<unit number> (void)
<unit number>: 0
Description
Start the LOCO count
Conditions for
The LOCO count function is enabled
output
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_Timer_GPT_U<unit number>.c
<unit number>: 0
RPDL function
Details
Example
R_GPT_ControlUnit
•
Starts the LOCO count
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
// Set up IWDT and start the count operation
R_PG_Timer_Set_IWDT();
R_PG_Timer_RefreshCounter_IWDT();
// Release GPT form module stop and set up LOCO count function
R_PG_Timer_Set_GPT_U0();
// Start the LOCO count
R_PG_Timer_StartCount_LOCO_GPT_U0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 152 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.29
Specification of Generated Functions
R_PG_Timer_HaltCount_LOCO_GPT_U<unit number>
Definition
bool R_PG_Timer_HaltCount_LOCO_GPT_U<unit number> (void)
<unit number>: 0
Description
Halt the LOCO count
Conditions for
The LOCO count function is enabled
output
Parameter
None
Return value
true
Halting succeeded.
false
Halting failed.
File for output
R_PG_Timer_GPT_U<unit number>.c
<unit number>: 0
RPDL function
Details
Example
R_GPT_ControlUnit
•
Halts the LOCO count
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
// Halt the LOCO count
R_PG_Timer_HaltCount_LOCO_GPT_U0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 153 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.30
Specification of Generated Functions
R_PG_Timer_ClearCounter_LOCO_GPT_U<unit number>
Definition
bool R_PG_Timer_ClearCounter_LOCO_GPT_U<unit number> (void)
<unit number>: 0
Description
Clear the LOCO count value register
Conditions for
The LOCO count function is enabled
output
Parameter
None
Return value
true
Clearing succeeded
false
Clearing failed
File for output
R_PG_Timer_GPT_U<unit number>.c
<unit number>: 0
RPDL function
Details
Example
R_GPT_ControlUnit
•
Clears the LOCO count value register
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
// Clear the LOCO count value register
R_PG_Timer_ClearCounter_LOCO_GPT_U0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 154 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.31
Specification of Generated Functions
R_PG_Timer_InitialiseCountResultValue_LOCO_GPT_U<unit number>
Definition
bool R_PG_Timer_InitialiseCountResultValue_LOCO_GPT_U<unit number> (void)
<unit number>: 0
Description
Initialize the LOCO count result registers
Conditions for
The LOCO count function is enabled
output
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_Timer_GPT_U<unit number>.c
<unit number>: 0
RPDL function
Details
Example
R_GPT_ControlUnit
•
Initialise the LOCO count result registers LCNT01 to LCNT15 using the LCNT00 value.
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
// Initialize the LOCO count result registers
R_PG_Timer_InitialiseCountResultValue_LOCO_GPT_U0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 155 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.32
Specification of Generated Functions
R_PG_Timer_GetCounterValue_LOCO_GPT_U<unit number>
Definition
bool R_PG_Timer_GetCounterValue_LOCO_GPT_U<unit number>
(uint16_t * loco_counter_val)
<unit number>: 0
Description
Get the value of the LOCO count value register
Conditions for
The LOCO count function is enabled
output
Parameter
uint16_t * loco_counter_val
The address of storage area for the LOCO count value
register
Return value
true
Acquisition succeeded
false
Acquisition failed
File for output
R_PG_Timer_GPT_U<unit number>.c
<unit number>: 0
RPDL function
Details
Example
R_GPT_ReadUnit
•
Gets the value of the LOCO count value register.
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
uint16_t loco_counter_val;
void func(void)
{
// Get the value of the LOCO count value register
R_PG_Timer_GetCounterValue_LOCO_GPT_U0( &loco_counter_val );
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 156 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.33
Specification of Generated Functions
R_PG_Timer_GetCounterAverageValue_LOCO_GPT_U<unit number>
Definition
bool R_PG_Timer_GetCounterAverageValue_LOCO_GPT_U<unit number>
(uint16_t * loco_counter_ave_val)
<unit number>: 0
Description
Get the LOCO count result average value
Conditions for
The LOCO count function is enabled
output
Parameter
uint16_t * loco_counter_ave_val
The address of storage area for the LOCO count result
average value
Return value
true
Acquisition succeeded
false
Acquisition failed
File for output
R_PG_Timer_GPT_U<unit number>.c
<unit number>: 0
RPDL function
Details
Example
R_GPT_ReadUnit
•
Get the LOCO count result average register value.
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
uint16_t
loco_counter_ave_val;
void func(void)
{
// Get the LOCO count result average value
R_PG_Timer_GetCounterAverageValue_LOCO_GPT_U0( & loco_counter_ave_val );
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 157 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.34
Specification of Generated Functions
R_PG_Timer_GetCountResultValue_LOCO_GPT_U<unit number>
Definition
bool R_PG_Timer_GetCountResultValue_LOCO_GPT_U<unit number>
(uint16_t * loco_count_result_val)
<unit number>: 0
Description
Get the LOCO count result registers value
Conditions for
The LOCO count function is enabled
output
Parameter
uint16_t * loco_count_result_val
A pointer to where the LOCO count result registers
value shall be stored.
(Provide space for 32-byte values)
Return value
true
Acquisition succeeded
false
Acquisition failed
File for output
R_PG_Timer_GPT_U<unit number>.c
<unit number>: 0
RPDL function
Details
Example
R_GPT_ReadUnit
•
Get the LOCO count result registers (LCNT00~LCNT15) value.
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
uint16_t
loco_count_result_val[16];
void func(void)
{
// Get the value of LOCO count result registers
R_PG_Timer_GetCountResultValue_LOCO_GPT_U0( loco_count_result_val );
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 158 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.35
Specification of Generated Functions
R_PG_Timer_SetPermissibleDeviation_LOCO_GPT_U<unit number>
Definition
bool R_PG_Timer_SetPermissibleDeviation_LOCO_GPT_U<unit number>
(uint16_t maximum_val, uint16_t minimum_val)
<unit number>: 0
Description
Set the LOCO count upper/lower permissible deviation value
Conditions for
The LOCO count function is enabled and the LOCO count value deviation exceedance
output
interrupt is enabled.
Parameter
uint16_t maximum_val
uint16_t minimum_val
Return value
File for output
The value to be written to the LOCO count upper
permissible deviation register
The value to be written to the LOCO count lower
permissible deviation register
true
Setting was made correctly
false
Setting failed
R_PG_Timer_GPT_U<unit number>.c
<unit number>: 0
RPDL function
Details
Example
R_GPT_ControlUnit
•
Sets the LOCO count upper/lower permissible deviation value.
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
// Set the LOCO count upper/lower permissible deviation value
R_PG_Timer_SetPermissibleDeviation_LOCO_GPT_U0(
0x10 // Upper permissible deviation
0x10 // Lower permissible deviation
);
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 159 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.10.36
Specification of Generated Functions
R_PG_Timer_StopModule_GPT_U<unit number>
bool R_PG_Timer_StopModule_GPT_U<unit number> (void)
Definition
<unit number>: 0
Description
Shut down the GPT
Parameter
None
Return value
true
Shutting down succeeded
False
Shutting down failed
File for output
R_PG_Timer_GPT_U<unit number>.c
<unit number>: 0
RPDL function
Details
R_GPT_Destroy
•
Stops a GPT and places it in the module-stop state. If two or more channels are running
when this function is called, all channels will be stopped. Call
R_PG_Timer_HaltCount_GPT_U<unit number>_C<channel number> or
R_PG_Timer_SynchronouslyHaltCount_GPT_U<unit number> to stop a single channel.
Example
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
// Shut down the GPT
R_PG_Timer_StopModule_GPT_U0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 160 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.11
Specification of Generated Functions
Compare Match Timer (CMT)
5.11.1
R_PG_Timer_Start_CMT_U<unit number>_C<channel number>
bool R_PG_Timer_Start_CMT_U<unit number>_C<channel number> (void)
Definition
<unit number>: 0 or 1
<channel number>: 0 to 3
Description
Set up the CMT and start the count operation
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_Timer_CMT_U<unit number>.c
<unit number>: 0 and 1
RPDL function
R_CMT_Create
Details
•
•
Example
Releases the CMT from the module-stop, makes initial settings, and starts the CMT
counting.
Interrupts of the CMT are set by this function. When the name of the interrupt notification
function has been specified in the GUI, if an interrupt occurs in the CPU, the function
having the specified name will be called. Create the interrupt notification function as
follows:
void <name of the interrupt notification function> (void)
For the interrupt notification function, note the contents of 5.21, Notes on Notification
Functions.
A case where the setting is made as follows.
• Cmt0IntFunc was specified as a compare match interrupt notification function name
#include "R_PG_default.h" //Include "R_PG_<project name>.h" to use this function.
void func(void)
{
R_PG_Timer_Start_CMT_U0_C0 (); //Set up the CMT0 and start the count operation
}
void Cmt0IntFunc (void)
{
func_cmt0();
//Processing in response to a compare match interrupt
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 161 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.11.2
Specification of Generated Functions
R_PG_Timer_HaltCount_CMT<unit number>_C<channel number>
bool R_PG_Timer_HaltCount_CMT_U<unit number>_C<channel number> (void)
Definition
<unit number>: 0 or 1
<channel number>: 0 to 3
Description
Halt the CMT count operation
Parameter
None
Return value
true
Halting succeeded.
false
Halting failed.
File for output
R_PG_Timer_CMT_U<unit number>.c
<unit number>: 0 or 1
RPDL function
Details
R_CMT_Control
•
Halts the CMT count operation.
•
To resume the count operation, call the following function.
R_PG_Timer_ResumeCount_CMT_U<unit number>_C<channel number>
Example
A case where the setting is made as follows.
• CMT unit 0 channel 0 was set up
• Cmt0IntFunc was specified as the compare match interrupt notification function name
#include "R_PG_default.h" //Include "R_PG_<project name>.h" to use this function.
void func(void)
{
R_PG_Timer_Start_CMT_U0_C0();
}
//Set up the CMT0 and start the count operation
void Cmt0IntFunc(void)
{
//Halt the CMT0 count operation
R_PG_Timer_HaltCount_CMT_U0_C0();
func_cmt0();
//Processing in response to a compare match interrupt
//Resume the CMT0 count operation
R_PG_Timer_ResumeCount_CMT_U0_C0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 162 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.11.3
Specification of Generated Functions
R_PG_Timer_ResumeCount_CMT_U<unit number>_C<channel number>
bool R_PG_Timer_ResumeCount_CMT_U<unit number>_C<channel number> (void)
Definition
<unit number>: 0 or 1
<channel number>: 0 to 3
Description
Resume the CMT count operation
Parameter
None
Return value
true
Resuming count succeeded.
false
Resuming count failed.
File for output
R_PG_Timer_CMT_U<unit number>.c
<unit number>: 0 or 1
RPDL function
Details
R_CMT_Control
•
Resumes the CMT count operation that was halted by
R_PG_Timer_HaltCount_CMT_U<unit number>_C<channel number>.
Example
A case where the setting is made as follows.
• CMT unit 0 channel 0 was set up
• Cmt0IntFunc was specified as the compare match interrupt notification function name
#include "R_PG_default.h" //Include "R_PG_<project name>.h" to use this function.
void func(void)
{
R_PG_Timer_Start_CMT_U0_C0(); //Set up the CMT0 and start the count operation
}
void Cmt0IntFunc(void)
{
//Halt the CMT0 count operation
R_PG_Timer_HaltCount_CMT_U0_C0();
func_cmt0();
//Processing in response to a compare match interrupt
//Resume the CMT0 count operation
R_PG_Timer_ResumeCount_CMT_U0_C0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 163 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.11.4
Specification of Generated Functions
R_PG_Timer_GetCounterValue_CMT_U<unit number>_C<channel number>
Definition
bool R_PG_Timer_GetCounterValue_CMT_U<unit number>_C<channel number>
(uint16_t * counter_val)
<unit number>: 0 or 1
<channel number>: 0 to 3
Description
Acquire the CMT counter value
Parameter
uint16_t * counter_val
Destination for storage of the counter value
Return value
true
Acquisition of the counter value succeeded.
false
Acquisition of the counter value failed.
File for output
R_PG_Timer_CMT_U<unit number>.c
<unit number>: 0 or 1
RPDL function
R_CMT_Read
Details
•
Example
A case where the setting is made as follows.
• CMT unit 0 channel 0 was set up
Acquires the counter value of a CMT.
#include "R_PG_default.h" //Include "R_PG_<project name>.h" to use this function.
uint16_t counter_val
void func1(void)
{
R_PG_Timer_Start_CMT_U0_C0(); //Set up the CMT0 and start the count operation
}
unt16_t func2(void)
{
uint16_t data;
// Acquire the value of a CMT0 counter
R_PG_Timer_GetCounterValue_CMT_U0_C0( &counter_val );
return data;
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 164 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.11.5
Specification of Generated Functions
R_PG_Timer_SetCounterValue_CMT_U<unit number>_C<channel number>
Definition
bool R_PG_Timer_SetCounterValue_CMT_U<unit number>_C<channel number>
(uint16_t counter_val)
<unit number>: 0 or 1
<channel number>: 0 to 3
Description
Set the CMT counter value
Parameter
uint16_t counter_val
Value to be written to the counter
Return value
true
Setting of the counter value succeeded.
false
Setting of the counter value failed.
File for output
R_PG_Timer_CMT_U<unit number>.c
<unit number>: 0 or 1
RPDL function
R_CMT_Control
Details
•
Example
A case where the setting is made as follows.
• CMT unit 0 channel 0 was set up
Set the counter value of a CMT.
#include "R_PG_default.h" //Include "R_PG_<project name>.h" to use this function.
void func1(void)
{
R_PG_Timer_Start_CMT_U0_C0();
}
//Set up the CMT0 and start the count operation
void func2(void)
{
R_PG_Timer_SetCounterValue_CMT_U0_C0( 0 ); // Set the value of a CMT0 counter
return;
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 165 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.11.6
Specification of Generated Functions
R_PG_Timer_StopModule_CMT_U<unit number>
bool R_PG_Timer_StopModule_CMT_U<unit number> (void)
Definition
<unit number>: 0 or 1
Description
Shut down the CMT unit
Parameter
None
Return value
true
Shutting down succeeded
false
Shutting down failed
File for output
R_PG_Timer_CMT_U<unit number>.c
<unit number>: 0 or 1
RPDL function
Details
R_CMT_Destroy
•
Stops a CMT unit and places it in the module-stop state per unit. If both CMT0 and
CMT1 of unit 0 (or both CMT2 and CMT3 of unit 1) are running when this function is
called, both channels are stopped. Call the following function to stop a single channel.
R_PG_Timer_HaltCount_CMT_U<unit number>_C<channel number>
Example
A case where the setting is made as follows.
CMT unit 0 channel 0 was set up
•
Cmt0IntFunc was specified as the compare match interrupt notification function name
#include "R_PG_default.h" //Include "R_PG_<project name>.h" to use this function.
void func(void)
{
R_PG_Timer_Start_CMT_U0_C0(); //Set up the CMT0 and start the count operation
}
void Cmt0IntFunc(void)
{
func_cmt();
//Processing in response to a compare match interrupt
R_PG_Timer_StopModule_CMT_U0();
// Stop the CMT unit 0
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 166 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.12
Specification of Generated Functions
Watchdog Timer (WDT)
5.12.1
R_PG_Timer_Start_WDT
Definition
bool R_PG_Timer_Start_WDT (void)
Description
Set up the WDT and start the count operation
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_Timer_ WDT.c
RPDL function
R_WDT_Create
Details
•
Makes initial settings of WDT and starts the count operation.
When the WDT is set to interval timer mode, the interval timer interrupt is set in this
function. When the name of the interrupt notification function has been specified in the
GUI, if an interrupt occurs in the CPU, the function having the specified name will be
called. Create the interrupt notification function as follows:
void <name of the interrupt notification function> (void)
For the interrupt notification function, note the contents of 5.21, Notes on Notification
Functions.
Example
A case where the setting is made as follows.
• The WDT has been set to interval timer mode.
• WdtIntFunc has been specified as a interval timer interrupt notification function name.
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
R_PG_Clock_Set(); //Set up the clocks
R_PG_Timer_Start_WDT(); //Set up the WDT and start the count operation
}
void WdtIntFunc(void)
{
//Processing when the interval timer interrupt occurs
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 167 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.12.2
Specification of Generated Functions
R_PG_Timer_HaltCount_WDT
Definition
bool R_PG_Timer_HaltCount_WDT (void)
Description
Stop the count operation
Parameter
None
Return value
true
Halting succeeded
false
Halting failed
File for output
R_PG_Timer_ WDT.c
RPDL function
R_WDT_Control
Details
•
•
Example
A case where the setting is made as follows.
• The WDT has been set to interval timer mode.
• WdtIntFunc has been specified as a interval timer interrupt notification function name.
Stops the WDT count operation.
Call R_PG_Timer_Start_WDT to resume the count operation.
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
R_PG_Clock_Set(); //Set up the clocks
R_PG_Timer_Start_WDT(); //Set up the WDT and start the count operation
}
void WdtIntFunc(void)
{
R_PG_Timer_HaltCount_WDT();
//Halt the WDT count operation
//Processing when the interval timer interrupt occurs
R_PG_Timer_Start_WDT();
//Set up the WDT and start the count operation
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 168 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.12.3
Specification of Generated Functions
R_PG_Timer_ResetCounter_WDT
Definition
bool R_PG_Timer_ResetCounter_WDT(void)
Description
Reset the counter of WDT
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_Timer_ WDT.c
RPDL function
R_WDT_Control
Details
Example
•
Resets the counter of WDT
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func1(void)
{
R_PG_Clock_Set(); //Set up the clocks
R_PG_Timer_Start_WDT(); //Set up the WDT and start the count operation
}
void func2(void)
{
R_PG_Timer_ResetCounter_WDT();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
//Reset the WDT counter
Page 169 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.12.4
Specification of Generated Functions
R_PG_Timer_ClearOverflowFlag_WDT
Definition
bool R_PG_Timer_ClearOverflowFlag_WDT (bool* ov)
Description
Reset the counter of WDT
Parameter
bool* ov
The address of storage area for the overflow flag
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_Timer_ WDT.c
RPDL function
R_WDT_Read
Details
•
•
Example
A case where the setting is made as follows.
• The WDT has been set to interval timer mode.
• The priority level of interval timer interrupt has been set to 0.
This function acquires the counter overflow flags and clears.
Specify 0 for a parameter if the flag is not required.
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
bool ov;
void func(void)
{
R_PG_Clock_Set(); //Set up the clocks
R_PG_Timer_Start_WDT(); //Set up the WDT and start the count operation
do{
R_PG_Timer_ClearOverflowFlag_WDT( &ov ); //Get the overflow flag
}while( !ov );
/Processing when the interval timer interrupt occurs
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 170 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.13
Specification of Generated Functions
Independent Watchdog Timer (IWDT)
5.13.1
R_PG_Timer_Set_IWDT
Definition
bool R_PG_Timer_Set_IWDT (void)
Description
Set up the IWDT
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_Timer_IWDT.c
RPDL function
R_IWDT_Set
Details
Example
•
•
Sets up the IWDT.
The IWDT count operation starts by counter refresh.
R_PG_Timer_RefreshCounter_IWDT can be used to refresh the counter
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
uint8_t output_val;
void func1(void)
{
//Set up the clocks
R_PG_Clock_Set();
//Set up the IWDT
R_PG_Timer_Set_WDT();
//Start the count operation by refreshing the counter
R_PG_Timer_RefreshCounter_IWDT();
}
void func2(void)
{
//Refresh the counter
R_PG_Timer_RefreshCounter_IWDT();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 171 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.13.2
Specification of Generated Functions
R_PG_Timer_RefreshCounter_IWDT
Definition
bool R_PG_Timer_RefreshCounter_IWDT (void)
Description
Refresh the counter
Parameter
None
Return value
true
Refreshing succeeded
false
Refreshing failed
File for output
R_PG_Timer_IWDT.c
RPDL function
R_IWDT_Control
Details
•
•
•
Example
R20UT0681EJ0103
May 16, 2014
Refreshes the IWDT counter
To start the count operation, call this function after setting up IWDT by
R_PG_Timer_Set_IWDT.
After starting the count operation, call this function to clear the counter before the counter
underflow.
Refer to the example of R_PG_Timer_Set_IWDT
Rev.1.03
Page 172 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.13.3
Specification of Generated Functions
R_PG_Timer_GetCounterValue_IWDT
Definition
bool R_PG_Timer_GetCounterValue_IWDT( uint16_t * counter_val )
Description
Acquire the IWDT counter value
Parameter
uint16_t * counter_val
The address of storage area for the IWDT counter value
Return value
true
Acquisition succeeded
false
Acquisition failed
File for output
R_PG_Timer_IWDT.c
RPDL function
R_IWDT_Read
Details
Example
•
•
Acquires the IWDT counter value.
The underflow flag shall be cleared in this function.
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
uint16_t counter_val;
void func1(void)
{
//Set up the clocks
R_PG_Clock_Set();
//Set up the IWDT
R_PG_Timer_Set_WDT();
//Start the count operation by refreshing the counter
R_PG_Timer_RefreshCounter_IWDT();
}
void func2(void)
{
R_PG_Timer_GetCounterValue_IWDT( &counter_val );
if( counter_val < 0x1000){
//Refresh the counter
R_PG_Timer_RefreshCounter_IWDT();
}
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 173 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.13.4
Specification of Generated Functions
R_PG_Timer_ClearUnderflowFlag_IWDT
Definition
bool R_PG_Timer_ClearUnderflowFlag_IWDT( bool * un )
Description
Acquire and clear the underflow flag
Parameter
bool * un
The address of storage area for the underflow flag
Return value
true
Acquisition succeeded
false
Acquisition failed
File for output
R_PG_Timer_IWDT.c
RPDL function
R_IWDT_Read
Details
Example
•
•
Acquires and clears the underflow flag.
Specify 0 for a parameter if the flag is not required.
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
bool un;
void func(void)
{
R_PG_Timer_ClearUnderflowFlag_IWDT ( &un );
if(un){
// Processing after a reset caused by a couter underflow
}
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 174 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.14
Specification of Generated Functions
Serial Communications Interface (SCIb)
5.14.1
R_PG_SCI_Set_C<channel number>
bool R_PG_SCI_Set_C<channel number> (void)
Definition
<channel number>: 0 to 2
Description
Set up a SCI channel
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_SCI_C<channel number>.c
<channel number>: 0 to 2
RPDL function
Details
R_SCI_Create, R_SCI_Set
•
Releases a SCI channel from the module-stop state, makes initial settings, and the
direction (input or output) and input buffer for the pin to be used is set.
•
Function R_PG_Clock_Set must be called before calling this function.
•
When the name of the notification function has been specified in the GUI, if
corresponding event occurs, the function having the specified name will be called. Create
the notification function as follows:
void <name of the notification function> (void)
For the notification function, note the contents of 5.21, Notes on Notification Functions.
Example
SCI0 has been set in the GUI.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
void func(void)
{
R_PG_Clock_Set();
R_PG_SCI_Set_C0();
//The clock-generation circuit has to be set first.
//Set up SCI0.
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 175 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.14.2
Specification of Generated Functions
R_PG_SCI_StartSending_C<channel number>
bool R_PG_SCI_StartSending_C<channel number> (uint8_t * data, uint16_t count)
Definition
<channel number>: 0 to 2
Description
Start the data transmission
Conditions for
•
The function of transmission is selected for a SCI channel in GUI.
output
•
"Notify the transmission completion of all data by function call" is selected as the data
transmission method in GUI.
Parameter
uint8_t * data
uint16_t count
The start address of the data to be sent.
The number of the data to be sent.
Set this to 0 if the transmit data is a character string (ending with a null
character).
Return value
File for output
true
Setting was made correctly
false
Setting failed
R_PG_SCI_C<channel number>.c
<channel number>: 0 to 2
RPDL function
Details
R_SCI_Send
•
This function starts the data transmission.
•
This function is generated when "Notify the transmission completion of all data by
function call" is selected as the data transmission method in GUI. This function returns
immediately and the notification function having the specified name will be called when
the last byte has been sent.
Create the notification function as follows:
void <name of the notification function> (void)
For the notification function, note the contents of 5.21, Notes on Notification Functions.
•
The number of transmitted data can be acquired by
R_PG_SCI_GetSentDataCount_C<channel number>. The transmission can be
terminated by calling R_PG_SCI_StopCommunication_C<channel number> before all
bytes have been sent.
•
R20UT0681EJ0103
May 16, 2014
The count of transmitted characters will loop back to 0 if 65536 characters are sent.
Rev.1.03
Page 176 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Example
Specification of Generated Functions
SCI0 has been set as transmitter in the GUI.
Sci0TrFunc was specified as the name of the transmit end notification function in the GUI.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
uint8_t data[255];
void func(void)
{
R_PG_Clock_Set();
//The clock-generation circuit has to be set first.
R_PG_SCI_Set_C0();
//Set up SCI0.
R_PG_SCI_StartSending_C0(data, 255);
//Send 255 bytes of binary data.
}
//Transmit end notification function that called when all bytes have been sent
void Sci0TrFunc(void)
{
//Shut down the SCI0
R_PG_SCI_StopModule_C0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 177 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.14.3
Specification of Generated Functions
R_PG_SCI_SendAllData_C<channel number>
bool R_PG_SCI_SendAllData_C<channel number> (uint8_t * data, uint16_t count)
Definition
<channel number>: 0 to 2
Description
Transmit all data
Conditions for
•
The function of transmission is selected for a SCI channel in GUI.
output
•
Other than "Notify the transmission completion of all data by function call" is selected as
the data transmission method in GUI.
Parameter
uint8_t * data
uint16_t count
The start address of the data to be sent.
The number of the data to be sent.
Set this to 0 if the transmit data is a character string (ending with a null
character).
Return value
File for output
true
Setting was made correctly
false
Setting failed
R_PG_SCI_C<channel number>.c
<channel number>: 0 to 2
RPDL function
Details
R_SCI_Send
•
This function transmits all data.
•
This function is generated when other than "Notify the transmission completion of all data
by function call" is selected as the transmission method in GUI. This function waits until
the last byte has been sent.
•
Example
The count of transmitted characters will loop back to 0 if 65536 characters are sent.
SCI0 has been set as transmitter in the GUI.
"Wait at the transmission function until the last byte has been transmitted" is selected as the
transmission method in GUI.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
uint8_t data[255];
void func(void)
{
R_PG_Clock_Set();
//The clock-generation circuit has to be set first.
R_PG_SCI_Set_C0();
//Set up SCI0.
R_PG_SCI_SendAllData_C0(data, 255);
//Send 255 bytes of binary data.
R_PG_SCI_StopModule_C0();
//Shut down the SCI0
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 178 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.14.4
Specification of Generated Functions
R_PG_SCI_GetSentDataCount_C<channel number>
bool R_PG_SCI_GetSentDataCount_C<channel number> (uint16_t * count)
Definition
<channel number>: 0 to 2
Description
Acquire the number of transmitted data
Conditions for
The function of transmission is selected for a SCI channel and "Notify the transmission
output
completion of all data by function call" is selected as the data transmission method in GUI.
Parameter
uint16_t * count
The storage location for the number of bytes that have been
transmitted in the current transmission.
Return value
true
Acquisition of the data count succeeded
false
Acquisition of the data count failed
File for output
R_PG_SCI_C<channel number>.c
<channel number>: 0 to 2
RPDL function
Details
R_SCI_GetStatus
•
When "Notify the transmission completion of all data by function call" is selected as the
data transmission method in GUI, the number of transmitted data can be acquired by
calling this function.
Example
SCI0 has been set as transmitter in the GUI.
Sci0TrFunc was specified as the name of the transmit end notification function in the GUI.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
uint8_t data[255];
void func(void)
{
R_PG_Clock_Set();
//The clock-generation circuit has to be set first.
R_PG_SCI_Set_C0();
//Set up SCI0.
R_PG_SCI_Send_C0(data, 255);
//Send 255 bytes of binary data.
}
//The transmit end notification function that called when all bytes have been sent
void Sci0TrFunc(void)
{
//Shut down the SCI0
R_PG_SCI_StopModule_C0();
}
//The function to check the number of transmitted data and terminate the transmission
void func_terminate_SCI(void)
{
uint16_t count;
// Acquire the number of transmitted data
R_PG_SCI_GetSentDataCount_C0(&count);
if( count > 32 ){
R_PG_SCI_StopCommunication_C0();
}
//Terminate the transmission
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 179 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.14.5
Specification of Generated Functions
R_PG_SCI_StartReceiving_C<channel number>
bool R_PG_SCI_StartReceiving_C<channel number> (uint8_t * data, uint16_t count)
Definition
<channel number>: 0 to 2
Description
Start the data reception
Conditions for
•
The function of reception is selected for a SCI channel in GUI
output
•
"Notify the reception completion of all data by function call" is selected as the data
reception method in GUI
Parameter
Return value
File for output
uint8_t * data
The start address of the storage area for the expected data.
uint16_t count
The number of the data to be received.
true
Setting was made correctly
false
Setting failed
R_PG_SCI_C<channel number>.c
<channel number>: 0 to 2
RPDL function
Details
R_SCI_Receive
•
This function starts the data reception.
•
This function is generated when "Notify the reception completion of all data by function
call" is selected as the data reception method in GUI. This function returns immediately
and the notification function having the specified name will be called when the last byte
has been received.
Create the notification function as follows:
void <name of the notification function> (void)
For the notification function, note the contents of 5.21, Notes on Notification Functions.
•
The number of received data can be acquired by R_PG_SCI_GetReceivedDataCount_C
<channel number>. The reception can be terminated by calling
R_PG_SCI_StopReceiving_C<channel number> before all bytes have been received.
•
R20UT0681EJ0103
May 16, 2014
The maximum number of characters to be received is 65535.
Rev.1.03
Page 180 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Example
Specification of Generated Functions
• SCI0 has been set as receiver in the GUI.
• Sci0ReFunc was specified as the name of the receive end notification function in the GUI.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
uint8_t data[255];
void func(void)
{
R_PG_Clock_Set();
//The clock-generation circuit has to be set first.
R_PG_SCI_Set_C0();
//Set up SCI0.
R_PG_SCI_StartReceiving_C0(data, 255);
//Receive 255 bytes of binary data.
}
//Receive end notification function that called when all bytes have been received
void Sci0ReFunc(void)
{
//Shut down the SCI0
R_PG_SCI_StopModule_C0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 181 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.14.6
Specification of Generated Functions
R_PG_SCI_ReceiveAllData_C<channel number>
bool R_PG_SCI_ReceiveAllData_C<channel number> (uint8_t * data, uint16_t count)
Definition
<channel number>: 0 to 2
Description
Receive all data
Conditions for
•
The function of reception is selected for a SCI channel in GUI.
output
•
Other than "Notify the reception completion of all data by function call" is selected as the
data reception method in GUI
Parameter
Return value
File for output
uint8_t * data
The start address of the storage area for the expected data.
uint16_t count
The number of the data to be received.
true
Setting was made correctly
false
Setting failed
R_PG_SCI_C<channel number>.c
<channel number>: 0 to 2
RPDL function
Details
R_SCI_Receive
•
This function receives all data.
•
This function is generated when other than "Notify the reception completion of all data by
function call" is selected as the data reception method in GUI. This function waits until the
last byte has been received.
•
Example
The maximum number of characters to be received is 65535.
SCI0 has been set as receiver in the GUI.
"Wait at the reception function until all data has been transmitted" is selected as the reception
method in GUI.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
uint8_t data[255];
void func(void)
{
R_PG_Clock_Set();
//The clock-generation circuit has to be set first.
R_PG_SCI_Set_C0();
//Set up SCI0.
R_PG_SCI_ReceiveAllData_C0(data, 255);
//Receive 255 bytes of binary
data.
R_PG_SCI_StopModule_C0();
//Shut down the SCI0
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 182 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.14.7
Specification of Generated Functions
R_PG_SCI_StopCommunication_C<channel number>
R_PG_SCI_StopCommunication_C<channel number> (void)
Definition
<channel number>: 0 to 2
Description
Stop transmission and reception of serial data
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_SCI_C<channel number>.c
<channel number>: 0 to 2
RPDL function
Details
R_SCI_Control
•
This function stops data transmission and reception.
•
When "Notify the transmission completion of all data by function call" is selected as the
data transmission method in GUI, the reception can be terminated by calling this function
before the number of bytes specified at R_PG_SCI_StartSending_C<channel number>
have been received.
•
When "Notify the reception completion of all data by function call" is selected as the data
reception method in GUI, the reception can be terminated by calling this function before
the number of bytes specified at R_PG_SCI_StartReceiving_C<channel number> have
been received.
Example
SCI0 has been set as receiver in the GUI.
Sci0ReFunc was specified as the name of the receive end notification function in the GUI.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
uint8_t data[255];
void func(void)
{
R_PG_Clock_Set();
//The clock-generation circuit has to be set first.
R_PG_SCI_Set_C0();
//Set up SCI0.
R_PG_SCI_StartReceiving_C0(data, 255);
//Send 255 bytes of binary data.
}
//The receive end notification function that called when all bytes have been received.
void Sci0ReFunc(void)
{
//Shut down the SCI0
R_PG_SCI_StopModule_C0();
}
//The function to check the number of received data and terminate the reception
void func_terminate_SCI(void)
{
uint8_t count;
//Acquire the number of received data
R_PG_SCI_GetReceivedDataCount_C0(&count);
if( count > 32 ){
R_PG_SCI_StopCommunication_C0();
//Terminate the reception
}
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 183 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.14.8
Specification of Generated Functions
R_PG_SCI_GetReceivedDataCount_C<channel number>
bool R_PG_SCI_GetReceivedDataCount_C<channel number> (uint16_t * count)
Definition
<channel number>: 0 to 2
Description
Acquire the number of received data
Conditions for
The function of reception is selected for a SCI channel and "Notify the reception completion
output
of all data by function call" is selected as the data reception method in GUI.
Parameter
uint16_t * count
The storage location for the number of bytes that have been
received in the current reception process.
Return value
true
Acquisition of the data count succeeded
false
Acquisition of the data count failed
File for output
R_PG_SCI_C<channel number>.c
<channel number>: 0 to 2
RPDL function
Details
R_SCI_GetStatus
•
When " Notify the reception completion of all data by function call " is selected as the
receive end notification in GUI, the number of received data can be acquired by calling
this function.
Example
SCI0 has been set as receiver in the GUI.
Sci0ReFunc was specified as the name of the receive end notification function in the GUI.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
uint8_t data[255];
void func(void)
{
R_PG_Clock_Set();
//The clock-generation circuit has to be set first.
R_PG_SCI_Set_C0();
//Set up SCI0.
R_PG_SCI_Receive_C0(data, 255);
//Send 255 bytes of binary data.
}
//The receive end notification function that called when all bytes have been received.
void Sci0ReFunc(void)
{
//Shut down the SCI0
R_PG_SCI_StopModule_C0();
}
//The function to check the number of received data and terminate the reception
void func_terminate_SCI(void)
{
uint16_t count;
//Acquire the number of received data
R_PG_SCI_GetReceivedDataCount_C0(&count);
if( count > 32 ){
R_PG_SCI_StopReceiving_C0();
//Terminate the reception
}
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 184 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.14.9
Specification of Generated Functions
R_PG_SCI_GetReceptionErrorFlag_C<channel number>
bool R_PG_SCI_GetReceptionErrorFlag_C<channel number>
Definition
( bool * parity, bool * framing, bool * overrun )
<channel number>: 0 to 2
Description
Get the serial reception error flag
Conditions for
The function of reception is selected for a SCI channel
output
Parameter
Return value
File for output
bool * parity
The address of storage area for the parity error flag
bool * framing
The address of storage area for the framing error flag
bool * overrun
The address of storage area for the overrun error flag
true
Acquisition of the flags succeeded
false
Acquisition of the flags failed
R_PG_SCI_C<channel number>.c
<channel number>: 0 to 2
RPDL function
Details
Example
R_SCI_GetStatus
•
This function acquires the reception error flags.
•
Specify the address of storage area for the flags to be acquired.
•
Specify 0 for a flag that is not required.
•
The flags of detected error will be set to 1.
SCI0 has been set as receiver in the GUI.
Sci0ReFunc was specified as the name of the receive end notification function in the GUI.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
uint8_t data[255];
void func(void)
{
R_PG_Clock_Set();
//The clock-generation circuit has to be set first.
R_PG_SCI_Set_C0();
//Set up SCI0.
R_PG_SCI_Receive_C0(data, 1);
//Send 1bytes of binary data.
}
//The receive end notification function that called when all bytes have been received.
void Sci0ReFunc(void)
{
// Acquire the reception error flags
R_PG_SCI_GetReceptionErrorFlag_C0( &parity, &framing, & overrun );
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 185 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.14.10
Specification of Generated Functions
R_PG_SCI_GetTransmitStatus_C<channel number>
bool R_PG_SCI_GetTransmitStatus_C<channel number> ( bool * complete )
Definition
<channel number>: 0 to 2
Description
Get the state of transmission
Conditions for
The function of transmission is selected for a SCI channel
output
Parameter
bool * complete
The address of storage area for the transmission completion flag
( 0: Being transmitted
Return value
File for output
1:Complete )
true
Acquisition of the transmission status succeeded
false
Acquisition of the transmission status failed
R_PG_SCI_C<channel number>.c
<channel number>: 0 to 2
RPDL function
Details
Example
R_SCI_GetStatus
•
This function acquires the state of transmission.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
bool complete;
void func(void)
{
//Get the state of transmission
R_PG_SCI_GetTransmitStatus_C0( &complete );
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 186 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.14.11
Specification of Generated Functions
R_PG_SCI_SendTargetStationID_C<channel number>
bool R_PG_SCI_SendTargetStationID_C<channel number> ( uint8_t id )
Definition
<channel number>: 0 to 2
Description
Conditions for
output
Transmits the ID code of the receiving station
•
•
The function of transmission is selected for a SCI channel
The multi-processer communications function is enabled in the asynchronous serial
communication mode
Parameter
uint8_t id
The ID to be transmitted (0 to 255)
Return value
true
Transmission succeeded
false
Transmission failed
File for output
R_PG_SCI_C<channel number>.c
<channel number>: 0 to 2
RPDL function
Details
R_SCI_Send
•
Generates an ID transmission cycle to transmit the ID code of the destination receiving
station.
•
Example
This function waits until the ID transmission cycle has been completed.
A case where the setting is made as follows.
The function of transmission is selected for a SCI2 channel
The multi-processer communications function is enabled in the asynchronous serial
communication mode
• “Wait at the transmission function until all data has been transmitted” is selected as the
data transmission method.
•
•
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
uint8_t data[10] = ”ABCDEFGHIJ”;
void func(void)
{
R_PG_Clock_Set();
//The clock-generation circuit has to be set first.
R_PG_SCI_Set_C2();
//Set up SCI2
R_PG_SCI_SendTargetStationID_C2( 5 );
//Send ID code (ID:5)
R_PG_SCI_SendAllData_C2( data, 10 );
//Send data
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 187 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.14.12
Specification of Generated Functions
R_PG_SCI_ReceiveStationID_C<channel number>
bool R_PG_SCI_ReceiveStationID_C<channel number> ( void )
Definition
<channel number>: 0 to 2
Description
Conditions for
output
Receives the ID code matches the ID of the receiving station itself
•
•
The function of reception is selected for a SCI channel
The multi-processer communications function is enabled in the asynchronous serial
communication mode
Parameter
None
Return value
true
Reception succeeded
false
Reception failed
File for output
R_PG_SCI_C<channel number>.c
<channel number>: 0 to 2
RPDL function
Details
R_SCI_Receive
•
This function waits until the ID code matches the ID of the receiving station itself has
been received.
Example
A case where the setting is made as follows.
• The function of reception is selected for a SCI0 channel
• The multi-processer communications function is enabled in the asynchronous serial
communication mode
• "Notify the reception completion of all data by function call" is selected as the data
reception method
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
uint8_t data[10];
void func(void)
{
R_PG_Clock_Set();
//The clock-generation circuit has to be set first.
R_PG_SCI_Set_C0();
//Set up SCI0
R_PG_SCI_ReceiveStationID_C0();
//Wait an ID reception
R_PG_SCI_StartReceiving_C0( data, 10 );
//Start receiving
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 188 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.14.13
Specification of Generated Functions
R_PG_SCI_StopModule_C<channel number>
bool R_PG_SCI_StopModule_C<channel number> (void)
Definition
<channel number>: 0 to 2
Description
Shut down a SCI channel
Parameter
None
Return value
true
Shutting down succeeded
false
Shutting down failed
File for output
R_PG_SCI_C<channel number>.c
<channel number>: 0 to 2
RPDL function
Details
R_SCI_Destroy
•
Example
Stops a SCI channel and places it in the module-stop state.
A case where the setting is made as follows.
•
SCI0 has been set as receptor in the GUI.
•
"Wait at the reception function until all data has been received" is selected as the data
reception method instead of specifying the receive end notification function name in
GUI.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
uint8_t data[255];
void func(void)
{
R_PG_Clock_Set();
//The clock-generation circuit has to be set first.
R_PG_SCI_Set_C0();
//Set up SCI0.
R_PG_SCI_Receive_C0(data, 255);
//Receive 255 bytes of binary data.
R_PG_SCI_StopModule_C0();
//Shut down the SCI0
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 189 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.15
Specification of Generated Functions
CRC Calculator (CRC)
5.15.1
R_PG_CRC_Set
Definition
bool R_PG_CRC_Set(void)
Description
Set up CRC calculator
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_CRC.c
RPDL function
R_CRC_Create
Details
Example
•
Releases the CRC calculator from the module-stop state, makes initial settings.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
uint16_t result;
void func(void)
{
R_PG_CRC_Set(); //Set up the CRC calculator
R_PG_CRC_InputData(0xf0); // Write the payload data
R_PG_CRC_InputData(0x8f); // Write the first half of the CRC checksum
R_PG_CRC_InputData(0x7f); // Write the second half of the CRC checksum
R_PG_CRC_GetResult (&result); // Read the CRC calculation result
R_PG_CRC_StopModule(); // Shutdown the CRC unit
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 190 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.15.2
Specification of Generated Functions
R_PG_CRC_InputData
Definition
bool R_PG_CRC_InputData (uint8_t data)
Description
Input a data to CRC calculator
Parameter
uint8_t data
The data to be used for the calculation
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_CRC.c
RPDL function
R_CRC_Write
Details
Example
R20UT0681EJ0103
May 16, 2014
•
This function writes the data into the CRC calculation register
Refer to the example of R_PG_CRC_Set.
Rev.1.03
Page 191 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.15.3
Specification of Generated Functions
R_PG_CRC_GetResult
Definition
bool R_PG_CRC_GetResult (uint16_t * result)
Description
Get the the result of calculation
Parameter
uint16_t * result
The address of the location where the result shall be stored.
Return value
true
Acquisition succeeded
false
Acquisition failed
File for output
R_PG_CRC.c
RPDL function
R_CRC_Read
Details
Example
R20UT0681EJ0103
May 16, 2014
•
This function acquires the the result of calculation
Refer to the example of R_PG_CRC_Set.
Rev.1.03
Page 192 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.15.4
Specification of Generated Functions
R_PG_CRC_StopModule
Definition
bool R_PG_CRC_StopModule(void)
Description
Shut down CRC calculator
Parameter
None
Return value
true
Shutting down succeeded
false
Shutting down failed
File for output
R_PG_CRC.c
RPDL function
R_CRC_Destroy
Details
Example
R20UT0681EJ0103
May 16, 2014
•
Stops the CRC calculator and places it in the module-stop state.
Refer to the example of R_PG_CRC_Set.
Rev.1.03
Page 193 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.16
Specification of Generated Functions
I2C Bus Interface (RIIC)
5.16.1
R_PG_I2C_Set_C<channel number>
bool R_PG_I2C_Set_C<channel number> (void)
Definition
<channel number>: 0
Description
Set up an I2C bus interface channel
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_I2C_C<channel number>.c
<channel number>: 0
RPDL function
Details
R_IIC_Create
•
Releases an I2C bus interface channel from the module-stop state, makes initial settings,
and the direction (input or output) and input buffer for the pin to be used is set.
Function R_PG_Clock_Set must be called before calling this function.
Example
RIIC0 has been set in the GUI.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
void func(void)
{
R_PG_Clock_Set();
R_PG_I2C_Set_C0();
//The clock-generation circuit has to be set first
//Set up RIIC0
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 194 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.16.2
Specification of Generated Functions
R_PG_I2C_MasterReceive_C<channel number>
bool R_PG_I2C_MasterReceive_C<channel number>
Definition
(bool addr_10bit, uint16_t slave, uint8_t* data, uint16_t count)
<channel number>: 0
Description
Master data reception
Conditions for
The function of master is selected for an I2C bus interface channel in GUI.
output
Parameter
Return value
File for output
bool addr_10bit
Slave address format (1: 10bit
0: 7bit)
uint16_t slave
Target slave address
uint8_t* data
The start address of the storage area for the expected data.
uint16_t count
The number of the data to be received.
true
Setting was made correctly
false
Setting failed
R_PG_I2C_C<channel number>.c
<channel number>: 0
RPDL function
Details
R_IIC_MasterReceive
•
This function reads data from slave module. The stop condition is generated when the
specified number of data has been received and reception completes.
•
If "Wait at the reception function until all data has been transmitted" is selected as the
master reception method in GUI, this function waits until the last byte has been received.
•
If "Notify the reception completion of all data by function call" is selected as the master
reception method in GUI, this function returns immediately and the notification function
having the specified name will be called when the last byte has been received.
Create the notification function as follows:
void <name of the notification function> (void)
For the notification function, note the contents of 5.21, Notes on Notification Functions.
•
A Start condition will be generated automatically. If the previous transfer did not issue a
stop condition, a repeated start condition will be generated.
•
In the 7-bit address mode, [7:1] of specified slave address value will be output. In 10-bit
address mode, [10:10] of specified slave address will be output.
•
The number of received data can be acquired by R_PG_I2C_GetReceivedDataCount_C
<channel number>.
•
When using 10-bit address mode, select other than [Notify the reception completion of
all data by function call] for master reception method in the GUI.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 195 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Example
Specification of Generated Functions
A case where the setting is made as follows.
•
The function of master is selected for a RIIC0
•
"Wait at the reception function until all data has been transmitted" is selected as the
master reception method
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
// The storage area for the received data
uint8_t iic_data[10];
void func(void)
{
//The clock-generation circuit has to be set first
R_PG_Clock_Set();
//Set up RIIC0
R_PG_I2C_Set_C0();
//Master reception
R_PG_I2C_MasterReceive_C0(
0,
//Slave address format
6,
//Slave address
iic_data,
// The start address of the storage area for the received data
10
// The number of the data to be received
);
//Stop RIIC0
R_PG_I2C_StopModule_C0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 196 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.16.3
Specification of Generated Functions
R_PG_I2C_MasterReceiveLast_C<channel number>
bool R_PG_I2C_MasterReceiveLast_C< channel number >
Definition
(uint8_t* data)
< channel number >: 0,1
Description
Conditions for
output
Complete a master reception process
•
The function of master is selected for an I2C bus interface channel in GUI.
•
Select DTC transfer as a master reception method
Parameter
uint8_t* data
The address of the storage area for the expected data.
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_I2C_C<channel number>.c
<channel number>: 0
RPDL function
Details
R_IIC_MasterReceiveLast
•
This function is genetarted when [Transfer the received serial data by DTC] is selected
as a master reception method.
•
In the master reception process that has used the DTC transfer, NACK and stop
•
condition will be issued by calling this function and the reception process will be
terminated.
•
To complete reception process when the DTC transfer completes, call this function from
DTC interrupt notification function.
•
Extra 1 byte is acquired from the receive data register in this function.
•
The events that has been detected during the reception process or the received data count
can be acquired by calling R_PG_I2C_GetEvent_Cn or
R_PG_I2C_GetReceivedDataCount_Cn.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 197 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Example
Specification of Generated Functions
A case where the setting is made as follows.
•
"Transfer the received serial data by DTC" is selected as the master reception method in
RIIC0 setting.
•
DTC is set as follows
Transfer request source : ICRXI0(receive data full interrupt of TIIC0)
Transfer unit size : 1 byte
Transfer count : Number of dtat to be received by RIIC0
Source start address : Address of RIIC0 received data register
Destination start address : Destination address of the data transfer
Source address mode : Fix
DMA interrupt notification fuction name : Dmac0IntFunc
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
void func1(void)
{
//The clock-generation circuit has to be set first
R_PG_Clock_Set();
//Set up RIIC0
R_PG_I2C_Set_C0();
//Set up the DTC and make the transfer setting
R_PG_DTC_Set();
R_PG_DTC_Set_ICRXI0();
//Activate the DTC
R_PG_DTC_Activate();
//Master reception
//For DTC transfer, specify PDL_NO_PTR for the address of the storage area
//For DTC transfer, specify 0 for the number of the data
R_PG_PG_I2C_MasterReceive_C0(
0,
//Slave address format
6,
//Slave address
PDL_NO_PTR, // The address of the storage area
0
// The number of the data
);
}
void func2(void)
{
uint8_t data; //Strage area of extra data
//Isse NACK and STOP condition and complete the reception
R_PG_PG_I2C_MasterReceiveLast( &data );
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 198 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.16.4
Specification of Generated Functions
R_PG_I2C_MasterSend_C<channel number>
bool R_PG_I2C_MasterSend_C<channel number>
Definition
(bool addr_10bit, uint16_t slave, uint8_t* data, uint16_t count)
<channel number>: 0
Description
Master data transmission
Conditions for
The function of master is selected for an I2C bus interface channel in GUI.
output
Parameter
Return value
File for output
bool addr_10bit
Slave address format (1: 10bit
0: 7bit)
uint16_t slave
Target slave address
uint8_t* data
The start address of the data to be sent
uint16_t count
The number of the data to be sent
true
Setting was made correctly
false
Setting failed
R_PG_I2C_C<channel number>.c
<channel number>: 0
RPDL function
Details
R_IIC_MasterSend
•
This function sends data to the slave module. The stop condition is generated when the
specified number of data has been transmitted and transmission completes.
•
If "Wait at the transmission function until all data has been transmitted" is selected as the
data transmission method in GUI, this function waits until the last byte has been
transmitted or other events are detected.
•
If "Notify the transmission completion of all data by function call" is selected as the data
transmission method in GUI, this function returns immediately and the notification
function having the specified name will be called when the last byte has been transmitted.
Create the notification function as follows:
void <name of the notification function> (void)
For the notification function, note the contents of 5.21, Notes on Notification Functions.
•
A Start condition will be generated automatically. If the previous transfer did not issue a
stop condition, a repeated start condition will be generated.
•
In the 7-bit address mode, [7:1] of specified slave address value will be output. In 10-bit
address mode, [10:1] of specified slave address will be output.
•
The number of transmitted data can be acquired by R_PG_I2C_GetSentDataCount_C
<channel number>.
•
When using 10-bit address mode, select other than [Notify the transmission completion of
all data by function call] for master transmission method in the GUI.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 199 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Example
Specification of Generated Functions
A case where the setting is made as follows.
•
The function of master is selected for a RIIC0
•
"Wait at the transmission function until all data has been transmitted" is selected as the
data transmission method
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
// The storage area for the data to be transmitted
uint8_t iic_data[10];
void func(void)
{
//The clock-generation circuit has to be set first
R_PG_Clock_Set();
//Set up RIIC0
R_PG_I2C_Set_C0();
//Master transmission
R_PG_I2C_MasterSend_C0(
0,
//Slave address format
6,
//Slave address
iic_data,
// The start address of the storage area for the data to be transmitted
10
// The number of the data to be transmitted
);
//Stop RIIC0
R_PG_I2C_StopModule_C0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 200 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.16.5
Specification of Generated Functions
R_PG_I2C_MasterSendWithoutStop_C<channel number>
bool R_PG_I2C_MasterSendWithoutStop_C<channel number>
Definition
(bool addr_10bit, uint16_t slave, uint8_t* data, uint16_t count)
<channel number>: 0
Description
Master data transmission ( No stop condition )
Conditions for
The function of master is selected for an I2C bus interface channel in GUI.
output
Parameter
Return value
File for output
bool addr_10bit
Slave address format (1: 10bit
0: 7bit)
uint16_t slave
Target slave address
uint8_t* data
The start address of the data to be sent
uint16_t count
The number of the data to be sent
true
Setting was made correctly
false
Setting failed
R_PG_I2C_C<channel number>.c
<channel number>: 0
RPDL function
Details
R_IIC_MasterSend
•
This function sends data to the slave module. The stop condition will not be generated.
To generate a stop condition, call R_PG_I2C_GenerateStopCondition_C<channel
•
number>.
If "Wait at the transmission function until all data has been transmitted" is selected as the
data transmission method in GUI, this function waits until the last byte has been
•
transmitted or other events are detected.
If "Notify the transmission completion of all data by function call" is selected as the data
transmission method in GUI, this function returns immediately and the notification
function having the specified name will be called when the last byte has been transmitted.
Create the notification function as follows:
void <name of the notification function> (void)
•
For the notification function, note the contents of 5.21, Notes on Notification Functions.
A Start condition will be generated automatically. If the previous transfer did not issue a
•
stop condition, a repeated start condition will be generated.
In the 7-bit address mode, [7:1] of specified slave address value will be output. In 10-bit
•
address mode, [10:1] of specified slave address will be output.
The number of transmitted data can be acquired by R_PG_I2C_GetSentDataCount_C
<channel number>.
•
When using 10-bit address mode, select other than [Notify the transmission completion of
all data by function call] for master transmission method in the GUI.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 201 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Example
Specification of Generated Functions
A case where the setting is made as follows.
•
The function of master is selected for a RIIC0
•
"Notify the transmission completion of all data by function call" is selected as the data
transmission method
•
IIC0MasterTrFunc was specified as the name of the transmit end notification function
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
// The storage area for the data to be transmitted
uint8_t iic_data[10];
void func(void)
{
//The clock-generation circuit has to be set first
R_PG_Clock_Set();
//Set up RIIC0
R_PG_I2C_Set_C0();
//Master transmission
R_PG_I2C_MasterSendWithoutStop_C0(
0,
//Slave address format
6,
//Slave address
iic_data, // The start address of the storage area for the data to be transmitted
10
// The number of the data to be transmitted
);
}
void IIC0MasterTrFunc(void){
//Generate stop condition
R_PG_I2C_GenerateStopCondition_C0();
//Stop RIIC0
R_PG_I2C_StopModule_C0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 202 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.16.6
Specification of Generated Functions
R_PG_I2C_GenerateStopCondition_C<channel number>
bool R_PG_I2C_GenerateStopCondition_C<channel number> (void)
Definition
<channel number>: 0
Description
Generate a stop condition
Conditions for
The function of master is selected for an I2C bus interface channel in GUI.
output
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_I2C_C<channel number>.c
<channel number>: 0
RPDL function
Details
R_IIC_Control
•
This function generates a stop condition for the transmission started by
R_PG_I2C_MasterSendWithoutStop_C<channel number>.
Example
R20UT0681EJ0103
May 16, 2014
Refer to the example of R_PG_I2C_MasterSendWithoutStop_C<channel number>
Rev.1.03
Page 203 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.16.7
Specification of Generated Functions
R_PG_I2C_GetBusState_C<channel number>
bool R_PG_I2C_GetBusState_C<channel number> ( bool *busy )
Definition
<channel number>: 0
Description
Get the bus state
Conditions for
output
The function of master is selected for an I2C bus interface channel in GUI.
Parameter
bool *busy
The address of storage area for the bus busy detection flag
Bus busy detection flag
0: The I2C bus is released (bus free state)
1: The I2C bus is occupied (bus busy state or in the bus free state)
Return value
File for output
true
Acquisition of the flag succeeded
false
Acquisition of the flag failed
R_PG_I2C_C<channel number>.c
<channel number>: 0
RPDL function
Details
Example
R_IIC_GetStatus
•
This function acquires the bus busy detection flag.
RIIC0 has been set in the GUI.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
// The storage area for the data to be transmitted
uint8_t iic_data[10];
//Storage for bus busy detection flag
bool busy;
void func(void)
{
//The clock-generation circuit has to be set first
R_PG_Clock_Set();
//Set up RIIC0
R_PG_I2C_Set_C0();
// Wait for the I2C bus to be free
do{
R_PG_I2C_GetBusState_C0( & busy );
} while( busy );
//Master transmission
R_PG_I2C_MasterSend_C0(
0,
//Slave address format
6,
//Slave address
iic_data, // The start address of the storage area for the data to be transmitted
10
// The number of the data to be transmitted
);
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 204 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.16.8
Specification of Generated Functions
R_PG_I2C_SlaveMonitor_C<channel number>
bool R_PG_I2C_SlaveMonitor_C<channel number> ( uint8_t *data, uint16_t count )
Definition
<channel number>: 0
Description
Slave bus monitor
Conditions for output
The function of slave is selected for an I2C bus interface channel in GUI.
Parameter
uint8_t* data
The start address of the received data
uint16_t count
The number of the data to be received
true
Setting was made correctly
false
Setting failed
Return value
File for output
R_PG_I2C_C<channel number>.c
<channel number>: 0
RPDL function
Details
R_IIC_SlaveMonitor
•
This function monitors the accesses from master modules.
•
If "Notify the reception completion of all data, slave read request, or a stop condition
detection by function call" is selected as the slave monitor method in GUI, this function
returns immediately and the notification function having the specified name will be called
when a read access from master module or a stop condition is detected. Create the
notification function as follows:
void <name of the notification function> (void)
For the notification function, note the contents of 5.21, Notes on Notification Functions.
•
If "Wait at the monitor function until reception completion, slave read request, or a stop
condition detection" is selected as the slave monitor method in GUI, this function waits
until a read access from master module or a stop condition is detected.
•
The received data from a master module is stored in the storage area of specified address.
Specify the number of data to not exceed the size of storage area. If the number of the
data from the master module exceeds the specified number, NACK shall be generated.
•
The transmit/receive mode can be acquired by calling R_PG_I2C_GetRW_C<channel
number>. The data can be transmitted by calling R_PG_I2C_SlaveSend_C<channel
number> to respond to a transmission (read) request from the master.
•
Call R_PG_I2C_GetDetectedAddress_C<channel number> to acquire a detected slave
address. Call R_PG_I2C_GetEvent_C<channel number> to acquire the detected events
(e.g. a stop condition or a start condition).
•
When using 10-bit address mode, select other than [Notify the transmission completion of
all data, slave read request, or a stop condition detection by function call] for slave
monitor method in the GUI.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 205 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Example
Specification of Generated Functions
A case where the setting is made as follows.
•
The function of slave is selected for a RIIC0
•
IIC0SlaveFunc was specified as the name of the slave monitor function
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
// The storage area for the data to be received
uint8_t iic_data_re[10];
// The storage area for the data to be transmitted (slave address 0)
uint8_t iic_data_tr_0[10];
// The storage area for the data to be transmitted (slave address 1)
uint8_t iic_data_tr_1[10];
//Storage for bus busy detection flag
uint8_t busy;
void func(void)
{
//The clock-generation circuit has to be set first
R_PG_Clock_Set();
//Set up RIIC0
R_PG_I2C_Set_C0();
// Slave monitor
R_PG_I2C_SlaveMonitor_C0(
iic_data_re, // The start address of the storage area for the received data
10
//The number of the data to be received
);
}
void IIC0SlaveFunc (void)
{
bool transmit, start, stop;
bool addr0, addr1;
//Get the detected events
R_PG_I2C_GetEvent_C0(0, &stop, &start, 0, 0);
//Get an access type
R_PG_PG_I2C_GetTR_C0(&transmit);
//Get a detected address
R_PG_I2C_GetDetectedAddress_C0(&addr0, &addr1, 0, 0, 0, 0);
if (start && transmit && address0) {
//Transmits the data to the master module
R_PG_I2C_SlaveSend_C(
iic_data_tr_0,
10
);
}
else if (start && read && address1) {
//Transmits the data to the master module
R_PG_I2C_SlaveSend_C(
iic_data_tr_1,
10
);
}
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 206 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.16.9
Specification of Generated Functions
R_PG_I2C_SlaveSend_C<channel number>
bool R_PG_I2C_SlaveSend_C<channel number> ( uint8_t *data, uint16_t count )
Definition
<channel number>: 0
Description
Slave data transmission
Conditions for output
The function of slave is selected for an I2C bus interface channel in GUI.
Parameter
uint8_t* data
The start address of the data to be transmitted
uint16_t count
The number of the data to be transmitted
true
Setting was made correctly
false
Setting failed
Return value
File for output
R_PG_I2C_C<channel number>.c
<channel number>: 0
RPDL function
Details
R_IIC_SlaveSend
•
This function transmits the data to the master module.
•
If the master requires more data than is supplied, this function shall loop back to the start
of the data.
Example
R20UT0681EJ0103
May 16, 2014
Refer to the example of R_PG_I2C_SlaveMonitor_C<channel number>
Rev.1.03
Page 207 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.16.10
Specification of Generated Functions
R_PG_I2C_GetDetectedAddress_C<channel number>
bool R_PG_I2C_GetDetectedAddress_C<channel number>
Definition
(bool *addr0, bool *addr1, bool *addr2, bool *general, bool *device, bool *host)
<channel number>: 0
Description
Get the detected address
Conditions for output
The function of slave is selected for an I2C bus interface channel in GUI.
Parameter
bool *addr0
The address of storage area for slave address 0 detection flag
bool *addr1
The address of storage area for slave address1 detection flag
bool *addr2
The address of storage area for slave address 2 detection flag
bool *general
The address of storage area for general call address detection flag
bool *device
The address of storage area for device-ID command detection flag
bool *host
The address of storage area for host address detection flag
true
Acquisition succeeded
false
Acquisition failed
Return value
File for output
R_PG_I2C_C<channel number>.c
<channel number>: 0
RPDL function
Details
Example
R20UT0681EJ0103
May 16, 2014
R_IIC_GetStatus
•
This function acquires the detected address.
•
Specify the address of storage area for the flags to be acquired.
•
Specify 0 for a flag that is not required.
•
The flag of the detected address will be set to 1.
Refer to the example of R_PG_I2C_SlaveMonitor_C<channel number>
Rev.1.03
Page 208 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.16.11
Specification of Generated Functions
R_PG_I2C_GetTR_C<channel number>
bool R_PG_I2C_GetTR_PG_C<channel number> ( bool * transmit )
Definition
<channel number>: 0
Description
Get the transmit/receive mode
Conditions for output
The function of slave is selected for an I2C bus interface channel in GUI.
Parameter
bool * transmit
The address of storage area for the transmit/receive mode flag
Transmit/receive mode flag
0: Receive mode
1: Transmit mode
Return value
File for output
true
Acquisition succeeded
false
Acquisition failed
R_PG_I2C_C<channel number>.c
<channel number>: 0
RPDL function
Details
Example
R20UT0681EJ0103
May 16, 2014
R_IIC_GetStatus
•
This function acquires the transmit/receive mode flag.
Refer to the example of R_PG_I2C_SlaveMonitor_C<channel number>
Rev.1.03
Page 209 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.16.12
Specification of Generated Functions
R_PG_I2C_GetEvent_C<channel number>
bool R_PG_I2C_GetEvent_C<channel number>
Definition
( bool *nack, bool *stop, bool *start, bool *lost, bool *timeout )
<channel number>: 0
Description
Get the detected event
Parameter
bool *nack
The address of storage area for a NACK detection flag
bool *stop
The address of storage area for a stop condition detection flag
bool *start
The address of storage area for a start condition detection flag
bool *lost
The address of storage area for an arbitration lost
bool *timeout
The address of storage area for a timeout detection
true
Acquisition succeeded
false
Acquisition failed
Return value
File for output
R_PG_I2C_C<channel number>.c
<channel number>: 0
RPDL function
Details
Example
R20UT0681EJ0103
May 16, 2014
R_IIC_GetStatus
•
This function acquires the detected event.
•
Specify 0 for a flag that is not required.
•
The flags of the detected event will be set to 1.
Refer to the example of R_PG_I2C_SlaveMonitor_C<channel number>
Rev.1.03
Page 210 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.16.13
Specification of Generated Functions
R_PG_I2C_GetReceivedDataCount_C<channel number>
bool R_PG_I2C_GetReceivedDataCount_C<channel number> ( uint16_t *count )
Definition
<channel number>: 0
Description
Acquires the count of received data
Parameter
uint16_t *count
The address of storage area for the number of bytes that have been
received
Return value
true
Acquisition of the data count succeeded
false
Acquisition of the data count failed
File for output
R_PG_I2C_C<channel number>.c
<channel number>: 0
RPDL function
Details
R_IIC_GetStatus
•
This function acquires the number of bytes that have been received in the current
reception process.
Example
A case where the setting is made as follows.
•
The function of master is selected for a RIIC0
•
"Notify the reception completion of all data by function call" is selected as the master
reception method
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
// The storage area for the data to be received
uint8_t iic_data[256];
// The storage area for the number of received data
uint16_t count;
void func(void)
{
//The clock-generation circuit has to be set first
R_PG_Clock_Set();
//Set up RIIC0
R_PG_I2C_Set_C0();
//Master receive
R_PG_I2C_MasterReceive_C0(
0,
//Slave address format
6,
//Slave address
iic_data, // The address of storage area for the data to be received
256
//The number of data to be received
);
//Wait until 64 bytes have been received
do{
R_PG_I2C_GetReceivedDataCount_C0( &count );
} while( count < 64 );
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 211 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.16.14
Specification of Generated Functions
R_PG_I2C_GetSentDataCount_C<channel number>
Definition
bool R_PG_I2C_GetSentDataCount_C<channel number> ( uint16_t *count )
<channel number>: 0
Description
Acquires the count of transmitted data
Parameter
uint16_t *count
The address of storage area for the number of bytes that have been
transmitted
Return value
true
Acquisition of the data count succeeded
false
Acquisition of the data count failed
File for output
R_PG_I2C_C<channel number>.c
<channel number>: 0
RPDL function
R_IIC_GetStatus
Details
•
This function acquires the number of bytes that have been transmitted in the current
transmission process.
Example
A case where the setting is made as follows.
•
The function of master is selected for a RIIC0
•
"Notify the transmission completion of all data by function call" is selected as the data
transmission method
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
// The storage area for the data to be transmitted
uint8_t iic_data[256];
// The storage area for the number of transmitted data
uint16_t count;
void func(void)
{
//The clock-generation circuit has to be set first
R_PG_Clock_Set();
//Set up RIIC0
R_PG_I2C_Set_C0();
//Master send
R_PG_I2C_MasterSend_C0(
0,
//Slave address format
6,
//Slave address
iic_data, // The address of storage area for the data to be transmitted
256
//The number of data to be transmitted
);
//Wait until 64 bytes have been transmitted
do{
R_PG_I2C_GetSentDataCount_C0( &count );
} while( count < 64 );
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 212 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.16.15
Specification of Generated Functions
R_PG_I2C_Reset_C<channel number>
Definition
bool R_PG_I2C_Reset_C<channel number> ( void )
<channel number>: 0
Description
Reset the bus
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_I2C_C<channel number>.c
<channel number>: 0
RPDL function
R_IIC_Control
Details
•
This function resets the module
•
The settings of the module are preserved.
Example
A case where the setting is made as follows.
•
The function of master is selected for a RIIC0
•
"Notify the transmission completion of all data by function call" is selected as the data
transmission method
IIC0MasterTrFunc was specified as the name of the transmit end notification function
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
// The storage area for the data to be transmitted
uint8_t iic_data[256];
void func(void)
{
//The clock-generation circuit has to be set first
R_PG_Clock_Set();
//Set up RIIC0
R_PG_I2C_Set_C0();
//Master send
R_PG_I2C_MasterSend_C0(
6,
//Slave address format
6,
//Slave address
iic_data, // The address of storage area for the data to be transmitted
10
//The number of data to be transmitted
);
}
void IIC0MasterTrFunc(void)
{
if ( error ){
R_PG_I2C_Reset_C0();
}
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 213 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.16.16
Specification of Generated Functions
R_PG_I2C_StopModule_C<channel number>
Definition
bool R_PG_I2C_StopModule_C<channel number> ( void )
<channel number>: 0
Description
Shut down the I2C bus interface channel
Parameter
None
Return value
true
Shutting down succeeded
false
Shutting down failed
File for output
R_PG_I2C_C<channel number>.c
<channel number>: 0
RPDL function
R_IIC_Destroy
Details
•
Example
A case where the setting is made as follows.
Stops an I2C bus interface channel and places it in the module-stop state.
•
The function of master is selected for a RIIC0
•
"Wait at the reception function until all data has been transmitted" is selected as the
master reception method
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
// The storage area for the data to be transmitted
uint8_t iic_data[256];
void func(void)
{
//The clock-generation circuit has to be set first
R_PG_Clock_Set();
//Set up RIIC0
R_PG_I2C_Set_C0();
//Master receive
R_PG_I2C_MasterReceive_C0(
0,
//Slave address format
6,
//Slave address
iic_data, // The address of storage area for the data to be received
10
//The number of data to be received
);
//Stop the RIIC0
R_PG_I2C_StopModule_C0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 214 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.17
Specification of Generated Functions
Serial Peripheral Interface (RSPI)
5.17.1
R_PG_RSPI_Set_C<channel number>
Definition
bool R_PG_RSPI_Set_C<channel number> (void)
<channel number>: 0
Description
Set up a RSPI channel
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_RSPI_C<channel number>.c
<channel number>: 0
RPDL function
Details
R_SPI_Create
•
Releases a serial peripheral interface channel from the module-stop state, makes initial
settings, and sets the pins to be used.
•
Function R_PG_Clock_Set must be called before calling this function.
•
The commands are not set in this function. To set the commands, call
R_PG_RSPI_SetCommand_C<channel number>.
Example
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
R_PG_Clock_Set();
//Set up the clocks
R_PG_RSPI_Set_C0();
//Set up RSPI0
R_PG_RSPI_SetCommand_C0();
//Set commands
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 215 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.17.2
Specification of Generated Functions
R_PG_RSPI_SetCommand_C<channel number>
Definition
bool R_PG_RSPI_SetCommand_C<channel number> (void)
<channel number>: 0
Description
Set commands
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_RSPI_C<channel number>.c
<channel number>: 0
RPDL function
Details
Example
R20UT0681EJ0103
May 16, 2014
R_SPI_Command
•
Set RSPI commands registers.
•
All commands set in GUI (maximum number of commands: 8) shall be set.
Refer to the example of R_PG_RSPI_Set_C<channel number>
Rev.1.03
Page 216 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.17.3
Specification of Generated Functions
R_PG_RSPI_StartTransfer_C<channel number>
Definition
Transmission and reception operations (Full-duplex synchronous serial communications)
bool R_PG_RSPI_StartTransfer_C<channel number>
( uint32_t * tx_start,
uint32_t * rx_start,
uint16_t sequence_loop_count )
<channel number>: 0
Serial communications consisting of only transmit operations
bool R_PG_RSPI_StartTransfer_C<channel number>
( uint32_t * tx_start,
uint16_t sequence_loop_count )
<channel number>: 0
Description
Start the data transfer
Conditions for
“Notify the transfer completion and the error detection by function call” has been selected
output
as the transfer method.
Parameter
uint32_t * tx_start
The start address of the data to be transmitted.
uint32_t * rx_start
The start address of the storage area for the expected
data.
uint16_t sequence_loop_count
The number of times that the command sequence will be
executed
Return value
File for output
true
Setting was made correctly
false
Setting failed
R_PG_RSPI_C<channel number>.c
<channel number>: 0
RPDL function
Details
R_SPI_Transfer
•
Starts the data transfer.
•
This function is generated when "Notify the transfer completion and the error detection
by function call" is selected as the data transfer method in GUI.
•
This function returns immediately and the notification function having the specified
name will be called when all commands are executed or error is detected.
Create the notification function as follows:
void <name of the notification function> (void)
For the notification function, note the contents of 5.21, Notes on Notification Functions.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 217 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Example
Specification of Generated Functions
A case where the setting is made as follows.
・
RSPI has been set to master mode
・
“Notify the transfer completion and the error detection by function call” is selected as
・
the transfer method
・
rsi0_int_func is specified as a notification function name
・
Number of commands: 1
Number of frames: 4
Data lengh of command 0 is 8 bits
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
uint32_t tx_data[4] = { 0x11, 0x22, 0x33, 0x44 };
uint32_t rx_data[4] = { 0x00, 0x00, 0x00, 0x00 };
bool over_run, mode_fault, parity_error;
void func(void)
{
R_PG_Clock_Set();
//Set up the clocks
R_PG_RSPI_Set_C0();
//Set up RSPI0
R_PG_RSPI_SetCommand_C0();
//Set commands
R_PG_RSPI_StartTransfer_C0( tx_data, rx_data, 1 ); //Transfe 4 frames * 8bits
}
void rsi0_int_func (void)
{
R_PG_RSPI_GetError_C0(&over_run,&mode_fault,&parity_error); //Get error flags
if( over_run || mode_fault || parity_error ){
//Processing when an error is detected
}
R_PG_RSPI_StopModule_C0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 218 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.17.4
Specification of Generated Functions
R_PG_RSPI_TransferAllData_C<channel number>
Definition
Transmission and reception operations (Full-duplex synchronous serial communications)
bool R_PG_RSPI_TransferAllData_C<channel number>
( uint32_t * tx_start,
uint32_t * rx_start,
uint16_t sequence_loop_count )
<channel number>: 0
Serial communications consisting of only transmit operations
bool R_PG_RSPI_TransferAllData_C<channel number>
( uint32_t * tx_start,
uint16_t sequence_loop_count )
<channel number>: 0
The DTC transfer is selected for the transfer method
bool R_PG_RSPI_TransferAllData_C<channel number>
( uint16_t sequence_loop_count )
<channel number>: 0
Description
Transfer all data
Conditions for
Other than “Notify the transfer completion and the error detection by function call” has been
output
selected as the transfer method.
Parameter
uint32_t * tx_start
uint32_t * rx_start
uint16_t sequence_loop_count
Return value
File for output
The start address of the data to be transmitted.
The start address of the storage area for the expected
data.
The number of times that the command sequence will
be executed
true
Setting was made correctly
false
Setting failed
R_PG_RSPI_C<channel number>.c
<channel number>: 0
RPDL function
Details
R_SPI_Transfer
•
Transfers all data.
•
This function is generated when other than "Notify the transfer completion and the error
detection by function call" is selected as the transmission method in GUI.
•
R20UT0681EJ0103
May 16, 2014
This function waits until all commands are executed.
Rev.1.03
Page 219 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Example
Specification of Generated Functions
A case where the setting is made as follows.
・
RSPI has been set to master mode.
・
“Wait until transfer completion” is selected as the transfer method.
・
Number of commands: 1
・
Data lengh of command 0 is 8 bits
Number of frames: 4
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
uint32_t tx_data[4] = { 0x11, 0x22, 0x33, 0x44 };
uint32_t rx_data[4] = { 0x00, 0x00, 0x00, 0x00 };
bool over_run, mode_fault, parity_error;
void func(void)
{
R_PG_Clock_Set();
//Set up the clocks
R_PG_RSPI_Set_C0();
//Set up RSPI0
R_PG_RSPI_SetCommand_C0();
//Set commands
R_PG_RSPI_TransferAllData_C0( tx_data, rx_data, 1 ); //Transfe 4 frames * 8bits
R_PG_RSPI_GetError_C0(&over_run,&mode_fault,&parity_error); //Get error flags
if( over_run || mode_fault || parity_error ){
//Processing when an error is detected
}
R_PG_RSPI_StopModule_C0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 220 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.17.5
Specification of Generated Functions
R_PG_RSPI_GetStatus_C<channel number>
Definition
bool R_PG_RSPI_GetStatus_C<channel number>
(bool * idle,
bool * receive_full,
bool * transmit_empty )
<channel number>: 0
Description
Acquire the transfer status
Parameter
bool * idle
bool * receive_full
bool * transmit_empty
Return value
File for output
The address of storage area for the idle flag
(0:Idle state 1: Transfer state)
The address of storage area for the receive buffer full flag
(0:Empty
1: Full)
The address of storage area for the transmit buffer empty flag
(0:Full
1: Empty)
true
Acquisition succeeded
false
Acquisition failed
R_PG_RSPI_C<channel number>.c
<channel number>: 0
RPDL function
Details
R_SPI_GetStatus
•
Acquires the transfer status.
•
Specify the address of storage area for the items to be acquired. Specify 0 for an item that
is not required.
•
The error flags (the overrun error flag, the mode fault error flag, and the parity error flag)
are cleared in this function. Call R_PG_RSPI_GetError_C<channel number> to acquire
the error flags before calling this function if needed.
Example
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
bool idle;
void func(void)
{
do{
//Get the id
R_PG_RSPI_GetStatus_C0( & idle, 0, 0 );
}while( idle );
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 221 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.17.6
Specification of Generated Functions
R_PG_RSPI_GetError_C<channel number>
Definition
bool R_PG_RSPI_GetError_C<channel number>
(bool * over_run,
bool * mode_fault,
bool * parity_error)
<channel number>: 0
Description
Acquire the error flags
Parameter
bool * over_run
The address of storage area for the overrun error flag
bool * mode_fault
The address of storage area for the mode fault error flag
bool * parity_error
The address of storage area for the parity error flag
true
Acquisition succeeded
false
Acquisition failed
Return value
File for output
R_PG_RSPI_C<channel number>.c
<channel number>: 0
RPDL function
Details
R_SPI_GetStatus
•
Acquires the error flags.
•
Specify the address of storage area for the items to be acquired. Specify 0 for an item that
is not required.
•
Example
The error flags shall be cleared in this function.
Refer to the example of R_PG_RSPI_StartTransfer_C<channel number>,
R_PG_RSPI_TransferAllData_C<channel number>, and
R_PG_RSPI_GetCommandStatus_C<channel number>
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 222 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.17.7
Specification of Generated Functions
R_PG_RSPI_GetCommandStatus_C<channel number>
Definition
bool R_PG_RSPI_GetCommandStatus_C<channel number>
( uint8_t * current_command,
uint8_t * error_command )
<channel number>: 0
Description
Acquire the command status
Conditions for
A RSPI channel has been set to the master mode
output
Parameter
uint8_t * current_command
The address of storage area for the current command
pointer value (0 to 7)
uint8_t * error_command
The address of storage area for the value of command
pointer when an error is detected (0 to 7)
Return value
File for output
true
Acquisition succeeded
false
Acquisition failed
R_PG_RSPI_C<channel number>.c
<channel number>: 0
RPDL function
Details
R_SPI_GetStatus
•
Acquires the current command pointer value (0 to 7) and the value of command pointer
when an error is detected (0 to 7).
•
Specify the address of storage area for the items to be acquired. Specify 0 for an item that
is not required.
•
The error flags (the overrun error flag, the mode fault error flag, and the parity error flag)
are cleared in this function. Call R_PG_RSPI_GetError_C<channel number> to acquire
the error flags before calling this function if needed.
Example
A case where the setting is made as follows.
•
RSPI has been set to the master mode
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
bool over_run, mode_fault,
uint8_t error_command;
parity_error;
void func(void)
{
R_PG_RSPI_GetError_C0(&over_run,&mode_fault,&parity_error); //Get error flags
if( over_run || mode_fault || parity_error ){
R_PG_RSPI_GetCommandStatus_C0( &error_command );
// Processing when an error is detected
}
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 223 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.17.8
Specification of Generated Functions
R_PG_RSPI_StopModule_C<channel number>
Definition
bool R_PG_RSPI_StopModule_C<channel number> (void)
<channel number>: 0
Description
Shut down a RSPI channel
Parameter
None
Return value
true
Shutting down succeeded
false
Shutting down failed
File for output
R_PG_RSPI_C<channel number>.c
<channel number>: 0
RPDL function
Details
Example
R_SPI_Destroy
•
Stops RSPI channel and places it in the module-stop state.
Refer to the example of R_PG_RSPI_StartTransfer_C<channel number> and
R_PG_RSPI_TransferAllData_C<channel number>.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 224 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.17.9
Specification of Generated Functions
R_PG_RSPI_LoopBack<loopback mode>_C<channel number>
Definition
bool R_PG_RSPI_LoopBack<loopback mode>_C<channel number> (void)
<loopback mode>: Direct, Reversed, Disable
<channel number>: 0
Description
Set loopback mode
Conditions for
The loopback mode has been set
output
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_RSPI_C<channel number>.c
<channel number>: 0
RPDL function
Details
R_SPI_Control
•
Sets or disables RSPI pins to loopback mode.
•
By calling R_PG_RSPI_LoopBackDirect_C<channel number>, the input path and output
path for the shift register are connected. (transmit data = receive data)
•
By calling R_PG_RSPI_LoopBackReversed _C<channel number>, the reversed input
path and output path for the shift register are connected. (reversed transmit data = receive
data)
•
By calling R_PG_RSPI_LoopBackDisable_C<channel number>, the loopback mode is
disabled.
Example
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
R_PG_RSPI_LoopBackDirect_C0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
//Set loopback mode
Page 225 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.18
Specification of Generated Functions
LIN Module (LIN)
5.18.1
R_PG_LIN_Set_LIN<channel number>
bool R_PG_LIN_Set_LIN<channel number> (void)
Definition
<channel number>: 0
Description
Set up a LIN module
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_LIN_LIN<channel number>.c
<channel number>: 0
RPDL function
Details
R_LIN_Create
•
Releases a LIN module from the module-stop state, makes initial settings, and sets the
pins to be used.
•
Sets up a LIN module in LIN operation mode.
Interrupts of the LIN module are set by this function. When the name of the interrupt
notification function has been specified in the GUI, if an interrupt occurs in the CPU, the
function having the specified name will be called. Create the interrupt notification
function as follows:
void <name of the interrupt notification function> (void)
•
For the interrupt notification function, note the contents of 5.21, Notes on Notification
Functions.
Example
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
//Initialize LIN module (LIN module is set to LIN operation mode)
R_PG_LIN_Set_LIN0();
//Enter wake-up mode
R_PG_LIN_EnterWakeUpMode_LIN0();
//Wake-up transmission
R_PG_LIN_WakeUpTransmit_LIN0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 226 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.18.2
Specification of Generated Functions
R_PG_LIN_Transmit_LIN<channel number>
bool R_PG_LIN_Transmit_LIN<channel number>
Definition
( uint8_t id,
uint8_t * send_data,
uint8_t data_count,
bool checksum_enhanced )
<channel number>: 0
Description
Transmit data
Parameter
uint8_t id
ID to be sent in the header
uint8_t * send_data
The start address of the data to be transmitted in the response
field
Return value
File for output
uint8_t data_count
The number of the data to be sent
bool checksum_enhanced
Check sum select ( 0: Classic 1: Enhanced )
true
Setting was made correctly
false
Setting failed
R_PG_LIN_LIN<channel number>.c
<channel number>: 0
RPDL function
Details
R_LIN_Transfer
•
Transmit the header and response.
•
Check sum is automatically calculated and added to the response.
•
Call R_PG_LIN_Set_LIN<channel number> before calling this function to set up the
LIN module.
•
This function needs to be called in LIN operation mode. To enter LIN operation mode
from other modes, use R_PG_LIN_EnterOperationMode_LIN<channel number>.
•
The status of transmission of the header and response can be acquired by
R_PG_LIN_GetStatus_LIN<channel number>.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 227 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Example
Specification of Generated Functions
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
// Storage area for the transmit data
uint8_t data_t[8];
// Storage area for the frame/wake-up transmit completion flag
bool frame_wakeup_transmission;
// Storage area for the error flag
bool error;
void func(void)
{
//Initialize transmit data
InitData();
//Transmit header and response (ID:3 Number of data:8 Check sum:Classic)
R_PG_LIN_Transmit_LIN0( 3, data_t, 8, 0 );
}
void Lin0IntFunc(void)
{
//Get the frame/wake-up transmit completion flag and error flag
R_PG_LIN_GetStatus_LIN0(
& frame_wakeup_transmission,
0,
& error,
0,
0,
);
if( error ){
//Error is detected
}
else if( frame_wakeup_transmission ){
// Frame/wake-up transmission is completed
}
}
void InitData(void)
{
t data_t[0] = 0x12;
t data_t[1] = 0x34;
t data_t[2] = 0x56;
t data_t[3] = 0x78;
t data_t[4] = 0x9a;
t data_t[5] = 0xbc;
t data_t[6] = 0xde;
t data_t[7] = 0xf0;
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 228 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.18.3
Specification of Generated Functions
R_PG_LIN_Receive_LIN<channel number>
bool R_PG_LIN_Receive_LIN<channel number>
Definition
( uint8_t id, uint8_t data_count, bool checksum_enhanced )
<channel number>: 0
Description
Receive data
Parameter
uint8_t id
ID to be sent in the header
uint8_t data_count
The number of the data to be received
bool checksum_enhanced
Check sum select ( 0: Classic 1: Enhanced )
true
Setting was made correctly
false
Setting failed
Return value
File for output
R_PG_LIN_LIN<channel number>.c
<channel number>: 0
RPDL function
Details
R_LIN_Transfer
•
Transmit the header and receive the response.
•
Call R_PG_LIN_Set_LIN<channel number> before calling this function to set up the
LIN module.
•
This function needs to be called in LIN operation mode. To enter LIN operation mode
from other modes, use R_PG_LIN_EnterOperationMode_LIN<channel number>.
•
The status of transmission of the header and reception of the response can be acquired by
R_PG_LIN_GetStatus_LIN<channel number>.
•
R20UT0681EJ0103
May 16, 2014
The received data can be read by R_PG_LIN_ReadData_LIN<channel number>.
Rev.1.03
Page 229 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Example
Specification of Generated Functions
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
// Storage area for the received data
uint8_t data_ r[8];
// Storage area for the frame/wake-up receive completion flag
bool frame_wakeup_ reception;
// Storage area for the error flag
bool error;
// Storage area for the check sum
bool check_sum;
void func(void)
{
//Transmit the header and receive the response
// (ID:3 Number of data:8 Check sum:Classic)
R_PG_LIN_Receive_LIN0( 3, 8, 0 );
}
void Lin0IntFunc(void)
{
//Get the frame/wake-up receive completion flag and error flag
R_PG_LIN_GetStatus_LIN0(
0,
& frame_wakeup_reception,
& error,
0,
0,
);
if( error ){
//Error is detected
}
else if( frame_wakeup_reception ){
// Frame/wake-up reception is completed
//Read received data
R_PG_LIN_ReadData_LIN0( data_r, 8 );
//Read check sum
R_PG_LIN_GetCheckSum_LIN0( & check_sum );
}
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 230 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.18.4
Specification of Generated Functions
R_PG_LIN_ReadData_LIN<channel number>
bool R_PG_LIN_ReadData_LIN<channel number>
Definition
( uint8_t * receive_data, uint8_t data_count )
<channel number>: 0
Description
Read data
Parameter
uint8_t * receive_data
The start address of the storage area for the expected data.
uint8_t data_count
The number of the data to be read
true
Acquisition succeeded
false
Acquisition failed
Return value
File for output
R_PG_LIN_LIN<channel number>.c
<channel number>: 0
RPDL function
Details
R_LIN_Read
•
Reads the data buffer registers.
•
The response corresponding to the header sent by R_PG_LIN_Receive_LIN can be
acquired by this function.
•
The storage area specified by receive_data have to be big enough for the requested
number of data.
Example
R20UT0681EJ0103
May 16, 2014
Refer to the example of R_PG_LIN_Receive_LIN<channel number>
Rev.1.03
Page 231 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.18.5
Specification of Generated Functions
R_PG_LIN_EnterResetMode_LIN<channel number>
bool R_PG_LIN_EnterResetMode_LIN<channel number> (void)
Definition
<channel number>: 0
Description
Enter LIN reset mode
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_LIN_LIN<channel number>.c
<channel number>: 0
RPDL function
Details
R_LIN_Control
•
Enters the LIN module in LIN reset mode
•
To enter the LIN module in LIN wake-up mode or LIN operation mode from LIN self-test
mode, enter LIN reset mode once by this function.
Example
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
//Initialize LIN module (LIN module is set to LIN operation mode)
R_PG_LIN_Set_LIN0();
//Enter LIN reset mode
R_PG_LIN_EnterResetMode_LIN0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 232 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.18.6
Specification of Generated Functions
R_PG_LIN_EnterOperationMode_LIN<channel number>
bool R_PG_LIN_EnterOperationMode_LIN<channel number> (void)
Definition
<channel number>: 0
Description
Enter LIN operation mode
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_LIN_LIN<channel number>.c
<channel number>: 0
RPDL function
Details
R_LIN_Control
•
Enters the LIN module in LIN operation mode
•
To enter the LIN module in LIN operation mode from LIN self-test mode, enter LIN reset
mode once by R_PG_LIN_EnterResetMode_LIN<channel number>.
Example
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
//Enter LIN reset mode
R_PG_LIN_EnterResetMode_LIN0();
//LIN operation mode
R_PG_LIN_EnterOperationMode_LIN0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 233 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.18.7
Specification of Generated Functions
R_PG_LIN_EnterWakeUpMode_LIN<channel number>
bool R_PG_LIN_EnterWakeUpMode_LIN<channel number> (void)
Definition
<channel number>: 0
Description
Enter LIN wake-up mode
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_LIN_LIN<channel number>.c
<channel number>: 0
RPDL function
Details
R_LIN_Control
•
Enters the LIN module in LIN wake-up mode
•
To enter the LIN module in LIN wake-up mode from LIN self-test mode, enter LIN reset
mode once by R_PG_LIN_EnterResetMode_LIN<channel number>.
Example
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
// Enter LIN wake-up mode
R_PG_LIN_EnterWakeUpMode_LIN0();
//Wake-up transmission
R_PG_LIN_WakeUpTransmit_LIN0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 234 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.18.8
Specification of Generated Functions
R_PG_LIN_WakeUpTransmit_LIN<channel number>
bool R_PG_LIN_WakeUpTransmit_LIN<channel number> (void)
Definition
<channel number>: 0
Description
Transmit wake-up signals
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_LIN_LIN<channel number>.c
<channel number>: 0
RPDL function
Details
R_LIN_Control
•
Transmits wake-up signals
•
This function needs to be called in LIN wake-up mode.
•
The status of transmission of the wake-up signal can be acquired by
R_PG_LIN_GetStatus_LIN<channel number>.
RPDL function
R20UT0681EJ0103
May 16, 2014
Refer to the example of R_PG_LIN_EnterWakeUpMode_LIN<channel number>.
Rev.1.03
Page 235 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.18.9
Specification of Generated Functions
R_PG_LIN_WakeUpReceive_LIN<channel number>
bool R_PG_LIN_WakeUpReceive_LIN<channel number> (void)
Definition
<channel number>: 0
Description
Receive wake-up signals
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_LIN_LIN<channel number>.c
<channel number>: 0
RPDL function
Details
R_LIN_Control
•
Receives wake-up signals
•
This function needs to be called in LIN wake-up mode.
•
The status of reception of the wake-up signal can be acquired by
R_PG_LIN_GetStatus_LIN<channel number>.
Example
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
// Storage area for the frame/wake-up receive completion flag
bool frame_wakeup_reception;
void func(void)
{
//Initialize LIN module (LIN module is set to LIN operation mode)
R_PG_LIN_Set_LIN0();
// Enter LIN wake-up mode
R_PG_LIN_EnterWakeUpMode_LIN0();
//Wake-up reception
R_PG_LIN_WakeUpReceive_LIN0();
//Wait for wake-up signal to be received
do{
R_PG_LIN_GetStatus_LIN0(
0,
& frame_wakeup_reception,
0,
0,
0,
);
}while( ! frame_wakeup_reception );
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 236 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.18.10
Specification of Generated Functions
R_PG_LIN_GetCheckSum_LIN<channel number>
bool R_PG_LIN_GetCheckSum_LIN<channel number> ( uint8_t * check_sum )
Definition
<channel number>: 0
Description
Get check sum
Parameter
uint8_t * check_sum
The start address of the storage area for check sum
Return value
true
Acquisition succeeded
false
Acquisition failed
File for output
R_PG_LIN_LIN<channel number>.c
<channel number>: 0
RPDL function
Details
Example
R20UT0681EJ0103
May 16, 2014
R_LIN_GetStatus
•
Reads the check sum buffer register.
Refer to the example of R_PG_LIN_Receive_LIN<channel number>
Rev.1.03
Page 237 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.18.11
Specification of Generated Functions
R_PG_LIN_EnterSelfTestMode_LIN<channel number>
bool R_PG_LIN_EnterSelfTestMode_LIN<channel number> (void)
Definition
<channel number>: 0
Description
Enter LIN self-test mode
Conditions for
Use of LIN self test mode is enabled
output
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_LIN_LIN<channel number>.c
<channel number>: 0
RPDL function
Details
R20UT0681EJ0103
May 16, 2014
R_LIN_Control
•
•
Enters the LIN module in LIN self-test mode
To enter LIN self-test mode from LIN wake-up mode or LIN operation mode, the LIN
module enters LIN reset mode once in this function.
Rev.1.03
Page 238 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Example
Specification of Generated Functions
A case where the setting is made as follows.
•
Lin0IntFunc was specified as the name of the LIN interrupt notification function.
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
// Storage area for the transmit data
uint8_t data_t[8];
// Storage area for the received data
uint8_t data_ r[8];
// Storage area for the frame/wake-up transmit completion flag
bool frame_wakeup_transmission;
// Storage area for the error flag
bool error;
void func(void)
{
//Initialize LIN module (LIN module is set to LIN operation mode)
R_PG_LIN_Set_LIN0();
//Enter LIN self-test mode
R_PG_LIN_EnterSelfTestMode_LIN0();
//Initialize transmit data
InitData();
//Start transmission test
R_PG_LIN_Transmit_LIN0( 3, data_t, 8, 0 );
}
void Lin0IntFunc(void)
{
//Get the frame/wake-up transmit completion flag and error flag
R_PG_LIN_GetStatus_LIN0(
& frame_wakeup_transmission,
0,
& error,
0,
0,
);
if( error ){
//Error is detected
}
else if( frame_wakeup_transmission ){
//Transmission completion
//Read the data buffer registers
R_PG_LIN_ReadData_LIN0( data_r, 8 );
}
}
void InitData(void)
{
t data_t[0] = 0x12;
t data_t[1] = 0x34;
t data_t[2] = 0x56;
t data_t[3] = 0x78;
t data_t[4] = 0x9a;
t data_t[5] = 0xbc;
t data_t[6] = 0xde;
t data_t[7] = 0xf0;
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 239 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.18.12
Specification of Generated Functions
R_PG_LIN_WriteCheckSum_LIN<channel number>
bool R_PG_LIN_WriteCheckSum_LIN<channel number> (uint8_t check_sum)
Definition
<channel number>: 0
Description
Write check sum
Conditions for
Use of LIN self test mode is enabled
output
Parameter
uint8_t check_sum
Check sum value to be written to check sum buffer register
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_LIN_LIN<channel number>.c
<channel number>: 0
RPDL function
Details
R20UT0681EJ0103
May 16, 2014
R_LIN_Control
•
•
Sets check sum buffer register.
Use this function to set check sum in reception of LIN self-test mode.
Rev.1.03
Page 240 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Example
Specification of Generated Functions
A case where the setting is made as follows.
•
Lin0IntFunc was specified as the name of the LIN interrupt notification function.
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
// Storage area for the received data
uint8_t data_ r[8];
// Storage area for the frame/wake-up receive completion flag
bool frame_wakeup_ reception;
// Storage area for the error flag
bool error;
void func(void)
{
//Initialize LIN module (LIN module is set to LIN operation mode)
R_PG_LIN_Set_LIN0();
//Enter LIN self-test mode
R_PG_LIN_EnterSelfTestMode_LIN0();
//Set data buffer registers
SetData();
// Start reception test
R_PG_LIN_Receive_LIN0( 3, 8, 0 );
}
void Lin0IntFunc(void)
{
//Get the frame/wake-up transmit completion flag and error flag
R_PG_LIN_GetStatus_LIN0(
0,
& frame_wakeup_reception,
& error,
0,
0,
);
if( error ){
// Error is detected
}
else if( frame_wakeup_reception ){
//Reception completion
//Read the data buffer registers
R_PG_LIN_ReadData_LIN0( data_r, 8 );
}
}
void SetData(void)
{
// Set data buffer registers
*((uint8_t*)(0x94018))=data_t[0]; //LDB1
*((uint8_t*)(0x94019))=data_t[1]; //LDB2
*((uint8_t*)(0x9401A))=data_t[2]; //LDB3
*((uint8_t*)(0x9401B))=data_t[3]; //LDB4
*((uint8_t*)(0x9401C))=data_t[4]; //LDB5
*((uint8_t*)(0x9401D))=data_t[5]; //LDB6
*((uint8_t*)(0x9401E))=data_t[6]; //LDB7
*((uint8_t*)(0x9401F))=data_t[7]; //LDB8
//Set check sum
R_PG_LIN_WriteCheckSum_LIN0 ( 0xc3 )
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 241 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.18.13
Specification of Generated Functions
R_PG_LIN_GetMode_LIN<channel number>
bool R_PG_LIN_GetMode_LIN<channel number> ( uint8_t * mode )
Definition
<channel number>: 0
Description
Get current operation mode
Parameter
uint8_t * mode
The address of the storage area for value indicates the operation mode
Relationship between operation mode and value
LIN reset mode
0x00
LIN wake-up mode
0x01
LIN operation mode
0x03
LIN self-test mode
0x04
Return value
File for output
true
Acquisition succeeded
false
Acquisition failed
R_PG_LIN_LIN<channel number>.c
<channel number>: 0
RPDL function
Details
Example
R_LIN_GetStatus
•
Acquires the current operation mode of LIN module.
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
uint8_t mode
// Storage area for value indicates the operation mode
void func(void)
{
R_PG_LIN_GetMode_LIN0( &mode ) //Get the current operation mode
switch( mode ){
case 0x00:
//LIN reset mode
break;
case 0x01:
//LIN wake-up mode
break;
case 0x03:
//LIN operation mode
break;
case 0x04:
//LIN self-test mode
break;
default;
break;
}
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 242 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.18.14
Specification of Generated Functions
R_PG_LIN_GetStatus_LIN<channel number>
bool R_PG_LIN_GetStatus_LIN<channel number>
( bool * frame_wakeup_transmission, bool * frame_wakeup_reception,
bool * header_transmission
bool * data1_reception,
Definition
bool * error,
)
<channel number>: 0
Description
Get the status of LIN module
Parameter
bool * frame_wakeup_transmission
bool * frame_wakeup_reception
bool * error
bool * data1_reception
bool * header_transmission
Return value
File for output
The address of the storage area for frame/wake-up
transmit completion flag
The address of the storage area for frame/wake-up
receive completion flag
The address of the storage area for error detection
flag
The address of the storage area for data 1 receive
completion flag
The address of the storage area for header transmit
completion flag
true
Acquisition succeeded
false
Acquisition failed
R_PG_LIN_LIN<channel number>.c
<channel number>: 0
RPDL function
Details
R_LIN_GetStatus
•
•
Acquires the status of LIN module.
Specify the address of storage area for the flags to be acquired. Specify 0 for a flag that is not
required.
Example
R20UT0681EJ0103
May 16, 2014
Refer to the example of R_PG_LIN_Transmit_LIN0, R_PG_LIN_Receive_LIN0,
R_PG_LIN_WakeUpReceive_LIN0, R_PG_LIN_EnterSelfTestMode_LIN0, and
R_PG_LIN_WriteCheckSum_LIN0.
Rev.1.03
Page 243 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.18.15
Specification of Generated Functions
R_PG_LIN_GetErrorStatus_LIN<channel number>
bool R_PG_LIN_GetErrorStatus_LIN<channel number>
bool * bus_error,
bool * frame_timeout,
( bool * bit_error,
Definition
bool * framing,
bool * check_sum_error
)
<channel number>: 0
Description
Get the status of error detection
Parameter
bool * bit_error
The address of the storage area for bit error flag
bool * bus_error
The address of the storage area for physical bus error flag
bool * frame_timeout
The address of the storage area for frame timeout error flag
bool * framing
The address of the storage area for framing error flag
bool * check_sum_error
The address of the storage area for check sum error flag
true
Acquisition succeeded
false
Acquisition failed
Return value
File for output
R_PG_LIN_LIN<channel number>.c
<channel number>: 0
RPDL function
Details
R_LIN_GetStatus
•
•
Acquires the status of error detection
Specify the address of storage area for the flags to be acquired. Specify 0 for a flag that is not
required.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 244 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Example
Specification of Generated Functions
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
bool error;
// Storage area for error flag
bool bit_error;
// Storage area for bit error flag
bool bus_error;
// Storage area for physical bus error flag
bool frame_timeout; // Storage area for frame timeout error flag
bool framing;
// Storage area for framing error flag
bool check_sum_error;
// Storage area for check sum error flag
void func(void)
{
// Get the error flag
R_PG_LIN_GetStatus_LIN0(
0,
0,
& error,
0,
0,
);
if( error ){
//Error is detected
//Get the status of error detection
R_PG_LIN_GetErrorStatus_LIN0(
& bit_error,
& bus_error,
& frame_timeout,
& framing,
& check_sum_error
);
if( bit_error ){
// Bit error is detected
}
if( bus_error ){
// Physical bus error is detected
}
if( frame_timeout ){
// Frame timeout error is detected
}
if( framing ){
// Framing error is detected
}
if( check_sum_error ){
// Check sum error is detected
}
}
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 245 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.18.16
Specification of Generated Functions
R_PG_LIN_StopModule_LIN<channel number>
bool R_PG_LIN_StopModule_LIN<channel number> (void)
Definition
<channel number>: 0
Description
Shut down a LIN module
Parameter
None
Return value
true
Shutting down succeeded
false
Shutting down failed
File for output
R_PG_LIN_LIN<channel number>.c
<channel number>: 0
RPDL function
Details
Example
R_LIN_Destroy
•
Stops a LIN module and places it in the module-stop state.
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
// Shut down a LIN module
R_PG_LIN_StopModule_LIN0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 246 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Specification of Generated Functions
5.19 12-Bit A/D Converter (S12ADA)
5.19.1 R_PG_ADC_12_Set_S12ADA<unit number>
Definition
bool R_PG_ADC_12_Set_S12ADA<unit number> (void)
Description
Set up the 12-Bit A/D Converter
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_ADC_12_S12ADA<unit number>.c
RPDL function
R_ADC_12_CreateUnit, R_ADC_12_Set
Details
・
・
・
・
Example
<unit number>: 0 to 1
<unit number>: 0 to 1
Releases the 12-Bit A/D converter from the module-stop state, makes initial settings, and
places it in the conversion-start trigger-input wait state. When the software trigger is
selected to start conversion, conversion is started by calling
R_PG_ADC_12_StartConversionSW_S12ADA<unit number>.
Function R_PG_Clock_Set must be called before calling this function.
The input direction is set for pins used as analog inputs and the input buffers for the pins
are disabled.
The A/D-conversion end interrupt is set in this function. When the name of the interrupt
notification function has been specified in the GUI, if an interrupt occurs in the CPU, the
function having the specified name will be called. Create the interrupt notification
function as follows:
void <name of the interrupt notification function> (void)
For the interrupt notification function, note the contents of 5.21, Notes on Notification
Functions.
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
R_PG_Clock_Set();
//Set up the clocks
R_PG_ADC_12_Set_S12ADA0(); //Set up the 12-Bit A/D converter
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 247 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Specification of Generated Functions
5.19.2 R_PG_ADC_12_Set
Definition
bool R_PG_ADC_12_Set(void)
Description
Set the programmable gain amplifier
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_ADC_12.c
RPDL function
R_ADC_12_CreateChannel
Details
・
Example
The gain is set in this function.
A case where the setting is made as follows.
・
The setting that uses the programmable gain amplifier has been specified in the GUI.
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
R_PG_Clock_Set();
//Set up the clocks
R_PG_ADC_12_Set_S12ADA0();
//Set up the 12-Bit A/D converter
// Set the programmable gain amplifier
R_PG_ADC_12_Set();
// Start A/D conversion by the software trigger
R_PG_ADC_12_StartConversionSW_S12ADA0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 248 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Specification of Generated Functions
5.19.3 R_PG_ADC_12_StartConversionSW_S12ADA<unit number>
Definition
bool R_PG_ADC_12_StartConversionSW_S12ADA<unit number> (void)
<unit number>: 0 to 1
Description
Start A/D conversion (Software trigger)
Conditions for
Setting of the A/D converter and specification of the software trigger as the activation
output
source
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_ADC_12_S12ADA<unit number>.c
RPDL function
R_ADC_12_Control
Details
・
<unit number>: 0 to 1
Starts A/D conversion by an A/D converter for which the software trigger is selected as
the activation source.
Example
A case where the setting is made as follows.
・
The software trigger is selected as the conversion start trigger.
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
void func(void)
{
R_PG_Clock_Set();
//Set up the clocks
R_PG_ADC_12_Set_S12ADA0();
//Set up the 12-Bit A/D converter
// Start A/D conversion by the software trigger
R_PG_ADC_12_StartConversionSW_S12ADA0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 249 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Specification of Generated Functions
5.19.4 R_PG_ADC_12_StopConversion_S12ADA<unit number>
Definition
bool R_PG_ADC_12_StopConversion_S12ADA<unit number> (void)
<unit number>: 0 to 1
Description
Stop A/D conversion
Parameter
None
Return value
true
Stopping conversion succeeded.
false
Stopping conversion failed.
File for output
R_PG_ADC_12_S12ADA<unit number>.c
RPDL function
R_ADC_12_Control
Details
・
<unit number>: 0 to 1
A/D conversion in the continuous scan mode can be stopped. Except the continuous scan
mode, this function need not be called after A/D conversion has ended.
After this function has stopped A/D conversion, continuous scanning is resumed on
input of the A/D-conversion start trigger. To end continuous scanning, stop the A/D
conversion unit by calling R_PG_ADC_12_StopModule_S12ADA<unit number>.
Example
A case where the setting is made as follows.
・
The continuous scan mode is selected as the operation mode.
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
uint16_t data;
//Storage for the result of A/D conversion
void func1(void)
{
R_PG_Clock_Set();
//Set up the clocks
R_PG_ADC_12_Set_S12ADA0();
//Set up the 12-Bit A/D converter
}
void func2(void)
{
//Stop the continuous scan
R_PG_ADC_12_StopConversion_S12ADA0();
// Acquire the result of A/D conversion
R_PG_ADC_12_GetResult_S12ADA0(&data);
//Stop the 12-Bit A/D Converter
R_PG_ADC_12_StopModule_S12ADA0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 250 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Specification of Generated Functions
5.19.5 R_PG_ADC_12_GetResult_S12ADA<unit number>
Definition
bool R_PG_ADC_12_GetResult_S12ADA<unit number> (uint16_t * result)
<unit number>: 0 to 1
Description
Acquire the result of A/D conversion
Parameter
uint16_t * result
The address of storage area for the result of A/D conversion
Return value
true
Acquisition of the result succeeded
false
Acquisition of the result failed
File for output
R_PG_ADC_12_S12ADA<unit number>.c
RPDL function
R_ADC_12_Read
Details
・
<unit number>: 0 to 1
From 1 to 5 two-byte memory slots are required. The number depends on the “Input
channel selection” and A/D-conversion start trigger.
・
If “Double Trigger” has been specified for channel ANn00 (n = 0 or 1) in the GUI, the
first memory slot contains the result from channel ANn00 (n = 0 or 1) triggered by “A
Trigger” and the last one contains the result from channel ANn00 (n = 0 or 1) triggered
by “B Trigger”.
Double Trigger : (A Trigger / B Trigger)
No.1: (TRG4AN / TRG4BN)
No.2: (TRG7AN / TRG7BN)
No.3: (GTADTRA0N / GTADTRB0N)
No.4: (GTADTRA1N / GTADTRB1N)
No.5: (GTADTRA2N / GTADTRB2N)
No.6: (GTADTRA3N / GTADTRB3N)
Example of data format:
Two channel scan mode.
AN000 selected as group 0, triggered by “Double Trigger”;
AN001, AN002 and AN003 selected as group 1, triggered by TRGA2N.
result[0] : The conversion result from AN000 triggered by “A Trigger” ADDR0A
result[1] : The conversion result from AN001 ADDR1
result[2] : The conversion result from AN002 ADDR2
result[3] : The conversion result from AN003 ADDR3
result[4] : The conversion result from AN000 triggered by “B Trigger” ADDR0B
・
When the MTU3 or GPT trigger is selected, the last memory slot contains the value of
ADDR0B though ADDR0B is not used except for “Double Trigger”.
・
When A/D conversion is in progress at the time of calling this function and a name for
the interrupt notification function has not been specified through the GUI, the function
waits until the end of A/D conversion before reading the result.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 251 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Example
Specification of Generated Functions
A case where the setting is made as follows.
・
Two channel scan mode.
AN000 selected as group 0, triggered by (TRG4AN / TRG4BN);
AN001, AN002 and AN003 selected as group 1, triggered by TRG7BN.
//Include “R_PG_<project name>.h” to use this function.
#include "R_PG_default.h"
uint16_t result[5];
//Storage for the result of A/D conversion
void func(void)
{
R_PG_Clock_Set();
//Set up the clocks
R_PG_ADC_12_Set_S12ADA0();
//Set up the 12-Bit A/D converter
}
//The A/D conversion end interrupt notification function
void S12ad0IntFunc(void)
{
// Acquire the result of A/D conversion
R_PG_ADC_12_GetResult_S12ADA0( result );
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 252 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Specification of Generated Functions
5.19.6 R_PG_ADC_12_StopModule_S12ADA<unit number>
Definition
bool R_PG_ADC_12_StopModule_S12ADA<unit number> (void)
<unit number>: 0 to 1
Description
Shut down the 12-Bit A/D converter
Parameter
None
Return value
true
Shutting down succeeded
false
Shutting down failed
File for output
R_PG_ADC_12_S12ADA<unit number>.c
RPDL function
R_ADC_12_Destroy
Details
・
<unit number>: 0 to 1
Stops the 12-Bit A/D converter and places it in the module-stop state. (Power
consumption decrease functoin)
・
When two units have been used, even if this function is called for one unit, it doesn’t
shift in the state of the module-stop state. Afterwards, both units shift in the state of the
module-stop state when this function is called for the other unit.
Example
R20UT0681EJ0103
May 16, 2014
Refer to the example of R_PG_ADC_12_StopConversion_S12ADA<unit number>
Rev.1.03
Page 253 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Specification of Generated Functions
5.20 10-Bit A/D Converter (ADA)
5.20.1 R_PG_ADC_10_Set_AD<unit number>
Definition
bool R_PG_ADC_10_Set_AD<unit number> (void)
Description
Set up the 10-Bit A/D Converter (ADA)
Parameter
Return value
None
true
Setting was made correctly
false
Setting failed
File for output
R_PG_ADC_10_AD<unit number>.c
RPDL function
R_ADC_10_Create
Details
•
<unit number>: 0
<unit number>: 0
Releases an A/D converter from the module-stop state, makes initial settings, and places it
in the conversion-start trigger-input wait state.
•
Call R_PG_ADC_10_StartConversionSW_AD<unit number> to start the
A/D-conversion by the software trigger.
Function R_PG_Clock_Set must be called before calling this function.
The input direction is set for pins used as analog inputs and the input buffers for the pins
•
are disabled.
•
The A/D-conversion end interrupt is set in this function. When the name of the interrupt
notification function has been specified in the GUI, if an interrupt request is conveyed to
•
the CPU, the function having the specified name will be called. Create the interrupt
notification function as follows:
void <name of the interrupt notification function> (void)
For the interrupt notification function, note the contents of 5.21, Notes on Notification
Functions.
Example
The hardware trigger has been specified in the GUI.
Ad0IntFunc has been specified as the name of the A/D-conversion end interrupt notification
function in the GUI.
#include "R_PG_default.h" //Include "R_PG_<project name>.h" to use this function.
uint16_t data; //Destination for storage of the result of A/D conversion
void func(void)
{
R_PG_Clock_Set();
R_PG_ADC_10_Set_AD0();
//The clock-generation circuit has to be set first.
//Set up ADA.
}
//AD-conversion end interrupt notification function
void Ad0IntFunc(void)
{
R_PG_ADC_10_GetResult_AD0(&data)
//Acquire the result of A/D conversion.
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 254 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Specification of Generated Functions
5.20.2 R_PG_ADC_10_StartConversionSW_AD<unit number>
bool R_PG_ADC_10_StartConversionSW_AD<unit number> (void)
Definition
<unit number>: 0
Description
Start the A/D conversion (Software trigger)
Parameter
None
Return value
true
Triggering the conversion succeeded.
false
Triggering the conversion failed.
File for output
R_PG_ADC_10_AD<unit number>.c
<unit number>: 0
RPDL function
Details
R_ADC_10_Control
•
Call this function when you use the software trigger.
•
Even when the hardware trigger has been selected, the A/D-conversion can be started by
calling this function.
Example
The software trigger has been specified in the GUI.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
void func(void)
{
R_PG_Clock_Set();
R_PG_ADC_10_Set_AD0();
//The clock-generation circuit has to be set first.
//Set up AD0.
//Start A/D conversion by the software trigger
R_PG_ADC_10_StartConversionSW_AD0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 255 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Specification of Generated Functions
5.20.3 R_PG_ADC_10_StopConversion_AD<unit number>
bool R_PG_ADC_10_StopConversion_AD<unit number> (void)
Definition
<unit number>: 0
Description
Stop the A/D conversion
Parameter
None
Return value
true
Stopping the conversion succeeded.
false
Stopping the conversion failed.
File for output
R_PG_ADC_10_AD<unit number>.c
<unit number>: 0
RPDL function
Details
R_ADC_10_Control
•
A/D conversion can be stopped in the continuous scan mode. In the single mode and
single-cycle scan mode, this function need not be called after A/D conversion has ended.
After this function has stopped A/D conversion, continuous scanning is resumed on
input of the A/D-conversion start trigger. To end continuous scanning, stop the A/D
conversion unit by calling R_PG_ADC_10_StopModule_AD<unit number>.
Example
The continuous scan mode has been specified in the GUI.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
uint16_t data;
//Destination for storage of the result of A/D conversion
void func1(void)
{
R_PG_Clock_Set();
R_PG_ADC_10_Set_AD0();
//The clock-generation circuit has to be set first.
//Set up AD0.
}
void func2(void)
{
//Stop continuous scanning.
R_PG_ADC_10_StopConversion_AD0();
//Acquire the result of A/D conversion.
R_PG_ADC_10_GetResult_AD0(&data);
//Stop the A/D converter.
R_PG_ADC_10_StopModule_AD0();
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 256 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Specification of Generated Functions
5.20.4 R_PG_ADC_10_GetResult_AD<unit number>
bool R_PG_ADC_10_GetResult_AD<unit number> (uint16_t * result)
Definition
<unit number>: 0
Description
Get the result of A/D conversion
Parameter
uint16_t * result
Destination for storage of the result of A/D conversion
Return value
true
Acquisition of the result succeeded.
false
Acquisition of the result failed.
File for output
R_PG_ADC_10_AD<unit number>.c
RPDL function
R_ADC_10_Read
Details
•
<unit number>: 0
The amount of data to be acquired depends on the number of A/D-conversion channels
that are in use. Reserve the area required for storing the result of A/D conversion for the
given number of channels.
•
When A/D conversion is in progress at the time of calling this function and a name for the
interrupt notification function has not been specified through the GUI, the function waits
until the end of A/D conversion before reading the result.
Example
Four channels (AN0 to AN3) are in use.
Ad0IntFunc has been specified as the name of the A/D-conversion end interrupt notification
function in the GUI.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
void func(void)
{
R_PG_Clock_Set();
R_PG_ADC_10_Set_AD0();
//The clock-generation circuit has to be set first.
//Set up AD0.
}
//AD-conversion end interrupt notification function
void Ad0IntFunc(void)
{
uint16_t data[4]; //Result of A/D conversion on all channels
uint16_t data_an0; //Result of A/D conversion on AN0
uint16_t data_an1; //Result of A/D conversion on AN1
uint16_t data_an2; //Result of A/D conversion on AN2
uint16_t data_an3; //Result of A/D conversion on AN3
R_PG_ADC_10_GetResult_AD0(data);
//Acquire the results of A/D conversion.
data_an0 = data[0];
data_an1 = data[1];
data_an2 = data[2];
data_an3 = data[3];
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 257 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Specification of Generated Functions
5.20.5 R_PG_ADC_10_SetSelfDiag_VREF_<voltage>_AD<unit number>
bool R_PG_ADC_10_SetSelfDiag_VREF_<voltage>_AD<unit number> (void)
Definition
<voltage>: 0, 0_5, 1 ( 0:Vref*0, 0_5:Vref/2, 1:Vref )
Description
Set up the A/D self-diagnostic function
Conditions for
The self-diagnostic function is enabled
<unit number>: 0
output
Parameter
None
Return value
true
Setting was made correctly
false
Setting failed
File for output
R_PG_ADC_10_AD<unit number>.c
RPDL function
R_ADC_10_Create
Details
•
•
•
•
Example
<unit number>: 0
Setsup the A/D self-diagnostic function.
In this function, the A/D conversion mode is set to the single mode and the conversion
start trigger is set to the software trigger.
To re-set the A/D converter, call R_PG_ADC_10_Set_AD<unit number>.
To start the self-diagnostic, call R_PG_ADC_10_StartConversionSW_AD<unit number>
and to get the result of self-diagnostic, call R_PG_ADC_10_GetResult_AD<unit
number>.
//Include "R_PG_<project name>.h" to use this function.
#include "R_PG_default.h"
uint16_t SelfDiagnostic_0()
{
uint16_t result;
R_PG_ADC_10_SetSelfDiag_VREF_0_AD0();
R_PG_ADC_10_StartConversionSW_AD0();
R_PG_ADC_10_GetResult_AD0 (&result);
return result;
}
uint16_t SelfDiagnostic_0_5()
{
uint16_t result;
R_PG_ADC_10_SetSelfDiag_VREF_0_5_AD0();
R_PG_ADC_10_StartConversionSW_AD0();
R_PG_ADC_10_GetResult_AD0 (&result);
return result;
}
uint16_t SelfDiagnostic_1()
{
uint16_t result;
R_PG_ADC_10_SetSelfDiag_VREF_1_AD0();
R_PG_ADC_10_StartConversionSW_AD0();
R_PG_ADC_10_GetResult_AD0 (&result);
return result;
}
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 258 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Specification of Generated Functions
5.20.6 R_PG_ADC_10_StopModule_AD<unit number>
bool R_PG_ADC_10_StopModule_AD<unit number> (void)
Definition
<unit number>: 0
Description
Shut down the 10-Bit A/D Converter (ADA)
Parameter
None
Return value
true
Shutting down succeeded
false
Shutting down failed
File for output
R_PG_ADC_10_AD<unit number>.c
<unit number>: 0
RPDL function
Details
R_ADC_10_Destroy
•
Stops an A/D converter and places it in the module-stop state. (Power consumption
decrease functoin)
Example
R20UT0681EJ0103
May 16, 2014
Refer to the example of R_PG_ADC_10_StopConversion_AD<unit number>
Rev.1.03
Page 259 of 270
RX62T Group Peripheral Driver Generator Reference Manual
5.21
Specification of Generated Functions
Notes on Notification Functions
5.21.1
Interrupts and processor mode
The RX CPU has two processor modes; supervisor and user.The driver functions will be executed by the CPU
in user mode.However any notification functions which are called by the interrupt handlers in RPDL will be
executed by the CPU in supervisor mode.This means that the privileged CPU instructions (RTFI, RTE and
WAIT) can be executed by the notification function and any function that is called by the notification function.
The user must:
•
Avoid using the RTFI and RTE instructions.
These instructions are issued by the API interrupt handlers, so there should be no need for the
user’s code to use these instructions.
•
Use the wait() intrinsic function with caution.
This instruction is used by some API functions as part of power management, so there should be
no need for the user’s code to use this instruction.
More information on the processor modes can be found in §1.4 of the RX Family software manual.
5.21.2
Interrupts and DSP instructions
The accumulator (ACC) register is modified by the following instructions:
•
DSP (MACHI, MACLO, MULHI, MULLO, MVTACHI, MVTACLO and RACW).
•
Multiply and multiply-and-accumulate (EMUL, EMULU, FMUL, MUL, and RMPA)
The accumulator (ACC) register is not pushed onto the stack by the interrupt handlers in RPDL.
If DSP instructions are being utilised in the users’ code, notification functions which are called by the interrupt
handlers in RPDL should either
•
Avoid using instructions which modify the ACC register.
•
Take a copy of the ACC register and restore it before exiting the callback function.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 260 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Registering Files with the IDE and Building Them
6. Registering Files with the IDE and Building Them
Note the following points when registering the files generated by the Peripheral Driver Generator with the
IDE(High-performance Embedded Workshop, CubeSuite+ or e2 studio) and building them.
(1)
Source files generated by the Peripheral Driver Generator do not include a startup program. For this reason,
you need to create a startup program by specifying [Application] as the project type during the process of
creating a IDE project.
(2)
Source files registered by the Peripheral Driver Generator with the IDE include an interrupt handler and
vector table. Since the interrupt handler and vector table must not overlap with those included in the
startup program created by using the IDE, intprg.c and vecttbl.c are excluded from the set of files that are
included in the build. Interrupt_handler.c and vector_table.c are made the target in case of e2studio.
(3)
Source files Interrupt_xxx.c, which includes the interrupt handler that the Peripheral Driver Generator
registers with the IDE, is overwritten when the Peripheral Driver Generator generates source files.
(4)
The Renesas Peripheral Driver Library is produced using the default compiler options (except that [Double
precision] is selected for [Precision of double]). If you specify the compiler options other than the defaults
in your project, you have to utilize Renesas Peripheral Driver Library source under your responsibility.
(5)
When adding source files generated by Peripheral Driver Generator to the High-performance Embedded
Workshop project created with RX Family C/C++ compiler package V.1.01, please note the following
points.
•
The linkage error may occur in building the program in High-performance Embedded Workshop
because the function name of reset operation in startup programs generated by High-performance
Embedded Workshop is different from that of the vector table in the source file generated by
Peripheral Driver Generator. To avoid linkage error, change the function name from
"PowerON_Reset" to "PowerON_Reset_PC" (in three places) in resetprg.c included in the startup
program. This problem does not occur in follow cases.
(a) Creating the High-performance Embedded Workshop project with RX Family C/C++
compiler package V.1.00, and then updating it to V.1.01.
(b) Applying RX Family Device File Updater V.1.03 or later.
•
(6)
The type of parameter in intrinsic function set_fintv has been changed from unsigned long to void*
in RX Family C/C++ compiler package V.1.01. Due to this change, warning message may be
output in building the program in High-performance Embedded Workshop. Please ignore this
message.
The Renesas Peripheral Driver Library has been built specifying double-precision floating point.
Therefore, to build the user program with Peripheral Driver Generator-generated files, specify
double-precision floating point option in builder settings of IDE as follows. It's unnecessary at the time of
e2 studio use.
CubeSuite+
1. Open the [CC-RX Property] by double-clicking [CC-RX(Build Tool)] in project tree.
2. In the [CPU] category, select [Handles in double precision] for [Precision of the double type and
long double type].
High-performance Embedded Workshop
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 261 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Registering Files with the IDE and Building Them
1. Select [Build]->[RX Standard Toolchain] from main menu to open the [RX Standard Toolchain]
dialog box.
2. Select the [CPU] tab.
3. Click the [Details] button to open the [CPU details] dialog box.
4. Select [Double precision] for [Precision of double].
(7)
The RPDL library use FIXEDVECT section that address is 0xFFFFFFD0. Therefore, to build the user
program with PDG-generated files, specify the linker option in builder setting of IDE as follows. It’s
necessary at the time of e2 studio use.
1. Select the project on Project Explorer.
2. Select [File]->[Properties] from main menu to open the [Properties] window.
3. Select [C/C++ build] ->[Settings]
4. Select [All configurations] for [Configuration]
5. Select [Linker] -> [Section] to show [Section viewer]
6. Set the address of the FIXEDVECT section as 0xFFFFFFD0.
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 262 of 270
RX62T Group Peripheral Driver Generator Reference Manual
Appendix
Appendix 1. Pin Functions for which the Allocation Can be Changed
Table a-1.1
112-pin LQFP
(the Upper Row of Each Pair is the Default Selection)
Peripheral module
Pin function
Selection of assignment
ICU
IRQ0
P10/MTCLKD/IRQ0
110
PE5/IRQ0
PG0/IRQ0/TRSYNC
1
59
P11/MTCLKC/IRQ1
PE4/MTCLKC/IRQ1/POE10#
109
8
IRQ2
PG1/IRQ1/TRDATA0
PE3/MTCLKD/IRQ2/POE11#
58
9
MTCLKA
PG2/IRQ2/TRDATA1
P33/MTIOC3A/MTCLKA/SSL3
57
67
*1
P21/ADTRG1#/MTCLKA/IRQ6
P32/MTIOC3C/MTCLKB/SSL2
76
68
*1
P20/ADTRG0#/MTCLKB/IRQ7
P31/MTIOC0A/MTCLKC/SSL1
77
70
P11/MTCLKC/IRQ1
PE4/MTCLKC/IRQ1/POE10#
109
8
P30/MTIOC0B/MTCLKD/SSL0
P10/MTCLKD/IRQ0
72
110
MTIOC0A
PE3/MTCLKD/IRQ2/POE11#
PB3/MTIOC0A/SCK0
9
35
MTIOC0B
P31/MTIOC0A/MTCLKC/SSL1
PB2/MTIOC0B/TXD0/SDA
70
36
POE10#
P30/MTIOC0B/MTCLKD/SSL0
PE2/NMI/POE10#
72
15
GTIOC0A
PE4/MTCLKC/IRQ1/POE10#
P71/MTIOC3B/GTIOC0A
8
65
*2
PD7/GTIOC0A/CTX/SSL1
P74/MTIOC3D/GTIOC0B
18
62
*2
PD6/GTIOC0B/SSL0
P72/MTIOC4A/GTIOC1A
19
64
*2
PD5/GTIOC1A/RXD1
P75/MTIOC4C/GTIOC1B
20
61
*2
PD4/GTIOC1B/SCK1
P73/MTIOC4B/GTIOC2A
21
63
*2
PD3/GTIOC2A/TXD1
P76/MTIOC4D/GTIOC2B
22
60
*2
PD2/GTIOC2B/MOSI
PB5/CTX/TXD2
23
31
*3
P81/MTIC5V/TXD2
PB6/CRX/RXD2
106
30
*3
P80/MTIC5W/RXD2
PB7/SCK2
107
29
*3
P82/MTIC5U/SCK2
P24/RSPCK
105
73
PA4/ADTRG0#/MTIOC1B/RSPCK
PD0/GTIOC3B/RSPCK
40
25
P23/CTX/LTX/MOSI
PB0/MTIOC0D/MOSI
74
38
(External
Interrupts)
IRQ1
MTU3
MTCLKB
MTCLKC
*1
MTCLKD
*1
MTU3_0
POE
GPT0
GTIOC0B
GPT1
GTIOC1A
GTIOC1B
GPT2
GTIOC2A
GTIOC2B
SCI2
TXD2
RXD2
SCK2
RSPI0
RSPCK
*4
MOSI
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Pin No.
Page 263 of 270
RX62T Group Peripheral Driver Generator Reference Manual
*4
MISO
*4
SSL0
*4
SSL1
*4
SSL2
*4
SSL3
*4
Appendix
PD2/GTIOC2B/MOSI
P22/ADTRG#/CRX/LRX/MISO
23
75
PA5/ADTRG1#/MTIOC1A/MISO
PD1/GTIOC3A/MISO
39
24
P30/MTIOC0B/MTCLKD/SSL0
PA3/MTIOC2A/SSL0
72
41
PD6/GTIOC0B/SSL0
P31/MTIOC0A/MTCLKC/SSL1
19
70
PA2/MTIOC2B/SSL1
PD7/GTIOC0A/CTX/SSL1
42
18
P32/MTIOC3C/MTCLKB/SSL2
PA1/MTIOC6A/SSL2
68
43
PE0/CRX/SSL2
P33/MTIOC3A/MTCLKA/SSL3
17
67
PA0/MTIOC6C/SSL3
PE1/SSL3
44
16
S12ADA0
ADTRG0#
PA4/ADTRG0#/MTIOC1B/RSPCK
P20/ADTRG0#/MTCLKB/IRQ7
40
77
S12ADA1
ADTRG1#
PA5/ADTRG1#/MTIOC1A/MISO
P21/ADTRG1#/MTCLKA/IRQ6
39
76
*1 to 4 The settings are linked together
Table a-1.2
100-pin LQFP
(the Upper Row of Each Pair is the Default Selection)
Peripheral module
Pin function
Selection of assignment
ICU
(External Interrupts)
IRQ0
P10/MTCLKD/IRQ0
PE5/IRQ0
100
1
IRQ1
P11/MTCLKC/IRQ1
PE4/MTCLKC/IRQ1/POE10#
99
8
*1
P33/MTIOC3A/MTCLKA/SSL3
P21/ADTRG1#/MTCLKA/IRQ6
58
67
*1
P32/MTIOC3C/MTCLKB/SSL2
P20/ADTRG0#/MTCLKB/IRQ7
59
68
P31/MTIOC0A/MTCLKC/SSL1
P11/MTCLKC/IRQ1
61
99
PE4/MTCLKC/IRQ1/POE10#
P30/MTIOC0B/MTCLKD/SSL0
8
63
P10/MTCLKD/IRQ0
PE3/MTCLKD/IRQ2/POE11#
100
9
MTIOC0A
PB3/MTIOC0A/SCK0
P31/MTIOC0A/MTCLKC/SSL1
32
61
MTIOC0B
PB2/MTIOC0B/TXD0/SDA
P30/MTIOC0B/MTCLKD/SSL0
33
63
POE
POE10#
PE2/NMI/POE10#
PE4/MTCLKC/IRQ1/POE10#
15
8
GPT0
GTIOC0A
*2
P71/MTIOC3B/GTIOC0A
PD7/GTIOC0A/CTX/SSL1/TRST#
56
18
*2
P74/MTIOC3D/GTIOC0B
PD6/GTIOC0B/SSL0/TMS
53
19
*2
P72/MTIOC4A/GTIOC1A
PD5/GTIOC1A/RXD1/TDI
55
20
*2
P75/MTIOC4C/GTIOC1B
PD4/GTIOC1B/SCK1/TCK
52
21
MTU3
MTCLKA
MTCLKB
MTCLKC
*1
MTCLKD
*1
MTU3_0
GTIOC0B
GPT1
GTIOC1A
GTIOC1B
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Pin No.
Page 264 of 270
RX62T Group Peripheral Driver Generator Reference Manual
GPT2
GTIOC2A
*2
P73/MTIOC4B/GTIOC2A
PD3/GTIOC2A/TXD1/TDO
54
22
*2
P76/MTIOC4D/GTIOC2B
PD2/GTIOC2B/MOSI/TRCLK
51
23
*3
PB5/CTX/TXD2/TRSYNC
P81/MTIC5V/TXD2
28
97
*3
PB6/CRX/RXD2/TRDATA0
P80/MTIC5W/RXD2
27
98
*3
PB7/SCK2/TRDATA1
P82/MTIC5U/SCK2
26
96
P24/RSPCK
PA4/ADTRG0#/MTIOC1B/RSPCK
64
37
PD0/GTIOC3B/RSPCK/TRDATA2
P23/CTX/LTX/MOSI
25
65
PB0/MTIOC0D/MOSI
PD2/GTIOC2B/MOSI/TRCLK
35
23
P22/ADTRG#/CRX/LRX/MISO
PA5/ADTRG1#/MTIOC1A/MISO
66
36
PD1/GTIOC3A/MISO/TRDATA3
P30/MTIOC0B/MTCLKD/SSL0
24
63
PA3/MTIOC2A/SSL0
PD6/GTIOC0B/SSL0/TMS
38
19
P31/MTIOC0A/MTCLKC/SSL1
PA2/MTIOC2B/SSL1
61
39
PD7/GTIOC0A/CTX/SSL1/TRST#
P32/MTIOC3C/MTCLKB/SSL2
18
59
PA1/MTIOC6A/SSL2
PE0/CRX/SSL2
40
17
P33/MTIOC3A/MTCLKA/SSL3
PA0/MTIOC6C/SSL3
58
41
GTIOC2B
SCI2
TXD2
RXD2
SCK2
RSPI0
Appendix
RSPCK
*4
MOSI
*4
MISO
*4
SSL0
*4
SSL1
*4
SSL2
*4
SSL3
S12ADA0
ADTRG0#
*4
PE1/SSL3
PA4/ADTRG0#/MTIOC1B/RSPCK
16
37
S12ADA1
ADTRG1#
P20/ADTRG0#/MTCLKB/IRQ7
PA5/ADTRG1#/MTIOC1A/MISO
68
36
P21/ADTRG1#/MTCLKA/IRQ6
67
*1 to 4 The settings are linked together
Table a-1.3
80-pin LQFP
(the Upper Row of Each Pair is the Default Selection)
Peripheral module
Pin function
Selection of assignment
ICU
IRQ1
P11/MTCLKC/IRQ1
77
(External Interrupts)
MTU3
MTCLKA
PE4/MTCLKC/IRQ1/POE10#
P33/MTIOC3A/MTCLKA/SSL3
7
48
*1
P21/ADTRG1#/MTCLKA/IRQ6
P32/MTIOC3C/MTCLKB/SSL2
57
49
*1
P20/ADTRG0#/MTCLKB/IRQ7
P31/MTIOC0A/MTCLKC/SSL1
58
51
P11/MTCLKC/IRQ1
PE4/MTCLKC/IRQ1/POE10#
77
7
P30/MTIOC0B/MTCLKD/SSL0
P10/MTCLKD/IRQ0
53
78
PE3/MTCLKD/IRQ2/POE11#
8
MTCLKB
MTCLKC
*1
MTCLKD
*1
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Pin No.
Page 265 of 270
RX62T Group Peripheral Driver Generator Reference Manual
MTU3_0
Appendix
MTIOC0A
PB3/MTIOC0A/SCK0
P31/MTIOC0A/MTCLKC/SSL1
27
51
MTIOC0B
PB2/MTIOC0B/TXD0/SDA
P30/MTIOC0B/MTCLKD/SSL0
28
53
POE
POE10#
PE2/NMI/POE10#
PE4/MTCLKC/IRQ1/POE10#
14
7
GPT0
GTIOC0A
*2
P71/MTIOC3B/GTIOC0A
PD7/GTIOC0A/CTX/TRST#
46
16
*2
P74/MTIOC3D/GTIOC0B
PD6/GTIOC0B/TMS
43
17
*2
P72/MTIOC4A/GTIOC1A
PD5/GTIOC1A/RXD1/TDI
45
18
*2
P75/MTIOC4C/GTIOC1B
PD4/GTIOC1B/SCK1/TCK
42
19
*2
P73/MTIOC4B/GTIOC2A
PD3/GTIOC2A/TXD1/TDO
44
20
*3
P24/RSPCK
PA4/ADTRG0#/MTIOC1B/RSPCK
54
80
*3
P23/CTX/LTX/MOSI
PB0/MTIOC0D/MOSI
55
30
*3
P22/ADTRG#/CRX/LRX/MISO
PA5/ADTRG1#/MTIOC1A/MISO
56
79
*3
P30/MTIOC0B/MTCLKD/SSL0
PA3/MTIOC2A/SSL0
53
31
*3
P31/MTIOC0A/MTCLKC/SSL1
PA2/MTIOC2B/SSL1
51
32
GTIOC0B
GPT1
GTIOC1A
GTIOC1B
GPT2
GTIOC2A
RSPI0
RSPCK
MOSI
MISO
SSL0
SSL1
S12ADA0
ADTRG0#
P20/ADTRG0#/MTCLKB/IRQ7
PA4/ADTRG0#/MTIOC1B/RSPCK
58
80
S12ADA1
ADTRG1#
P21/ADTRG1#/MTCLKA/IRQ6
PA5/ADTRG1#/MTIOC1A/MISO
57
79
*1 to 3 The settings are linked together
Table a-1.4
64-pin LQFP
(the Upper Row of Each Pair is the Default Selection)
Peripheral module
Pin function
Selection of assignment
MTU3
MTCLKC
*1
P31/MTIOC0A/MTCLKC/SSL1
P11/MTCLKC/IRQ1
43
61
*1
P30/MTIOC0B/MTCLKD/SSL0
P10/MTCLKD/IRQ0
45
62
MTIOC0A
PB3/MTIOC0A/SCK0
P31/MTIOC0A/MTCLKC/SSL1
23
43
MTIOC0B
PB2/MTIOC0B/TXD0/SDA
P30/MTIOC0B/MTCLKD/SSL0
24
45
GTIOC0A
*2
P71/MTIOC3B/GTIOC0A
PD7/GTIOC0A/TRST#
38
12
*2
P74/MTIOC3D/GTIOC0B
PD6/GTIOC0B/TMS
35
13
*2
P72/MTIOC4A/GTIOC1A
PD5/GTIOC1A/RXD1/TDI
37
14
*2
P75/MTIOC4C/GTIOC1B
PD4/GTIOC1B/SCK1/TCK
34
15
P73/MTIOC4B/GTIOC2A
36
MTCLKD
MTU3_0
GPT0
GTIOC0B
GPT1
GTIOC1A
GTIOC1B
GPT2
R20UT0681EJ0103
May 16, 2014
GTIOC2A
Rev.1.03
Pin No.
Page 266 of 270
RX62T Group Peripheral Driver Generator Reference Manual
RSPI0
Appendix
*2
PD3/GTIOC2A/TXD1/TDO
P24/RSPCK
16
46
*3
PA4/ADTRG0#/MTIOC1B/RSPCK
P23/CTX/LTX/MOSI
64
47
*3
PB0/MTIOC0D/MOSI
P22/CRX/LRX/MISO
26
48
*3
PA5/ADTRG1#/MTIOC1A/MISO
P30/MTIOC0B/MTCLKD/SSL0
63
45
*3
PA3/MTIOC2A/SSL0
P31/MTIOC0A/MTCLKC/SSL1
27
43
*3
PA2/MTIOC2B/SSL1
28
RSPCK
MOSI
MISO
SSL0
SSL1
*1 to 3 The settings are linked together
R20UT0681EJ0103
May 16, 2014
Rev.1.03
Page 267 of 270
RX62T Group
Peripheral Driver Generator
Reference Manual
Publication Date:
May 16, 2014
Published by:
Renesas Electronics Corporation
Edited by:
Rev.1.03
Microcomputer Tool Development Department 4
Renesas Solutions Corporation
© 2014 Renesas Electronics Corporation and Renesas Solutions Corporation. All rights reserved.
Colophon 3.0
RX62T Group
Peripheral Driver Generator
Reference Manual
R20UT0681EJ0103
Was this manual useful for you? yes no
Thank you for your participation!

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

Download PDF

advertisement