Skip to content

RL78 G23 128p FPB SDCard (Arduino™ Sketch)

MikiyaKobayashi edited this page Sep 30, 2025 · 1 revision

Introduction

  • This page describes how to run a sample sketch that writes to and reads from an SD card
  • For basic information such as how to install the Arduino IDE and Arduino libraries, and how to write sketches to the board, please refer to the Quick Start Guide

Operating Environment and Products Used

This page uses the following environment and products

Hardware

SoftWare

  • Arduino IDE 2.3.6
  • Arduino Library v1.2.0
  • SdFat by Bill Greiman 2.3.0

Installing the SdFat Library

  • Open the Library Manager
  • Enter "sdfat" in the Library Manager search form and press the "Install" button
sdtfatインストール_edit

Hardware Setup

  • Insert the SD card into the Digilent Pmod SD card slot and connect it to PMOD1
  • Connect the PC and RL78/G23-128p Fast Prototyping Board via USB
pmod_connection

Selecting the Sample Sketch

  • Select in order: “File” → “Examples” → “SdFat” → “exampleV1” → “ReadWrite”
サンプルスケッチ選択_edit

Confirming SD Card Write Operation

  • Open the Serial Monitor from “Tools” or by pressing ctrl+shift+M
シリアルモニタ_edit
  • After writing to the board, the following output will appear in the Serial Monitor:
Initializing SD card...initialization done.
Writing to test.txt...done.
test.txt:
testing 1, 2, 3.
  • Connect the SD card to the PC
  • Confirm that test.txt has been created and written correctly
test-1

Changing the Filename and Write Content on the SD Card

You can freely change the filename and write content by modifying as shown below:

Changes

  • Change the filename from "test.txt" to "mytest.txt"
  • Change the write content from "testing 1, 2, 3" to "mytest changed"

Modification Points

Line 46
-myFile = SD.open("test.txt", FILE_WRITE);
+myFile = SD.open("mytest.txt", FILE_WRITE);
Line 50
-Serial.print("Writing to test.txt...");
+Serial.print("Writing to mytest.txt...");
Line 51
-myFile.println("testing 1, 2, 3.");
+myFile.println("mytest changed");
Line 61
-myFile=SD.open("test.txt);
+myFile=SD.open("mytest.txt");
Line 63
-Serial.println("test.txt:");
+Serial.println("mytest.txt:");

Confirming SD Card Write Operation

  • After writing to the board, the following output will appear in the Serial Monitor:
Initializing SD card...initialization done.
Writing to mytest.txt...done.
mytest.txt:
mytest changed
  • Connect the SD card to the PC
  • Confirm that mytest.txt has been created and written correctly
mytest-1
Clone this wiki locally