Other Parts Discussed in Thread: TLC5955
Would you provide any sample code on any language about driving TLC5954 ? Thanks.
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.
Hi,
Currently, We don't have sample code for TLC5954, but you may take TLC5955 sample code for reference and TLC5954 should be more easier to use.
#include <ti/devices/msp432p4xx/driverlib/driverlib.h> #include <ti/devices/msp432p4xx/driverlib/debug.h> #include <ti/devices/msp432p4xx/driverlib/eusci.h> /* Standard Includes */ #include <stdint.h> #include <stdbool.h> #include "TLC5955.h" void SendGSData(int *temp) // { int k,temp1,temp2; // Send MSB=0 GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN5 );// SIN=0 GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-Low __delay_cycles(6); //6/25M=240ns GPIO_setOutputHighOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-high // Send 0-767 bits data; each 16 bits is a channel GSpwm data for(k=767;k>=0;k--) { temp1=1<<(k%16); temp2=temp[k/16]&temp1; if(temp2==temp1) {GPIO_setOutputHighOnPin(GPIO_PORT_P3,GPIO_PIN5);} //SIN=1 else {GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN5 );} //SIN=0 GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-Low __delay_cycles(6); //6/25M=240ns GPIO_setOutputHighOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-high } //__delay_cycles(6); //6/25M=240ns GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-low // __delay_cycles(1); //6/25M=240ns GPIO_setOutputHighOnPin(GPIO_PORT_P3,GPIO_PIN7);//XLAT-high __delay_cycles(6); //Twh1 XLAT high-level pulse width 6/25M=240ns GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN7 ); //XLAT-low } void ReadSIDdata(char RFRESH,char *LOD_data,char *LSD_data) { int k; //wait 65535th Gsclk if(RFRESH==1) {__delay_cycles(75000);} for(k=767;k>=720;k--) { GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN5 ); GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-Low __delay_cycles(6); //6/25M=240ns GPIO_setOutputHighOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-high LOD_data[(k-720)/3]=(LOD_data[(k-720)/3]<<1)|GPIO_getInputPinValue(GPIO_PORT_P5,GPIO_PIN2); } for(k=719;k>=672;k--) { GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN5 ); GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-Low __delay_cycles(6); //6/25M=240ns GPIO_setOutputHighOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-high LSD_data[(k-672)/3]=(LSD_data[(k-672)/3]<<1)|GPIO_getInputPinValue(GPIO_PORT_P5,GPIO_PIN2); } } void SendControlData(char LSDVLT,char ESPWM,char RFRESH,char TMGRST, char DSPRPT, char *BC_data,char *MC_data,char *DC_data)// { int k,k1,k2,k3; char temp,temp0,temp1,temp2,temp3,temp4,temp5,temp6; char t=0x96; //MSB is 1 GPIO_setOutputHighOnPin(GPIO_PORT_P3,GPIO_PIN5 ); //MSB is 1 SDA GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-Low __delay_cycles(6); //6/25M=240ns GPIO_setOutputHighOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-high // send 0X96 for(k=767;k>=760;k--) { temp=1<<(k-760); temp0=t&temp; if(temp0==temp) { GPIO_setOutputHighOnPin(GPIO_PORT_P3,GPIO_PIN5); //SDA=1 } else { GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN5); //SDA=0 } GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-Low __delay_cycles(6); //6/25M=240ns GPIO_setOutputHighOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-high // __delay_cycles(6); //6/25M=240ns } // no control data for(k=759;k>=371;k--) { GPIO_setOutputHighOnPin(GPIO_PORT_P3,GPIO_PIN5 );//SDA 1 GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-Low __delay_cycles(6); //6/25M=240ns GPIO_setOutputHighOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-high } //LSDVLT is 1 or 0 if(LSDVLT==0) {GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN5 );}//SDA 0 else {GPIO_setOutputHighOnPin(GPIO_PORT_P3,GPIO_PIN5 );}//SDA 1 GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-Low __delay_cycles(6); //6/25M=240ns GPIO_setOutputHighOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-high //ESPWM is 1 or 0 if(ESPWM==0) {GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN5 );}//SDA 0 else {GPIO_setOutputHighOnPin(GPIO_PORT_P3,GPIO_PIN5 );}//SDA 1 GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-Low __delay_cycles(6); //6/25M=240ns GPIO_setOutputHighOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-high //RFRESH is 1 or 0 if(RFRESH==0) {GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN5 );}//SDA 0 else {GPIO_setOutputHighOnPin(GPIO_PORT_P3,GPIO_PIN5 );}//SDA 1 GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-Low __delay_cycles(6); //6/25M=240ns GPIO_setOutputHighOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-high //TMGRST is 1 or 0 if(TMGRST==0) {GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN5 );}//SDA 0 else {GPIO_setOutputHighOnPin(GPIO_PORT_P3,GPIO_PIN5);}//SDA 1 GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-Low __delay_cycles(6); //6/25M=240ns GPIO_setOutputHighOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-high //DSPRPT is 1 or 0 if(DSPRPT==0) {GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN5 );}//SDA 0 else {GPIO_setOutputHighOnPin(GPIO_PORT_P3,GPIO_PIN5);}//SDA 1 GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-Low __delay_cycles(6); //6/25M=240ns GPIO_setOutputHighOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-high //send BC data BCR[7:0] BCG[7:0] BCB[7:0] for (k1=20;k1>=0;k1--) { temp1=1<<(k1%7); temp2=BC_data[k1/7]&temp1; if(temp2==temp1) { GPIO_setOutputHighOnPin(GPIO_PORT_P3,GPIO_PIN5); //SDA=1 } else { GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN5); //SDA=0 } GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-Low __delay_cycles(6); //6/25M=240ns GPIO_setOutputHighOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-high } //send MC data MCR[2:0] MCG[2:0] MCB[2:0] for (k2=8;k2>=0;k2--) { temp3=1<<(k2%3); temp4=MC_data[k2/3]&temp3; if(temp4==temp3) { GPIO_setOutputHighOnPin(GPIO_PORT_P3,GPIO_PIN5); //SDA=1 } else { GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN5 ); //SDA=0 } GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-Low __delay_cycles(6); //6/25M=240ns GPIO_setOutputHighOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-high } //send DC data DCRn[7:0] DCGn[2:0] DCBn[2:0] for (k3=335;k3>=0;k3--) { temp5=1<<(k3%7); temp6=DC_data[k3/7]&temp5; if(temp6==temp5) { GPIO_setOutputHighOnPin(GPIO_PORT_P3,GPIO_PIN5); //SDA=1 } else { GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN5 ); //SDA=0 } GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-Low __delay_cycles(6); //6/25M=240ns GPIO_setOutputHighOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-high } // __delay_cycles(6); //6/25M=240ns GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN6);//SCL-low // __delay_cycles(1); //6/25M=240ns GPIO_setOutputHighOnPin(GPIO_PORT_P3,GPIO_PIN7);//XLAT-high __delay_cycles(6); //Twh1 XLAT high-level pulse width 6/25M=240ns GPIO_setOutputLowOnPin(GPIO_PORT_P3,GPIO_PIN7); //XLAT-low }
Thanks.
Kenneth