一、芯片的引脚定义以及作用
31: BLANK When BLANK is high, all OUTn outputs are forced OFF. GS counter is also reset.
When BLANK is low, OUTn are controlled by the grayscale PWM control.
24: GSCLK Reference clock for grayscale PWM control (由TIME3提供方波)
1: SCLK Serial data shift clock (为SIN的写入提供输送 SCLK)
2: SIN Serial data input (高电平写入的为1低电平写入的为0)
23: SOUT Serial data output
3: MODE Input mode-change pin. When MODE = GND, the device is in GS mode. When MODE = VCC, the device is in DC mode.
32: XLAT Level triggered latch signal. When XLAT is high, the TLC59401 writes data from the input shift register to either GS register (MODE is low) or DC register (MODE is high). When XLAT is low, the data in the GS or DC registers are held constant and do not change.
二、两种重要的模式GS MODE和DC MODE
3: MODE Input mode-change pin. When MODE = GND, the device is in GS mode. When MODE = VCC, the device is in DC mode.
the GS data must be set before the DC data is set.(设置GS数据之前必须设置DC数据)
XLAT must be low when the MODE pin goes high-to-low or low-to-high to change back and forth between GS mode and DC mode.
1、 SETTING DOT CORRECTION
The TLC59401 has the capability to fine-adjust the output current of each channel (OUT0 to OUT15) independently.(每个灯的电流都可以独立控制)
Each of the 16 channels can be programmed with a 6-bit word.(63级) 6-bit*16 = 96bit. 每个灯的控制点占用6bit。
The channel output can be adjusted in 64 steps from 0% to 100% of the maximum output current Imax.
(共有64级灯亮的控制)
在设计计算机系统的时候,有两种处理内存中数据的方法。一种叫为little-endian,存放在内存中最低位的数值是来自数据的最右边部分(也就是数据的最低位部分)
Big-Endian format 最低位来自最左边的数据。
数据的传输形式:
The format is Big-Endian format. In this format, the MSB is transmitted first, followed by the MSB-1, etc.
相关代码的实现:
if(type == DC_MODE)
{
for(uint8_t i = 0; i < 16; i++) //
{
dc_data = p_tlc->led_dc_data_buff[15-i];
for(uint8_t t = 0; t < 6; t++)
{
if(dc_data & 0x20)
{
HAL_GPIO_WritePin(IR_SIN_GPIO_Port,IR_SIN_Pin,GPIO_PIN_SET);
HAL_GPIO_WritePin(IR_SCLK_GPIO_Port,IR_SCLK_Pin,GPIO_PIN_SET); //
HAL_GPIO_WritePin(IR_SCLK_GPIO_Port,IR_SCLK_Pin,GPIO_PIN_RESET);
}
else
{
HAL_GPIO_WritePin(IR_SIN_GPIO_Port,IR_SIN_Pin,GPIO_PIN_RESET);
HAL_GPIO_WritePin(IR_SCLK_GPIO_Port,IR_SCLK_Pin,GPIO_PIN_SET);
HAL_GPIO_WritePin(IR_SCLK_GPIO_Port,IR_SCLK_Pin,GPIO_PIN_RESET);
}
dc_data = dc_data << 1;
}
}
}
2、SETTING GRAYSCALE
The use of 12 bits per channel results in 4096 different brightness steps, from 0% to 100% brightness.
3、GRAYSCALE PWM OPERATION
The first GSCLK pulse after BLANK goes low increases the grayscale counter by one and switches on all OUTn with a grayscale value not equal to zero.
Each following rising edge of GSCLK increases the grayscale counter by one.
The TLC59401 compares the grayscale value of each output OUTn with the grayscale counter value. All OUTn with grayscale values equal to the counter values are switched off.
Output On-Time