background image

 

Application Note 

R01AN5615EJ0200  Rev.2.00 

 

Page  1  of 42 

Mar.24.22 

 

RL78/G23 

ELCL Multiple Parameter Monitoring Function 

Introduction 

  This application note describes how to monitor multiple input signals (parameters) using the logic and event 
link controller (ELCL). By using ELCL, it is possible to reduce the resources (external parts, ROM, RAM, etc.) 
because the functions realized by external parts or software can be realized by hardware. 

 

Target Device 

RL78/G23 

 

When applying the sample program covered in this application note to another microcomputer, modify the 

program according to the specifications for the target microcomputer and conduct an extensive evaluation of 
the modified program. 

 

 

 

Summary of Contents for RL78/G23

Page 1: ...nk controller ELCL By using ELCL it is possible to reduce the resources external parts ROM RAM etc because the functions realized by external parts or software can be realized by hardware Target Device RL78 G23 When applying the sample program covered in this application note to another microcomputer modify the program according to the specifications for the target microcomputer and conduct an ext...

Page 2: ...ss 16 4 8 2 Channel change process for TAU0 17 4 8 3 TAU0 reset process 18 4 8 4 ELCL interrupt process 19 4 8 5 ELCL flip flop reset process 19 4 8 6 INTP0 interrupt process 20 4 8 7 Wait process 21 4 8 8 TAU0 channel 7 interrupt process 21 5 Application example 22 5 1 Setting up the ELCL components 22 5 2 r01an5615_elcl_parameter scfg 24 5 2 1 Clocks 26 5 2 2 System 26 5 2 3 r_bsp 26 5 2 4 Confi...

Page 3: ...ing Function R01AN5615EJ0200 Rev 2 00 Page 3 of 42 Mar 24 22 5 3 2 Example of using four ports with no external interrupt function as interrupts 37 5 3 3 How to Make Inputs Negative Logic 38 6 Sample Code 39 7 Reference 39 Revision History 40 ...

Page 4: ...0 L2F1 L3F0 L3F1 and link the output of the flip flops to the monitor register ELOMONI Thereby it is possible to confirm the state of the input signal by reading the monitor register For example link four ports P20 to P23 that do not have an external interrupt function to INPUT A to INPUT D and set the link destination of OUTPUT E to event link interrupt INTELCL As a result INTELCL is generated wh...

Page 5: ...RL78 G23 ELCL Multiple Parameter Monitoring Function R01AN5615EJ0200 Rev 2 00 Page 5 of 42 Mar 24 22 Figure 1 2 Timing chart OUTPUT E INPUT A INPUT B INPUT C INPUT D ELOMONI3 ELOMONI4 ELOMONI5 ELOMONI6 ...

Page 6: ...VD0 Reset mode Rising edge TYP 1 90V Falling edge TYP 1 86V Integrated development environment CS CS for CC V8 07 00 from Renesas Electronics Corp C compiler CS CC RL V1 11 from Renesas Electronics Corp Integrated development environment e2 studio e2 studio 2022 01 22 01 0 from Renesas Electronics Corp C compiler e2 studio CC RL V1 11 from Renesas Electronics Corp Integrated development environmen...

Page 7: ...e design includes sufficient pin processing and meets electrical characteristic requirements Connect each input only port to VDD or VSS through a resistor Caution 2 Connect the EVSS pin to VSS and the EVDD pin to VDD Caution 3 VDD must be held at not lower than the reset release voltage VLVD0 that is specified as LVD 3 2 Used Pins Table 3 1 shows list of used pins and assigned functions Table 3 1 ...

Page 8: ... SW1 is pressed the lighting interval of LED1 changes accordingly Table 4 1 shows operation overview The operations from No 1 to 10 are repeated by pressing SW1 Table 4 1 Operation overview Combination of timers No g_timer_mode SW1 TAU0 LED1 Channel 0 Channel 1 Channel 2 Channel 3 1 0 STOP STOP STOP STOP OFF 2 1 Press STOP STOP STOP STOP OFF 3 1 Count STOP STOP STOP Blink About 2s intervals 4 2 Pr...

