Brendan Gillatt
Epson EA-C20017AR LCD


Epson EA-C20017AR LCD display My dad had three surplus Epson EA-C20017AR LCDs which had been lying in a component bin for years. They looked useful enough so I thought I would try to get them to work. They are monochrome, 1x20 displays with additional 'cursor' elements.

I started with a bit of Googling to find some information about the LCDs. A couple of noteworthy pages came up. Firstly a page written by Derek Kennedy hosts a scanned datasheet (these modules pre-date PDF datasheets). It is at the very end under 'Other Stuff'. The second site was Doug Rice's page on the LCDs. There are three relevant datasheets hosted there, though be warned that the example schematic on the page does not quite match up with the '' example code provided.


Schematic diagram connecting LCD to PIC. The LCD is driven with an on board Epson SED1200 driver. In its packaged configuration, the driver interface is Z80 peripheral bus compatible. The driver chip could have been configured to use an RC oscillator, but instead an external clock source must be generated making it awkward to connect to a PIC: a PIC uses its two oscillator pins for a crystal or a clock output, not both. I chose to use an 18LF4620 for my experimentation because it was on hand and has in internal oscillator.

I will only be writing to the LCD so I simply tied RD to VCC (also what Doug Rice did with his code). The VOUT connection is the contrast adjustment. If you can it is best to use a voltage dividing trimmer of about 50K to 100K but I did not have one on hand. I found mine worked fairly well with just a resistor of 3.3K to ground.

There are two types of data that can be written to the LCD: a command or character data. The type is selected using the A0 line. A clock between 500KHz and 2MHz must always be present on CLK. Because the interface is only 4-bit, each byte of data must be split and sent as two nibbles. A quick overview of how to write a byte to the LCD:

  1. If the byte sent is a data byte, set the A0 line to 0; if it is a command, set the A0 line to 1.
  2. Set CS to 0. (This wakes up the LCD)
  3. Put the most significant 4 bits of the byte on the D0-D3 data lines.
  4. Set WR to 0 then to 1 again. (This latches the data into the LCD)
  5. Set the A0 line to the opposite of what it was set to in the first step. I.E. if it was set to 1, this time set it to 0.
  6. Put the least significant 4 bits of the byte on the D0-D3 data lines.
  7. Set WR to 0 then to 1 again.
  8. Reset CS to 1.

Initialising and Writing to the Display

There are really only three commands that must be sent to get the LCD to display something:

  1. SYSTEM RESET (0x10)—initialises various parts of the display.
  2. LINE SELECT (0x13)—informs the driver chip which kind of LCD is attached to it.
  3. DISPLAY ON (0x0D)—turns on the output of the driver chip. Note that this does not have to immediately follow the previous two commands, which is the case in my example code.

Sending those three commands and nothing else results in random characters being displayed. The next step is to write some text to the screen. One point to remember is that, from the point of view of the driver chip, the display is really two 10 character LCDs joined end to end. This means that to fill the entire 20 characters, the process must be split into two write sequences.

Before firing text at the LCD, the place where it is written to must be specified (called the cursor). The SET CURSOR ADDRESS command is used for this. It is not a fixed command in the way that SYSTEM RESET is always 0x10. Instead, it is created by ORing or adding 0x80 with the offset from the left of the LCD. For example, say we wanted to start writing at 3 characters from the left of the LCD we would OR together 0x80 and 0x03 creating our command 0x83. Awkwardly, this only works for the first 10 characters (remember the display is really two 10 character LCDs strung together). To put text in the last 10 positions of the LCD, the offset is ORed or added with 0xC0 instead of 0x80. This also means that writing, say, 12 characters to the display without explicitly selecting the second set of 10 characters will mean at least some will be truncated.

Once the cursor is put in the correct place, characters can be written (ensuring the A0 line is initially set to 0). The character table is compatible with ASCII.

Other Notes

There is a variety of different cursor styles available. The cursor is made visible with the CURSOR ON command (0x0F). The cursor can be made to blink with CURSOR BLINK ON (0x0B) and can be set to either an underscore (0x08) or as a block (0x09).

Example Code

I've written a small ammount of code in C for the LCD which runs on a PIC18F4620. It compiles in C18.

There is a lot of functionality in the module which I have not written yet—things like custom characters and shifting the cursor.

Version 1.0 of example code