Jump to content
Sign in to follow this  

RGB Led IR Library PWM problem

Recommended Posts



Playing with IR receiver (IR Library from Energia) and RGB led. I cant write analog values to my RGB led without breaking the program.

I connected the three outputs to analogWrite capable pins. All works great when writing 0 or 255 but the library stop working well when i try to write other value to make the color less bright.

Then i read about timers and PWM. I notice my library use Timer1_A so i need to connect leds to pins capable of analog writing but using Timer0_A.

These pins were three, but one is RXD of Serial and messed things up.

So I changed the library to use Timer0_A and connect leds to pins capable of analog writing but using Timer1_A. The program at the moment works nice, but again only with 0 or 255 values.

BUT i noticed i can write other values to ONE of these pins, it dont breaks things. I wonder what could be the difference, with datasheet.

The pins were:


#define RED P2_1
#define GREEN P2_2
#define BLUE P2_4 ---> this works with values between 0 and 255



With datasheet i noticed pin P2_4 has "Out2 output", thats all difference i have found.

BUT i put RED to P2_5 wich is "Out2 output" too and again it breaks things, while BLUE doesnt.

All of these without knowing what can be out2 output.

I miss something. Can you help me? I can give you more details if needed.


EDITED: Individually, it works. Pins that are analogWrite capable and use T0_A are {2_1 - 2_2 - 2_4 - 2_5}





Problems with timers and IR library http://forum.43oh.com/topic/3550-ir-library-and-pwm/

Datasheet(page 6) http://www.ti.com/lit/ds/symlink/msp430g2553.pdf

PinOUT https://www.dropbox.com/s/mcvbnkdpzsn1wna/LaunchPad%20MSP430G2553-V1.4.jpg

Share this post

Link to post
Share on other sites

I see people keep running into issues with timers because they use things that do not shout they are timer libraries. These include pwm/analogWrite, tick/millis/micros, softwareUart, motor, etc.

I think the integration of these libraries needs to be reconsidered. What good are they if you still need to know in depth about the perks of the MSP430 to get them to play nice? Rather hook all things up to Energia tick callbacks, but ofcourse that would be a hog on system resources.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this