Page 9: ... intervals g_timer_mode 2 The LED1 is blinked at INTTM00 and INTTM01 ORed intervals g_timer_mode 3 The LED1 is blinked at INTTM00 INTTM01 and INTTM02 ORed intervals g_timer_mode 4 The LED1 is blinked at INTTM00 INTTM01 INTTM02 and INTTM03 ORed intervals Reset release 1 2 3 4 5 6 7 8 9 10 Figure 4 2 Timing chart of the sample code INTTM01 INTTM00 INTTM03 INTTM02 INTELCL SW1 LED1 g_timer_mode 0 g_ti...

Page 10: ...TM02 and INTTM03 as the ELCL input signal and INTELCL as the ELCL output signal Figure 4 3 System configuration of the sample code L2F0 L3F1 L3F0 L2F1 L1L0 ELCL L2L0 ELL2T 30EN ELL3T 30EN ELL2T 31EN ELL3T 31EN L1L1 ELOMONI7 ELOMONI6 ELOMONI5 ELOMONI4 ELOMONI3 ELOMONI2 ELOMONI1 ELOMONI0 ELOMONI INTTM00 INTTM01 INTTM02 INTTM03 Interrupt Control circuit CPU P53 P53 LED1 P137 SW1 TAU0 INTELCL ...

Page 11: ..._MultipleParameterMoni toring_user c Interrupt source file for ELCL Note 2 Config_PORT DIR Folder for PORT program Config_PORT c Source file for PORT Config_PORT h Header file for PORT Config_PORT_user c Interrupt source file for PORT Note 1 Config_TAU0_0 DIR Folder for TAU0 channel 0 program Config_TAU0_0 c Source file for TAU0 channel 0 Config_TAU0_0 h Header file for TAU0 channel 0 Config_TAU0_...

Page 12: ...IAR version of the sample code contains r01an5615_elcl_parameter ipcf For the ipcf file refer to RL78 Smart Configurator User Guide IAR R20AN0581 4 3 Option Byte Settings Table 4 4 shows the option byte settings Table 4 4 Option Byte Settings Address Setting Value Contents 000C0H 040C0H 1110 1111B EFH Operation of Watchdog timer is stopped counting is stopped after reset 000C1H 040C1H 1111 1110B F...

Page 13: ...erMon itoring_interrupt 4 6 Functions Table 4 7 shows the functions used in the sample code However the unchanged functions generated by the Smart Configurator are excluded Table 4 7 Functions Function name Outline Source file main Main process main c r_timer_update Channel change process for TAU0 support_functions c r_timer_reset TAU0 stop process support_functions c r_Config_MultipleParameterMon...

Page 14: ...U to be operated is changed and the TAU is started and stopped Arguments None Return value None Remarks None Function name r_timer_reset Outline TAU0 reset process Header r_smc_entry h support_functions h Declaration void timer_reset void Description Stop TAU0 reset the counter and wait for the start state Arguments None Return value None Remarks None Function name r_Config_MultipleParameterMonito...

Page 15: ... Function name r_ms_delay Outline Wait process Header r_cg_macrodriver h r_cg_userdefine h Config_TAU0_7 h Declaration void r_ms_delay uint16_t msec Description This function waits for the time ms specified by the argument msec This function counts using channel 7 Polls if g_ms_timer is less than CHATTA_WAIT completes wait process if more than CHATTA_WAIT Arguments msec Return value None Remarks N...

Page 16: ...ete rMonitoring_Start Enable interrupt EI INTP0 Start R_Config_INTC_INTP0_Sta rt INTELCL occurred INTP0 occurred Wait for SW1 INTP0 to be pressed 1 g_led_flag 0 g_timer_mode LED1 OFF LED1 ON LED1 OFF Flip Flop reset r_elcl_reset_flipflop ELCL output disable R_Config_MultipleParamete rMonitoring_Stop ELCL output enable R_Config_MultipleParamete rMonitoring_Start g_led_flag 0 Yes Yes No No 1 g_timer...

Page 17: ...0 TAU01 TAU02 and TAU03 RETI g_timer_mode 0 g_timer_mode 1 g_timer_mode 2 g_timer_mode 3 g_timer_mode 4 A B C D A B C D TOE0L 00H LED1 OFF STOP Reset TAU0 R_TAU0_Set_PowreOff Initialization of TAU00 R_Config_TAU0_0_Create Enable outputs of TAU00 A B A B g_timer_mode 1 g_timer_mode 2 TAU00 count start Initialization of TAU00 R_Config_TAU0_0_Create Initialization of TAU01 R_Config_TAU0_1_Create Enab...

