I am currently a project intern, working on Light Fidelity (Li-Fi). Most part of the project deals with development of software for Renesas Micro controller.

I have a simple doubt regarding timer and interrupt programming.

As a part of my project, I have to generate an interrupt as soon as the timer overflows. I am trying hard and finding it difficult to achieve it . Also. I need to know about how to calculate the timer overflow value, so that an interrupt is generated.

It would be great help,if these questions are solved and explained in detail.

Thank you!

  • $\begingroup$ Respected sir, thank you for showing your your interest and help me solve this problem. The details are as follows : 1) Renesas RL78/F13 microcontrollers. 2) We are using IAR IDE, along with APPLILET3 for code generation. Hope this will be beneficial to solve my doubt. Thank you! $\endgroup$ Dec 4, 2019 at 4:02
  • $\begingroup$ My experience is limited to e2Studio, smart configurator and RX130 processor platform. Using above tools and microcontroller it took me less than 15 minute achieve the above task. I think this can be achieved with RL78/F13. If you are open to experimenting with e2Studio, smart configurator and RL78 I will post a step. Hopefully this will help you guidance to solve the problem for RL78/F13 and IAR IDE. Let me know your thoughts. $\endgroup$ Dec 5, 2019 at 1:53
  • $\begingroup$ Dear Sir, it will be of great help, if you could guide me. Thank you! $\endgroup$ Dec 5, 2019 at 10:04
  • $\begingroup$ I have posted a brief response to your question. If need assistance with setting up a GPIO port connected to LED, post a separate question with a link this question. There are step that I left out, which I believe are intuitive, $\endgroup$ Dec 6, 2019 at 15:25
  • $\begingroup$ Also I suggest that you update the question with comments about micro controller and IDE and delete the comment. Their is an edit option to help update the question, below the tags $\endgroup$ Dec 6, 2019 at 15:27

2 Answers 2


This response is based on RX130 Capacitive touch development board as shown below

Renesas RX130 Capacitive touch development board

  • IDE: e2Stuido v7.5 and above
  • Toolchain: Renesas RXC toolchain
  • Board: RX130 Capacitive touch development board
  • MCU: RX130 R5F5130ADFN
  • Debugger: E1

The steps below are to help setup the RX130

  1. Set up clocks HOCO Clock and VCC to 5.0

Set up VCC

make sure other clocks a deselected

Select the clocks

  1. Select the Compare Match Timer and add software module

Select Software Component

Add Module

Compare Match Timer

  1. Configure the Compare Match Timer (CMT)

Name the CMT

Configure CMT

The above are all the step you need to configure the Compare Match Timer. There are steps that have been left out to be concise.

To test the CMT setup a GPIO port connected to a LED and toggle the LED when CMT has rolled over and interrupt is generated


The following link might help:


It has information about how to use interrupts (very similar to Arduino). However, for the timer I only see references to functions like milli.

As you mention, the best way is to set up a timer which automatically sets the value of the time, after the interrupt is generated.

For this, you need to set the relevant registers, which can be found in the datasheet of your MCU.

In general, it works something like this:

  • Chose a timer peripheral (if there are more, high likely)
  • Set the timer value (this can involve multiple registers, like a value, multiplier, something to repeat interrupts or a one-shot, or a comparator).
  • Start the interrupt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.