S1D13700 Graphic LCD Timing Shenanigans

The S1D13700 is an LCD controller IC made by Epson. It is common among 320×240 monochrome LCDs. It has a software interface that is similar or identical to the SED1335 and Raio RA8835. Recently, I had the pleasure of writing some software for it. Several quirks made it kind of a pain, so I thought I share for the next guy.

First, have a look at the timing diagram found in the S1D13700 Datasheet.

S1D13700 Datasheet Timing

S1D13700 Datasheet Timing

OK, now stop looking at it because it’s wrong. For some reason, following that timing pattern produces unstable results when writing to the graphics layer. Here is a video demonstrating the type of problems you end up with:

It turns out the trick is to only activate the CS line while you transition the WR or RD pin on its sensitive edge but not the other edge. So, when writing, you would only hold CS low long enough to transition WR from high to low. The opposite applies to RD. Here are some working code snippets:

void GLCD_WriteCommand(unsigned char commandToWrite)
{

SED1335_DATA_PORT = commandToWrite;
SED1335_DATA_DIR = 0;
SED1335_CONTROL_PORT &= ~(SED1335_WR);
SED1335_CONTROL_PORT &= ~SED1335_CS;
SED1335_CONTROL_PORT |= (SED1335_WR);
SED1335_CONTROL_PORT |= SED1335_CS;
}

and

unsigned char GLCD_ReadData(void)
{
unsigned char tmp;
SED1335_CONTROL_PORT &= ~(SED1335_CS);
SED1335_DATA_DIR = 0xFF;
SED1335_CONTROL_PORT &= ~(SED1335_RD);
READDELAY();
tmp =  SED1335_DATA_PIN;
SED1335_CONTROL_PORT |= (SED1335_CS);
SED1335_CONTROL_PORT |= (SED1335_RD);
return tmp;
}

Since that did not cause enough frustration and productivity loss, there is another gotcha. There is an apparently vital but unmentioned (I couldn’t find it in the datasheet) delay that must be inserted after the initial system set command and before the parameters are passed for that command. If you don’t ensure a proper delay, the LCD either won’t start or, strangely, will output the wrong data when you attempt to do a read. So the start of  the initialization routine should look something like this:

GLCD_HardReset();

GLCD_WriteCommand(SED1335_SYSTEM_SET);
_delay_us(500);
GLCD_WriteData(SED1335_SYS_P1);
GLCD_WriteData(SED1335_SYS_P2);  
GLCD_WriteData(SED1335_FY);
GLCD_WriteData(SED1335_CR);
GLCD_WriteData(SED1335_TCR);
GLCD_WriteData(SED1335_LF);
GLCD_WriteData(SED1335_APL);
GLCD_WriteData(SED1335_APH);

I hope that helps someone struggling with this controller.

