18-CHANNEL LED DRIVER EVALUATION BOARD GUIDE
Integrated Silicon Solution, Inc. – ams.issi.com
8
Rev. B, 12/28/2018
APPENDIX
Ⅰ
: IS31FL3238 Arduino Test Code V01A
#include<Wire.h>
#include<avr/pgmspace.h>
#define Addr_GND 0x68
//7 bit format is 0x3F
byte PWM_Gamma64[64]=
{
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
0x08,0x09,0x0b,0x0d,0x0f,0x11,0x13,0x16,
0x1a,0x1c,0x1d,0x1f,0x22,0x25,0x28,0x2e,
0x34,0x38,0x3c,0x40,0x44,0x48,0x4b,0x4f,
0x55,0x5a,0x5f,0x64,0x69,0x6d,0x72,0x77,
0x7d,0x80,0x88,0x8d,0x94,0x9a,0xa0,0xa7,
0xac,0xb0,0xb9,0xbf,0xc6,0xcb,0xcf,0xd6,
0xe1,0xe9,0xed,0xf1,0xf6,0xfa,0xfe,0xff
};
void setup() {
// put your setup code here, to run once:
Wire.begin();
Wire.setClock(400000);//I2C 400kHz
// pinMode(4,OUTPUT);//SDB
// digitalWrite(4,HIGH);//SDB_HIGH
//delay(100); //keep 0.5s
Init_FL3238();
}
void loop() {
// put your main code here, to run repeatedly:
// delay(50);
Init_FL3238();
IS31FL3238_mode1();//breath mode
}
void IS_IIC_WriteByte(uint8_t Dev_Add,uint8_t Reg_Add,uint8_t Reg_Dat)
{
Wire.beginTransmission(Dev_Add/2);
Wire.write(Reg_Add); // sends regaddress
Wire.write(Reg_Dat); // sends regaddress
Wire.endTransmission(); // stop transmitting
}
void Init_FL3238(void)
{
uint8_t i = 0;
for(i=0x4A;i<=0x6D;i++)
{
IS_IIC_WriteByte(Addr_GND,i,0xFF);//write all scaling
}
IS_IIC_WriteByte(Addr_GND,0x6e,0xff);//GCC
IS_IIC_WriteByte(Addr_GND,0x49,0x00);//update PWM & congtrol registers
IS_IIC_WriteByte(Addr_GND,0x00,0x01);//normal operation
}
void IS31FL3238_mode1(void)//white LED
{
int i=0,j=0;
for(j=0;j<=63;j++)
{
for(i=0x01;i<=0x47;i=i+2)
{
IS_IIC_WriteByte(Addr_GND,i, PWM_Gamma64[j]);//write all PWM set 0x80
IS_IIC_WriteByte(Addr_GND,0x49,0x00);//update PWM & congtrol registers
}
delay(10); //keep 0.5s
}
for(j=63;j>=0;j--)
{
for(i=0x01;i<=0x47;i=i+2)
{