Sota Shinohara
Sota Shinohara
Application Engineer
Published: May 29, 2023

Here's a procedure that even beginners can use to easily create a game using a microcontroller.

The RL78 microcontroller has a cheap and easy-to-use development environment available. For this tutorial, we used the RL78/G23 Fast Prototyping Board (FPB) to create a mole-catching game.

First, let me explain the mole-catching game. The game randomly lights up the segments of a 7-segment LED at fixed time intervals, and the player has to press the button at the moment when the decimal point is lit up. If the player manages to stop the decimal point, then they have successfully caught the mole (as shown in Figure 1).

Figure 1

To create the mole-catching game, please obtain the following necessary components from your favorite online shopping site or other sources.

  • Breadboard
  • 1-digit 7-segment LED
  • LEDs (blue, red)
  • Tactile switch
  • 120Ω resistor
  • Sink-type transistor array
  • Jumper wires
  • Micro USB Type-B cable
  • FPB (RL78/G23 64-pin)

Integrated Development Environment (IDE)

Next, let's prepare the development tools. Install the development tools while referring to the Start Developing with the RL78 - Essential for Microcomputer Beginners - Part 1 blog. For reference, I chose CS+ which is easy to understand even for beginners.

Peripheral Function

Let me briefly introduce the peripheral functions of the RL78/G23 that were used in programming the mole-catching game.

  1. Port function: Used to control the 7-segment LED display.
  2. Timer Array Unit (TAU): Generates interrupts at regular intervals to adjust the display time of the 7-segment LED.
  3. True Random Number Generator (TRNG): Used to generate random patterns of LED display.

Reference: RL78/G23 Product Information Page

Creation Process

Let's create the game by following the steps below.

  1. Download the code that has been created using C language from the following URL (available in Japanese only).
    Code: Let's Make a Game Using a Microcontroller - Part 1: Sample Programs and More - Renesas Community
  2. We will wire the circuit according to the circuit diagram shown in Figure 2 and demonstrated with the boards in Figure 3 and Figure 4.

    In this game's specifications, the blue LED lights up when the game is successful, and the red LED lights up when the game is lost.
    Figure 2
    Figure 3 and Figure 4
  3. Connect jumper wires to the FPB as shown in Figure 5 and Figure 6.
    Refer to Pages 16-18 of the "RL78/G23-64p Fast Prototyping Board User's Manual" for the terminal layout of the FPB.
    Figure 5
    Figure 6
  4. Connect the USB cable to both the PC and the microcontroller as shown in Figure 7.
  5. Debug the code using CS+, see Figure 8 for reference.
    Debug the code that you downloaded earlier using CS+.
  6. Run the program.
    After debugging, run the program as demonstrated in Figure 9.
    Once the program is debugged, it is written into the microcontroller. The program that was debugged once is stored in the microcontroller, so you can operate it just by supplying power without debugging with CS+ next time. However, if you want to operate the microcontroller alone without using a PC, you need to use programming software such as RFP to write the program again.
  7. It worked correctly.
    Press the button to start the game
    Red LED lights up when failed
    Blue LED lights up upon success

That concludes the game creation process. By using the FPB and breadboard, you can connect to your PC with just one USB cable and eliminate the need for soldering work. I highly recommend using the FPB and breadboard for electronic projects. If you're interested in electronics, try creating your own project using the RL78 microcontroller.

Reference: Fast Prototyping Board for RL78 Family

The reference used for creating the mole-catching game is provided in the URL below. Please take a look if you are interested!
*The following URL is available in Japanese only.

Reference: Parent-Child Electronics Projects with Matsuta Kosaku (

Share this news on