Jump to content


  • Content Count

  • Joined

  • Last visited

Posts posted by Mastaan

  1. Yes and no.

    analog write does use the timer/pwm function. However, 50Hz is much too low to use under default settings. Such a long period cannot be accomodated for.

    You better run a timer and toggle the PWM signals in an ISR.


    tm4c123gx micro-controllers has builtin PWM blocks, that does all the proper duty cycle and frequency division from the clock cycle without the use of the processor, all you need to do is set the right control and status registers, and I am pretty sure the PWM function in energia uses these PWM blocks to generate the signal.


    Thank you.

  2. Ok I solved it, because I need to generate only 50 Hz signals, I went to wiring_analog.c, there I found 

    void analogWrite(uint8_t pin, int val) {
        //  duty cycle(%) = val / 255;
        //  Frequency of 490Hz specified by Arduino API
        PWMWrite(pin, 255, val, 50);
    and I just changed 490 to 50 and boom solved...
    If you want different frequencies, at different pins you can use PWMWrite (pin, resolution, val, freq); function, but make sure to #include wiring_analog.c.
    You can download this software from TI to look at what pins can do what, and visually plan out your pins. The pin #s aren't the same as Energia, just cross check.
  3. 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.

  • Create New...