Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 3 > INTERFACING JHD12864E TO PSOC3

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



INTERFACING JHD12864E TO PSOC3
Moderator:
RKRM

Post Reply
Follow this topic



INTERFACING JHD12864E TO PSOC3

sivananda posted on 28 Sep 2012 5:04 AM PST
Top Contributor
58 Forum Posts

 Hi to all....

   iam beginner to Psoc3...recently i tried to interface JHD12864E graphical LCD to psoc3...here, iam mentioning the steps that i did to interface it....

            1) I have taken 8 GPIOS of psoc3 (PORT6 of first touch starter kit) for connecting to DB0 to DB7 of JHD12864E.

            2) and i have taken 6 another GPIOS to various control pins of JHD12864E...

                                                             RS--->P4[6],    RW--->P4[4],    ENABLE---->P12[3],   

                                                             CS1----> P4[5], CS2----->P4[7],   RESET---->P2[7],

                                          and named each pin as shown above....

and i connected the power pins of JHD12864E as follows....

                                       pin 1----> GND,  Pin2---->+5V,   Pin3---> the varying end of 10K variable resistor,

                                      Pin  18---> connected to one end of 10K variable resistor, and other end of variable resistor connected to ground.                       Pin 19---->+5V,  and   Pin20------> GND

          3) here iam mentioning the source code which i have written..............

 

#include <device.h>

 

void main()

{

    /* Place your initialization/startup code here (e.g. MyInst_Start()) */

 

    /* CyGlobalIntEnable; */ /* Uncomment this line to enable global interrupts. */

   

   

   //RESET of GLCD//

   RESET_Write(0);

    CS1_Write(0);

   CS2_Write(0);

   RESET_Write(1);

   CS1_Write(1);

   CS2_Write(1);

   ENABLE_Write(1);

   CyDelay(1);

   ENABLE_Write(0);

   

   //First half DISPLAY ON//  //to turn ON the first half of this LCD the data through the pins should be like this//

   CS1_Write(1);               // CS1=1, CS2=0, RS=0(for instruction), RW=0 (to write),// 

                               //and DB0=7,DB6=0,DB5=1,DB4=1,DB3=1,DB2=1,DB1=1,DB0=1//

   CS2_Write(0);               //ENABLE Should be falling edge//

   RS_Write(0);

   RW_Write(0);

   PRT0DB_Write(0x3F);

   ENABLE_Write(1);

   CyDelay(1);

   ENABLE_Write(0);

   

   

   //Second half DISPLAY ON//     //to turn ON the first half of this LCD the data through the pins should be like this//

   CS1_Write(0);                  // CS1=0, CS2=1, RS=0(for instruction), RW=0 (to write),//

   CS2_Write(1);                  //and DB0=7,DB6=0,DB5=1,DB4=1,DB3=1,DB2=1,DB1=1,DB0=1//

   RS_Write(0);                    //ENABLE Should be falling edge//

   RW_Write(0);

   PRT0DB_Write(0x3F);

   ENABLE_Write(1);

   CyDelay(1);

   ENABLE_Write(0);

   

   //first half Y Adress //    DB7=0,DB6=1, DB5 TO DB0 is to give the Y address

   CS1_Write(1);

   CS2_Write(0);

   RS_Write(0);

   RW_Write(0);

   PRT0DB_Write(0x60);

   ENABLE_Write(1);

   CyDelay(1);

   ENABLE_Write(0);

   

   //second half Y Adress //

    CS1_Write(0);

   CS2_Write(1);

   RS_Write(0);

   RW_Write(0);

   PRT0DB_Write(0x60);

   ENABLE_Write(1);

    CyDelay(1);

   ENABLE_Write(0);

 

   //first half X page select// DB7=1,DB6=0,DB5=1,DB4=1,DB3=1, DB2 TO DB0 is to give x address//

    CS1_Write(1);

   CS2_Write(0);

   RS_Write(0);

   RW_Write(0);

   PRT0DB_Write(0xBB);

   ENABLE_Write(1);

    CyDelay(1);

   ENABLE_Write(0);

   

   //second half X page select//

    CS1_Write(0);

   CS2_Write(1);

   RS_Write(0);

   RW_Write(0);

   PRT0DB_Write(0xBB);

   ENABLE_Write(1);

    CyDelay(1);

   ENABLE_Write(0);

 

  //first half Start line

   //CS1_Write(1);

   //CS2_Write(0);

   //RS_Write(0);

   //RW_Write(0);

   //PRT0DB_Write(0xD0);

   //ENABLE_Write(1);

   //ENABLE_Write(0);

   

   //second half start line

   //CS1_Write(0);

   //CS2_Write(1);

   //RS_Write(0);

   //RW_Write(0);

   //PRT0DB_Write(0xD0);

   //ENABLE_Write(1);

   //ENABLE_Write(0);

 

//first half write data// TO WRITE DATA RS=1, RW=0

 CS1_Write(1);

   CS2_Write(0);

   RS_Write(1);

   RW_Write(0);

   PRT0DB_Write(0xAA);

   ENABLE_Write(1);

    CyDelay(1);

   ENABLE_Write(0);

 

  //second half write data// 

   CS1_Write(0);

   CS2_Write(1);

   RS_Write(1);

   RW_Write(0);

   PRT0DB_Write(0xAA);

   ENABLE_Write(1);

    CyDelay(1);

   ENABLE_Write(0);

}

 