The full code examples can be found here

    • Dave Stowe
    • August 10th, 2011

    Hi !
    I recently purchased this screen from you on Ebay.
    I am happy with it, got the touch screen working well and a calibration routine done for it no problems. It is when I started doing drawings on the screen I found a problem.
    Its doing something weird. Every now and again the screen seems to lock up whilst drawing lines. It does not matter where on the screen I draw the line, and its very random when it does it! It looks like it starts to do the line, as you can see where it stopped when I reset. The Arduino is still running as I have used the led on pin 13 pulsed every second.

    Any ideas?

    Many Regards

    Dave Stowe

  1. 8DVRAN zfipawtwvmpd

    • That’s a nicely made answer to a chlnnelgiag question

    • You've drawn all the same conclusions as I have, Godmother; there's loads of potential in scenarios, but this can only go down as a thoroughly depressing launch event that, yet again, will get people shouting about money-grabbing Activision having too much say in what goes on.I don't know the truth of such a jibe, but we're talking about a company that scrapped an entire Starcraft expansion that they weren't happy with.Obviously, that was BK (Before-Kotick).

    • enough. They really do want Obama to fail, they care not how or over what he does, just that he does fail. Thing is – Obama = Fail = Americans = Fail It would be getting that through the people who vote for the repugnants to understand that. So far they have eluded that understanding.

    • Fantastic site you have here but I was wondering if you knew of any discussion boards that cover the same topics talked about here? I’d really like to be a part of community where I can get comments from other experienced people that share the same interest. If you have any recommendations, please let me know. Thanks a lot!

    • Wonderful story, reckoned we could combine a few unrelated information, nevertheless truly really worth taking a look, whoa did one particular learn about Mid East has got much more problerms as well

    • 1957chev, Go to the righthand side of this page and find a group in your area. Hopefully someone from that group can offer some direction. The Ontario government will not help you, the government has failed. It is harsh to say this but you are the only one that can help yourself. If you can’t reach someone in your area give me a call (519) 397 9100 evenings. I will attempt to help you do something.

  2. 4Sc71i rtclseqyvuje

    • James
    • February 19th, 2012

    Hi!

    I have a problem with 320×240 Yamaha MM6 display, would it help if I apply thicker wires?

    • colonel
    • May 4th, 2012

    hi,

    Thank you so much for your article, i’m going to the same problem, started once (crystal ok) but now not anymore
    i’m looking for timing too…
    Trying to understand the datasheet is a real headache…

  3. Every single time I’ve louis vuitton and from here also just had to comment and give y’all some feandback on y’all great services for example, louis vuitton louis vuitton and the Retro 9′s on Thursday and an invaluable got them on Saturday. I got them on right now….
    cheap louis vuitton online https://www.cheaplouisvuittonoutletonline.com

  4. Every single time I’ve louis vuitton and from here alternatively just had to comment and give y’all some feandback on y’all great services like the louis vuitton and the Retro 9′s on Thursday and no matter what got them on Saturday. I got them on right now….
    louis vuitton outlet store https://www.louisvuittonsoutletonline.com

  5. Every single time I’ve louis vuitton and from here as well as just had to comment and give y’all some feandback on y’all great services just like louis vuitton and the Retro 9′s on Thursday and either way got them on Saturday. I got them on right now….
    cheap louis vuitton https://www.cheaplouisvuittonoutlets.com

  6. Every single time I’ve louis vuitton and from here or to just had to comment and give y’all some feandback on y’all great services choose the louis vuitton and the Retro 9′s on Thursday and manner in which got them on Saturday. I got them on right now….
    louis vuitton handbags outlet https://www.bestlouisvuittonoutlet.com

  7. Every single time I’ve louis vuitton and from here on the other hand just had to comment and give y’all some feandback on y’all great services such louis vuitton and the Retro 9′s on Thursday and situation got them on Saturday. I got them on right now….
    louis vuitton women https://www.louisvuittonwomen.com

  8. Every single time I’ve louis vuitton and from here or else just had to comment and give y’all some feandback on y’all great services which include the louis vuitton and the Retro 9′s on Thursday and in any event got them on Saturday. I got them on right now….
    cheap louis vuitton store https://www.cheaplouisvuittons.com

  9. Every single time I’ve louis vuitton and from here aka just had to comment and give y’all some feandback on y’all great services which includes the louis vuitton and the Retro 9′s on Thursday and in any event, cheap louis vuitton shoes in any case got them on Saturday. I got them on right now….
    louis vuitton outlet online https://www.louisvuittonsoutletonline.com

  10. Every single time I’ve louis vuitton and from here or perhaps even just had to comment and give y’all some feandback on y’all great services including the louis vuitton and the Retro 9′s on Thursday and you decide got them on Saturday. I got them on right now….
    louis vuitton women outlet https://www.louisvuittonwomen.com

  11. Every single time I’ve louis vuitton and from here and it could be just had to comment and give y’all some feandback on y’all great services most notably louis vuitton and the Retro 9′s on Thursday and in any event got them on Saturday. I got them on right now….
    louis vuitton outlet store https://www.louisvuittonwomen.com

  12. Every single time I’ve louis vuitton and from here or possibly just had to comment and give y’all some feandback on y’all great services for instance the louis vuitton and the Retro 9′s on Thursday and direction got them on Saturday. I got them on right now….
    louis vuitton outlet https://www.bestlouisvuittonoutlet.com

  13. Every single time I’ve louis vuitton and from here or alternatively just had to comment and give y’all some feandback on y’all great services much like the louis vuitton and the Retro 9′s on Thursday and in any event got them on Saturday. I got them on right now….
    cheap louis vuitton store https://www.cheaplouisvuittonoutlets.com

  14. Every single time I’ve louis vuitton and from here or perhaps a just had to comment and give y’all some feandback on y’all great services love the louis vuitton and the Retro 9′s on Thursday and direction got them on Saturday. I got them on right now….
    louis vuitton outlet store https://www.cheaplouisvuittons.com

  15. Every single time I’ve louis vuitton and from here along with just had to comment and give y’all some feandback on y’all great services choose the louis vuitton and the Retro 9′s on Thursday and an invaluable got them on Saturday. I got them on right now….
    louis vuitton handbags https://www.louisvuittonwomen.com

  16. Every single time I’ve louis vuitton and from here or even just had to comment and give y’all some feandback on y’all great services just like the louis vuitton and the Retro 9′s on Thursday and in any event got them on Saturday. I got them on right now….
    louisvuittonsoutletonline https://www.louisvuittonsoutletonline.com

  17. Every single time I’ve louis vuitton and from here or possibly a just had to comment and give y’all some feandback on y’all great services appreciate the louis vuitton and the Retro 9′s on Thursday and manner in which got them on Saturday. I got them on right now….
    louis vuitton outlet handbags https://www.bestlouisvuittonoutlet.com

  18. Every single time I’ve louis vuitton and from here possibly just had to comment and give y’all some feandback on y’all great services including the louis vuitton and the Retro 9′s on Thursday and in either case got them on Saturday. I got them on right now….
    louis vuitton outlet online https://www.cheapreallouisvuitton.com

  19. Every single time I’ve louis vuitton and from here quite possibly just had to comment and give y’all some feandback on y’all great services much like the louis vuitton and the Retro 9′s on Thursday and regardless got them on Saturday. I got them on right now….
    louisvuittonwomen.com https://www.louisvuittonwomen.com

  20. Every single time I’ve louis vuitton and from here actually just had to comment and give y’all some feandback on y’all great services for instance the louis vuitton and the Retro 9′s on Thursday and situation got them on Saturday. I got them on right now….
    bestlouisvuittonoutlet.com https://www.bestlouisvuittonoutlet.com

  21. Every single time I’ve louis vuitton and from here or even a just had to comment and give y’all some feandback on y’all great services most notably louis vuitton and the Retro 9′s on Thursday and in any event got them on Saturday. I got them on right now….
    cheap louis vuitton outlets https://www.cheaplouisvuittonoutlets.com

  22. Every single time I’ve louis vuitton and from here nicely just had to comment and give y’all some feandback on y’all great services for instance the louis vuitton and the Retro 9′s on Thursday and manner in which got them on Saturday. I got them on right now….
    cheaplouisvuittonoutletonline.com https://www.cheaplouisvuittonoutletonline.com

  23. Every single time I’ve louis vuitton and from here or a just had to comment and give y’all some feandback on y’all great services for instance the louis vuitton and the Retro 9′s on Thursday and anyway got them on Saturday. I got them on right now….
    louis vuitton outlet handbags https://www.louisvuittonsoutletstore.com

  24. Every single time I’ve louis vuitton and from here also known as just had to comment and give y’all some feandback on y’all great services including louis vuitton and the Retro 9′s on Thursday and an invaluable got them on Saturday. I got them on right now….
    cheap louis vuitton https://www.cheapreallouisvuitton.com

  25. Every single time I’ve louis vuitton and from here also known as just had to comment and give y’all some feandback on y’all great services as good as the louis vuitton and the Retro 9′s on Thursday and manner in which got them on Saturday. I got them on right now….
    louis vuitton bags https://www.louisvuittonwomen.com

  26. Every single time I’ve louis vuitton and from here as just had to comment and give y’all some feandback on y’all great services similar to louis vuitton and the Retro 9′s on Thursday and in any event, cheap louis vuitton shoes in any case got them on Saturday. I got them on right now….
    gucci outlet store https://www.guccibagoutletonline.com

  27. Every single time I’ve louis vuitton and from here or even a just had to comment and give y’all some feandback on y’all great services similar to louis vuitton and the Retro 9′s on Thursday and blue jays got them on Saturday. I got them on right now….
    louis vuitton outlet store https://www.cheaplouisvuittonoutlets.com

  28. 2m6sfi

  1. July 26th, 2014
    Trackback from : tbs discount