3 Replies Latest reply on Aug 5, 2015 7:32 PM by user_242978793

    Trouble with newhaven LCD display (C-12864A1Z) with PSOC 4 development kit

    amos.wong

      Hi,

         

       

         

      Im having huge trouble trying to interface the newhaven LCD display which has a ST7565P LCD driver to the PSOC 4.

         

      http://www.newhavendisplay.com/nhdc12864a1zfsbfbwhtt-p-3895.html

         

       

         

      I have an SPI block and 3 output pins on my "top design"

         

      3 output pins - Reset, A0, CS

         

      On the SPI, i used the mosi (SCL) to connect to the SCL on the LCD, while miso(SDA) to the data pin on the LCD

         

      I have an initialization code that runs like this... I basically took this off newhaven's website..

         

       

         

      int main()
      {
          /* Initialization */
          XBEE_Start();                //starts the Xbee UART
          SPI_Start();
          LCD_Initialization();

         

       

         

      ...................

         

      }

         

      void comm_out(unsigned char j) //Command Output Serial Interface
      {
          unsigned int n;
          CS_Write(0);
          A0_Write(0);                //A0 = Command
          for(n=0; n<8; n++){
               j <<=1;
           SPI_mosi_s_Write(0);
           SPI_miso_s_Write(j);
           CyDelayUs(1);
           SPI_mosi_s_Write(1);
          }
          CS_Write(1);
      }

         

      void LCD_Initialization(void)
      {
          comm_out(0xA0);                        //RAM->SEG output = normal
          comm_out(0xAE);                        //Display OFF
          comm_out(0xC0);                        //COM scan direction = normal
          comm_out(0xA2);                        //1/9 bias
          comm_out(0x2F);                        //power control set
          comm_out(0x21);                        //resistor ratio set
          comm_out(0x81);                        //Electronic volume command (set contrast)
          comm_out(0x2F);                        //Electronic volume value (contrast value)
      }