This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TLC5971 Output is always ON whenever the Board is power

Other Parts Discussed in Thread: TLC5971

Good day to all,

Please i need your guide and support on how to solve this Problem.I am using 6 Outputs of TLC5971  to control the brightness of 6 Leds.Everything is working well except the fact that the Outputs are always ON whenever I power on the board.Based on the initialisation that i made,I expect the Outputs to be OFF  whenever  I power ON the board.I would be very grafeful if somebody could help me have a look  through my code perhaps my initialisation code is wrong.Below are my lines of code:

void ClearClock()
{
	PORTB &= ~(1 << PB3);  
}

void SetClock()
{
	PORTB |= (1 << PB3);   
}

void ToggleClock()
{
	_delay_us(50);
	SetClock();
	_delay_us(50);
	ClearClock();
	clockcount++;
}

void GenerateLatch()
{
	_delay_us(400);
	
}

void SetData()
{
	PORTD |= (1 << PD6);   // Setzen
}

void ClearData()
{
	PORTD &= ~(1 << PD6);  // Rücksetzen
}


void send_16Bit(unsigned int data10)

{
	int i=15;
	do
	{
		if (((data10 & (1<<i))>>i) == 1)
		SetData();
		else
		ClearData();
		ToggleClock();
		i=i-1;
	}
	while (i >= 0);
}


void InitRegister()
{
	// 0x25 = 100101b
	
	SetData(); ToggleClock();
	ClearData(); ToggleClock();
	ClearData(); ToggleClock();
	SetData(); ToggleClock();
	ClearData(); ToggleClock();
	SetData(); ToggleClock();
	
	
	SetData(); ToggleClock();    // OUTTMG (1=OUTx turned on/off at rising edge of clock
	ClearData(); ToggleClock();  // EXTGCK (0=internal Clock)
	SetData(); ToggleClock();    // TMGRST (Display timing reset mode)
	SetData(); ToggleClock();    // DSPRPT (auto Display repeat mode)
	ClearData(); ToggleClock();  // BLANK (0=LEDs on; 1=LEDs off)
	// global brightness correction

	for (int i=212; i>191; i--)
	{
		SetData(); ToggleClock();
		a++;
	}
	// Greyscale Data
	a=0;
	for (int i=192; i>0; i--)
	{
		ClearData(); ToggleClock();
		a++;
	}
	a=0;
	GenerateLatch();
}


void SendLEDHeader(void)
{
	// 0x25 = 100101b
	
	SetData(); ToggleClock();
	ClearData(); ToggleClock();
	ClearData(); ToggleClock();
	SetData(); ToggleClock();
	ClearData(); ToggleClock();
	SetData(); ToggleClock();
	
	
	SetData(); ToggleClock();    // OUTTMG (1=OUTx turned on/off at rising edge of clock
	ClearData(); ToggleClock();  // EXTGCK (0=internal Clock)
	ClearData(); ToggleClock();    // TMGRST (Display timing reset mode)
	SetData(); ToggleClock();    // DSPRPT (auto Display repeat mode)
	ClearData(); ToggleClock();  // BLANK (0=LEDs on; 1=LEDs off)
	// global brightness correction

	for (int i=212; i>191; i--)    //^191
	{
		SetData(); ToggleClock();
		a++;
	}
}

void SetRegister_1(unsigned short LED0,unsigned short LED1, unsigned short LED2, unsigned short LED3, unsigned short LED4, unsigned short LED5)

{
	
	

	SendLEDHeader();
	send_16Bit(0);
	send_16Bit(0);
	send_16Bit(0);
	send_16Bit(0);
	send_16Bit(0);
	send_16Bit(0);
	send_16Bit(65535-LED5);
	send_16Bit(65535-LED4);
	send_16Bit(65535-LED3);
	send_16Bit(65535-LED2);
	send_16Bit(65535-LED1);
	send_16Bit(65535-LED0);
	
}


int main(void)
{
	DDRB |= 1 <<PINB3; // PIN  B3  Clock Output
	DDRD |= 1 <<PIND6;   // PIN  D6  Data Output
	InitRegister();
	USART_Init(47);
	SetRegister_1(0,0,0,0,0,0);
	
	while(1)
	{
		clockcount=0;
		
		
		
		
		//wait_command();
		
 		UARTReceiver();
	
		
		
		

	}
}//

   Thank you for the  Support.Best regards.

  • Hello,

    After reading your program, I think your board should turn on all LEDs when power on, which means what you complained "Outputs are always ON" is exactly it should be.

    In the main() program, line 145, SetRegister_1(0,0,0,0,0,0), all parameters are '0'; while in the function SetRegister_1, line 129~134, you use the parameters in this way: send_16Bit(65535-LEDx), which means that you input '65535' as GS data for channel OUTR0/G0/B0/R1/G1/B1, then all the 6 LEDs should be turn on with maximum brightness at power on moment.

    BTW, I saw you set TMGRST=0 in SendLEDHeader function, see line 104. I suggest you choose TMGRST=1, which will reset GS counter and start a new display period when you write new GS data into IC.

    Please let me know your thought.

    Mike