Author Topic: LCD2S Character set  (Read 2304 times)

chrispbarlow

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Intelligent Systems and Devices
LCD2S Character set
« on: December 14, 2012, 03:14:15 AM »
Thought this would be useful for anyone struggling with displaying non-standard characters on the Modtronix Serial LCD modules.

I've recently been using a LCD2S with 20x4 LCD display as part of a project using Arduino and an AVR plugin for Eclipse, and I've come across a discrepancy between the character set (Datasheet ch13, fig 24) and the characters displayed on the screen.

I have a function, void lcdPrint(char charToSend) (see below), which I wrote myself and uses the SPI library for Arduino. This generally works fine and I can display most things on the screen. The function is used in a time-triggered application where I only send one character to the display at a time (there's lots of other stuff going on around this).

However, I came across an issue when trying to display a backslash ("\") which the datasheet says should be 0x5E (standard ASCII). I tried various ways of coding this such as:

Code: [Select]
lcdPrint('\\');
lcdPrint(0x5E);
lcdPrint(94);
('\\' in C is resolved as the backslash character, ASCII 0x5E)

Using these resulted in the Yen symbol being displayed instead.

After a bit of hunting around, I discovered the following character set:

http://arduino.cc/forum/index.php/topic,21371.0.html

It seems that this is the character set the display uses, and not the one shown in the datasheet. I have confirmed this by successfully sending other characters to the display where there are discrepancies, such as the left and right arrows, etc.

Unfortunately, this seems to suggest that there is no support for the backslash character on the display.

lcdPrint function:

Code: [Select]
/*
 * Prints single character to LCD (accepts control characters)
 */
void lcdPrint(char charToSend)
{
lcdSync(); /* Send syncronisation sequence to LCD */

digitalWrite(lcd_cs, LOW);
delayMicroseconds(1);

SPI.transfer(WRITE_STR); /* Send 'write string' command (0x80) */
delayMicroseconds(1);
digitalWrite(lcd_cs, HIGH);
delayMicroseconds(1);

digitalWrite(lcd_cs, LOW);
delayMicroseconds(1);

SPI.transfer(charToSend); /* Send charToSend */
delayMicroseconds(1);

digitalWrite(lcd_cs, HIGH);

delayMicroseconds(1);

}
@chrispbarlow