NHD-4.3-480272EF-ASXN#-CTP touch controller interrupt signal

Comments

2 comments

  • Michael_L

    Chris,

    Have you been referring to the proper datasheet for the NHD-4.3-480272EF-ASXN#-CTP?  The pinout for the CTP is shown on page 4, and the /WAKE signal is not brought out to the 6-pin FFC.
    You will notice pin 6 is the /RESET signal for the FocalTech controller IC.  A logic HIGH needs to be present on this pin for the CTP to operate correctly.
    Typically, a pull-down resistor is put on this signal, so on start-up the CTP's IC is in reset, then you would have your microcontroller drive it high before use.
    Please find my Arduino example code below to help show how to use the CTP:

    /***********************************************************************\
    CTP_Register_Test_Due.ino

    (c)2016 Michael LaVine | Newhaven Display International, Inc.

    This code is meant to serve as an example of how to communicate with
    Newhaven Display's FT5x06 based capacitive touch panels.

      This program is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published by
      the Free Software Foundation; either version 3 of the License, or
      (at your option) any later version.

      This program is distributed in the hope that it will be useful,
      but WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      GNU General Public License for more details.
    \***********************************************************************/
    #include <Wire.h>

    #define RESET 18
    #define INT 19
    #define slaveAddress_FT5x06 0x38

    unsigned char readValue1, readValue2, readValue3, readValue4;

    void resetCTP()
    {
      delay(5);
      digitalWrite(RESET, HIGH);
      delay(400);
    }

    void writeI2C(unsigned char slaveAddress, unsigned char registerAddress, unsigned char registerData)      // I2C routine to write to 1 register
    {
      Wire.beginTransmission(slaveAddress);
      Wire.write(registerAddress);
      Wire.write(registerData);
      while(Wire.endTransmission());
    }

    unsigned char readI2C(unsigned char slaveAddress, unsigned char registerAddress)     // I2C routine to read 1 register
    {
      unsigned char readValue;
      Wire.beginTransmission(slaveAddress);
      Wire.write(registerAddress);
      while(Wire.endTransmission());
      Wire.requestFrom(slaveAddress, 1);
      while(Wire.available())
      {
        readValue = Wire.read();
      }
      return readValue;
    }

    void read4I2C(unsigned char slaveAddress, unsigned char registerAddress)     // I2C routine to read 4 consecutive registers
    {
      Wire.beginTransmission(slaveAddress);
      Wire.write(registerAddress);
      while(Wire.endTransmission());
      Wire.requestFrom(slaveAddress, 4);
      while(Wire.available())
      {
        readValue1 = Wire.read();
        readValue2 = Wire.read();
        readValue3 = Wire.read();
        readValue4 = Wire.read();
      }
    }
    /*****************************************************/
    /*****************************************************/
    /*****************************************************/
    void setup()
    {
      pinMode(RESET, OUTPUT);
      pinMode(INT, INPUT);
      Wire.begin();
      Serial.begin(9600);
      resetCTP();
    }

    void loop()
    {
      unsigned char dummy = 0, gesture = 0, numpoints = 0, t1xh = 0, t1xl = 0, t1yh = 0, t1yl = 0;
      unsigned int t1x = 0, t1y = 0;
     
      while(1)
      {
        while((digitalRead(INT)) == LOW)
        {
          read4I2C(slaveAddress_FT5x06, 0x00);
          dummy = readValue1;                       // Dummy read
          gesture = readValue2;                     // Gesture value
          numpoints = readValue3;                   // Number of touch points
          t1xh = readValue4;                        // Upper 8 bits of X-axis touch location
          read4I2C(slaveAddress_FT5x06, 0x04);
          t1xl = readValue1;                        // Lower 8 bits of X-axis touch location
          t1yh = readValue2;                        // Upper 8 bits of Y-axis touch location
          t1yl = readValue3;                        // Lower 8 bits of Y-axis touch location
          dummy = readValue4;                       // Dummy read
          t1x = t1xl | (t1xh << 8);                 // Get the 16 bit X-axis touch location
          t1y = t1yl | (t1yh << 8);                 // Get the 16 bit Y-axis touch location
             
          //****************************************************************************//
          //  UNCOMMENT THE LINE BELOW THAT YOU WANT TO BE SHOWN ON THE SERIAL MONITOR  //
          //****************************************************************************//
             
              //Serial.println(gesture, DEC);delay(25);    // Show gesture value
              //Serial.println(numpoints, DEC);delay(25);  // Show number of touch points
              Serial.println(t1x&0x0FFF, DEC);delay(25);   // Show 16-bit X-axis touch location
              //Serial.println(t1y&0x0FFF, DEC);delay(25);   // Show 16-bit Y-axis touch location
        }
      }
    }

     

    0
  • Chris Electronics

    Cheers Michael, it turned out to be a faulty connector not making contact with the ribbon cable.

    Thank you for your response

    0

Please sign in to leave a comment.