Jump to content

Search the Community

Showing results for tags 'analogwrite'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News
    • Announcements
    • Suggestions
    • New users say Hi!
  • Spotlight!
    • Sponsor Spotlight
    • Sponsor Giveaways
  • Energia
    • Energia - MSP
    • Energia - TivaC/CC3XXX
    • Energia - C2000
    • Energia Libraries
  • MSP Technical Forums
    • General
    • Compilers and IDEs
    • Development Kits
    • Programmers and Debuggers
    • Code vault
    • Projects
    • Booster Packs
    • Energia
  • Tiva-C, Hercules, CCXXXX ARM Technical Forums
    • General
    • SensorTag
    • Tiva-C, Hercules, CC3XXX Launchpad Booster Packs
    • Code Vault
    • Projects
    • Compilers and IDEs
    • Development Kits and Custom Boards
  • Beagle ARM Cortex A8 Technical Forums
    • General
    • Code Snippets and Scripts
    • Cases, Capes and Plugin Boards
    • Projects
  • General Electronics Forum
    • General Electronics
    • Other Microcontrollers
  • Connect
    • Embedded Systems/Test Equipment Deals
    • Buy, Trade and Sell
    • The 43oh Store
    • Community Projects
    • Fireside Chat
  • C2000 Technical Forums
    • General
    • Development Kits
    • Code Vault
    • Projects
    • BoosterPacks

Calendars

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Location


Interests


Sparkfun


Github