/* [] END OF FILE */

and I kept all the pins driving mode as STRONG...

after doing this, my GLCD backlight is turning ON......but it is not displaying any data.......

so, can any one help me how to interface it correctly to Psoc3, so that i can send various data to display in the intended position of GLCD......here iam attaching the "topdesign" page of my workspace




Re: INTERFACING JHD12864E TO PSOC3

H L posted on 28 Sep 2012 06:39 AM PST
Top Contributor
679 Forum Posts

 you can archive your project and upload the zip file here.



Re: INTERFACING JHD12864E TO PSOC3

pavloven posted on 28 Sep 2012 10:30 AM PST
Top Contributor
78 Forum Posts

I use a similar indicator  POWERTIP PG-12864A.
Perhaps you have already seen AN2147  "Interfacing to a Graphics LCD from PSoC":
http://www.psocdeveloper.com/docs/appnotes/an-mode/detail/an-pointer/an2147/an-file/an2147_01.pdf.html

I pointed out a few links here :  http://www.cypress.com/?app=forum&id=2233&rID=67910
Pay attention to the project  Melchor Varela (Graphic LCD Module Interface for PSoC5)
 



Re: INTERFACING JHD12864E TO PSOC3

hli posted on 28 Sep 2012 01:44 PM PST
Top Contributor
675 Forum Posts

The JHD12864E uses a S6B0108 controller, which is compatible (AFAIK) to the KS0108. For both controllers google can give you a number of samples projects and code. (Pavlovens link even gives you code for the PSoC, even if the web site is in spanish...)



Re: INTERFACING JHD12864E TO PSOC3

hli posted on 28 Sep 2012 02:06 PM PST
Top Contributor
675 Forum Posts

What I noticed (I used a similar display, and compared with my code):

  • writing only 0x3f for init might not be enough - I also set the display start line (by sending command 0xc0)
  • I used larger delays between commands (10µS)
  • you also might need additional delay after setting the data (there is a minimum setup time of 200ns)
  • the variable resistor needs to be connected between +5V and Vee (pin18), it should not be connected to ground
  • the PSoC needs to run on 5V, not 3.3V


Re: INTERFACING JHD12864E TO PSOC3

sivananda posted on 01 Oct 2012 11:58 PM PST
Top Contributor
58 Forum Posts

 hi lleung....

thank u very much for ur suggestion.....here iam attaching Zip fileof my project....please analyse it and help me where i did mistake......



Re: INTERFACING JHD12864E TO PSOC3

sivananda posted on 01 Oct 2012 12:04 AM PST
Top Contributor
58 Forum Posts

 hi lleung....

thank u very much for ur suggestion.....here iam attaching Zip fileof my project....please analyse it and help me where i did mistake......

 

hi hli...

 i corrected all the mistakes...such as delay power supply and sending display startline command......but still i am not getting output....here i attached a Zip file of my project...can u please analyse it......