Page 18: ...fig_TAU0_0_Create Initialization of TAU01 R_Config_TAU0_1_Create Enable outputs of TAU00 TAU01 TAU02 and TAU03 TAU00 TAU01 TAU02 and TAU03 count start Initialization of TAU02 R_Config_TAU0_2_Create Initialization of TAU03 R_Config_TAU0_3_Create Initialization of TAU02 R_Config_TAU0_2_Create TOE0L 07H TS0 07H TOE0L 0FH TS0 0FH 4 8 3 TAU0 reset process Figure 4 7 shows flowchart of TAU0 reset proces...

Page 19: ...4 8 ELCL interrupt process r_Config_MultipleParameterM onitoring_interrupt return g_led_flag 1 4 8 5 ELCL flip flop reset process Figure 4 9 shows flowchart of ELCL flip flop reset process Figure 4 9 ELCL flip flop reset process r_elcl_reset_flipflop return ELL2CTL ELL2T3xEN 0 ELL2CTL ELL2T3xEN 1 Reset flip flop in block L2 ELL3CTL ELL3T3xEN 0 ELL3CTL ELL3T3xEN 1 Reset flip flop in block L3 ...

Page 20: ... 20 of 42 Mar 24 22 4 8 6 INTP0 interrupt process Figure 4 10 shows flowchart of INTP0 interrupt process Figure 4 10 INTP0 interrupt process No Yes r_Config_INTC_intp0_interrupt 5 g_timer_mode g_timer_mode 0 g_timer_flag 1 Wait r_ms_delay CHATTA_WAIT Enable interrupt EI PIF0 0 return ...

Page 21: ...ocess r_ms_delay TAU07 Start R_Config_TAU0_7_Start return g_ms_timer CHATTA_WAIT No TAU07 Stop R_Config_TAU0_7_Stop g_ms_timer 0 Initialization of TAU07 R_Config_TAU0_7_Create Yes TS07 1 TT07 1 4 8 8 TAU0 channel 7 interrupt process Figure 4 12 shows flowchart of TAU0 channel 7 interrupt process Figure 4 12 TAU0 channel 7 interrupt process r_Config_TAU0_7_interrupt return g_ms_timer ...

Page 22: ...5615_elcl_parameter scfg The following is a description of the file and examples of settings and notes for use 5 1 Setting up the ELCL components To use the ELCL component you need to install the ELCL content file The procedure is shown below 1 Start the Smart Configurator 2 Click on the Components tag and then click Add component 3 When the New Component window shown in Figure 5 1 opens click on ...

Page 23: ...elect Multiple Parameter Monitoring Function and download it Please download the common setting file RL78 G23 Common ELCL Module as well Figure 5 2 Download the module 5 After the download is complete make sure that ELCL multiple parameter monitoring is available for selection Figure 5 3 Select the module ...

Page 24: ...bsp Start up select Enable use BSP startup Control of invalid memory access detection Disable RAM guard space GRAM0 1 Disabled Guard of control registers of port function GPORT Disabled Guard of registers of interrupt function GINT Disabled Guard of control registers of clock control function voltage detector and RAM parity error detection function GCSC Disabled Data flash access control DFLEN Dis...

Page 25: ...imer Operating mode 16 bit count mode Resource TAU0_2 Operation clock CK00 Clock source fCLK 212 Interval value 2000 count Interrupt setting unused Config_TAU0_3 Components Interval timer Operating mode 16 bit count mode Resource TAU0_3 Operation clock CK00 Clock source fCLK 212 Interval value 1000 count Interrupt setting unused Config_TAU0_7 Components Interval timer Operating mode 16 bit count m...

Page 26: ...tings Note that changing the settings 5 2 5 Config_INTC Set the interrupt settings of the sample code The sample code sets the external maskable interrupt INTP0 delete it if you do not use INTP0 5 2 6 Config_TAU0_0 Config_TAU0_1 Config_TAU0_2 Config_TAU0_3 Set the TAU00 TAU01 TAU02 and TAU03 of the sample code In the sample code it is used as an interval timer and the interval time is changed for ...

