INTERFACING JHD12864E TO PSOC3

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

 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

0 Likes
1 Solution
Anonymous
Not applicable

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

View solution in original post

0 Likes
38 Replies
Anonymous
Not applicable

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

0 Likes
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received

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.ht...

   

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)
 

HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

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...)

HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

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
  •    
Anonymous
Not applicable

 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......

0 Likes
Anonymous
Not applicable

 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......

0 Likes
Anonymous
Not applicable
0 Likes
lock attach
Attachments are accessible only for community members.
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Connections to the module attached.

   

 

   

Regards, Dana.

Anonymous
Not applicable

 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

0 Likes
Anonymous
Not applicable
0 Likes
Anonymous
Not applicable

 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?

0 Likes
Anonymous
Not applicable

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

   

typedef unsigned char BYTE;

   

typedef bit BOOL;

HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

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

Anonymous
Not applicable

 hi hli,

   

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

0 Likes
Anonymous
Not applicable

Good to hear that 🙂

lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

 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.

0 Likes
Anonymous
Not applicable

 That library seems to include AVR specific header files. 

   

It can be modified form psoc creator bu takes time.

Anonymous
Not applicable

 do we have any readily available GLCD libraries supporting PSOC3

0 Likes
Anonymous
Not applicable

Yes, there is GLCD library in creator 2.1.

0 Likes
Anonymous
Not applicable

 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..............

0 Likes
Anonymous
Not applicable

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.

Anonymous
Not applicable

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

lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

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

0 Likes
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received

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.
 

0 Likes
Anonymous
Not applicable
Anonymous
Not applicable

 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..........

0 Likes
Anonymous
Not applicable

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

0 Likes
Anonymous
Not applicable

 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. 😞

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

@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

0 Likes
Anonymous
Not applicable

 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. 😞

0 Likes
Anonymous
Not applicable

 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.....

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

lock attach
Attachments are accessible only for community members.
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received

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 )

Anonymous
Not applicable

 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.

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

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...

0 Likes
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received

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

Anonymous
Not applicable

 @pavloven

   

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

0 Likes
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received

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)