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.

CCS/TMS320F28377S: TMS320F28377S

Part Number: TMS320F28377S

Tool/software: Code Composer Studio

Hi,

How can i make this line of code to work

EPwm7Regs.CMPA.bit.CMPA = sqrt(((double)AdcaResultRegs.ADCRESULT0)/4096);

when I look at 

EPwm7Regs.CMPA.bit.CMPA it is always 0 and watch expression

sqrt(((double)AdcaResultRegs.ADCRESULT0)/4096)

shows me "unknown" data type and this error

 'sqrt()' not found at sqrt(((double) (AdcaResultRegs).ADCRESULT0/4096))

thanks vadim

  • Hi,

    You can make use of the following TMU intrinsic supported by C2000 compiler :

      EPwm7Regs.CMPA.bit.CMPA = __sqrt(((float)AdcaResultRegs.ADCRESULT0)/4096);

     


    Please make sure to enable TMU flag in compiler option.

    If my reply answers your question please click on "This resolved my issue" button located at the bottom of my post.

    Regards

    Himanshu

  • Hi Himanshu

    It did not resolve the problem it is still the same, the watch expression gives me the same error

    __sqrt(((float)AdcaResultRegs.ADCRESULT0)/4096);unknown	'__sqrt()' not found	 at __sqrt(((float) (AdcaResultRegs).ADCRESULT0/4096))	
    

    I have TMU support in compiler options tmu0

    thanks vadim

  • Hi,

    This intrinsic is supported by C2000 compiler thus CCS watch window won't be able to recognize "__sqrt()" keyword, I would recommend you to rather use this in code and store in some variable , let say "temp". Then observe "temp" in expressions window.

     temp = __sqrt(((float)AdcaResultRegs.ADCRESULT0)/4096);

     

    If my reply answers your question please click on "This resolved my issue" button located at the bottom of my post.

    Regards

    Himanshu