pcf85162

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

pcf85162

2,007件の閲覧回数
anjalishelke
Contributor I

Hi,

I'm using PCF85162 driver for display. After reading datasheet I cannot figure out how to initialize it and how to write data to display?

What RAM addresses shall I use for writing segments of the display.

  u_int8 PCF8562_init(void) { //·½Ê½É趨: ÔÊÐíÏÔʾ¡¢Æ«ÖÃ1/2¡¢¾²Ì¬ //0 1 0 0 1 1 0 1 //C 1 0 x E B M1 M0 u_int8 initCode[2] = {IICADDR8562, 0x4d}; if( ISendStr(IICADDR8562,0x4d,&initCode[0],2) ) return (1); else return (0); }

タグ(2)
3 返答(返信)

1,578件の閲覧回数
angelbaunino
Contributor I

Hello 

I've made an example, perhaps it helps you

Regards.

/* Pin A4 (SDA), Pin A5 (SCL).*/

#include <Wire.h>

/* Slave Address PCF85162, PCF8562, PCF8566*/
#define PCF85162_ADDR 0x38
/* Commands */
#define PCF_CONTINUE (1 << 7)

#define PCF_CMD_SET_MODE (1 << 6)
#define PCF_MODE_ENABLE 0x08
#define PCF_MODE_HALF_BIAS 0x04
#define PCF_MODE_THIRD_BIAS 0x00
#define PCF_MODE_MULTIPLEX_4 0x00 // Multiplex 1:4
#define PCF_MODE_MULTIPLEX_3 0x03 // Multiplex 1:3
#define PCF_MODE_MULTIPLEX_2 0x02 // Multiplex 1:2
#define PCF_MODE_STATIC 0x01

#define PCF_CMD_LOAD_DATA_POINTER(dp) (dp & 0x1f)

#define PCF_CMD_SELECT_DEVICE(devNum) (((1 << 6) | (1 << 5)) | (devNum & 0x07))

#define PCF_CMD_SELECT_BANK ((1 << 6) | (1 << 5) | (1 << 4) | (1 << 3))
#define PCF_SELECT_INPUT_ROW0 0x00
#define PCF_SELECT_INPUT_ROW2 0x02
#define PCF_SELECT_OUTPUT_ROW0 0x00
#define PCF_SELECT_OUTPUT_ROW2 0x01

#define PCF_CMD_SELECT_BLINK ((1 << 6) | (1 << 5) | (1 << 4))
#define PCF_SELECT_NORMAL_BLINK 0x00
#define PCF_SELECT_ALTERN_BLINK 0x04
#define PCF_SELECT_BLINK_FREC_0 0x00
#define PCF_SELECT_BLINK_FREC_1 0x01
#define PCF_SELECT_BLINK_FREC_2 0x02
#define PCF_SELECT_BLINK_FREC_3 0x03

/* Display Data 0babcdefgP */
byte ONE = 0b01100000;
byte TWO = 0b11011010;
byte THREE = 0b11110010;
byte FOUR = 0b01100110;
byte FIVE = 0b10110110;
byte SIX = 0b10111110;
byte SEVEN = 0b11100000;
byte EIGHT = 0b11111110;
byte NINE = 0b11110110;
byte ZERO = 0b11111100;
byte DOT_POINT = 0b00000001;
byte EMPTY = 0b00000000;

byte TWO_D2 = 0b11011100;
byte THREE_D2 = 0b11110100;
byte ZERO_D2 = 0b11111010;

byte num[11] = {ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, ZERO};

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

/*Init PCF Device*/
Wire.beginTransmission(PCF85162_ADDR);
//Wire.write(PCF_CMD_SELECT_DEVICE(3) |PCF_CONTINUE); // subadd device - If I want set only one device
Wire.write(PCF_CMD_SET_MODE | PCF_MODE_ENABLE | PCF_MODE_STATIC | PCF_CONTINUE ); // enable driver
Wire.endTransmission();
delay(500);
}

void loop() {

for (int k = 0; k < 10; k++)
{
Wire.beginTransmission(PCF85162_ADDR);
Wire.write(PCF_CMD_SELECT_DEVICE(3) | PCF_CONTINUE); // subadd device
Wire.write(PCF_CMD_LOAD_DATA_POINTER(0)); // clear pointer

Wire.write(num[k]); // Digit 4
Wire.write(num[k]); // Digit 3
Wire.write(num[k]); // Digit 2
Wire.write(num[k]); // Digit 1

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

0 件の賞賛
返信

1,578件の閲覧回数
zafarobad
Contributor I

Hello !

What controller you have used for this code ?

Kindly can you share the schematic of hardware you interfaced ?

0 件の賞賛
返信

1,578件の閲覧回数
angelbaunino
Contributor I

Hello 

I have the same issue, I'm very confused about how to initialize PFC85162

how can I send the address+commands+data. I am using arduino.

thank you.

0 件の賞賛
返信