Found 9 results

  1. Hi, Sorry for the repost, I save my preview topic in the wrong place I think (http://forum.43oh.com/topic/9286-msp432-servo-librairy-conflicting-with-pwm-analogwrite/, if someone can delete this one...). I am using an MSP432P401R launchpad Rev B with Energia 17 on Windows 10. I've recently got this issue: I can't control servomotors with the Servo.h librairy and at the same time send several PWM. As soon as I called the "attach" function from Servo, the others call to analogWrite in my code don't work anymore. I think it is due to some timer conflicts (both functions using A0 timer ?), but I can't figured out how to fix the problem. I see something wierd in the Servo librairy code (in Servo.cpp:72): //timerParams.clockSource = Timer_Source_SMCLK; This instruction, that seems to choose the timer to use, is commented. Moreover I noticed that several defined are not used in the code of Servo (from Servo.h): #define SERVO_TIMER TIMERA0_BASE #define SERVO_TIME_CFG TIMER_CFG_B_PERIODIC | TIMER_CFG_SPLIT_PAIR #define SERVO_TIMER_TRIGGER TIMER_TIMB_TIMEOUT #define SERVO_TIMER_INTERRUPT INT_TIMERA0B #define SERVO_TIMER_AB TIMER_B #define SERVO_TIMER_PERIPH PRCM_TIMERA0 I have tried to modify "A0" by "A1" without success. Did someone run in a similare problem and could give me some clue to fix it ? Thanks Nathan
  2. gbrennon

    MSP430 - Change PWM Frequency

    Hey guys! I'm having some fun with my MSP430 and started to play with the Energia IDE so I can make some tests faster than by the standard library of the microcontroller. But I've searched on the reference and saw that the only function to use with PWM is analogWrite()... How could I change the frequency of the PWM instead of only its Duty cycle? Thank you guys!
  3. Hello! I am new to embedded programming and the forums. For my first task I am trying to generate a clean square wave with a configurable frequency and I figured PWM would be a good way to do this. Below is my code. This works to an extent, but during the off time there are regular spikes to 3.6V at about 10kHz as seen in my scope plot. The scope is a cheap Rigol DS1102. How can I eliminate these spikes? and is my approach the best approach or is there a better one that may not have the extra spikes? thanks in advance for the help! void setup() { // declare pin 14 to be an output: pinMode(GREEN_LED, OUTPUT); } void loop() { // set the frequency: analogFrequency(800); //PWM (Pin, Duty Cycle) - Maximum = 100% = 255 analogWrite(GREEN_LED, 127); } MSP-EXP430G2 w/ crystal populated to pins XIN/XOUT MSP430G2553 Energia 11 Windows 8.1 x64
  4. What is the preferred way to stop doing analogWrite (PWM) on a pin in Energia? For instance how should I change a pin to digitalWrite, or change it to input, or to just prepare to stop using the pin? In particular, how do you stop the timer (which is used to generate the PWM)? Studying the code for analogWrite, digitalWrite and pinMode I do not see where PWM timers are ever stopped once they are started. (I looked at the code on MSP430, Stellaris, and CC3200). To confirm my impression, I ran a little test on an MSP430. While I can change mode to output and/or do a digitalWrite to change the pin after doing an analogWrite, it appears that the timer just keeps ticking away, even though it is no longer controlling the pin. (I haven't tested this on the other platforms or tested whether changing the pin to input stops the timer.) Is there some glitch where the timers have to be left running once started? Why would one care if the timer keeps running? It uses power (or is this an insignificant amount of power, even on an MSP430 or CC3200 running on a battery). It might make bookkeeping a little easier if unused timers were stopped. (e.g. easier to tell which ones could safely be used for other purposes). Thanks.
  5. Ananthan

    PWM signal on Energia

    Hi, I am trying to use the analog write function on energia and am having trouble. When I use the function on the inbuilt LEDs everything is working fine but when I use it on external circuits, if I use analogWrite(255)(the maximum) the led is staying on with the maximum brightness as it supposed to but for any other values, its off. In the example codes there is one which increases and decreases the brightness of the led periodically. For the in-built LED its working fine but for others, when the brightness is supposed to be maximum, the LED is staying on and all other time its off. Any help would be great. Thanks.
  6. Hello, I am trying to analogWrite on the RGB leds, with energia. Appearently this can be done, as the original came with a demo program of this sort. Also the documentation of energia, the hardware documentation states that this RGB led pins are indeed analogWritable (purple) But when i try to use analogWrite - it will either take a 0 or 1 position, and no PWM will be outputted. It works as expected with digital output. Any ideas? Best Regards, -C.B.
  7. When programming recently, I found that I had some trouble controlling a motor at the same time as several servo. The servos would go all crazy, and the motor wouldn't work. I guessed that this was because the timers were interfering, or not enough timers, or similar. Digging into the servo library, and the analogWrite function, I found that they're both trying to use Timer A. Thus, I modified the analogWrite function. In file energia/hardware/msp430/cores/msp430/wiring_analog.c , I commented out lines 110 to 123 (inclusive). Below is the code commented out. case T0A1: // TimerA0 / CCR1 TA0CCR0 = PWM_PERIOD; // PWM Period TA0CCTL1 = OUTMOD_7; // reset/set TA0CCR1 = PWM_DUTY(val); // PWM duty cycle TA0CTL = TASSEL_2 + MC_1 + analog_div; // SMCLK, up mode break; #if defined(__MSP430_HAS_TA3__) || defined(__MSP430_HAS_T0A3__) case T0A2: // TimerA0 / CCR2 TA0CCR0 = PWM_PERIOD; // PWM Period TA0CCTL2 = OUTMOD_7; // reset/set TA0CCR2 = PWM_DUTY(val); // PWM duty cycle TA0CTL = TASSEL_2 + MC_1+ analog_div; // SMCLK, up mode break; #endif This may only work using the G2553, but if you're stuck with a G2231 from a rev 1.4 board, just sample a new chip
  8. canibalimao

    Using analogWrite

    Hi guys, Sorry for being ask for help again, but this time isn't a coding help, is about the MCU's themselves. I'm trying to build a RGB led dimmer (like heartbeat) and I need to know two things: 1- (most essential) it's possible to "transfer" the MSP430 chip to a breadboard and work without the launchpad board attached? The "secret" behind the name "LaunchPad" is program the MCU and then "Launch" it to a breadboard and use it without connecting it to a PC for power/comunication. 2- all the MSP430 MCU's (G2231, G2211, etc) can handle with analogWrite, or just the 20 pins ones? Hopw you can help me once again guys. Thank you very much.
  9. I don't have one of these yet, I am still waiting for mine to arrive. My question is this: How many "individual" pins on this board are capable of doing analogWrite? I say individual as on the MSP430G2553 while there are 6 pins available, certain pins share the same timer, so you can only use 1 pin out of a "pair" which share a timer. So, that said, does anyone have an answer to this? Thank you! Also, I read somewhere that the pins on this board are 5 volt tolerant, however while reading the datasheet, it looks like that isn't the case. Would be great if I could use this board with 5v logic (even if it is being powered by 3.3v). Can anybody weigh in on that?
×