Re: INTERFACING JHD12864E TO PSOC3

sivananda posted on 01 Oct 2012 12:10 AM PST
Top Contributor
58 Forum Posts


Re: INTERFACING JHD12864E TO PSOC3

danaaknight posted on 01 Oct 2012 12:15 AM PST
Top Contributor
1773 Forum Posts

Connections to the module attached.

 

Regards, Dana.



Re: INTERFACING JHD12864E TO PSOC3

sivananda posted on 01 Oct 2012 12:42 AM PST
Top Contributor
58 Forum Posts

 hello Dana..

                    I followed the connections same as u mentioned.....my GLCD getting turned ON.......and i can vary its contrast also....but all the pixels of GLCD displaying black........it is not displaying the data what i sent through datapins



Re: INTERFACING JHD12864E TO PSOC3

sivananda posted on 01 Oct 2012 01:12 AM PST
Top Contributor
58 Forum Posts


Re: INTERFACING JHD12864E TO PSOC3

sivananda posted on 01 Oct 2012 01:28 AM PST
Top Contributor
58 Forum Posts

 hi lleung, hli, pavloven and dana....

 thank u verymuch to all of you....just now i got succeed in interfacing my GLCD properly to psoc3....now iam able to send the data properly which i would like to display....

    May i know why the variable declred with datatypes "BYTE" and "BOOL" are showing undefined by PSOC3....and if i want to make it define with "BYTE" or "BOOL" which library file do i need to include?

 



Re: INTERFACING JHD12864E TO PSOC3

H L posted on 01 Oct 2012 02:30 AM PST
Top Contributor
679 Forum Posts

I think you should include the following tydedef in your h file 

typedef unsigned char BYTE;

typedef bit BOOL;



Re: INTERFACING JHD12864E TO PSOC3

hli posted on 01 Oct 2012 09:03 AM PST
Top Contributor
675 Forum Posts

@sivananda: what was the final problem which needed correction?



Re: INTERFACING JHD12864E TO PSOC3

sivananda posted on 03 Oct 2012 11:38 PM PST
Top Contributor
58 Forum Posts

 hi hli,

           iam believing that the problem is with my variable resistor.....i replaced it with a new one......now it is working properly



Re: INTERFACING JHD12864E TO PSOC3

H L posted on 03 Oct 2012 12:39 AM PST
Top Contributor
679 Forum Posts

Good to hear that :-)



Re: INTERFACING JHD12864E TO PSOC3

sivananda posted on 03 Oct 2012 04:59 AM PST
Top Contributor
58 Forum Posts

 hi...

    From  Osama’s Lab KS0108 GLCD Controller, i found that there are two versions of libraries available for GLCD.....one is "CodeVisionAVR"....and other one is "gcc" version..........

                        does psoc3 supports any one from these libraries.....if it supports, can any one help me how to configure our GPIOs to utilize this library....

                        If it not supports.....send me if any other libraries that are compatible to Psoc3 available...........please notice that my GLCD is JHD12864E which runs with the same KS0108 drivers......

               here iam attaching the pdf document of "Osama's Lab KS0108 GLCD controller" for reference......please notice it.



Re: INTERFACING JHD12864E TO PSOC3

H L posted on 03 Oct 2012 06:06 AM PST
Top Contributor
679 Forum Posts

 That library seems to include AVR specific header files. 

It can be modified form psoc creator bu takes time.



Re: INTERFACING JHD12864E TO PSOC3

sivananda posted on 03 Oct 2012 09:56 PM PST
Top Contributor
58 Forum Posts

 do we have any readily available GLCD libraries supporting PSOC3



Re: INTERFACING JHD12864E TO PSOC3

H L posted on 04 Oct 2012 10:20 PM PST
Top Contributor
679 Forum Posts

Yes, there is GLCD library in creator 2.1.



Re: INTERFACING JHD12864E TO PSOC3

sivananda posted on 04 Oct 2012 09:46 PM PST
Top Contributor
58 Forum Posts

 hi lleung...

                          I dont want to use GLCD component from creator 2.1 catalogue(as it needs expansion board)....i interfaced my GLCD with GPIOS and directly controlling GPIOS to write/read the data to my GLCD.......may i know the headerfile which i need to include in my source file to utilize the GLCD library you mentioned....

                         I mean how to make use of the library u mentioned..............



