Port Configuration:ポート設定(0x09~0x0F)
Port Configurationレジスタ内には、各ポートについて2つのビットが用意されています。これらのビットは、各ポートをLEDドライバ、出力ポート、またはプルアップ抵抗付き/なしの入力ポートとして定義するために使用します。28ポートに対応して7個のPort Configurationレジスタが存在します。
Port I/O Value:ポート入出力値(0x20~0x5F)
Port I/O Valueレジスタは、各ポートについて29個あります(ポート31には2個のレジスタがあります)。21個のPort I/O Valueレジスタは、8個の異なるポートからなるグループについて同時にI/O値を定義するために使用することができます。残りのPort I/O Valueレジスタは、2、3、4、5、6、または7個の異なるポートからなるグループを同時に定義するために使用することができます。
I2CWrite(0x80, 0x02, 0x07); // Set a half global constant current
I2CWrite(0x80, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); // Set all ports to LED drive mode
I2CWrite(0x80, 0x04, 0x01); // Set the shutdown/run bit of the configuration register
I2CWrite(0x80, 0x12, 0x07); // Set a half port P4 constant current
I2CWrite(0x80, 0x09, 0xA8); // Set P4 to LED drive mode
I2CWrite(0x80, 0x04, 0x01); // Set the shutdown/run bit of the configuration register
0x02, 0x07; // Set a half global constant current
0x09, 0x00;// Set ports P4 through P7 to LED drive mode
0x0A, 0x00;// Set ports P8 through P11 to LED drive mode
0x0B, 0x00;// Set ports P12 through P15 to LED drive mode
0x0C, 0x00;// Set ports P16 through P19 to LED drive mode
0x0D, 0x00; // Set ports P20 through P23 to LED drive mode
0x0E, 0x00;// Set ports P24 through P27 to LED drive mode
0x0F, 0x00; // Set ports P28 through P31 to LED drive mode
0x04, 0x01; // Set the shutdown/run bit of the configuration register
I2CWrite(0x80, 0x0B, 0x5A, 0x55, 0x55); // Set P14 through P23 to output
I2CWrite(0x80, 0x4E, 0xFF); // Set P14 through P21 to logic high
I2CWrite(0x80, 0x56, 0x03); // Set P22 through P23 to logic high
I2CWrite(0x80, 0x04, 0x01); // Set the shutdown/run bit
0x0B, 0x5A; // Set P14 and P15 to output
0x0C, 0x55; // Set P16 through P19 to output
0x0D, 0x55; // Set P20 through P23 to output
0x4E, 0xFF; // Set P14 through P21 to logic high
0x56, 0x03; // Set P22 and P23 to logic high
0x04, 0x01; // Set the shutdown/run bit