Jump to content
43oh

RGB Led IR Library PWM problem


Recommended Posts

MSP430g2553

ALL DOCUMENTATION BELOW

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}

 

 

 

DOCUMENTATION ABOUT:

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

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.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...