Go back to the PmodCLS Resource Center

Pmod CLS User Guide

Welcome to the FAQ / User Guide for the PmodCLS! As questions come up, either through the Digilent Forum or otherwise, they will be addressed here in this document.

  1. I came here because I saw there would be a list of instructions available to view.

    Great reason! You can view the list in the table in paragraphs below

Instruction Set

Instruction Result
<row>;<col>H set cursor position to <row>, <col>
s save cursor position
u restore saved cursor position
j clear display and home cursor
<ps>K erase within line, 0 = current position to end of line, 1 = start of line to current position, 2 = entire line
<ps>N erase field in current line <ps> = number of chars starting at current position
<pn>@ scroll left <pn> columns
<pn>A scroll right <pn> columns
* reset: equivalent to cycling power of PmodCLS
<ps>h set display mode, 0 = wrap line at 16 character, 1 = wrap line at 40 characters
<ps>c set cursor mode, 0 = cursor off, 1 = cursor on, blink off, 2 = cursor on, blink on
<pn>a save TWI address in EEPROM to <pn>
<pn>b save baud rate value in EEPROM to <pn>
<pt>p program character table into LCD
Instruction Result
<pt>t save RAM character table to EEPROM
<pt>l load EEPROM chracter table to RAM
<pn>…<pn>;<ps>d define user programmable character
<ps>m save communication mode to EEPROM
w enables write to EEPROM
<ps>n save cursor mode to EEPROM
<ps>o save display mode to EEPROM
Symbol Definition
<pr> row number (0-1)
<pc> column number (0-39)
<pn> numeric parameter (decimal, hex, or binary)
<ps> decimal selection parameter
<pt> character table selector (0-2 in EEPROM, 3 in RAM)

Custom Characters

The module can display up to eight custom characters at a time, but is capable of storing four sets of eight characters. This consists of three stored character tables in EEPROM and one table loaded into the LCD’s RAM.

To create a new custom character, send the command (ESC)[<pn>…<pn>;<ps>d where <pn> is a numeric parameter that describes a row in the character and <ps> is a decimal selection parameter (0 through 7.) A custom character definition contains eight rows, so the escape sequence to define one must have eight <pn> values followed by the <ps> value that specifies the character being defined.

To create a new character, first draw out the pattern. Then, determine the numerical value of each row in the character. Note that the left-most segment is the most significant bit. Record each row, from top to bottom, and record which character in the table to save it to. Each row of the character contains six pixels so only the low six bits of each value are used.

For example, the following character would saved by writing:

lcdChar(0x1B); lcdString(“[14;31;21;31;23;16;31;14;0d”);

where lcdChar() and lcdString() are functions that write characters and arrays of characters.

The above command saves the character to the '0' address in the LCD's RAM table. To display this character, send the numerical value of the address character. In this example, it is performed by writing lcdChar(0x00);

The character will appear at the location of the LCD's cursor.

  1. I noticed that the backslash character for the PmodCLS isn't programmed as such, rather it appears to be the yen symbol (¥). How do I go about changing this within the character library? Or do I need to create a custom character?

    Great question!

    Unfortunately, the complete answer isn't quite so nice. The short answer (as determined by this user's post here on the Digilent forum) is to send the following Escape Sequence to the board: <ESC>[0;16;8;4;2;1;0;0;1d<ESC>[3p
    This will nicely result in creating a custom character.

    However, this raises multiple other questions which I will address in turn.


  2. So, how does one change the character within the actual stored font? Is it possible?

    I think the answer is that it is supposedly possible. However as I mentioned before, escape sequences, specifically known as Control Sequence Introducers, are used to communicate with either the display or the Atmel Atmega48. The word choice of “either” is deliberate. No documentation for the Atmega48, the LCD panel, or the commonly used KS0066/HD44780 display controllers, ever mentions using an escape sequence. Since the LCD panel and KS0066 datasheets are relatively short and to the point (and by the fact that the PmodCLS uses the Atmel Atmega48), it makes me inclined to think that the Atmega48 is the one processing the escape sequences. Unfortunately, when you compare the provided escape sequences in old reference manual to standard ANSI escape codes for the VT510 or even Wikipedia's article it becomes apparent that it was a custom made sequence that was built into it.

    Which, bluntly put, sucks.


  3. Why was the backslash a ¥ symbol in the first place?

    Mostly because of the alternate ASCII library. See this section of a Wikipedia article.

  4. What is an escape sequence?

    An escape sequence or code or whatever you want to call it, is a set of characters that software/firmware will recognize as a certain type of command is about to be submitted to the program. You might see this as something like a newline character set '\n', or it could be much more complex like what's used in the PmodCLS <ESC>['stuff'. For the vast majority of modern computer users, you will never need to know what an escape code or sequence is.