This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PWM Duty Cycle generation with Floating Point Output

Other Parts Discussed in Thread: HALCOGEN

Hi,

I am Working with RM48 HDK. I need to generate PWM signal duty cycle with Floating Point. but if i configure the Duty % in halcogen with floating point, I checked with scope but there is no floating point output. How it can be done. Attached the Project file.

8446.pwm30.rar 

  • Manjunathan,

    It looks like you are only calling hetInit() in your main function.
    Try calling pwmStart(hetRAMBASE_t * hetRAM,uint32 pwm);
    (from het.h). with the # of the PWM that you want to start.

    This # is not the pin # but the number corresponding to the PWM in HalCoGen's Gui - of which there are pwm0 - pwm7
    defined in the same header file. You'll need to check halcogen to see which pin the PWM you want comes out on since
    this is all configurable.

    If you want to change the duty or period look at the other functions like:
    void pwmStop(hetRAMBASE_t * hetRAM,uint32 pwm);
    void pwmSetDuty(hetRAMBASE_t * hetRAM,uint32 pwm, uint32 pwmDuty);
    void pwmSetSignal(hetRAMBASE_t * hetRAM,uint32 pwm, hetSIGNAL_t signal);

    -Anthony
  • Thank you Mr.Anthony F. Seely 

    I have written some codes to obtain floating point output in Duty cycle such as 7.5, 7.6 etc.

    But while building the code errors are generated

    my requirement is duty cycle with floating point output (i.e 7.5,7.6 etc)

    Codes:

    hetSIGNAL_t setup_pwm;
    //hetSIGNAL_t Set_Duty_Period2;
    /* USER CODE END */

    void main(void)
    {
    /* USER CODE BEGIN (3) */

    /* Initialize HET driver */
    hetInit();
    setup_pwm.period =(float64)1e6/2000; //2 khz

    uint32 Dutcycle = setup_pwm.period*0.075;
    uint32 Porcentdutty=0.075*100;
    pwmSetSignal(hetRAM1, pwm1, setup_pwm);
    pwmSetDuty_full(hetRAM1, pwm1, Porcentdutty, Dutcycle);
    pwmStart(hetRAM1, pwm1);
    /* Run forever */
    while(1);

    /* USER CODE END */
    }

     while building following errors are generated

    1.

    Description Resource Path Location Type
    unresolved symbol pwmSetDuty_full, first referenced in ./source/sys_main.obj pwm1 C/C++ Problem

    2.

    Description Resource Path Location Type
     unresolved symbols remain pwm1 

    3.

    Description Resource Path Location Type
    #10010 errors encountered during linking; "pwm1.out" not built pwm1 C/C++ Problem

    Warings:

    1.

    Description Resource Path Location Type
    <a href="file:/c:/ti/ccsv6/tools/compiler/dmed/HTML/225.html">#225-D</a> function "pwmSetDuty_full" declared implicitly sys_main.c /pwm1/source line 85 C/C++ Problem

    Please help me sort out the problem sir

    Thanks and regards

    K.Manjunathan PSGIAS 

     

  • Manjunathan,

    I believe all these issues are due to a single problem - which is that you don't have the source code anywhere in the project for the function pwmSetDuty_full(). (That is not the same function which is provided in HalCoGen so you would need to write the source for this function and build it into the project).
  • Thank you Mr.Anthony Seely