0

I've just bought few NXP PCA8561AHN LCD segment drivers to do some tests which unfortunately did not went as expected.

I'm familiar with expanders and segment LED displays but LCDs seem to be way more complicated than I thought and there are no libraries or articles to start with.

According to the datasheet, everything is connected correctly, as follows:

  • VLCD: +3.3V
  • VDD: +3.3V
  • VSS: GND
  • RST: pulled down by a 1K resistor
  • A0: unconnected
  • SCL: pulled up by a 1K resistor and connected to A5/SCL on MCU
  • SDA: pulled up by a 1K resistor and connected to A4/SDA on MCU
  • PORE: unconnected
  • SEG0 to SEG13: LCD segments
  • COM0: LCD pin 1 (backplane #1)
  • COM1: LCD pin 18 (backplane #2)

PCA8561 draws 35uA when RST is pulled down so it seem to be "active".

Here's how I've tried to initialize the i2C communication with the driver:

#include <Wire.h>

#define address 0x38

const byte numbers[10] = {
  B01000000,
  B01111001,
  B00100100,
  B00110000,
  B00011001,
  B00010010,
  B00000010,
  B01111000,
  B00000000,
  B00010000
 };

void setup() {
  Serial.begin(9600);

  Wire.begin();

  Wire.beginTransmission(address);
  Wire.endTransmission();
}

void loop() {

  Wire.beginTransmission(address);

  Wire.write(numbers[5]);


  while (Wire.available()) {
    char c = Wire.read();
    Serial.print(c);
  }

  Wire.endTransmission();
  delay(250);
}

PCA8561 datasheet

PCA8561 pinout PCA8561 pinout .

LCD pinout LCD pinout Update

void setup() {
  Wire.begin();

  Wire.beginTransmission(address);

  Wire.write(0x00);
  // Wire.write(00000000);
  Wire.write(00101100);
  Wire.write(0x0);

  Wire.write(0x01); // Display_ctrl command (address 01h)
  // Wire.write(00011100);
  Wire.write(010); // frame frequency selection: 96Hz

  Wire.write(0x02); // Display_ctrl_1 command (address 02h)
  // Wire.write(00001100);
  Wire.write(11); // static mode

  Wire.endTransmission();
}

void loop() {
  Wire.beginTransmission(address);

  /*
     Static drive mode
     Using a single backplane, COM0
  */
  Wire.write(0x04); // SEG0 to SEG 7
  Wire.write(B11111111); // all segments ON
  Wire.write(0x05); // SEG8 to SEG15
  Wire.write(B11111111); // all segments ON

  Wire.endTransmission();
}
  • Few things: 1. Wiring - the datasheet says in 8.3.3: "At power-on the PCA8561 can be reset (...) by pulling pin RST low". By pulling it to GND you asking your LCD to stay in Reset state. 2. You miss display initialisation. Where is your settings for Device_ctrl, Display_ctrl_1, Display_ctrl_2 registers? – smajli Mar 5 at 10:51
  • 1
    @smajli , first of all, thank you for taking your time to read the datasheet, I really appreciate the effort. Second, I've managed to write some code for a correct(i hope) start sequence and finally, i can see 10 segments lit on LCD. I think there are some pads unsoldered which I will take care of later. Still not sure if the start sequence can be written in a more efficient way so if there is something I can improve, please let me know. Thanks a lot for your help – Meepo Mar 6 at 11:50
  • good effort. I'm glad I could help. Little things for your code: you may use #define Display_ctrl 0x01 at the beginning of your code, and later instead Wire.write(0x01) place Wire.write(Display_ctrl). Make it with all display commands and registers you are planning to use. This will make your code human friendly. Later you may think about placing these into separate file thus making it ready for writing a library. – smajli Mar 7 at 10:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.