Page 27: ...rMonitoring Initialize the ELCL in the sample code In the sample code INTTM00 INTTM01 INTTM02 and INTTM03 are selected for input and INTELCL is selected for output See Section 5 3 Component ELCL multiple parameter monitoring for details 5 2 9 Config_PORT Set the port of the sample code In the sample code P53 is used to control LED1 ...

Page 28: ...r Source A ELISEL_0 11Note 1 Signals listed in Table 5 4 Table 5 5 Table 5 6 Select an input factor Source B Source C ELISEL_6 11Note 1 Signals listed in Table 5 4 Table 5 6 Source D Output E INTELCL Select the output destination DTC startup Trigger SMS startup Trigger A D converter hardware trigger D A converter 0 hardware trigger D A converter 1 hardware trigger CTSU hardware trigger ITL capture...

Page 29: ... SAU0 Channel0 Data Output SAU0 Channel1 Data Output SAU0 Channel0 Communication Clock Output SAU0 Channel1 Communication Clock Output P11 P50 UARTA0 Communication Clock Output TAU0 Channel0 Output TAU0 Channel1 Output TAU0 Channel2 Output TAU0 Channel3 Output TAU0 Channel4 Output TAU0 Channel5 Output TAU0 Channel6 Output TAU0 Channel7 Output P10 P51 comparator ch0 comparator ch1 UARTA0 Data Outpu...

Page 30: ...ELISELn register Input parameter ELISEL0 P20 P120 INTP6 INTURE0 INTTM10 INTTM16 INTUT1 ELISEL1 P21 P121 INTP7 INTURE1 INTTM11 INTTM17 INTUR1 ELISEL2 P22 P122 INTP8 INTTM12 INTST3 INTCSI30INTIIC30 INTIICA1 ELISEL3 P23 P147 INTP9 INTSRE3 INTTM13H INTSR3 INTCSI31 INTIIC31 ELISEL4 P30 P00 INTKR INTTM14 INTUT0 ELISEL5 P31 P01 INTTM13 INTTM15 INTUR0 ELISEL 0 5 P137 ...

Page 31: ...INTIIC11 INTSMSE ELISEL7 INTP1 INTTM01 INTITL INTSR2 INTCSI21 INTIIC21 INTSRE1 INTTM03H INTP10 INTCMP0 ELISEL8 INTP2 INTTM02 INTWDTI INTSRE2 INTM11H INTREMC INTP11 INTCMP1 ELISEL9 INTP3 INTTM03 INTRTC INTST0 INTCSI00 INTIIC00 INTSR0 INTCSI01 INTIIC01 INTCTSUWR ELISEL10 INTP4 INTTM04 INTTM07 INTSRE0 INTTM01H INTLVI INTCTSURD ELISEL11 INTP5 INTTM05 INTIICA0 INTST1 INTCSI10 INTIIC10 INTAD INTCTSUFN E...

Page 32: ...fer to Figure 4 3 for the overall ELCL configuration Table 5 7 ELCL register settings Inputs Register Symbol Register Name Setting Description ELISEL6 Input signal select register 6 16H Select INTTM00 ELISEL7 Input signal select register 7 16H Select INTTM01 ELISEL8 Input signal select register 8 16H Select INTTM02 ELISEL9 Input signal select register 9 16H Select INTTM03 Figure 5 5 Setting of ELC...

Page 33: ...link target of L1 ELL1LNK0 Event link L1 output select register 0 01H Link target selected by ELL1SEL0 to input 0 of logic cell 0 in logic cell block L1 ELL1LNK1 Event link L1 output select register 1 02H Link target selected by ELL1SEL1 to input 1 of logic cell 0 in logic cell block L1 ELL1LNK2 Event link L1 output select register 2 03H Link target selected by ELL1SEL2 to input 0 of logic cell 1 ...

Page 34: ...ster 0 0AH Link target selected by ELL2SEL0 to set control of flip flop 0 in logic cell block L2 ELL2LNK1 Event link L2 output select register 1 01H Link target selected by ELL2SEL1 to input 0 of logic cell 0 in logic cell block L2 ELL2LNK2 Event link L2 output select register 2 02H Link target selected by ELL2SEL2 to input 1 of logic cell 0 in logic cell block L2 ELL2LNK4 Event link L2 output sel...

