PCF8566 help needed

Hi all,

I need some help:

I got a 2,5 digit lcd display (16 pins 1 backpane) controlled with a PCF8566 display driver. I got it working (got output to the display) My sketch is from this forum, but uses 1:4 drive.

I want to use static drive. With static drive I assume I can write to each separate segment. This allows me to use a for loop to write to the segments.

Question:

  • Is my assumption right?
  • How to select static drive?

http://www.nxp.com/documents/data_sheet/PCF8566.pdf

My setup: S0 to S13 connected to segment 1 tot 14.

My code:

#include <Wire.h>

#define DRIVER_ADDR 0x3E  // 7 bit add

#define PCF_CONTINUE (1 << 7)

#define PCF_CMD_SET_MODE ((1 << 6))
#define PCF_MODE_LOW_POWER (1 << 4)
#define PCF_MODE_ENABLE (1 << 3)
#define PCF_MODE_HALF_BIAS (1 << 2)
#define PCF_MODE_THIRD_BIAS 0
#define PCF_MODE_MULTIPLEX_4 0 // Multiplex 1:4
#define PCF_MODE_STATIC 1


//Deze werkt!!!! 

//#include <Wire.h>                  // I2C Master lib for ATTinys which use USI


// the setup routine runs once when you press reset:
void setup() {
  // initialize the digital pin as an output.
  //pinMode(0, OUTPUT); //LED on Model B
  pinMode(1, OUTPUT); //LED on Model A
  pinMode(2, INPUT_PULLUP); //TWI
  pinMode(0, INPUT_PULLUP); //TWI
   
  Wire.begin();                    // initialize I2C lib
  delay(1000);
   
}


// the loop routine runs over and over again forever:
  char start=0;
void loop() {

  if ( start ==0 )  // do one not in the init wait power stable
  {
    start =1;
  Wire.beginTransmission(DRIVER_ADDR);
  Wire.write(0x60 |PCF_CONTINUE);     // subadd device
  Wire.write(0x48 |PCF_CONTINUE );    //  0x48 , enable driver 1:4
  Wire.write(0);                      // clear pointer
  Wire.endTransmission();            // Send 1 byte to the slave 
  
  }
//  digitalWrite(1, HIGH);      // drive led high
//  delay(1000);               // wait for a second

  Wire.beginTransmission(DRIVER_ADDR);
  Wire.write(0x60 |PCF_CONTINUE);   //  subadd device
  Wire.write(0x00);                 //  clear pointer
 //  for (int i = 0; i < 12; i++) {       // send 12 byte 24 x 4 
Wire.write(0xaa);// S0 0xaa weergeven op display
delay(10);
//Wire.write(0xaa);// S1 0xaa weergeven op display
delay(10);
//Wire.write(0xaa);// S2 0xaa weergeven op display
delay(10);
//Wire.write(0xaa);// S3 0xaa weergeven op display
delay(10);
//Wire.write(0xaa);// S4 0xaa weergeven op display
delay(10);
//Wire.write(0xaa);// S5 0xaa weergeven op display
delay(10);
//Wire.write(0xaa);// S6 0xaa weergeven op display
delay(10);

// 0x55   //  clears display
/*
Wire.write(0xaa);// S7 0xaa weergeven op display
delay(10);
Wire.write(0xaa);// S8 0xaa weergeven op display
delay(10);
Wire.write(0xaa);// S9 0xaa weergeven op display
delay(10);
Wire.write(0xaa);// S10 0xaa weergeven op display
delay(10);
Wire.write(0xaa);// S11 0xaa weergeven op display
delay(10);
Wire.write(0xaa);// S12 0xaa weergeven op display
delay(10);
Wire.write(0xaa);// S13 0xaa weergeven op display
delay(10);
*/
//      }
  Wire.endTransmission();  

//  digitalWrite(1, LOW);     // drive LED low
  delay(500);               // wait for a second
  
  Wire.beginTransmission(DRIVER_ADDR);
  Wire.write(0x60 |PCF_CONTINUE);                 // 
  Wire.write(0x00);           
  for (int i = 0; i < 12; i++) {
         Wire.write(0x55); // 0x55   //  empty display
        delay(10);
      }
  Wire.endTransmission();  
}

you have to separate the data pointer for you 7 segment.