user51535: I am using the following codes to print characters on LCD display....
#include <LiquidCrystal.h>

const int rs = 8, en = 9, d0 = 4, d1 = 5, d2 = 6, d3 = 7;
LiquidCrystal lcd(rs, en, d0, d1, d2, d3);

void setup() {
  lcd.begin(16, 2);
  Serial.begin(9600);
}

void loop() {
  if (Serial.available()) {
    delay(100);
    lcd.clear();
    while (Serial.available() > 0) {
      lcd.write(Serial.read());
    }
  }
}

but in the end it is generating an unwanted character also..

kindly help me with the problem

user50469: The character to the right of the 'A' on your LCD display does not correspond to any of the built-in character bitmap definitions (either on a EU or Chinese display).  This random pattern is likely one of the 8 programmable character bitmaps supported by the LCD that has not been defined yet (ASCII codes 0 to 7).
So, you're likely sending the LCD a character with a value between 0 and 7.  It's probably a good idea to filter out invalid characters before attempting to display them on your LCD.
Filtering Example:
char c = Serial.read();
if ((c >= 32) && (c <= 128))
  lcd.write(c);


51535: <p>I am using the following codes to print characters on LCD display....</p>

<pre class="lang-cpp prettyprint-override"><code>#include &lt;LiquidCrystal.h&gt;

const int rs = 8, en = 9, d0 = 4, d1 = 5, d2 = 6, d3 = 7;
LiquidCrystal lcd(rs, en, d0, d1, d2, d3);

void setup() {
  lcd.begin(16, 2);
  Serial.begin(9600);
}

void loop() {
  if (Serial.available()) {
    delay(100);
    lcd.clear();
    while (Serial.available() &gt; 0) {
      lcd.write(Serial.read());
    }
  }
}
</code></pre>

<p>but in the end it is generating an unwanted character also..
<a href="https://i.stack.imgur.com/pr7ro.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pr7ro.jpg" alt="enter image description here"></a></p>

<p>kindly help me with the problem</p>
 50469: <p>The character to the right of the 'A' on your LCD display does not correspond to any of the built-in character bitmap definitions (either on a EU or Chinese display).  This random pattern is likely one of the 8 programmable character bitmaps supported by the LCD that has not been defined yet (ASCII codes 0 to 7).</p>

<p>So, you're likely sending the LCD a character with a value between 0 and 7.  It's probably a good idea to filter out invalid characters before attempting to display them on your LCD.</p>

<p>Filtering Example:</p>

<pre><code>char c = Serial.read();
if ((c &gt;= 32) &amp;&amp; (c &lt;= 128))
  lcd.write(c);
</code></pre>