Re: INTERFACING JHD12864E TO PSOC3

H L posted on 05 Oct 2012 04:25 AM PST
Top Contributor
679 Forum Posts

It is a library using the internal UDBs. 

You don't need expansion board. The IOs should be connected via the PSOC pins.

It is the same as other componet. connect the signal to IOs and clocks in your design, the IDE would general all the header files for you.

 



Re: INTERFACING JHD12864E TO PSOC3

H L posted on 05 Oct 2012 04:29 AM PST
Top Contributor
679 Forum Posts

It was mentioned above, should. have a look of this project ( use google translate to engilish)

 http://ea4frb.blogspot.com.au/2010/07/interfase-modulo-lcd-grafico-para-el.html



Re: INTERFACING JHD12864E TO PSOC3

sivananda posted on 08 Oct 2012 10:04 PM PST
Top Contributor
58 Forum Posts

hi lleung..

               i found a link from the blog u mentioned above.....i hope the entire project lies in it......but the problem is iam unable to open this link...if i try to open it iam getting a message as shown in the attached screen shot......can u please tell me how to open this Zip file..

 

 http://www.ea4frb.eu/PSoC5/GLCD/GLCD-PSoC5-R00.zip



Re: INTERFACING JHD12864E TO PSOC3

pavloven posted on 08 Oct 2012 10:56 PM PST
Top Contributor
78 Forum Posts

I've used the project Melchor Varela in my project data logger temperature.
You can see it here, but in Russian language:
http://mylab.wmsite.ru/moi-razrab/cypress-psoc/temperature-logger/
project files:  READ_TEMP.zip ,  DS18b20_logger.zip  and  PSoC_SD.zip

I will try to find a project Melchor Varela in my archive and put it here.
I hope the author will not be against.
 



Re: INTERFACING JHD12864E TO PSOC3

H L posted on 08 Oct 2012 01:45 AM PST
Top Contributor
679 Forum Posts

You can check the LCD projects here 

http://mylab.wmsite.ru/moi-razrab/cypress-psoc/psoc-user-module-library/



Re: INTERFACING JHD12864E TO PSOC3

sivananda posted on 08 Oct 2012 04:31 AM PST
Top Contributor
58 Forum Posts

 hi lleung..

             i downloaded the LCD projects from the link given by you....but when iam trying to build them with creator2.1, i am getting errors, so that iam unable to proceed.....here iam attaching the screen shots of the errors what iam getting....please notice and tell me how to rectify it..........



Re: INTERFACING JHD12864E TO PSOC3

H L posted on 08 Oct 2012 05:22 AM PST
Top Contributor
679 Forum Posts

 I have no problem with both the GLCD and the DMA one. 



Re: INTERFACING JHD12864E TO PSOC3