Page 35: ... selection fixed to 0 ELL3LNK0 Event link L3 output select register 0 0AH Link target selected by ELL3SEL0 to set control of flip flop 0 in logic cell block L3 ELL3LNK4 Event link L3 output select register 4 01H Link target selected by ELL3SEL4 to set control of flip flop 1 in logic cell block L3 ELL3LNK6 Event link L3 output select register 6 03H Link target selected by ELL3SEL6 to clock of flip ...

Page 36: ... logic cell block L2 ELOSEL4 Output signal select register 4 0EH Select the output signal 3 from logic cell block L3 ELOSEL5 Output signal select register 5 0AH Select the output signal 4 from logic cell block L2 ELOSEL6 Output signal select register 6 0FH Select the output signal 4 from logic cell block L3 Figure 5 9 Settings of ELCL output L2L0 Output Signal L2F0 Output Signal L3F0 Output Signal...

Page 37: ... Interrupt Control circuit CPU INTELCL Note that the interrupt function realized in this configuration differs from the external interrupt function INTPx in the following respects INTELCL is an ORed signal of the input pins and an interrupt is generated when the ORed signal changes from Low to High If the code is output from the smart configurator as is an interrupt will be generated on the rising...

Page 38: ... change before after change void R_Config_MultipleParameterMonitoring_Create void uint8_t p_isel0 uint8_t p_isel1 uint8_t p_isel2 uint8_t p_isel3 uint8_t p_isel2u uint8_t p_isel3u uint8_t p_osel0 uint8_t p_osel1 uint8_t p_osel2 ELISEL6 0x16U p_isel0 0x07U ELISEL7 0x16U p_isel1 0x08U ELISEL8 0x16U p_isel2 0x09U p_isel2u 0x03U ELISEL9 0x16U p_isel3 0x0AU p_isel3u 0x04U ELL1SEL0 p_isel0 ELL1SEL1 p_is...

Page 39: ...s Manual Software R01US0015E RL78 Smart Configurator User s Guide CS R20AN0580E RL78 Smart Configurator User s Guide e2 studio R20AN0579E RL78 Smart Configurator User s Guide IAREW R20AN0581E The latest version can be downloaded from the Renesas Electronics website Technical Update Technical News The latest version can be downloaded from the Renesas Electronics website All trademarks and registere...

Page 40: ...Operation Confirmation Conditions Emulator E2 Emulator Lite CS e2 studio COM port IAR E2 Emulator Lite Figure 3 1 Hardware Configuration Added P11 TOOLRxD and P12 TOOLTxD Table 5 1 Smart Configurator Settings Note added 11 12 Updated the folder structure in Table 4 2 due to the sample program update Added Note 3 due to the update of the IAR version sample code 12 Table 4 4 Option byte setting Dete...

Page 41: ...gure 4 12 INTP0 interrupt process Figure number Figure 4 12 Figure 4 10 Figure 4 13 Wait process Figure number Figure 4 13 Figure 4 11 Figure 4 14 TAU0 channel 7 interrupt process Figure number Figure 4 14 Figure 4 12 Figure 5 1 Add component Figure 5 2 Download the module Figure 5 3 Select the module Figure 5 4 Component ELCL multiple parameter monitoring Figure update 23 25 27 28 Updated the com...

Page 42: ... ELCL multiple parameter monitoring update Table 5 4 Choices of input parameter common to ELISEL 0 to 11 Table 5 5 Choices of input parameter common to ELISEL 0 to 5 Table 5 6 Choices of input parameter common to ELISEL 6 to 11 38 Updated the smart configurator output code in line with the update of the component ELCL Multiple Parameter Monitoring 5 3 3 How to Make Inputs Negative Logic Updated to...

Page 43: ...put signal during power off state as described in your product documentation 4 Handling of unused pins Handle unused pins in accordance with the directions given under handling of unused pins in the manual The input pins of CMOS products are generally in the high impedance state In operation with an unused pin in the open circuit state extra electromagnetic noise is induced in the vicinity of the ...

Page 44: ...D ALL WARRANTIES EXPRESS OR IMPLIED WITH RESPECT TO THIS DOCUMENT AND ANY RELATED OR ACCOMPANYING SOFTWARE OR HARDWARE INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE 8 When using Renesas Electronics products refer to the latest product information data sheets user s manuals application notes General Notes for Handling and Using Semiconduc...

Reviews: