主题中讨论的其他器件:TLC5957、
工具/软件:Code Composer Studio
大家好!
我想使用 code composer studio 对 显示屏的代码进行编程。
驱动器 IC 为 TLC5957。 我有一个称为 10×16全色 RGB LED 矩阵 参考设计的参考设计。
但我对 c 语言不是很好、我无法理解 TI 支持的代码。
代码中突出显示了我不会裸体的地方。
代码如下所示:
秘书长的报告 /* DriverLib 包括*/ #include /*标准包括*/ #include #include #include "TLC5957.H" #include "LED.h" /*#define CPU_F (((double) 48000000) #define DELAY_us (x)_DELAY_CYCLES ((long)(CPU_F*(double) x/1000000.0) )#define DELAY_ms (x)_ DELAY_AULT_DAULT_1 (long)#define UCP_AULT_UCP_AULT_1 (timer_A AULT_UCP_UCP_1)+ UCP_UTPL* 1)#define AULT_UCP_UCP_1 (UCP_UCP_UCP_1)#define AULT_1 Timer_A_CLOCKSOURCE_SMCLK、 // SMCLK 时钟源 Timer_A_CLOCKSOURCE_divider _1、 // SMCLK/1 = 3MHz Timer_Period、 // 5000个周期 Timer_A_TAIE_INTERRUPT_DISABLE、 //禁用计时器中断 Timer_A_CCIE_CCR0_INTERRUPT_ENABLE,//启用 CCR0中断 Timer_A_do 清除 //清除值 };*/ int GSdata0[]= { 0x0000.0x0000.0x0000.0x0000、//D0B、D7G、D0R 0x0000.0x0000.0x0000.0x0000、//D1B、D6G、D1R 0x0000.0x0000.0x0000.0x0000、//D2B、D5G、D2R 0x0000.0x0000.0x0000.0x0000、//D3B、D4G、D3R 0x0000.0x0000.0x0000.0x0000、//D4B、D3G、D4R 0x0000.0x0000.0x0000.0x0000、//D5B、D2G、D5R 0x0000.0x0000.0x0000.0x0000、//D6B、D1G、D6R 0x0000.0x0000.0x0000.0x0000、//D7B、D0G、D7R 0x0000.0x0000.0x0000.0x0000、//D8B、D15G、D8R 0x0000.0x0000.0x0000.0x0000、//D9B、D14G、D9R 0x0000.0x0000.0x0000.0x0000、//D10B、D13G、D10R 0x0000.0x0000.0x0000.0x0000、//D11B、D12G、D11R 0x0000.0x0000.0x0000.0x0000、//D12B、D11G、D12R 0x0000.0x0000.0x0000.0x0000、//D13B、D10G、D13R 0x0000.0x0000.0x0000.0x0000、//D14B、D9G、D14R 0x0000, 0x0000, 0x0000//D15B,D8G,D15R }; int GSdata1[]= { 4、4、//D0 B、G、R 4、4、//D1 B、G、R 4、4、//D2 B、G、R 4、4、//D3 B、G、R 4、4、//D4 B、G、R 4、4、//D5 B、G、R 4、4、//D6 B、G、R 4、4、//D7 B、G、R 4、4、//D8 B、G、R 4、4、//D9 B、G、R 4、4、//D10 B、G、R 4、4、//D11 B、G、R 4、4、//D12 B、G、R 4、4、//D13 B、G、R 4、4、//D14 B、G、R 4、4、//D15 B、G、R }; int GSdataR[]= { 0x000、0x000、0xxif、//D0B、D7G、D0R 0x000、0x000、0xxfff、//D1B、D6G、D1R 0x000、0x000、0xxif、//D2B、D5G、D2R 0x000、0x000、0xxif、//D3B、D4G、D3R 0x000、0x000、0xxif、//D4B、D3G、D4R 0x000、0x000、0xxfff、//D5B、D2G、D5R 0x000、0x000、0xxif、//D6B、D1G、D6R 0x000、0x000、0xxfff、//D7B、D0G、D7R 0x000、0x000、0xxfff、//D8B、D15G、D8R 0x0000x0000x0x0000xFFF、//D9B、D14G、D9R 0x000、0x000、0xxif、//D10B、D13G、D10R 0x000、0x000、0xxif、//D11B、D12G、D11R 0x000、0x000、0xxfff、//D12B、D11G、D12R 0x000、0x000、0xxfff、//D13B、D10G、D13R 0x000、0x000、0xxif、//D14B、D9G、D14R 0x000、0x000、0xxfff //D15B、D8G、D15R }; int GSdataG[]= { 0x0000x0xf、0x000、//D0B、D7G、D0R 0x0000x0xf、0x000、//D1B、D6G、D1R 0x000、0xxfff、0x000、//D2B、D5G、D2R 0x0000x0xf、0x000、//D3B、D4G、D3R 0x0000xf、0x000、//D4B、D3G、D4R 0x000、0xxfff、0x000、//D5B、D2G、D5R 0x0000x0xf、0x000、//D6B、D1G、D6R 0x0000x0xf、0x000、//D7B、D0G、D7R 0x0000x0xf、0x000、//D8B、D15G、D8R 0x0000x0xf、0x000、//D9B、D14G、D9R 0x0000x0xf、0x000、//D10B、D13G、D10R 0x0000x0xf、0x000、//D11B、D12G、D11R 0x0000x0xf、0x000、//D12B、D11G、D12R 0x0000xf、0x000、//D13B、D10G、D13R 0x0000x0xf、0x000、//D14B、D9G、D14R 0x0000xf、0x000 //D15B、D8G、D15R }; int GSdataB[]= { 0xxf、0x000、0x000、//D0B、D7G、D0R 0xxf、0x000、0x000、//D1B、D6G、D1R 0xxf、0x000、0x000、//D2B、D5G、D2R 0xxf、0x000、0x000、//D3B、D4G、D3R 0xxf、0x000、0x000、//D4B、D3G、D4R 0xxf、0x000、0x000、//D5B、D2G、D5R 0xxf、0x000、0x000、//D6B、D1G、D6R 0xxf、0x000、0x000、//D7B、D0G、D7R 0xxf、0x000、0x000、//D8B、D15G、D8R 0xxf、0x000、0x000、//D9B、D14G、D9R 0xxf、0x000、0x000、//D10B、D13G、D10R 0xxf、0x000、0x000、//D11B、D12G、D11R 0xxf、0x000、0x000、//D12B、D11G、D12R 0xxf、0x000、0x000、//D13B、D10G、D13R 0xxf、0x000、0x000、//D14B、D9G、D14R 0xfff、0x000、0x000 //D15B、D8G、D15R }; int GSdataP[]= { 0xxf、0x0000xf、//D0B、D7G、D0R 0xxf、0x0000xf、//D1B、D6G、D1R 0xxf、0x0000xf、//D2B、D5G、D2R 0xxf、0x0000xf、//D3B、D4G、D3R 0xxf、0x0000xf、//D4B、D3G、D4R 0xxf、0x0000xf、//D5B、D2G、D5R 0xxf、0x0000xf、//D6B、D1G、D6R 0xxf、0x0000xf、//D7B、D0G、D7R 0xxf、0x0000xf、//D8B、D15G、D8R 0xxf、0x0000xf、//D9B、D14G、D9R 0xxf、0x0000xf、//D10B、D13G、D10R 0xxf、0x0000xf、//D11B、D12G、D11R 0xxf、0x0000xf、//D12B、D11G、D12R 0xxf、0x0000xf、//D13B、D10G、D13R 0xxf、0x0000xf、//D14B、D9G、D14R 0xfff、0x000、0xxfff //D15B、D8G、D15R }; int GSdataY[]= { 0x000、0xxfff、0xxif、//D0B、D7G、D0R 0x0000x0xFFF、0xFFF、//D1B、D6G、D1R 0x000、0xxfff、0xxif、//D2B、D5G、D2R 0x000、0xxfff、0xxf、//D3B、D4G、D3R 0x000、0xxfff、0xxif、//D4B、D3G、D4R 0x000、0xxfff、0xxif、//D5B、D2G、D5R 0x0000x0xFFF、0xFFF、//D6B、D1G、D6R 0x0000x0xFFF、0xFFF、//D7B、D0G、D7R 0x0000x0xFFF、0xFFF、//D8B、D15G、D8R 0x0000x0xFFF、0xFFF、//D9B、D14G、D9R 0x0000x0xFFF、0xFFF、//D10B、D13G、D10R 0x000、0xxfff、0xxif、//D11B、D12G、D11R 0x0000xxfff、0xxf、//D12B、D11G、D12R 0x000、0xxfff、0xxif、//D13B、D10G、D13R 0x0000x0xFF,0xFF,//D14B, D9G, D14R 0x000、0xxfff、0xxif //D15B、D8G、D15R }; int GSdataT[]= { 0xLF、0xLF、0x000、//D0B、D7G、D0R 0xLF、0xLF、0x000、//D1B、D6G、D1R 0xxf、0xf、0x000、//D2B、D5G、D2R 0xLF、0xLF、0x000、//D3B、D4G、D3R 0xLF、0xLF、0x000、//D4B、D3G、D4R 0xLF、0xLF、0x000、//D5B、D2G、D5R 0xLF、0xLF、0x000、//D6B、D1G、D6R 0xLF、0xLF、0x000、//D7B、D0G、D7R 0xxf、0xf、0x000、//D8B、D15G、D8R 0xLF、0xLF、0x000、//D9B、D14G、D9R 0xLF、0xLF、0x000、//D10B、D13G、D10R 0xLF、0xLF、0x000、//D11B、D12G、D11R 0xLF、0xLF、0x000、//D12B、D11G、D12R 0xLF、0xLF、0x000、//D13B、D10G、D13R 0xLF、0xLF、0x000、//D14B、D9G、D14R 0xfff、0x0xf、0x000 //D15B、D8G、D15R }; void Switch_Line (unsigned char I) { 开关(I) { 案例1: { GPIO_setOutputHighOnPin (GPIO_PORT_P2、GPIO_PIN7); GPIO_setOutputLowOnPin (GPIO_PORT_P2、GPIO_PIN3|GPIO_PIN4|GPIO_PIN6); GPIO_setOutputLowOnPin (GPIO_PORT_P3、GPIO_PIN5|GPIO_PIN7); GPIO_setOutputLowOnPin (GPIO_PORT_P5、GPIO_PIN1|GPIO_PIN6); GPIO_setOutputLowOnPin (GPIO_PORT_P6、GPIO_PIN6|GPIO_PIN7); } 中断; 案例2: { GPIO_setOutputHighOnPin (GPIO_PORT_P2、GPIO_PIN6); GPIO_setOutputLowOnPin (GPIO_PORT_P2、GPIO_PIN3|GPIO_PIN4|GPIO_PIN7); GPIO_setOutputLowOnPin (GPIO_PORT_P3、GPIO_PIN5|GPIO_PIN7); GPIO_setOutputLowOnPin (GPIO_PORT_P5、GPIO_PIN1|GPIO_PIN6); GPIO_setOutputLowOnPin (GPIO_PORT_P6、GPIO_PIN6|GPIO_PIN7); } ;中断; 案例3: { GPIO_setOutputHighOnPin (GPIO_PORT_P2、GPIO_PIN4); GPIO_setOutputLowOnPin (GPIO_PORT_P2、GPIO_PIN3|GPIO_PIN6|GPIO_PIN7); GPIO_setOutputLowOnPin (GPIO_PORT_P3、GPIO_PIN5|GPIO_PIN7); GPIO_setOutputLowOnPin (GPIO_PORT_P5、GPIO_PIN1|GPIO_PIN6); GPIO_setOutputLowOnPin (GPIO_PORT_P6、GPIO_PIN6|GPIO_PIN7); } ;中断; 案例4: { GPIO_setOutputHighOnPin (GPIO_PORT_P5、GPIO_PIN6); GPIO_setOutputLowOnPin (GPIO_PORT_P2、GPIO_PIN3|GPIO_PIN4|GPIO_PIN6|GPIO_PIN7); GPIO_setOutputLowOnPin (GPIO_PORT_P3、GPIO_PIN5|GPIO_PIN7); GPIO_setOutputLowOnPin (GPIO_PORT_P5、GPIO_PIN1); GPIO_setOutputLowOnPin (GPIO_PORT_P6、GPIO_PIN6|GPIO_PIN7); } ;中断; 情况5: { GPIO_setOutputHighOnPin (GPIO_PORT_P6、GPIO_PIN6); GPIO_setOutputLowOnPin (GPIO_PORT_P2、GPIO_PIN3|GPIO_PIN4|GPIO_PIN6|GPIO_PIN7); GPIO_setOutputLowOnPin (GPIO_PORT_P3、GPIO_PIN5|GPIO_PIN7); GPIO_setOutputLowOnPin (GPIO_PORT_P5、GPIO_PIN1|GPIO_PIN6); GPIO_setOutputLowOnPin (GPIO_PORT_P6、GPIO_PIN7); } ;中断; 案例6: { GPIO_setOutputHighOnPin (GPIO_PORT_P6、GPIO_PIN7); GPIO_setOutputLowOnPin (GPIO_PORT_P2、GPIO_PIN3|GPIO_PIN4|GPIO_PIN6|GPIO_PIN7); GPIO_setOutputLowOnPin (GPIO_PORT_P3、GPIO_PIN5|GPIO_PIN7); GPIO_setOutputLowOnPin (GPIO_PORT_P5、GPIO_PIN1|GPIO_PIN6); GPIO_setOutputLowOnPin (GPIO_PORT_P6、GPIO_PIN6); } ;中断; 案例7: { GPIO_setOutputHighOnPin (GPIO_PORT_P2、GPIO_PIN3); GPIO_setOutputLowOnPin (GPIO_PORT_P2、GPIO_PIN4|GPIO_PIN6|GPIO_PIN7); GPIO_setOutputLowOnPin (GPIO_PORT_P3、GPIO_PIN5|GPIO_PIN7); GPIO_setOutputLowOnPin (GPIO_PORT_P5、GPIO_PIN1|GPIO_PIN6); GPIO_setOutputLowOnPin (GPIO_PORT_P6、GPIO_PIN6|GPIO_PIN7); } ;中断; 案例8: { GPIO_setOutputHighOnPin (GPIO_PORT_P5、GPIO_PIN1); GPIO_setOutputLowOnPin (GPIO_PORT_P2、GPIO_PIN3|GPIO_PIN4|GPIO_PIN6|GPIO_PIN7); GPIO_setOutputLowOnPin (GPIO_PORT_P3、GPIO_PIN5|GPIO_PIN7); GPIO_setOutputLowOnPin (GPIO_PORT_P5、GPIO_PIN6); GPIO_setOutputLowOnPin (GPIO_PORT_P6、GPIO_PIN6|GPIO_PIN7); } ;中断; 案例9: { GPIO_setOutputHighOnPin (GPIO_PORT_P3、GPIO_PIN5); GPIO_setOutputLowOnPin (GPIO_PORT_P2、GPIO_PIN3|GPIO_PIN4|GPIO_PIN6|GPIO_PIN7); GPIO_setOutputLowOnPin (GPIO_PORT_P3、GPIO_PIN7); GPIO_setOutputLowOnPin (GPIO_PORT_P5、GPIO_PIN1|GPIO_PIN6); GPIO_setOutputLowOnPin (GPIO_PORT_P6、GPIO_PIN6|GPIO_PIN7); } ;中断; 案例10: { GPIO_setOutputHighOnPin (GPIO_PORT_P3、GPIO_PIN7); GPIO_setOutputLowOnPin (GPIO_PORT_P2、GPIO_PIN3|GPIO_PIN4|GPIO_PIN6|GPIO_PIN7); GPIO_setOutputLowOnPin (GPIO_PORT_P3、GPIO_PIN5); GPIO_setOutputLowOnPin (GPIO_PORT_P5、GPIO_PIN1|GPIO_PIN6); GPIO_setOutputLowOnPin (GPIO_PORT_P6、GPIO_PIN6|GPIO_PIN7); };中断; } } void Switch_Line_off (无符号字符 i) { 开关(I) { 案例1: { GPIO_setOutputLowOnPin (GPIO_PORT_P2、GPIO_PIN7); } 中断; 案例2: { GPIO_setOutputLowOnPin (GPIO_PORT_P2、GPIO_PIN6); } ;中断; 案例3: { GPIO_setOutputLowOnPin (GPIO_PORT_P2、GPIO_PIN4); } ;中断; 案例4: { GPIO_setOutputLowOnPin (GPIO_PORT_P5、GPIO_PIN6); } ;中断; 情况5: { GPIO_setOutputLowOnPin (GPIO_PORT_P6、GPIO_PIN6); } ;中断; 案例6: { GPIO_setOutputLowOnPin (GPIO_PORT_P6、GPIO_PIN7); } ;中断; 案例7: { GPIO_setOutputLowOnPin (GPIO_PORT_P2、GPIO_PIN3); } ;中断; 案例8: { GPIO_setOutputLowOnPin (GPIO_PORT_P5、GPIO_PIN1); } ;中断; 案例9: { GPIO_setOutputLowOnPin (GPIO_PORT_P3、GPIO_PIN5); } ;中断; 案例10: { GPIO_setOutputLowOnPin (GPIO_PORT_P3、GPIO_PIN7); };中断; } } 空 Init_Line() { GPIO_setAsOutputPin (GPIO_PORT_P1、GPIO_PIN6|GPIO_PIN7); GPIO_setAsOutputPi (GPIO_PORT_P2、GPIO_PIN3|GPIO_PIN4|GPIO_PIN6|GPIO_PIN7); GPIO_setAsOutputPin (GPIO_PORT_P3、GPIO_PIN5|GPIO_PIN6|GPIO_PIN7); GPIO_setAsOutputPin (GPIO_PORT_P5、GPIO_PIN0|GPIO_PIN1|GPIO_PIN2|GPIO_PIN6|GPIO_PIN7); GPIO_setAsOutputPin (GPIO_PORT_P6、GPIO_PIN6|GPIO_PIN7); GPIO_setOutputHighOnPin (GPIO_PORT_P1、GPIO_PIN6|GPIO_PIN7);// GPIO_setOutputHighOnPin (GPIO_PORT_P1、GPIO_PIN6|GPIO_PIN7); GPIO_setOutputHighOnPin (GPIO_PORT_P2、GPIO_PIN3|GPIO_PIN4|GPIO_PIN6|GPIO_PIN7); GPIO_setOutputHighOnPin (GPIO_PORT_P3、GPIO_PIN5|GPIO_PIN6|GPIO_PIN7); GPIO_setOutputHighOnPin (GPIO_PORT_P5、GPIO_PIN0|GPIO_PIN1|GPIO_PIN2|GPIO_PIN6|GPIO_PIN7); GPIO_setOutputHighOnPin (GPIO_PORT_P6、GPIO_PIN6|GPIO_PIN7); } int main (void) { /* TLC5957矩阵的主代码*/ init_Clock(); init_TLC5957(); init_Line(); /*将 P1.1配置为输入并启用中断*/ MAP_GPIO_setAsInputPinWithPullUpResistor (GPIO_PORT_P1、GPIO_PIN1); MAP_GPIO_clearInterruptFlag (GPIO_PORT_P1、GPIO_PIN1); MAP_GPIO_enableInterrupt (GPIO_PORT_P1、GPIO_PIN1); MAP_Interrupt_enableInterrupt (INT_Port1); /*启用 SRAM 组保持*/ MAP_SYSCTL_enableSRAMBankRetention (SYSCTL_SRAM_BANK1); /*启用主中断*/ MAP_Interrupt_enableMaster(); GPIO_setOutputLowOnPin (GPIO_PORT_P2、GPIO_PIN7); GPIO_setOutputLowOnPin (GPIO_PORT_P1、GPIO_PIN6|GPIO_PIN7); GPIO_setOutputLowOnPin (GPIO_PORT_P2、GPIO_PIN3|GPIO_PIN4|GPIO_PIN6); GPIO_setOutputLowOnPin (GPIO_PORT_P3、GPIO_PIN5|GPIO_PIN6|GPIO_PIN7); GPIO_setOutputLowOnPin (GPIO_PORT_P5、GPIO_PIN0|GPIO_PIN1|GPIO_PIN2|GPIO_PIN6|GPIO_PIN7); GPIO_setOutputLowOnPin (GPIO_PORT_P6、GPIO_PIN6|GPIO_PIN7); GPIO_setPeripheralModuleFunctionOutputPin (GPIO_PORT_P4、GPIO_PIN3、GPIO_PRIMARY_MODULE_Function); /* WriteFCData (char LGSE2、char Poker、char BC、char CCR、char CCG、char LGSE1、char SEL_SCK_EDGE、char LGSE3、char ESPWM、char SEL_PCHG、char SEL_GCK_EDGE、char XREFRFSH、char DVSEL_GDLY、char SDL0、char SEL_PCHG、char) // Switch_Line (2); WriteFCData (0、1、2、256、256、256、256、256、0、0、1、0、0、1、0、0);//首先写入 FC 数据 //WriteGSData_Poker (GSdata1); //Doraemon ();//Run Doraemon //Scan(); //微笑(); //Gradient (); //Rainbow (); //Flower (); //呼吸(); /* while (1) { WriteGSData (GSdata1); delay_ms (1); }*/ // Switch_Line (3); //WriteGSData_Poker (GSdata1); while (1) { switch (key_FLAG) { 案例1:scan();break; 案例2:Smile();break; 情况3:梯度();中断; 判例4:花卉();断裂; 判例5:Doraemon ();Break; 判例6:worth();break; 判例7:Rainbow ();Break; 情况8:PULSE();break; } } /*void TA1_0_IRQHandler (void) { GCLK (0); Switch_Line (line); WriteGSData (GSdata); GCLK (1); MAP_Timer_A_startCounter (timer_A1_base、timer_A_up_mode); MAP_Timer_A_clearCaptureCompareInterrupt (TIMER_A1_base、 TIMER_A_CAPTURECOMPARE 寄存器_0); //map_GPIO_toggleOutputOnPin (GPIO_PORT_P1、GPIO_PIN0); }*/ /* GPIO ISR */ void Port1_IRQHandler (void)// LED 环形效应开关函数 { uint32_t status; STATUS = MAP_GPIO_getEnabableInterruptStatus (GPIO_PORT_P1); MAP_GPIO_clearInterruptFlag (GPIO_PORT_P1、STATUS); key_FLAG++; if (key_FLAG = 9) key_FLAG = 1; }
0x000、0xfff、4、WriteFCData (0、1、2、256、256、256、256、256、0、0、1、0、0、1、0、0)是什么意思?
案例1:scan();break;
案例2:Smile();break;
情况3:梯度();中断;
判例4:花卉();断裂;
判例5:Doraemon ();Break;
判例6:worth();break;
判例7:Rainbow ();Break;
情况8:pultrule();break;
上面的代码是否可以显示该模式?
我想使用 PWM 来控制显示屏的 LED 的单独亮度以及上面提到的代码、有人能不能给出一些建议?