Search the Community

Showing results for tags 'pwm'.



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.


Found 40 results

  1. PWM is much easier on the new Launchpad using the PWM peripherals, here is a working example using the 3 onboard LEDs. #include <stdint.h> #include <stdbool.h> #include "inc/hw_gpio.h" #include "inc/hw_types.h" #include "inc/hw_memmap.h" #include "driverlib/sysctl.h" #include "driverlib/pin_map.h" #include "driverlib/gpio.h" #include "driverlib/pwm.h" int main(void) { unsigned long ulPeriod; //Set the clock SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); //Configure PWM Clock to match system SysCtlPWMClockSet(SYSCTL_PWMDIV_1); // Enable the peripherals used by this program. SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM1); //The Tiva Launchpad has two modules (0 and 1). Module 1 covers the LED pins ulPeriod = SysCtlClockGet() / 200; //PWM frequency 200HZ //Configure PF1,PF2,PF3 Pins as PWM GPIOPinConfigure(GPIO_PF1_M1PWM5); GPIOPinConfigure(GPIO_PF2_M1PWM6); GPIOPinConfigure(GPIO_PF3_M1PWM7); GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3); //Configure PWM Options //PWM_GEN_2 Covers M1PWM4 and M1PWM5 //PWM_GEN_3 Covers M1PWM6 and M1PWM7 See page 207 4/11/13 DriverLib doc PWMGenConfigure(PWM1_BASE, PWM_GEN_2, PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_NO_SYNC); PWMGenConfigure(PWM1_BASE, PWM_GEN_3, PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_NO_SYNC); //Set the Period (expressed in clock ticks) PWMGenPeriodSet(PWM1_BASE, PWM_GEN_2, ulPeriod); PWMGenPeriodSet(PWM1_BASE, PWM_GEN_3, ulPeriod); //Set PWM duty-50% (Period /2) PWMPulseWidthSet(PWM1_BASE, PWM_OUT_5,ulPeriod/2); PWMPulseWidthSet(PWM1_BASE, PWM_OUT_6,ulPeriod/2); PWMPulseWidthSet(PWM1_BASE, PWM_OUT_7,ulPeriod/2); // Enable the PWM generator PWMGenEnable(PWM1_BASE, PWM_GEN_2); PWMGenEnable(PWM1_BASE, PWM_GEN_3); // Turn on the Output pins PWMOutputState(PWM1_BASE, PWM_OUT_5_BIT |PWM_OUT_6_BIT|PWM_OUT_7_BIT, true); //Do nothing while(1) { } }
  2. I am using Energia 17 environment with LAUNCHXL-F28069M board. I would like to implement PWM signal on two pins. One signal for example with 30% duty cycle and second inverted to the first one. It means when 1st pin is HIGH the 2nd should be LOW and conversely. In arduino language is only one function for PWM "analogWrite(80,100)". How to set inverted PWM signal in the same phase on second pin?
  3. I'm working on a project where I need to oscillate at 25khz. I've been using the PWM built into the MSP430G2553 and it doesn't seem to be accurate enough to give me exactly 25khz. I've been getting anywhere from 23khz to 27khz and cannot figure out why it's off by so much. I might be doing something wrong. Does anybody know what sort of accuracy I should expect from the on board PWM in the MSP430G2553. Is there a way to make it more accurate? I was looking at adding an external crystal, but would rather not add that complication if it isn't necessary.
  4. So, this is partly for me, and partly for others who need a refresher, or just do not know how. But I will be making several post here over time on how to write very simply code, to do one thing, or another. These, used in conjunction with a shell script could be very useful / flexible. After several long talks with many people, including some here on these very forums. I've decided that using C, to communicate with hardware, or hardware interfaces is best as can be for many situations. However, when you need to run several tools all at once, and have output formatted in some fashion, or easily modified. Shell scripts are very good at that sort of thing. Read from a real-time clock This post I will make about reading from a real-time clock. I spent hours messing around code related to I2C communications, and could never get exactly what I wanted. Plus, I wanted something that output date / time that looked very similar to the date Linux command. This could definitely been done using a shell script, but code size would probably be a lot larger. Additionally, a shell script would very likely be a lot slower, as with a script, one would have to be calling external cmdline tools to perform various operations. This example code is very fast, and prints to screen immediately after issuing the command. Since this command is very simple, and only prints the formatted date / time to screen. This could very easily be called from a shell script, and formatted further if need be. The real-time clock I'm using for this demonstration is a Maxim DS3232 real-time clock which is very accurate, and also very expensive compared to other real-time clocks. At $7 + US each, it's not cheap. I also had to write my own device tree overlay for this RTC, which strictly speaking is not necessary. One can set the device up from the command line manually as demonstrated for many different RTC's on the web. In fact, all the device tree overlay that I wrote does, is set all this automatically up at boot. As far as teh actual overlay it's self. All I did was modify an existing overlay from the "official" bb-overlays repo on github. https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/BB-RTC-01-00A0.dts To look something like this: /* * Copyright (C) 2015 Robert Nelson <robertcnelson@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ /dts-v1/; /plugin/; #include <dt-bindings/board/am335x-bbw-bbb-base.h> #include <dt-bindings/gpio/gpio.h> #include <dt-bindings/pinctrl/am33xx.h> / { compatible = "ti,beaglebone", "ti,beaglebone-black", "ti,beaglebone-green"; /* identification */ part-number = "BB-RTC-01"; version = "00A0"; fragment@2 { target = <&i2c2>; __overlay__ { status = "okay"; /* shut up DTC warnings */ #address-cells = <1>; #size-cells = <0>; /* MCP79410 RTC module */ rtc@68 { compatible = "maxim,ds3232"; reg = <0x68>; }; }; }; }; On our cape, the RTC is on bus I2C-2, which is already enabled by default for capemgr. The rest of the above just means that status is okay(load the device ), the kernel module to load is called "ds3232", and the device address on the bus is 0x68. Now on to the actual C code for reading from /dev/rtc1: #include <stdio.h> #include <stdlib.h> #include <linux/rtc.h> #include <sys/ioctl.h> #include <sys/time.h> #include <sys/types.h> #include <fcntl.h> #include <unistd.h> #include <errno.h> void display_date_time(void) { struct rtc_time rtc_tm; int fd = open("/dev/rtc1", O_RDONLY); if(fd == -1){ perror("/dev/rtc"); exit(errno); } /* Read the RTC time/date */ int retval = ioctl(fd, RTC_RD_TIME, &rtc_tm); if (retval == -1) { perror("ioctl"); exit(errno); } int d = rtc_tm.tm_mday; int m = rtc_tm.tm_mon + 1; int y = rtc_tm.tm_year + 1900; const char *wdays[] = {"Sun","Mon","Tues","Wed","Thur","Fri","Sat"}; const char *mnths[] = {"Jan","Feb","Mar","Apr","May","June","July","Aug","Sept","Oct","Nov","Dec"}; int wday = (d += m < 3 ? y-- : y - 2, 23*m/9 + d + 4 + y/4- y/100 + y/400)%7; fprintf(stdout, "%s %s %02d %02d:%02d:%02d %d UTC\n", wdays[wday], mnths[rtc_tm.tm_mon], rtc_tm.tm_mday, rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec, y); } int main( int argc, char **argv ) { display_date_time(); return 0; } As one can see, most of this code is for formatting the output in a specific way. In this case, the output will look exactly like the output one might expect to see after issuing the command "date". However, this output is fixed to output the date / time in the UTC time zone. As for one of the projects I'm using this in is for devices spread out all over the US, in 3 different time zones, and we do not care so much what the local time zone of that system so much, as much as knowing a given time "standard". e.g. if something fails, and we need to tell a customer what failed, and what time it failed, we can, Then if we need to convert that time to their time zone, easy. Notice that the read() is handled by ioctl(). . . Output: root@wgd:~/# gcc -Wall -o read_rtc read_rtc.c root@wgd:~/# ./read_rtc Tues May 09 23:08:49 2017 UTC
  5. Hello all !! I have a question about my TIVA board: What is the range of frequencies that we can get for the PWM, taking into account the possibilities of "clock division" and the "number of bits"? I ask you if in case we had to measure a resonator with the PWM as a generator (at 50% duty cycle). regards
  6. So I have my MSP430 launchpad with g2553 and g2452 lying around for year now and finally have a reason to use it. I'm a total noob (I mean I programmed some assembler and C in college and know some basic stuff about MCUs but never actually put it to use), but my for my first project I've picked a tough one. That way I'll be challenged and won't get bored. So I've just bought a motherboard that only has 2 fan connectors on it, but I need at least 4 of those, so I decided to make a fan controller. I could just use some 7805s but what's the fun in that? The idea is to use the inferior msp430g2452 controller from the launchpad to generate 4 pwm channels to control 4 fans by changing the duty cycle with potentiometers. From what I've found on the internet, you can only have as many PWM channels as Capture/Compare Registers on a timer, but the first one will always be used for frequency and have 50% duty cycle. 2452 has only one timer with 3 CCRs, so I could only use 2 PWM channels. With g2553 in a 20 pin package that number is 3 and for SMD package you could have 4 PWM channels. But from what I understand from page 6 in tidu761 design guide, you could have as many software PWM channels as you have GPIO pins available. They can all be the same frequency after all, I only need to change the duty cycle. So far as I keep researching design guides and datasheets I have a few questions: 1) What frequency should I use for PWM? I'm guessing it should at least be outside the audible range, so 25 to 30khz should be fine, right? 2) What pins should I use? I would need at least 4 pins for potentiometers, say P1.0 through P1.3 and 4 pins for PWM, P2.0 to P2.3 would be fine? Or should I use some specific pins? Thanks for reading this!
  7. I have a custom board that is driven with an MSP4302553 chip and can drive a Piezo Transducer which resonates at 25khz. I am limited to using a single rechargeable Lithium battery which is 3.3v. In order to get the 117dB that I want out of the Piezo Transducer, I need to generate a square wave with a 25khz frequency and 10volts across the 2 Piezo pins. I found a Push Pull library which allows me to get a -3.3v-3.3v range, or a total of 6.6v across the 2 pins on my Piezo. This gives me about 80dB. I need to boost that voltage by just a little bit after the PWM pins, without losing the 25khz frequency that I'm sending to the Piezo. Does anybody have any ideas for doing this? I'm on a tight budget and want to keep my board as tiny as possible with the fewest components possible. Thanks, Curtis
  8. From the tm4c1294, I thought I remembered only seeing 8 PWM pins, yet the Energia picture (http://energia.nu/wordpress/wp-content/uploads/2014/06/LaunchPads-LM4F-TM4C-%E2%80%94-Pins-Maps-13-34.jpeg) shows quite a bit more than that. Can you really get PWM on every pin marked for PWM on the Energia diagram, or is it a case of all of the pins marked being PWM capable but only get PWM on 8 of them?
  9. Hello, I wrote a very simple PWM Code for my Brushless DC Motor (incl. ESC) and it works very good (I don't use any Potentiometers.): int motorPin = PF_1; void setup() { pinMode(motorPin, OUTPUT); } void loop() { analogWrite(motorPin, HIGH); delayMicroseconds(1000); analogWrite(motorPin, LOW); delayMicroseconds(19000); } I need 50Hz (1/50=20us). The Motor breaks when the first delay is "1000us" and the second is "19000us". The Motor arrives highspeed when the first delay is "2000us" and the second is "18000us" So my dutycycle should be between 5 - 10% What i need is this PWM Signal without any delays. Is there any way to create a PWM without delays? Thank you very much. greetings, Yaman
  10. I am uploading the fade example of energia to the tiva t4mc1294 connected launchpad but the LED is not fading. It is just blinking. I have also connected the pwm output to motor drivers but the speed of the motors are not changing. When I check the voltage of the pin with my multimeter, I get 0.66v. I have tried the fade example on different pins like PF2, PF3(pins marked for analogWrite in launchpad reference) but the results are same. Here is the code for the fade example, given as reference. int brightness = 0; // how bright the LED is int fadeAmount = 5; // how many points to fade the LED by void setup() { // declare pin 14 to be an output: //analogFrequency(FREQ); pinMode(PF_3, OUTPUT); pinMode(PF_2,OUTPUT); Serial.begin(9600); } void loop() { digitalWrite(PF_2,HIGH); // set the brightness of pin 9: analogWrite(PF_3, brightness); // change the brightness for next time through the loop: brightness = brightness + fadeAmount; Serial.print(brightness); // reverse the direction of the fading at the ends of the fade: if (brightness == 0 || brightness == 255) { fadeAmount = -fadeAmount ; } // wait for 30 milliseconds to see the dimming effect delay(30); }
  11. 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
  12. Hi , I have written my scheduler which uses the Timer0 subtimer A to generate interrupt for Multi-tasking. I have tested the waverforms generating accurately and arriving at the right time periods. Now the issue that I am facing is PWM waves are not arrived at the expected time. Is PWM interfere with the Timer functionality? What is the work around? Are there any free timers available which I can use it for my scheduler? Some insights to this would really help. Thanks, Peeyush
  13. 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!
  14. 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
  15. I've been looking for a while and can't find a good example showing how I can play any sort of music or speech files (mp3, au, wav, etc.). I've got a configuration setup that allows me to read files for things like LCD screens, I'm looking to read a music or speech file and play it through an amplified speaker. I'm not looking to make just tones, rather to play full music or speech files. I've found projects for Arduino such as (http://hlt.media.mit.edu/?p=1963), but nothing that works with MSP430 and Energia. Has anyone done something similar to this with Energia?
  16. I am using an MSP430fr5969. The board only has one hardware pwm available and it located on P1.2. For my application, I need to generate two different pwm signals to control two different motors. One of those is a servo, the other is a linear actuator but it is controlled through a motor speed controller that uses a pwm input (replicating that of an RC receiver). Can I use the servo library and attach a servo to any pin or does that pin have to have hardware pwm? I looked through the Servo.cpp file and it seems to be doing software serial. When i run servo examples, and hook the pin up to an oscilloscope I do not get nice square waves being generated as an output. Currently I am using pin 9, the defualt for the servo libraries. Thanks, Nolan
  17. I am looking to run two motors via motor controllers that require pwm signals. I have learned how hardware and software pwm work. I also have learned what would be required to create a software pwm with a chip timer and clock in CCS. I am still however confused on whether this is required in energia and how I can tell what pins i am able to use. Using a MSP430fr5969: Can i simply use the analogwrite() function on a pin that allows for it to be used according to the pin map http://energia.nu/wordpress/wp-content/uploads/2014/10/LaunchPad-with-MSP430FR5969.jpg ? Does the analogwrite function only work on the pins that have hardware pwm capability or is it a software pwm function? Could I for example use pins P1_4 and P1_3 to send a pwm to signal to the motor controllers? Does the same apply when reading pwm signals? -Nolan
  18. Hi, I need to generate 4 pwm signals at 50 HZ, they need to run with out interruption. I know the TM4C123G6PM has 2 pwm blocks, but is it possible to access them through Energia? can I use Analog.write(); ? Someone please help. Thank you.
  19. All, Can I output a PWM signal to P1.0 pin (G2231 chip) using timer A in up mode and setting CCR0 / CCR1 accordingly? In short, I was going to use the example code provided by TI (see slac163 and slaa428, example I'm using is the "C" code msp430x21x2_ta_1.c), where pin P1.2 is used for the PWM output. Well, I tried to modify the code to output the signal to P1.0 but can't get it to work. My conclusion is that P1.0 cannot be selected for such function, but I cannot find anythere in the user guide or datasheets a confirmation. In fact, by reading the datasheet (page 6) I had understood it can do that... (link). What am I doing wrong? Can the timer output be in pin P1.0? Here is the code I'm using - below it is set to output to pin P1.2, but there's commented code for pin P1.0 that I tried using. #include <msp430.h> #include <stdlib.h> int main( void ) { //---------------- // // Hardware config // //---------------- // WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer // DCO configuration DCOCTL = CALDCO_1MHZ; //Set DCO to 1 MHz BCSCTL1 = CALBC1_1MHZ; // Calibrate internal clock for 1 MHz // Port 1 configuration P1DIR = 0x04; P1SEL |= BIT2; // P1DIR = 0x01; // P1SEL |= BIT0; // Timer A configuration TACTL = TASSEL_2 + // Set clock to internal DCO ID_0 + // No frequency divider MC_0; // Stopped to begin with CCR0 = 1000-1; // PWM Period (1 us) CCTL1 = OUTMOD_7; // CCR1 reset/set CCR1 = 500; // CCR1 PWM duty cycle //----------- // // Main logic // //----------- // TACTL |= MC_1; _BIS_SR(LPM0_bits); }
  20. 3 channel, high power LED driver, built to fit 10W RGB LEDs (those things are blindingly bright!) Now on Tindie.
  21. Hello, im barely new in ARM programming. What i want to do is to run four independent PWM channels to manage my things. I wrote some code and as i supposed it didint work. In debug process i checked registers and it seems to be ok. Load and match values are corerct so i think error is somewhere in timers configuration. Can someone help me out ? Thanks in advance for reply. Here is my code that i ran on my launchpad. #define PART_LM4F120H5QR 1 #include <inc/hw_types.h> #include <inc/hw_memmap.h> #include <driverlib/sysctl.h> #include <driverlib/gpio.h> #include <driverlib/pin_map.h> #include <driverlib/timer.h> #define PWM_FREQ 20000 void InitGPIOs() { // running clock for gpio C SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC); } void InitPWMs() { // runing clock for timers: wide timer 0 and wide timer 1, both 64 bits SysCtlPeripheralEnable(SYSCTL_PERIPH_WTIMER0); SysCtlPeripheralEnable(SYSCTL_PERIPH_WTIMER1); TimerConfigure(WTIMER0_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_PWM); // timer0 A TimerConfigure(WTIMER0_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_B_PWM); // timer0 B TimerConfigure(WTIMER1_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_PWM); // timer1 A TimerConfigure(WTIMER1_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_B_PWM); // timer1 B // 20 khz freq TimerLoadSet(WTIMER0_BASE, TIMER_A, (SysCtlClockGet()/PWM_FREQ)-1 ); TimerLoadSet(WTIMER0_BASE, TIMER_B, (SysCtlClockGet()/PWM_FREQ)-1 ); TimerLoadSet(WTIMER1_BASE, TIMER_A, (SysCtlClockGet()/PWM_FREQ)-1 ); TimerLoadSet(WTIMER1_BASE, TIMER_B, (SysCtlClockGet()/PWM_FREQ)-1 ); // initial width value TimerMatchSet(WTIMER0_BASE, TIMER_A, (SysCtlClockGet()/PWM_FREQ)/2); TimerMatchSet(WTIMER0_BASE, TIMER_B, (SysCtlClockGet()/PWM_FREQ)/2); TimerMatchSet(WTIMER1_BASE, TIMER_A, (SysCtlClockGet()/PWM_FREQ)/2); TimerMatchSet(WTIMER1_BASE, TIMER_B, (SysCtlClockGet()/PWM_FREQ)/2); // enabling timers TimerEnable(WTIMER0_BASE, TIMER_A); TimerEnable(WTIMER0_BASE, TIMER_; TimerEnable(WTIMER1_BASE, TIMER_A); TimerEnable(WTIMER1_BASE, TIMER_; // pin muxing for pwms GPIOPinConfigure(GPIO_PC4_WT0CCP0); GPIOPinTypeTimer(GPIO_PORTC_BASE, GPIO_PIN_4); GPIOPinConfigure(GPIO_PC5_WT0CCP1); GPIOPinTypeTimer(GPIO_PORTC_BASE, GPIO_PIN_5); GPIOPinConfigure(GPIO_PC6_WT1CCP0); GPIOPinTypeTimer(GPIO_PORTC_BASE, GPIO_PIN_6); GPIOPinConfigure(GPIO_PC7_WT1CCP1); GPIOPinTypeTimer(GPIO_PORTC_BASE, GPIO_PIN_7); } int main() { // setting clock to maximum speed 80 Mhz SysCtlClockSet(SYSCTL_USE_PLL | SYSCTL_SYSDIV_2_5 | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN); InitGPIOs(); InitPWMs(); while(true) { } return 0; }
  22. 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.
  23. I found out from this post that there are 14 PWM outputs possible on the MSP430F5529 microcontroller, and 10 PWM outputs possible on the MSP430F5529 Launchpad. How many are possible when using Energia? I think it is less, but I can't tell from the .h file. I will be using a custom BoosterPack so it doesn't have to stick to that standard. Thanks, Ben
  24. hi , i'm trying to create a PWM signal with period of 15 msec and pulse width the can vary between 1.1 msec and 1.9 msec. (I'm using the Msp430F5529 ) how can i do it? thx in advance.
  25. Hello, I'm planning for a project the use of 12 Channels PWM (Frequency must be above 60khZ, because of driving some VCA´s and not getting into the audio range). As I know, Energia uses "software" PWM with the use of timers (the hardware PWM´s of the new TIVA's is not implimented). So my question is, may I can get some overall performance boost using the driverlib hardware PWM rather than the energia software version? Thanks regards Matthias