0802A 4bit LCD Interfacing with renesas R5F102AA

The LCD powers on and displays one solid lines (black boxes), but no characters are shown. Even after sending correct initialization commands (e.g., 0x28, 0x0C, 0x01), the display remains unchanged. The Display OFF command (0x08) has no effect either.

Observed Symptoms:

  • Backlight and contrast are OK.
  • LCD shows 1 solid lines (default uninitialized state).
  • No change after command execution.
  • Verified working pin connections and logic levels.

Steps Taken:

  1. Verified correct wiring for 4-bit mode:
  • RS → P5.1, EN → P5.0, D4-D7 → P1.4–P1.7
  • R/W pin tied to GND
  1. Used HD44780-compatible 4-bit init sequence:

LCD_Nibble(0x03); // x3
LCD_Nibble(0x02); // switch to 4-bit
LCD_Command(0x28); // Function set
LCD_Command(0x0C); // Display ON
LCD_Command(0x06); // Entry mode
LCD_Command(0x01); // Clear

  1. Proper delays added between steps (as per datasheet).
// lcd.c - Corrected Version with Proper EN Pulse and Initialization Sequence

**file lcd.c**
#include "lcd.h"

static const unsigned char LINE[2] = {0x80, 0xC0};
volatile unsigned long delay_count = 0;

void delayMs(unsigned long delay)
{
    delay_count = 0;
    R_TAU0_Channel0_Start();
    while (delay_count < delay);
    R_TAU0_Channel0_Stop();
}

void delayUs(unsigned int us)
{
    volatile unsigned int i;
    for (i = 0; i < (us * 5); i++)
    {
        NOP();
    }
}

void LCD_Enable(void)
{
    LCD_EN = 1;
    delayUs(1);      // Short enable pulse
    LCD_EN = 0;
    delayMs(2);      // Let command settle
}

void LCD_Nibble(unsigned char nibble)
{
    LCD_D4 = (nibble >> 0) & 0x01;
    LCD_D5 = (nibble >> 1) & 0x01;
    LCD_D6 = (nibble >> 2) & 0x01;
    LCD_D7 = (nibble >> 3) & 0x01;
    LCD_Enable();
}

void LCD_Command(unsigned char cmd)
{
    LCD_RS = 0;
    LCD_Nibble(cmd >> 4);
    LCD_Nibble(cmd & 0x0F);
    delayMs(2);
}

void LCD_Data(unsigned char data)
{
    LCD_RS = 1;
    LCD_Nibble(data >> 4);
    LCD_Nibble(data & 0x0F);
    delayMs(2);
}

void LcdInit(void)
{
    LCD_RS = 0;
    LCD_EN = 0;

    delayMs(40); // Wait for LCD power-up

    // Initialization sequence for 4-bit interface
    LCD_Nibble(0x03); delayMs(5);
    LCD_Nibble(0x03); delayMs(1);
    LCD_Nibble(0x03); delayMs(1);
    LCD_Nibble(0x02); delayMs(1); // Switch to 4-bit

    LCD_Command(0x28); // 4-bit, 2-line, 5x8 font
    LCD_Command(0x08); // Display OFF
    LCD_Command(0x01); // Clear Display
    delayMs(2);
    LCD_Command(0x06); // Entry mode set
    LCD_Command(0x0C); // Display ON, Cursor OFF
}

void LcdPrint(char row, char col, char* str)
{
    LCD_Command(LINE[row - 1] + (col - 1));
    while (*str)
    {
        LCD_Data(*str++);
    }
}

**file lcd.h**

// lcd.h
#ifndef LCD_H
#define LCD_H

#include "r_cg_macrodriver.h"
#include "r_cg_port.h"
#include "r_cg_timer.h"

#define LCD_EN    P5.0
#define LCD_RS    P5.1

#define LCD_D4    P1.4
#define LCD_D5    P1.5
#define LCD_D6    P1.6
#define LCD_D7    P1.7

void LCD_Enable(void);
void LCD_Nibble(unsigned char nibble);
void LCD_Command(unsigned char cmd);
void LCD_Data(unsigned char data);
void LcdInit(void);
void LcdPrint(char row, char col, char* str);
void delayMs(unsigned long delay);

#endif

please suggest some solutions
![image|690x393](upload://2islNhYipjxRO75xyzCpplwzg58.png)

I moved your topic to an appropriate forum category @komalpatil.

In the future, when creating a topic please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.

This is an important part of responsible forum usage, as explained in the "How to get the best out of this forum" guide. The guide contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

This is my LCD schematic pin mapping

I have deleted your other cross-post @komalpatil.

Cross-posting is against the Arduino forum rules. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.

Repeated cross-posting can result in a suspension from the forum.

In the future, please only create one topic for each distinct subject matter. This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

Why don't you use the Liquid Crystal Library in the Arduino ide?