H L posted on 08 Oct 2012 05:23 AM PST
Top Contributor
679 Forum Posts

 Sorry, forgot to mention that I am using 2.0 at home, as for some reason, I cannot install 2.1 here in this machine. :-(



Re: INTERFACING JHD12864E TO PSOC3

Bob Marlowe posted on 08 Oct 2012 05:41 AM PST
Top Contributor
1768 Forum Posts

@lleung

I would suggest to de-install Creator 2.0 on your machine at home and then freshly download 2.1 and install it. I had similar problems but could solve them this way.

 

Bob



Re: INTERFACING JHD12864E TO PSOC3

H L posted on 08 Oct 2012 05:56 AM PST
Top Contributor
679 Forum Posts

 Tks Bob

tried that, didn't work. Had to stay with 2.0 for now. 

I got a virus a while ago. (I think it got in when the I was manually updating the firewaall, but at least the anti-virus was still working) :-(

The machine is not 100% recovered. both didn't have the time to reinsall all the software again. :-(

 



Re: INTERFACING JHD12864E TO PSOC3

sivananda posted on 08 Oct 2012 07:40 AM PST
Top Contributor
58 Forum Posts

 hi lleung ...

 i tried it in both creator 2.0 and 2.1.....in both of them i am getting  the same errors......

@bob 

        I am having creator 1.0, 2.0 and 2.1 ......all the three in my laptop........will it create any problem for compilation of my code.....

                    



Re: INTERFACING JHD12864E TO PSOC3

Bob Marlowe posted on 08 Oct 2012 08:04 AM PST
Top Contributor
1768 Forum Posts

All versions of creator 1, 2.0 and 2.1 are co-existent and do not create problems itself. But the fact that between 1.0 and 2.1 a handfull of errors have gotten corrected implies that you are living with errors in projects using the older versions. Thake the time, archieve everything and then update all projects to 2.1. Then archieve a second time.

 

Bob



Re: INTERFACING JHD12864E TO PSOC3

pavloven posted on 08 Oct 2012 09:28 AM PST
Top Contributor
78 Forum Posts

You searched for this file:

 www.ea4frb.eu/PSoC5/GLCD/GLCD-PSoC5-R00.zip

I stuck it on the bottom.

I can offer you a project that contains another variant of work with GLCD

I took the library from the Melchor Varela, and inserted it in my  GLCD_DMA.cylib

Perhaps the project contains a lot of serious and minor bugs, but I hope that he will help you.

http://mylab.wmsite.ru/moi-razrab/cypress-psoc/12bitadc_and_4dig_logger_to/


SD_Logger.zip -  project archive

IND01.BIN  -  this file is created on the SD card

Multi_Read_SD.exe  -  test program to view the result  ( IND01.BIN )



Re: INTERFACING JHD12864E TO PSOC3

sivananda posted on 03 Dec 2012 12:54 AM PST
Top Contributor
58 Forum Posts

 hi...

        Till now i worked with cy8ckit-003(first touch kit) of psoc 3 and as i mentioned in the previous posts, i interfaced GLCD JHD12864E to the first touch kit of PSoC3 and i am the intended output perfectly. Till now i have been using the first touch kit that belongs to my college...... now i bought the CY8CKIT -030 kit on my own and i returned the first touch kit to college....but when i am  executing the same code(by  which i have been working for a past few months with first touch kit) with CY8CKIT-030 i am not getting output......

here i am attaching the zip file of my project, can any one help me how to execute it with CY8Ckit-030.....Except GPIOS i didnt change any thing when i was switching from first touch kit to CY8Ckit-030.



Re: INTERFACING JHD12864E TO PSOC3

sivananda posted on 03 Dec 2012 01:04 AM PST
Top Contributor
58 Forum Posts

As i mentioned in the previous post, here i am attaching the ZIP file of my project.....can any one please tell me what are the modifications required to make it work with CY8CKIT-030...



Re: INTERFACING JHD12864E TO PSOC3

pavloven posted on 03 Dec 2012 10:39 AM PST
Top Contributor
78 Forum Posts

Replace temporarily line in glcd.c so:

204   static void GLCD_TimerWait(void)
205   {
206                //while (Timer_LCD_ReadCounter()!=0)  
207     CyDelay(1);  // 1 or more
208      {;}
209   }

maybe this will help to  find the problem



Re: INTERFACING JHD12864E TO PSOC3

sivananda posted on 03 Dec 2012 08:36 PM PST
Top Contributor
58 Forum Posts

 @pavloven

yes, i am getting now....may i know why my timer is failing to provide the required delay.......



Re: INTERFACING JHD12864E TO PSOC3

pavloven posted on 04 Dec 2012 10:50 PM PST
Top Contributor
78 Forum Posts

I hope that guru of this forum will help  you , very good help in such cases, technical support.
I do not understand the reason .....

I do not know how it works Timer_LCD_ReadCounter () in Fixed Function mode 
and when to use Timer_LCD_Start ();
Possible with BUS_CLOCK = 24MHz  should be replaced
while (Timer_LCD_ReadCounter() > 100) // // or another
instead while  (Timer_LCD_ReadCounter()!=0)

or replace the timer on CyDelayUs (count)

 

 

 






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: GRAA; Secondary Owner: RAIK; Sunset Date: 01/01/20