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.
I'm working on a LED driver application on MSP430-based MCU for generating the LED
signals required to drive a TLC5951 device of up to 24 LEDs. TI has released us the source code tailored to suit our needs.
I'm looking to add a support for dual led blink at 5Hz. i.e Alternately blinking two different leds every 200ms.
Do you have a sample source code which does above? Or could you guide on how to implement this on top of the current source code?
Thanks,
Arun
Hallo Arun,
when I understood the question correctly, you are looking for an example to toggle the LED every 200ms.
In our Resource Explorer we have different examples which can be used.
You may check the timer examples with PWM ( .._tb0_16)
for example:
Here you need to adjust the PWM period an duty cycle accordingly, depending of the clock source and targeted timings.
Timer value example to get the 200ms based on example _tb0_16.c
CSCTL5 |= DIVS_3; // SMCLK divider= 8, SMCLK=125kHz TB0CCR0 = 25000-1; // PWM Period TB0CCTL1 = OUTMOD_7; // CCR1 reset/set TB0CCR1 = 12500; // CCR1 PWM duty cycle TB0CCTL2 = OUTMOD_7; // CCR2 reset/set TB0CCR2 = 12500; // CCR2 PWM duty cycle TB0CTL = TASSEL__SMCLK | MC__UP | TACLR; // SMCLK, up mode, clear TAR
I tested that to different device, should work also on yours.
Hope that helps
Regards
Kostas
Hi Kostas,
Thanks for the reply. The code I have already supports blink at 1Hz and 5Hz (200ms). We have a new requirement to support 2 LEDs alternating at 5Hz.
Lets say led1 and led2 are different colour leds. The blink pattern should alternate different colors.
led1(on) --- led2 (on) ----led1(on)----led2(on)
I could make it work with 1Hz frequency by changing the DC register values. I need help in making it work at 5Hz frequency.
Thanks,
Arun
Hallo Arun,
can you tell me which registers you are using, or could you send me this part of the code?
Do you generate a PWM?
Your blink pattern should be: while the one LED is ON for 200ms the second should be OFF and vice versa. Correct?
Regards
Kostas
Hi Kostas,
Can you add me as a friend so that I can send the code to you? I don't want to share the code in public as it has some customizations. TI had customized an led driver example code to meet our requirements.
PWM is used so that the on-time and off time can be controlled.
Yes, while one LED is on, the other should be off. The LED need not be on during the entire 200ms.
Thanks,
Arun
Hallo Arun,
you should have received the email.
Let's close that case here.
Regards
Kostas
Hi Kostas,
I have shared the code to via message. Do I need to close this case?
Thanks,
Arun
**Attention** This is a public forum