S1D13700 Library, Schematic, and Example Code

Example S1D13700 Graphic LCD Breadboard Set-up

Example S1D13700 Graphic LCD Breadboard Set-up

This is some example code written specifically for the Powertip PG320240WRF-HE9 320×240 Graphic LCD but it should work with any S1D13700. Much of the code is based upon work by Radosław Kwiecień originally found at http://en.radzio.dxp.pl/sed1335/. Each zip file contains a schematic demonstrating how to connect it to the microcontroller.

The Arduino zip file contains the Arduino compatible library, an example sketch, and documentation. You can also view the online version of the documentation Here.

Also you can have a look at the new beta bitmap text and bitmap image functions – Beta Library for Arduino

Revision History
January 24, 2010
  • Beta library with additional Arduino functions
Nov 24, 2010
  • First upload of Arduino compatible library
Nov 3, 2010
  • Added very important delay to initialization procedure
  • Added use of Reset pin for more consistent start-up
Oct 20, 2010
  • Updated Schematic, corrected DOFF pin connection
Oct 16, 2010
  • Initial Upload
    • kosthala
    • November 24th, 2010

    In the schematics there is no mention for the Vcc value, is it 5V or 3.3V?

    Thanks in advance.

      • cafeadmin
      • November 24th, 2010

      It is either. However, If you use 3.3V with the 15 ohm backlight resistor, the backlight won’t be very bright. You can remove the backlight resistor at 3.3V but it is very important at 5V.

    • kosthala
    • November 24th, 2010

    I don’t get it. How it is possible to be either 5V or 3.3V?. Unless there is a regulator and buffer chips on board. Is this right?

      • cafeadmin
      • November 24th, 2010

      This is typical. For example, an average PIC or AVR microcontroller will accept 2.7V to 5V. The S1D13700 controller separates the core voltage and I/O voltage. The core voltage must be between 3V and 3.6V. If you are using the PG320240WRF-HE9 from eBay, it has a 3.3V regulator to accommodate 5V operation. It does have a 100mV dropout, so you must provide at least 3.1V to achieve the 3V minimum. Since the I/O is separate, if you power it with 5V, communication still takes place at 5V. I guess you could say buffers are used, but they are part of the S1D13700 IC.

    • kosthala
    • November 24th, 2010

    Ok, i got it, thanks.

    • Jon B.
    • January 11th, 2011

    Is there any way to set the character size within the provided Arduino Library?

    Thank you,

    Jon

      • cafeadmin
      • January 11th, 2011

      If you are talking about changing the sized of the 5×7 font built into the ROM, the controller doesn’t provide for that. You can load your own characters into the CGRAM but there is no provision for that in the Arduino library. It is probably easier to draw your own font with pixels anyway.

        • Jon B.
        • January 18th, 2011

        If I were to draw my own characters would it just be a matter of reading the font data and then using the setPixel function to create each pixel of the character?

        By the way,thank you for providing this hardware and supporting libraries. I found it relatively easy to get started, and I don’t have any technical experience. Thanks again for the clear instructions.

          • cafeadmin
          • January 19th, 2011

          That is correct. Although, since the screen has an 8-bit wide interface, it would be much faster if the size of the font you made lined up with byte size, meaning it was exactly 8 or 16 pixels wide. If you set one pixel at a time, the software reads a byte into memory, changes the one pixel, then writes it back. If it is 8 or 16 pixels wide, you don’t need to read anything, you just write 8 bits (or 8 pixels) at a time, which takes 1/3 the time of setting one pixel. I hope that makes sense.

  1. I’m trying to get the drawing of bitmaps going, and I see you were able to implement the eBay logo in the image at the top.

    That’s great!

    I’m trying to implement a drawBitmap function, and feel like I’m close, but there is a problem with casting a char * as an unsigned char in the .cpp file…. I’m sure you’re aware of this and hence you did not include it in the download.

    So far, I have this, as adapted from one of the other referenced files:


    void S1D13700::drawBitmap(char * bmp, int x, int y, int width, int height)
    {
    unsigned int i, j;
    for(i = 0; i < height ; i++)
    {
    graphicGoTo(x, y+i);
    writeCommand(S1D13700_MWRITE);
    for(j = 0; j < width/8; j++)
    writeData(bmp+j+(40*i));
    }
    }

    Of course, the conflict is that the class ‘writeData’ is looking for an input of an unsigned char, whereas ‘bmp’ is a char *. I tried manipulating the writeData class to accept a char * instead, but no luck… wondering if you have any tips? Thank you so much.

      • cafeadmin
      • January 20th, 2011

      writeData((unsigned char) *(bmp+j+(40*i)));

      You only need the type cast if compiler warnings annoy you, the important thing you missed was the derefrence operator (the asterisk).

      This tutorial is excellent:
      http://www.cplusplus.com/doc/tutorial/

      The section applicable to this discussion is “Pointers”

        • cafeadmin
        • January 20th, 2011

        I forgot to mention that in the AVR, the flash and ram space are separated. If you want to copy a bitmap from flash (which you probably do), you need explicit instructions. The easiest thing to do would be to copy it directly from the AVR example. Of course you need that function, the GLCD_ReadByteFromROMMemory function, and you need to add this include:

        #include <avr/pgmspace.h>

        For a test graphic, you can include the logos file untouched.

    • Zitman
    • January 20th, 2011

    Can you elaborate on how to write 8 or 16 bits at a time using the setPixel call

    Z

      • cafeadmin
      • January 21st, 2011

      Setpixel is only for 1 pixel at a time. 8 bits at a time requires a custom routine.

    • Jon B.
    • January 21st, 2011

    I’ve been trying to implement some Font functions working from a KS0108 library. Everything compiles fine, it just doesn’t display. Not sure what I have wrong. Are there any plans on updating the provided Arduino Library to allow referencing bitmap fonts?

      • cafeadmin
      • January 21st, 2011

      Yes, now that so many people have asked about it.

    • Jon B.
    • January 21st, 2011

    I can share what I’ve done so far on the font functions if there is a way to do that, although, it may not save any time because I’m very new to this. Let me know if you would like to see it.

      • cafeadmin
      • January 21st, 2011

      I have written the functionality on other platforms several times so I have code to port. I do appreciate the offer though.

    • Zitman
    • January 21st, 2011

    Jon,

    I would certainly be interested.

    CafeAdmin,

    Can you point me in a direction please? I am very interested in how to go about doing this but have not been able to find anything online. Can you point me at a data sheet or site that might give me some more insight into doing this. I will be happy to share any findings

      • cafeadmin
      • January 21st, 2011

      The routine that draws the bitmap in the AVR example writes 8 pixels at a time.

    • Scott
    • January 23rd, 2011

    Hi,
    I get the following warning when compiling the PIC C18 Project. Does this mean that the control port is not being set properly?

    \Powertip_Screen_PIC18F4455_NOV_03_10\sed1335-pic18.c:43:Warning [2060] shift expression has no effect

    Scott

      • cafeadmin
      • January 23rd, 2011

      No, it’s perfectly normal. It’s really kind of a stupid warning and not all compilers do it. It means your using pin 0 on some port.

      For example, if you wanted to set pin 4 high on port A, you might do this:


      LATA |= (1 < < 4);

      Meaining you start with 00000001, shift it left 4 times, and get 00010000 which is combined via a logical OR with the existing port value. Now if you do this:


      #define MYPIN 0

      LATA |= (1 < < MYPIN);

      You are shifting left zero times which is the same as not shifting at all. Hence the warning "shift expression has no effect"

  2. Hi, connetcted this screen to atXmega128A1 dev. board. Compiled prog for atmega324. I used Vports for compabilty, so changed only bits at sed1335-avr.c and specific settings (like clocking) for xmega.
    Now i getting “random pixels” (garbage) on the screen only :(
    Checked everything ( Nothing.
    Please, help me! =)

      • cafeadmin
      • January 30th, 2011

      Give me a few days. I will add an xmega file to the AVR example.

  3. Now it works on 8MHz clock of xmega – maximum =)
    But works at all =)

      • cafeadmin
      • January 31st, 2011

      That makes sense. If you want a faster clock add some extra NOP to the read delay in sed1335-avr.c. Watch out for voltage spikes caused by parasitic inductance at high speeds, you may want to use series resistors on the data lines.

      • DO NOT USE VPORT’S!! )))
        I rewrote lib for using native xmega ports, and all works at 32MHz ) Very-very fast =)
        Maybe i’ll use logic analyzer later to understand why it didn’t work with vports =)

    • John
    • February 2nd, 2011

    Hi, Are there any schemes to free up some of the digital pins on the Arduino? Or is it time to get an Arduino Mega so I don’t have to make a choice between gathering data and displaying data. Thank you for your time!

      • cafeadmin
      • February 2nd, 2011

      You might be able to get away with not using the reset pin (you should still pull up the LCDs reset line). You could use your analog pins as digital pins. You could use a high speed I/O expander like the MCP23S17, although, that would require a rewrite of the core functions. The easiest solution is to use a micro with more pins, as you suggested.

    • John
    • February 2nd, 2011

    Thank you for the prompt response!

    • Scott
    • February 5th, 2011

    I got it working on a PIC18F4455 using the USB clock (48Mhz). It works fine when it decides to work at all, and will keep working until I shut it off like overnight. I seem to be having a “cold start problem”. Any ideas.

    I also converted the Arduino font for use with the C18.

    //------------------------------------------------------------------------
    //(add following in main)
    //------------------------------------------------------------------------

    void drawBitmapText(void)
    {
    /*Create a string variable */
    char buf[] = "Hello World!";
    /*Clear the screen */
    GLCD_ClearText();
    GLCD_ClearGraphic();
    /*specify the column and row address
    where the text should be output */
    GLCD_TextGoTo(10,1);
    /*Write our string variable to the screen */
    GLCD_WriteText(buf);
    /*Write the same string in a different place */
    GLCD_TextGoTo(20,28);
    GLCD_WriteText(buf);
    GLCD_WriteBitmapText(buf,50, 50, LUCIDA_FONT);
    GLCD_WriteBitmapText(buf,100, 100, LUCIDA_FONT);
    GLCD_WriteBitmapText(buf,50, 150, LUCIDA_FONT);
    }
    //------------------------------------------------------------------------
    (add following in SED1335.c)
    //------------------------------------------------------------------------
    //Write text using a fixed 16-pixel width, 24 pixel height bitmap font, each character is 48 bytes or 24 ints
    //first param is pointer to the string to be written
    //last param is pointer to the font
    void GLCD_WriteBitmapText(char * text,int x, int y, rom far const unsigned int * font)
    {
    unsigned int * fontPointer;
    char i;

    while(*text)
    {
    //First get the pointer to the first int of the font letter
    //Font starts with space which is ascii char #32
    fontPointer = font + ((*text - 32) * 24); // each char 24 ints long
    for (i=0;i> 8); //highbyte or last 8 pixels
    fontPointer++;
    }
    text++;
    x+=16; //move the cursor 16 pixels for the next char
    }
    }
    //------------------------------------------------------------------------
    (add following in SED1335-pic18.c)
    //------------------------------------------------------------------------unsigned int GLCD_ReadIntFromROMMemory(rom const unsigned int * ptr)
    {
    return *ptr;
    }
    //------------------------------------------------------------------------

    (chang font as follows)
    #ifndef LUCIDA_FONT_DEF
    #define LUCIDA_FONT_DEF

    //#include

    rom far const unsigned int LUCIDA_FONT[] = {
    // @0 ' ' (14 pixels wide)
    0x0000, 0x0000, 0x0000,....

      • cafeadmin
      • February 5th, 2011

      If the reset line is connected properly then the delay after


      GLCD_WriteCommand(SED1335_SYSTEM_SET);

      in the initialization routine is probably malfunctioning/not long enough. Check that your clock is declared properly in sed1335.h, etc.

        • ingsmivinki
        • August 3rd, 2011

        cafe why you didint anwer me

    • Scott
    • February 5th, 2011

    Sorry the code won’t paste.

      • cafeadmin
      • February 5th, 2011

      When dealing with WordPress, code should be enclosed in code tags like this


      <code>
      ...Code Here
      </code>

      I tried to fix your comment above but I don’t know if WordPress deleted some of it first. Thank you for the contribution.

    • John Jardine
    • February 6th, 2011

    Hey.. mine just arrived from eBay. Can’t seem to it working on my Arduino Mega 1280. Do I have to remap the pins? If so, anyone want me to give me a hand? It seems some port D pins don’t even exist on the mega 1280 so I’m not really sure what to do. I’m using the Arduino Beta example code.

    If someone could help a noob out, it would be much appreciated :)

    • aureolus
    • February 18th, 2011

    First of all, thanks for this library!

    My question is: How can i create my own fonts?

      • cafeadmin
      • February 19th, 2011

      I don’t currently have an easy answer for you. I plan to create something for that.

    • aureolus
    • February 19th, 2011

    I’m currently trying to add support for fonts created with GLCD Font creator http://www.pocketmt.com/. Will report you if I suceed

    • Max
    • February 20th, 2011

    http://fasterpast.ru/BmpCvtDemo.zip
    Very usefull thing: img to RAW or C code converter. With supporting of grayscale 1bpp 2bpp 4bpp 8bpp and many others =)
    (fully functional demo, not for commercial use)

    • Joram
    • February 24th, 2011

    i’ve got a this lcd with a new atmega324p 20PU, connected everything as in the schematic pdf but all i get is random pixels on or off. What could this be? bad connection? wrong fuse bits? do i have to change anything in the code?

  4. Hello, First of all thanks for your codes and product. I just test your pic18f4450 code on a pic18f4550 @ 48 MHz and works great, but I translated to MCC30 (included in the url, could you please have a look?) for using a pic24fg64gb004 @ 32 MHz external crystal of 20 MHz and I only get garbage pixels after init, do you have any idea of what is going on? Thanks In advance.

      • EFEL
      • February 28th, 2011
        • cafeadmin
        • March 22nd, 2011

        I tried to grab this but the URL is no longer good. Sorry for the delay.

        • cafeadmin
        • April 4th, 2011

        Both URLs work for me now. It must have been a temp thing, sorry. Regarding your code, the only thing that jumps out at me is the commenting of the delay in the init routine directly after the SYSTEM SET command. That delay is necessary. If you don’t have a us delay you can just delay it for 1 ms and it should not make a difference. The pic24 at 32Mhz results in an instruction clock of 16mhz vs the 12mhz instruction clock of the pic18. That means you might also need a couple of extra NOPs in the read delay. Let me know if that does not work.

        • Thanks for your reply. I’m going to test that and commented. Thanks again

    • Sébastien
    • March 22nd, 2011

    Sorry for my english , but i have a problem .

    The screen works perfectly with my arduino mega , but some time the screen turn blank and i need to reboot the arduino .

    Have you any idea ?

    Thanks

      • cafeadmin
      • March 22nd, 2011

      Try a stronger pullup on the reset line (lower value resistor).

        • Sébastien
        • March 30th, 2011

        Thx
        I have already the problem with a lower value of resistor.
        I fixed it by disconnected the cable between rst and arduino and changed DOFF -> VCC to DOFF -> GND with resitor .

        Thanks angain for your works and the libraries

      • ingsmivinki
      • July 30th, 2011

      u used atmega324p ?

    • Jeroen
    • April 12th, 2011

    Hi There,
    I have downloaded your code, and it works.
    However, I want to change to 48MHz. (20MHz crystal, and 96MHz PPL)
    I have changed the following:

    //————————————————————————————————-
    //————————————————————————————————-
    /*************************************/
    /*Uncomment this line for over 32Mhz */
    /*************************************/
    #define READDELAY(); Nop();Nop();Nop();Nop();Nop();Nop();Nop();Nop();Nop();Nop();
    /*************************************/
    /*Uncomment this line for 16-32MHz */
    /*************************************/
    //#define READDELAY(); Nop();Nop();Nop();Nop();Nop();Nop();
    /*************************************/
    /*Uncomment this line for 8-16MHz */
    /*************************************/
    //#define READDELAY(); Nop();Nop();
    /*************************************/
    /*Uncomment this line for 4MHz */
    /*************************************/
    //#define READDELAY(); Nop();

    AND

    /*Change this to match the FOSC*/
    #define CPU_CLOCK 48000000

    However, it is not working correctly.
    Im wondering, am I doing something wrong in the code, or maybe it is because I m running on breadboard!?

    Could someone please post code for PIC18F4550 C18 compiler running on 48MHz?

    Thanks in advance!

    Jeroen

      • cafeadmin
      • April 26th, 2011

      I have used it on a breadboard at 48Mhz (really 12). Try to blink an LED so you can be sure the PIC is actually running and your oscillator PRAGMA settings are correct.

        • Jeroen
        • April 27th, 2011

        Hi cafeadmin, thanks for your response.

        A LED was blinking, so the PIC was running.
        Also, the pragma settings were correct, since USB was running, and that requires 48MHz.

        Just to be sure, I have designed a PCB to connect the LCD to the PIC. Hopefully this will eliminate any kind of distortion et cetera.

        Do you maybe have the code for running at 48MHz, so I can check mine?

        Jeroen

          • cafeadmin
          • April 28th, 2011

          An easy way to check that the breadboard is not the issue is to probe it with an oscilloscope, if you have one available. Can you elaborate on “it is not working correctly”?

            • Jeroen
            • April 28th, 2011

            How do you mean, probe it with an oscilloscope?
            Check the data lines for any distortion?

            It is not working correctly:
            It seems some pixels are shifted a number of pixels, and the display is not cleared 100%

            I hope this weekend I will receive my test PCB, so I will check to see if the problem lies there (I wouldn’t be surpriced) and will get back to you then.

            Jeroen

    • Jon B.
    • April 25th, 2011

    @cafeadmin

    In the documentation you mentioned the MicroChip AR2010. Do you have any more information on how this could be implemented with the touch screen included with this display? Thank you.

      • cafeadmin
      • April 26th, 2011

      It is a 4-wire touchscreen. The best instructions I have are in the AR1020 datasheet. Which micro-controller are you using?

        • Jon B.
        • April 26th, 2011

        I am using an Arduino Mega 2560.

          • cafeadmin
          • April 26th, 2011

          Someone has written an Arduino library for 4-wire touch using the ADC. try this: http://www.practicalarduino.com/projects/touch-control-panel

        • Frankly I think that’s absetuloly good stuff.

        • Im no specialist, excluding I care about you merely crafted the greatest position. You definitely comprehend what youre talking about, and I can truly get following that. Thankfulness for staying so forthright and accordingly straightforward.

        • Wow. Nice set of posts guys. I encourage you all to do the same as well on other threads. It’s nice to see a fair number of fact dumps and reasoned replies. It’s how I learn the ins and outs of all this sciency “stuff” (*grin*). Hat Tip to the Editor as well.

        • , we are agreed that a reboot is impossible in America under current conditions. It’s just not among the Stuff White People Like. What we will see instead is the breakup of this nation into several component parts. Many of these parts will be reactionary. None will be of Mencius’s preferred form of reactionary.

        • It took me fifteen years for this ‘overnight’ success. People think that I was lucky that i got success. They forget the work and effort of years which I have put into this – thanks for visit and comments – kindly keep on sharing – regards

        • What Can a Planner Offer? Monday, February 13th, 2012 | Uncategorized | Administrator Regarding , many consider consulting a planner essential.  Some retired people who do not get expert guidance, later regret some of the financial choices produced.  So what could you hope for from a planner?

    • pindnet
    • May 13th, 2011

    Hello, first of all I want to thank you for your sample code and help. I modified your pic18 version for work with a pic24FJ and C30 compiler with the addition of arial font, so If you want to use it and post it in your site you can do it. The url is from megaupload and it includes some pictures about the running with your ebaylogo and a “Hello World” using arial font. The only issue I cant understand is that sometimes the font is blurry and after some hard resets the program works fine.

    Thanks again and best regards,

    http://www.megaupload.com/?d=PFUKYKI7

    • franpemo
    • May 15th, 2011

    Hello, I want to thanks for your codes but I have some problems. I purchased a couple of these displays but I cant make any of them to work, the only is a blank screen not even garbage pixels, I tested your codes with any modification in 3.3V and 5V with a pic18f4550 (three IC) and always have nothing.

    Greetings,

    • TJ
    • May 18th, 2011

    Do I really need all D0-D7? I have those 20×4 lcd displays, and I only need to hook up D4-D7.

    • Josh
    • May 23rd, 2011

    I setup the LCD on a breadboard as your diagram recommended. However, I am having problems getting it to run on with a PIC 18f4553 (which is identical to the 18f4550, except for a 12-bit ADC). Your code works on 18f4550′s, so it should work find for the 18f4553 too. However, The LCD screen remains blank, with only the back lights working.

    I made two changes to the code provided:
    /*************************************/
    /*Uncomment this line for over 32Mhz */
    /*************************************/
    #define READDELAY(); Nop();Nop();Nop();Nop();Nop();Nop();Nop();Nop();Nop();Nop();

    And this:
    /*Change this to match the FOSC*/
    #define CPU_CLOCK 48000000

    As you recommended for one of the other users, I added a blinking LED to the setup to make sure the PIC was working. That worked fine.

    Do you have any other suggestions on things I should check or modify?

    Thank you,
    Josh

    • TJ
    • May 23rd, 2011

    Is there a reason why we need both RD and WR wired up? Do we ever read from LCD? Couldn’t we just use a pull up or pull down resistor both both and free up 1 pin from arduino?

      • efelnavarro
      • May 23rd, 2011

      Hello TJ, the read operations happend when you set a Pixel, look at the “GLCD_SetPixel”…

  5. Hi,

    First, thank’s for your works and your item !
    I have buy this on ebay and make a little PCB for test it .
    I work with a 18F4685 @ 40Mhz (10Mhz crystal + PLL ) the librairy works I have the logo but when I would like to draw horizontal line a lot of piece of line not drow .

    I would like to understand your works and the original librairy .
    Is not same that KS0108 controler ?
    It’s possible to explain a little the S1D13700 controler please ?

    Thank’s in advance for your answer !

    Best regards
    CaZaE

      • cafeadmin
      • June 8th, 2011

      I believe the controllers are very similar. I explained it some in this blog post.

      If you see the logo properly but the line messes up, you need to add additional NOPs to the READDELAY macro in the pic source file.

      • Thank’s for your reply, Sorry I have dont see you post about this librairy I go to read it !

        I have try to add more and more Nop() in this macro but I have some problems .

        I try to discover the problem and I reply in this post .

        Again : thank’s for all !

        Best regards
        CaZaE

    • Joel d
    • May 29th, 2011

    Hi. Thanks for supporting this project!

    Trying to get my S1D13700 working with an Arduino Mega 2560; not sure what if any customizations I’d need to make — I’m using Digital pins 0..12 as indicated.

    1) The 2560 is faster, so do I need more NOPs to slow down the timing?

    I’ve imported the libraries into Arduino and the code does appear to be running. The screen backlight is on, and I see the blinking light on the arduino after a 4 second pause when the program is running.

    I’ve tried using a 2.2k and 10k pot for adjusting the contrast; makes no difference.

    I’ve also tried some of the variations mentioned above for DOFF and RST. Currently I’m running with 220 Ohms resistor on the reset line.

    2) What is DOFF for, anyway?

    3) Has anyone else been able to get this working with the Arduino Mega 2650?

    Thanks!

    – Joel

      • cafeadmin
      • June 8th, 2011

      An example illustrating how to set that up is covered in section 3c of the documentation.

        • ingsmivinki
        • July 31st, 2011

        where is the sesion 3c i have problem with that lcd, i only see the backlight but no information

    • ingsmivinki
    • July 30th, 2011

    i want some code for the torch screen im use a atmega32, and i want to know how to write data in the lcd….

    • spisso
    • August 1st, 2011

    Hello, thanks for your tutorial I’m experimenting some issues with this screen and I do not know how to solve it. I’m using a pic18f4620 and I noticed that the screen only displays something when I keep pressed the reset button, after realese the button the display does not show anything. Do you have any suggestion?

    Thanks…

  6. X7V9W5 dgpyzavtcisy

    • diego
    • October 10th, 2011

    Hi I’m a few days ago with a Winsted, 320240 and I can not do s1d13700 walking, Manufacturer angina is unresponsive and was going crazy lol, please help me Odria?
    diego hug

    • Adam
    • January 24th, 2012

    Hi,
    Ive bought the screens from ebay a few months ago, was able to get it running on arduino, but since then i’ve been trying to port to pic24.

    First off i would like to thank you again for all the work you’re contributing to this project.

    Above , user pindnet posted some code for the P24 & C30 compiler.
    I would love to access this file, however, MEGAUPLOAD no longer works… :(

    If anyone has a copy of that file and is willing to send me a copy, it would be Much appreciated!

    Thanks again everyone for input.

    Regards,
    Adam.

    • Jeff
    • February 12th, 2012

    Hello,

    Thanks for taking the time to create all of this, I couldn’t have gotten my project to this point without your work. I am experiencing a problem where the pixels of a bitmapped image are being shifted over in certain places on the screen. The shifting takes place at arbitrary places and onlt shifts from left to right, not up and down.
    could this be a timing issue? if so how would i adjust for this?

    Thanks Again
    Jeff

    • colonel
    • May 9th, 2012

    HI,

    i tested the wait signal and its so much quicker !!
    you guys should try this one !

    void S1D13700_WriteData(unsigned char dataToWrite)
    {

    S1D13700_DATA_PORT = dataToWrite;
    S1D13700_DATA_PORT_TRIS = S1D13700_DATA_PORT_TRIS_OUT;

    S1D13700_CS_PIN = 0;

    S1D13700_A0_PIN = 0; S1D13700_WR_PIN = 0;// tiny pause
    S1D13700_A0_PIN = 0; S1D13700_WR_PIN = 0;
    S1D13700_A0_PIN = 0; S1D13700_WR_PIN = 0;
    while ( 0 == S1D13700_WAIT_PIN);
    S1D13700_CS_PIN = 1;
    S1D13700_A0_PIN = 1; S1D13700_WR_PIN = 1;

    /*
    S1D13700_DATA_PORT = dataToWrite;
    S1D13700_DATA_PORT_TRIS = S1D13700_DATA_PORT_TRIS_OUT;

    S1D13700_CS_PIN = 0;
    delay_ms(S1D13700_DELAY_ONE);
    S1D13700_A0_PIN = 0; S1D13700_WR_PIN = 0;
    delay_ms(S1D13700_DELAY_ONE);
    S1D13700_CS_PIN = 1;
    delay_ms(S1D13700_DELAY_ONE);
    S1D13700_A0_PIN = 1; S1D13700_WR_PIN = 1;
    delay_ms( S1D13700_DELAY_CMD_CMD );

    */
    }

    void S1D13700_WriteCommand(unsigned char commandToWrite)
    {
    S1D13700_DATA_PORT = commandToWrite;
    S1D13700_DATA_PORT_TRIS = S1D13700_DATA_PORT_TRIS_OUT;

    S1D13700_WR_PIN = 0;
    S1D13700_CS_PIN = 0;

    S1D13700_WR_PIN = 0;
    S1D13700_WR_PIN = 0;
    S1D13700_WR_PIN = 0;
    while ( 0 == S1D13700_WAIT_PIN);
    S1D13700_CS_PIN = 1;
    S1D13700_WR_PIN = 1;

    /*
    S1D13700_DATA_PORT = commandToWrite;

    S1D13700_DATA_PORT_TRIS = S1D13700_DATA_PORT_TRIS_OUT;

    S1D13700_WR_PIN = 0;
    delay_ms(S1D13700_DELAY_ONE);
    S1D13700_CS_PIN = 0;
    delay_ms(S1D13700_DELAY_ONE);
    S1D13700_WR_PIN = 1;
    delay_ms(S1D13700_DELAY_ONE);
    S1D13700_CS_PIN = 1;
    delay_ms( S1D13700_DELAY_CMD_CMD );
    */
    }

    • ALI MIRZA
    • January 28th, 2015

    How Can we run LCD with Arduino Due? My LCD working fine with Arduino UNO but when same connections made with Arduino Due it gave me the following error:

    Arduino: 1.5.8 (Windows 8), Board: “Arduino Due (Programming Port)”

    Build options changed, rebuilding all

    In file included from C:\Program Files (x86)\Arduino\libraries\S1D13700_Library_For_Arduino_NOV_24_10\S1D13700.cpp:44:0:
    C:\Program Files (x86)\Arduino\libraries\S1D13700_Library_For_Arduino_NOV_24_10\S1D13700.cpp: In function ‘void setData(unsigned char)’:
    C:\Program Files (x86)\Arduino\libraries\S1D13700_Library_For_Arduino_NOV_24_10\S1D13700.h:52:19: error: ‘DDRD’ was not declared in this scope
    #define FIXED_DIR DDRD
    ^
    C:\Program Files (x86)\Arduino\libraries\S1D13700_Library_For_Arduino_NOV_24_10\S1D13700.cpp:87:3: note: in expansion of macro ‘FIXED_DIR’
    FIXED_DIR = 0xFF;
    ^
    C:\Program Files (x86)\Arduino\libraries\S1D13700_Library_For_Arduino_NOV_24_10\S1D13700.h:53:20: error: ‘PORTD’ was not declared in this scope
    #define FIXED_PORT PORTD
    ^
    C:\Program Files (x86)\Arduino\libraries\S1D13700_Library_For_Arduino_NOV_24_10\S1D13700.cpp:88:3: note: in expansion of macro ‘FIXED_PORT’
    FIXED_PORT = data;
    ^
    C:\Program Files (x86)\Arduino\libraries\S1D13700_Library_For_Arduino_NOV_24_10\S1D13700.cpp: In member function ‘unsigned char S1D13700::readData()’:
    C:\Program Files (x86)\Arduino\libraries\S1D13700_Library_For_Arduino_NOV_24_10\S1D13700.h:52:19: error: ‘DDRD’ was not declared in this scope
    #define FIXED_DIR DDRD
    ^
    C:\Program Files (x86)\Arduino\libraries\S1D13700_Library_For_Arduino_NOV_24_10\S1D13700.cpp:214:3: note: in expansion of macro ‘FIXED_DIR’
    FIXED_DIR = 0×00;
    ^
    C:\Program Files (x86)\Arduino\libraries\S1D13700_Library_For_Arduino_NOV_24_10\S1D13700.h:54:19: error: ‘PIND’ was not declared in this scope
    #define FIXED_PIN PIND
    ^
    C:\Program Files (x86)\Arduino\libraries\S1D13700_Library_For_Arduino_NOV_24_10\S1D13700.cpp:226:10: note: in expansion of macro ‘FIXED_PIN’
    tmp = FIXED_PIN;
    ^
    Error compiling.

    This report would have more information with
    “Show verbose output during compilation”
    enabled in File > Preferences.

    • sap
    • February 11th, 2015

    Hi,
    Could someone please give me a code giving the basics of how to display a character on Graphical touchscreen LCD having S1D13700 controller (CFAG320240CX-TFH-T-TS).I am using PIC32MX795F512L.
    IDE is MPLAB v8.41.C coding to be used.
    I tried writing a code using the steps being told in the daasheet of the Graphical touchscreen:

    #include
    #include

    /*********************************************************************************************************************
    Configuration bits.
    *********************************************************************************************************************/
    // Configuration Bit settings
    // SYSCLK = 80 MHz (8MHz Crystal/ FPLLIDIV * FPLLMUL / FPLLODIV)
    // PBCLK = 20 MHz
    // Primary Osc w/PLL (XT+,HS+,EC+PLL)
    // WDT OFF
    // Other options are don't care

    #pragma config FNOSC = PRIPLL // Oscillator Selection
    #pragma config FSOSCEN = OFF // Secondary Oscillator Enable (KLO was off)
    #pragma config POSCMOD = HS // Primary Oscillator
    #pragma config OSCIOFNC = ON // CLKO Enable
    #pragma config FPBDIV = DIV_4 // Peripheral Clock divisor

    #pragma config FPLLIDIV = DIV_2 // PLL Input Divider
    #pragma config FPLLMUL = MUL_20 // PLL Multiplier
    #pragma config FPLLODIV = DIV_1 // PLL Output Divider
    #pragma config FWDTEN = OFF // Watchdog Timer Disable
    #pragma config DEBUG = ON // Background Debugger Enable

    //#pragma config UPLLIDIV = DIV_1 // USB PLL Input Divider
    //#pragma config UPLLEN = OFF // USB PLL Enabled

    /*
    #pragma config FWDTEN = OFF // Watchdog Timer Disable
    #pragma config WDTPS = PS1 // Watchdog Timer Postscale
    #pragma config FCKSM = CSDCMD // Clock Switching & Fail Safe Clock Monitor
    #pragma config IESO = ON // Internal/External Switch-over
    #pragma config CP = OFF // Code Protect
    #pragma config BWP = OFF // Boot Flash Write Protect
    #pragma config PWP = OFF // Program Flash Write Protect
    #pragma config ICESEL = ICS_PGx1 // ICE/ICD Comm Channel Select
    #pragma config FUSBIDIO = OFF // USBID is controlled by the port function
    #pragma config FVBUSONIO = OFF // VBUSON is controlled by the port function */

    /*********************************************************************************************************************
    Define
    *********************************************************************************************************************/
    //#define SYS_FREQ (80000000)

    #define LCD_CTRL IOPORT_D
    #define LCD_DATA IOPORT_E
    #define LCD_RST BIT_2
    #define LCD_CS BIT_4
    #define LCD_EN BIT_1
    #define LCD_WR BIT_3
    #define LCD_ST BIT_5

    // Function prototypes
    void CommandWrite(unsigned char);
    void DataWrite(unsigned char);
    void ClearTextLayer(void);
    void ClearGraphicLayer(void);
    void Delay100uS(unsigned int);

    void LCD_INITIALIZATION(void);

    void CommandWrite(unsigned char command)
    {
    PORTWrite(LCD_CTRL, 0x04); // RESET LCD,
    PORTWrite(LCD_CTRL, 0x26); // RESET LCD, LCD Enable, LCD status
    PORTWrite(LCD_DATA, command); // Send data to LCD data bus
    Delay100uS(140); // Give atleast 2us Delay
    PORTWrite(LCD_CTRL, 0x24); // Disabling the display controller for read and write
    PORTWrite(LCD_CTRL, 0x14); //
    PORTWrite(LCD_DATA, 0x00); // End of command
    Delay100uS(140); // for 2 TS(i.e 2us)
    }

    void DataWrite(unsigned char data)
    {
    PORTWrite(LCD_CTRL, 0x04); // RESET LCD,
    PORTWrite(LCD_CTRL, 0x06); // RESET LCD,
    PORTWrite(LCD_DATA, data); // Send data to LCD data bus
    Delay100uS(140); // Give atleast 2us Delay
    PORTWrite(LCD_CTRL, 0x04); // RESET LCD,
    PORTWrite(LCD_CTRL, 0x14); // Disabling the display controller for read and write
    PORTWrite(LCD_DATA, 0x00);
    Delay100uS(140); // Give atleast 2us Delay
    }
    void LCD_INITIALIZATION(void)
    {
    // int layer = 0; // Initialize layer
    mPORTESetPinsDigitalOut(BIT_7 | BIT_6 | BIT_5 | BIT_4 | BIT_3 | BIT_2 | BIT_1 | BIT_0);
    mPORTDSetPinsDigitalOut(BIT_12| BIT_7 | BIT_6 | BIT_5 | BIT_4 | BIT_3 | BIT_2 | BIT_1);
    Delay100uS(140); // Delay
    PORTWrite(LCD_CTRL, 0x00); // Reset pin high
    Delay100uS(140); // Wait for 250Us
    PORTWrite(LCD_CTRL, 0x04); // Reset pin low
    Delay100uS(140); // Wait for 250Us

    // SYSTEM-SET Commands
    CommandWrite(0x40); // SYSTEM SET Initializes device and display
    Delay100uS(140);
    DataWrite(0x30); //
    Delay100uS(140);
    DataWrite(0x87); //
    Delay100uS(140);
    DataWrite(0x00); // for changing the line distance to single line or 0x07
    Delay100uS(140);
    DataWrite(0x27); // 40 columns per line (40*8 = 320)
    Delay100uS(140);
    DataWrite(0x2D); // 0(no change)
    Delay100uS(140);
    DataWrite(0xEF); // 240 Horizontal lines
    Delay100uS(140);
    DataWrite(0x28); //
    Delay100uS(140);
    DataWrite(0x00);
    Delay100uS(140);

    // SCROLL Commands
    CommandWrite(0x44); // SCROLL-Sets screen block start addresses and sizes
    Delay100uS(140);
    DataWrite(0x00); // First screen block start address
    Delay100uS(140);
    DataWrite(0x00); // Set to 0000h
    Delay100uS(140);
    DataWrite(0xEF); // Display lines in first screen block = 240
    Delay100uS(140);
    DataWrite(0xB0); // Second screen block start address
    Delay100uS(140);
    DataWrite(0x04); // Set to 0400h-(GRAPHICS MODE COLUMN WIDTH)
    Delay100uS(140);
    DataWrite(0xEF); // Display lines in second screen block =240
    Delay100uS(140);
    /* DataWrite(0x00); // Second screen block start address
    Delay100uS(140);
    DataWrite(0x04); // Set to 0400h-(GRAPHICS MODE COLUMN WIDTH)
    Delay100uS(140);
    DataWrite(0xF0); // Display lines in second screen block =240
    Delay100uS(140);*/

    // HDOT-SCROLL Settings
    CommandWrite(0x5A); // HDOT SCR-Sets horizontal scroll position
    Delay100uS(140);
    DataWrite(0x00); // Set horizontal pixel shift to zero (REG[1Bh] bits 2-0)
    Delay100uS(140);

    // OVERLAY Settings
    CommandWrite(0x5B); // OVLAY-Sets display overlay format
    Delay100uS(140);
    DataWrite(0x01);
    Delay100uS(140);

    // DISP-ON/OFF Settings
    CommandWrite(0x58); // DISP ON/OFF-Enables/disables display and display attributes(58h&59h)
    Delay100uS(140);
    DataWrite(0x56); // Enable layer1 and layer2
    Delay100uS(140);

    ClearTextLayer(); // Clear main layer1
    Delay100uS(140);
    ClearGraphicLayer(); // Clear main layer2
    Delay100uS(140);

    //CSRW
    CommandWrite(0x46); // CSRW
    Delay100uS(140);
    DataWrite(0x00); //
    Delay100uS(140);
    DataWrite(0x00); //
    Delay100uS(140);

    // CURSOR Settings
    CommandWrite(0x5D); // CSRFORM-Sets cursor type
    Delay100uS(140);
    DataWrite(0x04); //
    Delay100uS(140);
    DataWrite(0x86); // 7th bit-CURSOR MODE BIT
    Delay100uS(140);

    // DISP-ON/OFF Settings
    CommandWrite(0x59); // DISP ON/OFF-Enables/disables display and display attributes(58h&59h)
    Delay100uS(140);

    // CURSOR DIRECTION
    CommandWrite(0x4C);
    Delay100uS(140);

    //MWRITE
    CommandWrite(0x42);
    Delay100uS(140);
    DataWrite(0x20);
    Delay100uS(140);
    DataWrite(0x45);
    Delay100uS(140);
    DataWrite(0x50);
    Delay100uS(140);
    DataWrite(0x53);
    Delay100uS(140);
    DataWrite(0x4F);
    Delay100uS(140);
    DataWrite(0x4E);
    Delay100uS(140);

    //CSRW
    CommandWrite(0x46); // CSRW
    Delay100uS(140);
    DataWrite(0x00); //
    Delay100uS(140);
    DataWrite(0x10); //
    Delay100uS(140);

    // CURSOR DIRECTION
    CommandWrite(0x4F);
    Delay100uS(140);

    //MWRITE
    CommandWrite(0x42);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);

    //CSRW
    CommandWrite(0x46);
    Delay100uS(140); // CSRW
    DataWrite(0xB1);
    Delay100uS(140); //
    DataWrite(0x04);
    Delay100uS(140); //

    //MWRITE
    CommandWrite(0x42);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    /*---*/
    //CSRW
    CommandWrite(0x46);
    Delay100uS(140); // CSRW
    DataWrite(0xB2);
    Delay100uS(140); //
    DataWrite(0x40);
    Delay100uS(140); //

    //MWRITE
    CommandWrite(0x42);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);

    //CSRW
    CommandWrite(0x46);
    Delay100uS(140); // CSRW
    DataWrite(0xB3);
    Delay100uS(140); //
    DataWrite(0x40);
    Delay100uS(140); //

    //MWRITE
    CommandWrite(0x42);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);

    //CSRW
    CommandWrite(0x46);
    Delay100uS(140); // CSRW
    DataWrite(0xB4);
    Delay100uS(140); //
    DataWrite(0x40);
    Delay100uS(140); //

    //MWRITE
    CommandWrite(0x42);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    //CSRW
    CommandWrite(0x46);
    Delay100uS(140); // CSRW
    DataWrite(0xB5);
    Delay100uS(140); //
    DataWrite(0x40);
    Delay100uS(140); //

    //MWRITE
    CommandWrite(0x42);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);

    //CSRW
    CommandWrite(0x46);
    Delay100uS(140); // CSRW
    DataWrite(0xB6);
    Delay100uS(140); //
    DataWrite(0x40);
    Delay100uS(140); //

    //MWRITE
    CommandWrite(0x42);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);

    //CSRW
    CommandWrite(0x46);
    Delay100uS(140); // CSRW
    DataWrite(0xB7);
    Delay100uS(140); //
    DataWrite(0x40);
    Delay100uS(140); //

    //MWRITE
    CommandWrite(0x42);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);

    //CSRW
    CommandWrite(0x46);
    Delay100uS(140); // CSRW
    DataWrite(0xB8);
    Delay100uS(140); //
    DataWrite(0x40);
    Delay100uS(140); //

    //MWRITE
    CommandWrite(0x42);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);

    //CSRW
    CommandWrite(0x46);
    Delay100uS(140); // CSRW
    DataWrite(0xB9);
    Delay100uS(140); //
    DataWrite(0x40);
    Delay100uS(140); //

    //MWRITE
    CommandWrite(0x42);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);
    DataWrite(0xFF);
    Delay100uS(140);

    //CSRW
    CommandWrite(0x46);
    Delay100uS(140); // CSRW
    DataWrite(0x00);
    Delay100uS(140); //
    DataWrite(0x02);
    Delay100uS(140); //

    // CURSOR DIRECTION
    CommandWrite(0x4C);
    Delay100uS(140);

    //MWRITE
    CommandWrite(0x42);
    Delay100uS(140);
    DataWrite(0x44);
    Delay100uS(140);
    DataWrite(0x6F);
    Delay100uS(140);
    DataWrite(0x74);
    Delay100uS(140);
    DataWrite(0x20);
    Delay100uS(140);
    DataWrite(0x4D);
    Delay100uS(140);
    DataWrite(0x61);
    Delay100uS(140);
    DataWrite(0x74);
    Delay100uS(140);
    DataWrite(0x72);
    Delay100uS(140);
    DataWrite(0x69);
    Delay100uS(140);
    DataWrite(0x78);
    Delay100uS(140);
    DataWrite(0x20);
    Delay100uS(140);
    DataWrite(0x4C);
    Delay100uS(140);
    DataWrite(0x43);
    Delay100uS(140);
    DataWrite(0x44);
    Delay100uS(140);

    }

    void Delay100uS(unsigned int j)
    {
    unsigned int i;
    for(i=0; i<j; i++); //j=140 for 100uS
    }

    void ClearTextLayer(void)
    {
    int i;
    CommandWrite(0x46);
    // Initialize cursor to 8-bit right shift mode
    DataWrite(0x00); // Lower byte address
    DataWrite(0x00);
    CommandWrite(0x4C);
    CommandWrite(0x42);
    PORTWrite(LCD_CTRL, 0x00);

    for(i = 0; i < 1200; i++)
    { DataWrite(' ');
    PORTWrite(LCD_CTRL, 0x02);
    PORTWrite(LCD_CTRL, 0x00);
    }
    PORTWrite(LCD_CTRL, 0x10);
    }

    void ClearGraphicLayer(void)
    {
    unsigned int i;
    CommandWrite(0x46);
    // Initialize cursor to 8-bit right shift mode
    DataWrite(0xB0); // Lower byte address
    DataWrite(0x04);
    CommandWrite(0x4C);
    CommandWrite(0x42);
    PORTWrite(LCD_CTRL, 0x00);
    for(i = 0; i < (40 * 240); i++)
    {
    DataWrite(0x00);
    PORTWrite(LCD_CTRL, 0x02);
    PORTWrite(LCD_CTRL, 0x00);
    }
    PORTWrite(LCD_CTRL, 0x10);
    }

    void main(void)
    {
    mPORTDSetPinsDigitalOut(BIT_6); //RA0 configured as Digital O/P
    mPORTDSetBits(BIT_6); //RA0 configured active High to Disable chip select for RAM0
    LCD_INITIALIZATION(); // LCD Initialisation
    }

    Kindly ignore the comments..I haven’t edited it completely.
    I’m not able to get anything on the display after running the cde.

    Any help in this regard will be appreciated.

    Thanks in advance

  7. Valuable info. Lucky me I found your site by accident,
    and I’m shocked why this coincidence didn’t happened in advance!
    I bookmarked it.

  8. Simply want to say your article is as surprising. The clarity in your post is just nice and i can assume you’re an expert
    on this subject. Fine with your permission allow me
    to grab your RSS feed to keep up to date with
    forthcoming post. Thanks a million and please continue the
    rewarding work.

  9. Having read this I thought it was extremely enlightening.

    I appreciate you taking the time and effort to put this information together.

    I once again find myself personally spending a significant amount of time both reading
    and commenting. But so what, it was still worth it!

  1. November 20th, 2010