PSoC4 GLCD Initialisation

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

cross mob
Anonymous
Not applicable

Hello,

   

I'm currently working with the PSoC4 Pioneer Kit and trying to interface a GLCD with two KS0108 Controllern on it.
I connected the data-port (8 bit) to Port2, a control-port (including chip-select 1 and 2, RS and RW signals) to port P1.1-P1.4, the Enable-signal to P1.0 and the Reset-Signal to +5V (the board is currently running on 5V).
V0 is tied to VLCD with an 1K potentiometer for contrast adjustment. K and A are directly connected to GND and +5V.
I always measured 4,7V but it should still be inside the range of the display.

   

This is my code:

   

#define CHIP1   0x02
#define CHIP2   0x01
#define CHIP12  0x00
#define DESELCT 0x03

   

#define LOW     0x00
#define HIGH    0x01

   

void Toggle_EnableSignal()
{
    ControlPortE_Write(LOW);
   
    CyDelayUs(5);
   
    ControlPort_Write(HIGH);
   
    CyDelayUs(5);
}

   

void P6800_SendCommandPacket(uint8 chip, uint8 cmd)
{
    ControlPort_Write((chip << 2));
   
    DataPort_Write(cmd);
   
    Toggle_EnableSignal();   
}

   

void P6800_SendDataPacket(uint8 chip, uint8 data)
{
    ControlPort_Write((chip << 2) | 0x02);
   
    DataPort_Write(data);
   
    Toggle_EnableSignal();   
}

   


int main()
{   
    CyDelay(3000);   
   
    P6800_SendCommandPacket(CHIP1, 0x3E); // dsp off
    CyDelay(100);
    P6800_SendCommandPacket(CHIP1, 0xC0); // start line
    CyDelay(100);
    P6800_SendCommandPacket(CHIP1, 0x3F); // dsp on
    CyDelay(100);
    P6800_SendCommandPacket(CHIP1, 0x40); // col select
    CyDelay(100);
    P6800_SendCommandPacket(CHIP1, 0xB8); // page select
   
    CyDelay(50);   
   
    P6800_SendDataPacket(CHIP1, 0xFE);          // print the letter P
    P6800_SendDataPacket(CHIP1, 0x22);  
    P6800_SendDataPacket(CHIP1, 0x22);
    P6800_SendDataPacket(CHIP1, 0x22);
    P6800_SendDataPacket(CHIP1, 0x1C);
    P6800_SendDataPacket(CHIP1, 0x3E); 
   
   
    CyGlobalIntEnable; /* Enable global interrupts. */

   

    /* Place your initialization/startup code here (e.g. MyInst_Start()) */
   
    for(;;)
    {
        /* Place your application code here. */
    }
}

   

I measured the signals directly on the display-pins and everything seemed finde. But I only get a blue screen (backlight is on).
The delays originally have been shorter than this but I wanted to be on the save side.

   

I hope you can help me with my problem.

   

Best regards

0 Likes
3 Replies
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

You might look at this to see how they handle talking to the controller -

   

 

   

http://en.radzio.dxp.pl/ks0108/

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Thank, but they did it almost the same way. I managed to fix it. I had some problems with the Port-Pins. Another really bad mistake was, that I used the wrong Port-Masks. Everything works fine now.

   

Thank you for your suggestions.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Glad to hear you resolved this.

   

 

   

Regards, Dana.

0 Likes